undo remove method added
authorClaus Gittinger <cg@exept.de>
Tue, 10 Sep 2002 14:05:27 +0200
changeset 3857 b325617f6771
parent 3856 d2c16db43c66
child 3858 3db383d93b90
undo remove method added
ChangeSetBrowser.st
--- a/ChangeSetBrowser.st	Fri Sep 06 22:51:09 2002 +0200
+++ b/ChangeSetBrowser.st	Tue Sep 10 14:05:27 2002 +0200
@@ -193,6 +193,28 @@
            #(#Menu
               #(
                #(#MenuItem
+                  #label: 'Undo (undelete Method)'
+                  #translateLabel: true
+                  #value: #doUndoRemoveMethod
+                  #isVisible: #hasUndoableRemoveMethodChangeSelected
+                )
+               #(#MenuItem
+                  #label: 'Undo (previous Version)'
+                  #translateLabel: true
+                  #value: #doUndoMethodChange
+                  #isVisible: #hasUndoableMethodChangeSelected
+                )
+               #(#MenuItem
+                  #label: 'Undo'
+                  #translateLabel: true
+                  #value: #doUndoMethodChange
+                  #enabled: false
+                  #isVisible: #hasNotUndoableChangeSelected
+                )
+               #(#MenuItem
+                  #label: '-'
+                )
+               #(#MenuItem
                   #label: 'Apply'
                   #translateLabel: true
                   #value: #doApply
@@ -543,6 +565,49 @@
     "Modified: 3.12.1995 / 18:13:06 / cg"
 ! !
 
+!ChangeSetBrowser methodsFor:'menu aspects'!
+
+hasNotUndoableChangeSelected
+    ^ (self hasUndoableMethodChangeSelected
+      or:[self hasUndoableRemoveMethodChangeSelected]) not
+!
+
+hasUndoableMethodChangeSelected
+    |nr chg|
+
+    self hasSingleSelection ifTrue:[
+        nr := self theSingleSelection.
+        nr notNil ifTrue:[
+            chg := changeSet at:nr.
+            chg isMethodChange ifTrue:[
+                chg isMethodRemoveChange ifFalse:[
+                    chg previousVersion notNil ifTrue:[
+                        ^ true
+                    ]
+                ]
+            ]
+        ]
+    ].
+    ^ false
+!
+
+hasUndoableRemoveMethodChangeSelected
+    |nr chg|
+
+    self hasSingleSelection ifTrue:[
+        nr := self theSingleSelection.
+        nr notNil ifTrue:[
+            chg := changeSet at:nr.
+            chg isMethodRemoveChange ifTrue:[
+                chg previousVersion notNil ifTrue:[
+                    ^ true
+                ]
+            ]
+        ]
+    ].
+    ^ false
+! !
+
 !ChangeSetBrowser methodsFor:'private'!
 
 applyChange:changeNr
@@ -791,5 +856,5 @@
 !ChangeSetBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/ChangeSetBrowser.st,v 1.25 2002-08-09 15:20:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/ChangeSetBrowser.st,v 1.26 2002-09-10 12:05:27 cg Exp $'
 ! !