X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fcommands%2FEditCommand.java;h=d41f9f8b04b8184208123ee89ae62fd5fbab8219;hb=7796bc87c98b21f199f9dc195401223984619091;hp=d18cb629271cff19e5c0ab54efb654739cb404c3;hpb=a45774ee31d9f35d4eff46d54d7deab719afb092;p=jalview.git
diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java
index d18cb62..d41f9f8 100644
--- a/src/jalview/commands/EditCommand.java
+++ b/src/jalview/commands/EditCommand.java
@@ -1,18 +1,18 @@
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see
* Title: EditCommmand *
- * + * ** Description: Essential information for performing undo and redo for cut/paste * insert/delete gap which can be stored in the HistoryList *
- * + * ** Copyright: Copyright (c) 2006 *
- * + * ** Company: Dundee University *
- * + * * @author not attributable * @version 1.0 */ @@ -55,6 +55,8 @@ public class EditCommand implements CommandI public static final int REPLACE = 4; + public static final int INSERT_NUC=5; + Edit[] edits; String description; @@ -94,11 +96,13 @@ public class EditCommand implements CommandI performEdit(0, null); } + @Override final public String getDescription() { return description; } + @Override public int getSize() { return edits == null ? 0 : edits.length; @@ -114,7 +118,7 @@ public class EditCommand implements CommandI * operation affects more alignment objects than the one referenced in al (for * example, cut or pasting whole sequences). Use the form with an additional * AlignmentI[] views parameter. - * + * * @param command * @param seqs * @param position @@ -131,7 +135,7 @@ public class EditCommand implements CommandI /** * append a new edit command with a set of alignment views that may be * operated on - * + * * @param command * @param seqs * @param position @@ -192,15 +196,21 @@ public class EditCommand implements CommandI case REPLACE: replace(edits[e]); break; + //TODO:add deleteNuc for UNDO +// case INSERT_NUC: +// insertNuc(edits[e]); +// break; } } } + @Override final public void doCommand(AlignmentI[] views) { performEdit(0, views); } + @Override final public void undoCommand(AlignmentI[] views) { int e = 0, eSize = edits.length; @@ -223,7 +233,7 @@ public class EditCommand implements CommandI case REPLACE: replace(edits[e]); break; - } + } } } @@ -234,10 +244,23 @@ public class EditCommand implements CommandI { command.seqs[s].insertCharAt(command.position, command.number, command.gapChar); +// System.out.println("pos: "+command.position+" number: "+command.number); } adjustAnnotations(command, true, false, null); } +// +// final void insertNuc(Edit command) +// { +// +// for (int s = 0; s < command.seqs.length; s++) +// { +// System.out.println("pos: "+command.position+" number: "+command.number); +// command.seqs[s].insertCharAt(command.position, command.number,'A'); +// } +// +// adjustAnnotations(command, true, false, null); +// } final void deleteGap(Edit command) { @@ -325,8 +348,10 @@ public class EditCommand implements CommandI // read it to the alignment if (command.alIndex[i] < command.al.getHeight()) { - command.al.getSequences().insertElementAt(command.seqs[i], - command.alIndex[i]); + List