From 9cc5cb837b899016311e8f80e0e4e689e4a54ff6 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 23 Nov 2006 15:51:44 +0000 Subject: [PATCH] If alignment is closed, then undo performed in visible window --- src/jalview/appletgui/AlignFrame.java | 21 ++++++++++++--------- src/jalview/gui/AlignFrame.java | 23 +++++++++++++---------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index df5b1a6..de19fd8 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -825,10 +825,11 @@ public void itemStateChanged(ItemEvent evt) //For sequence removal and addition, we need to fire //the property change event FROM the viewport where the //original alignment was altered + AlignmentI al = null; if (command instanceof EditCommand) { EditCommand editCommand = (EditCommand) command; - AlignmentI al = editCommand.getAlignment(); + al = editCommand.getAlignment(); Vector comps = (Vector) PaintRefresher.components .get(viewport.getSequenceSetId()); for (int i = 0; i < comps.size(); i++) @@ -842,17 +843,19 @@ public void itemStateChanged(ItemEvent evt) } } } - if (originalSource == null) - { - //The original view is closed, we must validate - //the current view against the closed view first - if (al != null) - PaintRefresher.validateSequences(al, viewport.alignment); - originalSource = viewport; - } + } + if (originalSource == null) + { + //The original view is closed, we must validate + //the current view against the closed view first + if (al != null) + PaintRefresher.validateSequences(al, viewport.alignment); + + originalSource = viewport; } + return originalSource; } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 11570ed..9ea5fc5 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -990,6 +990,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener */ protected void redoMenuItem_actionPerformed(ActionEvent e) { + if(viewport.redoList.size()<1) + return; + CommandI command = (CommandI) viewport.redoList.pop(); viewport.historyList.push(command); command.doCommand(); @@ -1010,10 +1013,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener //For sequence removal and addition, we need to fire //the property change event FROM the viewport where the //original alignment was altered + AlignmentI al=null; if (command instanceof EditCommand) { EditCommand editCommand = (EditCommand) command; - AlignmentI al = editCommand.getAlignment(); + al = editCommand.getAlignment(); Vector comps = (Vector) PaintRefresher.components .get(viewport.getSequenceSetId()); @@ -1028,19 +1032,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener } } } - if (originalSource == null) - { - //The original view is closed, we must validate - //the current view against the closed view first - if (al != null) - PaintRefresher.validateSequences(al, viewport.alignment); + } - originalSource = viewport; - } + if (originalSource == null) + { + //The original view is closed, we must validate + //the current view against the closed view first + if (al != null) + PaintRefresher.validateSequences(al, viewport.alignment); + originalSource = viewport; } - return originalSource; } -- 1.7.10.2