checkin from browser
authorClaus Gittinger <cg@exept.de>
Thu, 31 Aug 2000 12:04:21 +0200
changeset 2745 8fa3af64f96e
parent 2744 0ebeada0fee0
child 2746 9e7fbd54013c
checkin from browser
VersionDiffBrowser.st
--- a/VersionDiffBrowser.st	Thu Aug 31 00:01:31 2000 +0200
+++ b/VersionDiffBrowser.st	Thu Aug 31 12:04:21 2000 +0200
@@ -14,7 +14,7 @@
 "{ Package: 'stx:libtool' }"
 
 ApplicationModel subclass:#VersionDiffBrowser
-	instanceVariableNames:'classChangeSet diffTextView'
+	instanceVariableNames:'classChangeSet diffTextView boxAVisible boxBVisible boxMVisible'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-Browsers'
@@ -644,14 +644,14 @@
 
 <return: <Array with:MethodChange with:MethodChange | nil>>
 "
-    |sel changeA changeB|
+    |sel changeA changeB theTwoChanges|
 
     sel := self methodsChangedSelection value.
     sel notNil ifTrue:[
-        changeA := (self classChangeSet methodsChanged at:sel) first.
-        changeB := (self classChangeSet methodsChanged at:sel) second.
-        ^ Array with:changeA 
-                with:changeB 
+        theTwoChanges := self classChangeSet methodsChanged at:sel.
+        changeA := theTwoChanges first.
+        changeB := theTwoChanges second.
+        ^ Array with:changeA with:changeB 
     ].
     ^ nil
 !
@@ -747,30 +747,24 @@
 !VersionDiffBrowser methodsFor:'aspects'!
 
 boxAVisible
