X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fcommands%2FEditCommand.java;h=b39d1ddb69302035d183b18778a8c6939ee39b46;hb=9157d82cb9213d9071c15203dddf96ae9081dfbe;hp=ed9e5518d1574ebbd78065b7f68d0a9852b0605f;hpb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;p=jalview.git diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index ed9e551..b39d1dd 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -1,26 +1,34 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1) + * 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. + * 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 . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.commands; -import java.util.*; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; -import jalview.datamodel.*; +import java.util.Hashtable; +import java.util.List; /** * @@ -213,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; + } } } @@ -353,7 +359,9 @@ public class EditCommand implements CommandI List sequences; synchronized (sequences = command.al.getSequences()) { - sequences.add(command.alIndex[i], command.seqs[i]); + // int index = command.al.findIndex(command.seqs[i]); + // sequences.add(index, command.seqs[i]); + sequences.add(command.alIndex[i] < 0 ? 0 : command.alIndex[i], command.seqs[i]); } } else @@ -396,9 +404,13 @@ public class EditCommand implements CommandI + command.number); } if (command.seqs[i].getStart() == start) + { newstart--; + } else + { newend++; + } } } command.string[i] = null; @@ -702,10 +714,12 @@ public class EditCommand implements CommandI { temp = new Annotation[aSize + command.number]; if (annotations[a].padGaps) + { for (int aa = 0; aa < temp.length; aa++) { temp[aa] = new Annotation(command.gapChar + "", null, ' ', 0); } + } } else { @@ -784,8 +798,10 @@ public class EditCommand implements CommandI int copylen = Math.min(command.position, annotations[a].annotations.length); if (copylen > 0) + { System.arraycopy(annotations[a].annotations, 0, temp, 0, copylen); // command.position); + } Annotation[] deleted = new Annotation[command.number]; if (copylen >= command.position)