X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fcommands%2FEditCommand.java;h=b39d1ddb69302035d183b18778a8c6939ee39b46;hb=9157d82cb9213d9071c15203dddf96ae9081dfbe;hp=d41f9f8b04b8184208123ee89ae62fd5fbab8219;hpb=f2a19cf17c426b1fca94c52d6e67085921302ee9;p=jalview.git
diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java
index d41f9f8..b39d1dd 100644
--- a/src/jalview/commands/EditCommand.java
+++ b/src/jalview/commands/EditCommand.java
@@ -1,45 +1,54 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
+ *
* 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
- * 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
+ * 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
* 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,7 +64,7 @@ public class EditCommand implements CommandI public static final int REPLACE = 4; - public static final int INSERT_NUC=5; + public static final int INSERT_NUC = 5; Edit[] edits; @@ -118,7 +127,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 @@ -135,7 +144,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 @@ -196,10 +205,10 @@ public class EditCommand implements CommandI case REPLACE: replace(edits[e]); break; - //TODO:add deleteNuc for UNDO -// case INSERT_NUC: -// insertNuc(edits[e]); -// break; + // TODO:add deleteNuc for UNDO + // case INSERT_NUC: + // insertNuc(edits[e]); + // break; } } } @@ -212,28 +221,26 @@ public class EditCommand implements CommandI @Override final public void undoCommand(AlignmentI[] views) - { - int e = 0, eSize = edits.length; - for (e = eSize - 1; e > -1; e--) - { - switch (edits[e].command) - { - case INSERT_GAP: - deleteGap(edits[e]); - break; - case DELETE_GAP: - insertGap(edits[e]); - break; - case CUT: - paste(edits[e], views); - break; - case PASTE: - cut(edits[e], views); - break; - case REPLACE: - replace(edits[e]); - break; - } + { + for(Edit e : edits){ + switch (e.command) + { + case INSERT_GAP: + deleteGap(e); + break; + case DELETE_GAP: + insertGap(e); + break; + case CUT: + paste(e, views); + break; + case PASTE: + cut(e, views); + break; + case REPLACE: + replace(e); + break; + } } } @@ -244,23 +251,24 @@ public class EditCommand implements CommandI { command.seqs[s].insertCharAt(command.position, command.number, command.gapChar); -// System.out.println("pos: "+command.position+" number: "+command.number); + // 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 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) { @@ -349,8 +357,11 @@ public class EditCommand implements CommandI if (command.alIndex[i] < command.al.getHeight()) { List