added "apply to next conflict"
authorClaus Gittinger <cg@exept.de>
Fri, 16 Aug 2002 13:50:04 +0200
changeset 3806 46e459fdde4c
parent 3805 f9115443f302
child 3807 1556e017bb42
added "apply to next conflict"
ChangesBrowser.st
--- a/ChangesBrowser.st	Fri Aug 16 13:47:00 2002 +0200
+++ b/ChangesBrowser.st	Fri Aug 16 13:50:04 2002 +0200
@@ -333,6 +333,12 @@
                   #enabled: #hasNoSelection
                 )
                #(#MenuItem
+                  #label: 'Apply to Conflict or End'
+                  #translateLabel: true
+                  #value: #doApplyToConflictOrEnd
+                  #enabled: #hasSingleSelection
+                )
+               #(#MenuItem
                   #label: '-'
                 )
                #(#MenuItem
@@ -2639,7 +2645,11 @@
                                             ].
 
                                             (changeClass isNil or:[methodSelector isNil or:[cls isLoaded not]]) ifTrue:[
-                                                changeDelta := '?'
+                                                changeClass isNil ifTrue:[
+                                                    changeDelta := '+'
+                                                ] ifFalse:[
+                                                    changeDelta := '?'
+                                                ]
                                             ] ifFalse:[
                                                 (changeClass includesSelector:methodSelector asSymbol) ifFalse:[
                                                     changeDelta := '+'.
@@ -3840,12 +3850,27 @@
 !
 
 classOfChange:changeNr
+    ^ self
+        classOfChange:changeNr
+        ifAbsent:[:className |
+            |msg|
+
+            className isNil ifTrue:[
+                msg := 'Could not extract classname from change'.
+            ] ifFalse:[
+                msg := 'Class not found: ''' , className , ''''.
+            ].
+            self warn:msg.
+            nil
+        ]
+!
+
+classOfChange:changeNr ifAbsent:exceptionBlock
     |className cls isMeta|
 
     className := self fullClassNameOfChange:changeNr.
     className isNil ifTrue:[
-        self warn:'Could not extract classname from change'.
-        ^ nil
+        ^ exceptionBlock value:nil
     ].
 
     isMeta := false.
@@ -3859,8 +3884,7 @@
     ].
 
     cls isNil ifTrue:[
-        self warn:('Class not found: ''' , className , '''').
-        ^ nil
+        ^ exceptionBlock value:className
     ].
 
     isMeta ifTrue:[
@@ -3972,7 +3996,7 @@
 !
 
 doApplyRest
-    "user wants all changes from changeNr to be applied"
+    "apply all changes from changeNr to the end"
 
     self withSingleSelectedChangeDo:[:changeNr |
         |lastNr "{ Class: SmallInteger }" |
@@ -3991,6 +4015,35 @@
     "Modified: 21.1.1997 / 22:25:29 / cg"
 !
 
+doApplyToConflictOrEnd
+    "apply all changes from changeNr to either a conflict (i.e. method exists)
+     or the end."
+
+    self withSingleSelectedChangeDo:[:changeNr |
+        |lastNr "{ Class: SmallInteger }"|
+
+        self clearCodeView.
+        skipSignal isNil ifTrue:[skipSignal := Signal new].
+
+        lastNr := self numberOfChanges.
+        changeNr to:lastNr do:[:changeNr |
+            | cls sel |
+            changeListView setSelection:changeNr.
+        
+            ((cls := self classOfChange:changeNr ifAbsent:[:className| nil]) notNil
+            and:[(sel := self selectorOfMethodChange:changeNr) notNil])
+            ifTrue:[
+                (cls implements:sel) ifTrue:[
+                    self autoSelect:changeNr.
+                    ^ self
+                ].
+            ].
+            self applyChange:changeNr
+        ].
+        self autoSelect:self numberOfChanges.
+    ]
+!
+
 doBrowse
     "user wants a browser on the class of a change"
 
@@ -5049,5 +5102,5 @@
 !ChangesBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.269 2002-08-09 15:20:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.270 2002-08-16 11:50:04 cg Exp $'
 ! !