ap.alignFrame.addHistoryItem(cut);
PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
- // ap.av.firePropertyChange("alignment", null, ap.av.getAlignment()
- // .getSequences());
+ ap.av.firePropertyChange("alignment", null, ap.av.getAlignment().getSequences());
}
}
{
ap.av.historyList.removeElement(command);
ap.alignFrame.updateEditMenuBar();
+ ap.av.firePropertyChange("alignment", null, ap.av.getAlignment().getSequences());
}
ap.paintAlignment(true);
@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;
+ }
}
}
List<SequenceI> sequences;
synchronized (sequences = command.al.getSequences())
{
- sequences.add(command.alIndex[i], command.seqs[i]);
+ sequences.add(command.alIndex[i] < 0 ? 0 : command.alIndex[i], command.seqs[i]);
}
}
else
ap.alignFrame.addHistoryItem(cut);
PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
- // ap.av.firePropertyChange("alignment", null, ap.av.getAlignment()
- // .getSequences());
+ ap.av.firePropertyChange("alignment", null, ap.av.getAlignment().getSequences());
}
}
*/
public void undoButton_actionPerformed(ActionEvent e)
{
+ if(historyList == null || historyList.isEmpty()){
+ undoButton.setEnabled(false);
+ return;
+ }
+
CommandI command = (CommandI) historyList.pop();
- command.undoCommand(af.getViewAlignments());
-
if (ap.av.historyList.contains(command))
{
+ command.undoCommand(af.getViewAlignments());
ap.av.historyList.remove(command);
+ ap.av.firePropertyChange("alignment", null, ap.av.getAlignment().getSequences());
af.updateEditMenuBar();
}