-    |holder|
-
-    (holder := builder bindingAt:#boxAVisible) isNil ifTrue:[
-        builder aspectAt:#boxAVisible put:(holder := true asValue).
+    boxAVisible isNil ifTrue:[
+        boxAVisible := true asValue.
     ].
-    ^ holder.
+    ^ boxAVisible.
 !
 
 boxBVisible
-    |holder|
-
-    (holder := builder bindingAt:#boxBVisible) isNil ifTrue:[
-        builder aspectAt:#boxBVisible put:(holder := true asValue).
+    boxBVisible isNil ifTrue:[
+        boxBVisible := true asValue.
     ].
-    ^ holder.
+    ^ boxBVisible.
 !
 
 boxMVisible
-    |holder|
-
-    (holder := builder bindingAt:#boxMVisible) isNil ifTrue:[
-        builder aspectAt:#boxMVisible put:(holder := true asValue).
+    boxMVisible isNil ifTrue:[
+        boxMVisible := true asValue.
     ].
-    ^ holder.
+    ^ boxMVisible.
 !
 
 changedLabelHolder
@@ -1195,6 +1189,64 @@
 
 !VersionDiffBrowser methodsFor:'private'!
 
+addAcceptToTextViewMenus
+"
+add to the standard diff text view or single text views menu an accept entry.
+The acceptAction will fetch the corresponding change and apply it
+(not the shown text)
+
+<return: self>
+"
+
+    |m v diffTextView leftView rightView singleView|
+
+    diffTextView := self diffTextView.
+    leftView := diffTextView leftTextView.
+    rightView := diffTextView rightTextView.
+    singleView := self builder componentAt:#singleTextView.
+
+    (Array 
+        with:leftView
+        with:rightView
+        with:singleView)
+    do:[:v |
+        m := v editMenu.
+        (m selectorAt:#accept) isNil ifTrue:[
+            m addLabels:#('-' 'accept')
+              selectors:(Array with:nil with:#accept)
+              after:#copySelection.
+        ].
+        m 
+            actionAt:#accept 
+            put:[
+                |idx idx2 text change changeSet|  
+
+                changeSet := self classChangeSet.
+
+                v == singleView ifTrue:[
+                    self methodsOnlyInASelection value notNil
+                    ifTrue: [
+                        change := (changeSet methodsOnlyInA at: self methodsOnlyInASelection value)
+                    ] ifFalse:[
+                        change := (changeSet methodsOnlyInB at: self methodsOnlyInBSelection value)
+                    ].
+                ] ifFalse:[     
+                     idx := self methodsChangedSelection value.
+
+                     v == self diffTextView leftTextView ifTrue:[
+                        change := (changeSet methodsChanged at:idx) first.
+                     ] ifFalse:[
+                        change := (changeSet methodsChanged at:idx) second.
+                     ].
+                ].
+                change apply
+            ].
+        m selectorAt:#accept put:nil.
+        v menuHolder:m.
+        v menuMessage:#value.
+    ]
+!
+
 generator
 "
 generate a print string for a change.
@@ -1213,15 +1265,20 @@
                 changeClassName := aChange className.
                 changeClassName = self classBeingCompared name ifTrue:[
                     result := aChange printStringWithoutClassName.
-                    aChange isMethodChange ifTrue:[
-                        cls := aChange changeClass.
-                        cls notNil ifTrue:[
-                            m := cls compiledMethodAt:aChange selector.
-                            (m notNil 
-                            and:[m package ~= cls package]) ifTrue:[
-                                result := aChange printStringWithoutClassName , ' [' , m package , ']'.
+
+                    aChange isMethodCategoryChange ifTrue:[
+                        result := result , ' (category)'
+                    ] ifFalse:[
+                        aChange isMethodChange ifTrue:[
+                            cls := aChange changeClass.
+                            cls notNil ifTrue:[
+                                m := cls compiledMethodAt:aChange selector.
+                                (m notNil 
+                                and:[m package ~= cls package]) ifTrue:[
+                                    result := aChange printStringWithoutClassName , ' [' , m package , ']'.
+                                ].
                             ].
-                        ].
+                        ]
                     ]
                 ] ifFalse:[
                     "/ include name in private class changes
@@ -1235,7 +1292,6 @@
         ].
         result
     ].
-
 !
 
 resetSelectionHolders
@@ -1365,10 +1421,14 @@
 "
     |changeSet|
 
-    aClass isNameSpace ifFalse:[
-        aClass isLoaded ifTrue:[
-            changeSet := (ClassChangeSet newForClass:aClass againstVersion:aVersionA).
-        ]
+    aClass isNil ifTrue:[
+        changeSet := nil
+    ] ifFalse:[
+        aClass isNameSpace ifFalse:[
+            aClass isLoaded ifTrue:[
+                changeSet := (ClassChangeSet newForClass:aClass againstVersion:aVersionA).
+            ]
+        ].
     ].
     self classChangeSet:changeSet
 !
@@ -1409,66 +1469,6 @@
     self classChangeSet:changeSet
 ! !
 
-!VersionDiffBrowser methodsFor:'values'!
-
-addAcceptToTextViewMenus
-"
-add to the standard diff text view or single text views menu an accept entry.
-The acceptAction will fetch the corresponding change and apply it
-(not the shown text)
-
-<return: self>
-"
-
-    |m v diffTextView leftView rightView singleView|
-
-    diffTextView := self diffTextView.
-    leftView := diffTextView leftTextView.
-    rightView := diffTextView rightTextView.
-    singleView := self builder componentAt:#singleTextView.
-
-    (Array 
-        with:leftView
-        with:rightView
-        with:singleView)
-    do:[:v |
-        m := v editMenu.
-        (m selectorAt:#accept) isNil ifTrue:[
-            m addLabels:#('-' 'accept')
-              selectors:(Array with:nil with:#accept)
-              after:#copySelection.
-        ].
-        m 
-            actionAt:#accept 
-            put:[
-                |idx idx2 text change changeSet|  
-
-                changeSet := self classChangeSet.
-
-                v == singleView ifTrue:[
-                    self methodsOnlyInASelection value notNil
-                    ifTrue: [
-                        change := (changeSet methodsOnlyInA at: self methodsOnlyInASelection value)
-                    ] ifFalse:[
-                        change := (changeSet methodsOnlyInB at: self methodsOnlyInBSelection value)
-                    ].
-                ] ifFalse:[     
-                     idx := self methodsChangedSelection value.
-
-                     v == self diffTextView leftTextView ifTrue:[
-                        change := (changeSet methodsChanged at:idx) first.
-                     ] ifFalse:[
-                        change := (changeSet methodsChanged at:idx) second.
-                     ].
-                ].
-                change apply
-            ].
-        m selectorAt:#accept put:nil.
-        v menuHolder:m.
-        v menuMessage:#value.
-    ]
-! !
-
 !VersionDiffBrowser::ClassChangeSet class methodsFor:'instance creation'!
 
 changeSetForClass:aClass 
@@ -1721,5 +1721,5 @@
 !VersionDiffBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/VersionDiffBrowser.st,v 1.32 2000-08-23 12:19:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/VersionDiffBrowser.st,v 1.33 2000-08-31 10:04:21 cg Exp $'
 ! !