ChangeSet.st
changeset 2117 4ff77bbf9f89
parent 2080 5cfd9170d01d
child 2122 3ffe8c94f2cc
--- a/ChangeSet.st	Wed Sep 16 17:14:52 2009 +0200
+++ b/ChangeSet.st	Thu Sep 17 15:14:17 2009 +0200
@@ -1594,6 +1594,56 @@
 
 !ChangeSet::ChangeFileReader methodsFor:'reading-private'!
 
+handleCategoriesForChange
+    |selector category categories attributes change|
+
+    selector := arguments first.
+    className := self receiversClassName.
+
+    categories := OrderedCollection new.
+    attributes := OrderedCollection new.
+
+    [
+        inputStream skipSeparators.
+        category := inputStream nextChunk.
+        category notEmptyOrNil
+    ] whileTrue:[
+        ( #( 'public' 'private' ) includes: category) ifTrue:[
+            attributes add:category
+        ] ifFalse:[
+            categories add:category
+        ].
+    ].
+    categories size == 1 ifTrue:[
+        "/ easy
+        change := MethodCategoryChange 
+                        className:className
+                        selector:selector
+                        source:(parseTree printString)
+                        category:(categories first).
+        self addChange:change.
+    ] ifFalse:[
+self halt.
+    ].
+
+    attributes size == 1 ifTrue:[
+        "/ easy
+        (attributes first = 'public') ifTrue:[
+            "/ default anyway - ignore
+        ] ifFalse:[
+            change := MethodPrivacyChange 
+                        className:className
+                        selector:selector
+                        privacy:(attributes first asSymbol).
+            change source:(parseTree printString).
+            self addChange:change.
+        ].
+    ] ifFalse:[
+self halt.
+    ].
+    ^ true
+!
+
 handleClassCommentChange
     |change|
 
@@ -1931,22 +1981,12 @@
      arg; the lineNumber is only valid, if the underlying stream 
      provides line-numbers; otherwise, nil is passed."
 
-    (selector == #'methods'
-    or:[(selector == #'publicMethods')
-    or:[(selector == #'privateMethods')
-    or:[(selector == #'methodsFor')
-    or:[(selector == #'methodsFor:')
-    or:[(selector == #'methodsForUndefined:')
-    or:[(selector == #'publicMethodsFor:')
-    or:[(selector == #'privateMethodsFor:')
-    or:[(selector == #'protectedMethodsFor:')
-    or:[(selector == #'methodsFor:stamp:')
-    or:[(selector == #'ignoredMethodsFor:')]]]]]]]]]]) ifTrue:[
-        ^ self handleMethodChange.
-    ].
-
-    selector == #'removeSelector:' ifTrue:[
-        ^ self handleRemoveMethodChange.
+    |dispatchSelector|
+
+    dispatchSelector := ('process_',(selector copyReplaceAll:$: with:$_)) asSymbol.
+Transcript showCR:dispatchSelector.
+    (self class implements:dispatchSelector) ifTrue:[
+        ^ self perform:dispatchSelector.
     ].
 
     "/ any subclass definiton selector ?
@@ -1955,56 +1995,157 @@
         ^ self handleClassDefinitionChange.
     ].
 
-    (selector == #'defineClass:superclass:indexedType:private:instanceVariableNames:classInstanceVariableNames:imports:category:')
-    ifTrue:[
-        ^ self handleVW7ClassDefinitionChange.
-    ].
-
-    selector == #'renameCategory:to:' ifTrue:[
-        ^ self handleMethodCategoryRenameChange.
-    ].
-
-    (selector == #'category:') ifTrue:[
-        ^ self handleMethodCategoryChange.
-    ].
-    (selector == #'privacy:') ifTrue:[
-        ^ self handleMethodPrivacyChange.
-    ].
-
-    selector == #'comment:' ifTrue:[
-        ^ self handleClassCommentChange.
-    ].
-
-    selector == #'commentStamp:prior:' ifTrue:[
-        ^ self handleSqueakCommentStamp.
-    ].
-
-    selector == #'instanceVariableNames:' ifTrue:[
-        ^ self handleClassInstanceVariableDefinitionChange
-    ].
-
-    selector == #'removeClass:' ifTrue:[
-        ^ self handleRemoveClassChange.
-    ].
-
-    selector == #'renameClass:to:' ifTrue:[
-        ^ self handleRenameClassChange.
-    ].
-
-    selector == #'name:' ifTrue:[
-        ^ self handleNameSpaceCreationChange.
-    ].
-
-    (selector == #'primitiveDefinitions'
-    or:[selector == #'primitiveFunctions'
-    or:[selector == #'primitiveVariables']]) ifTrue:[
-        ^ self handlePrimitiveChange.
-    ].
-
     ^ false
-
-    "Created: / 16-02-1998 / 13:42:40 / cg"
-    "Modified: / 04-06-2007 / 22:07:31 / cg"
+!
+
+process_categoriesFor_
+    "'categoriesFor:' chunk (Dolphin)"
+
+    ^ self handleCategoriesForChange.
+!
+
+process_category_
+    "'category:' chunk (ST/X)"
+
+    ^ self handleMethodCategoryChange.
+!
+
+process_commentStamp_prior_
+    "'commentStamp:prior::' chunk (Squeak)"
+
+    ^ self handleSqueakCommentStamp.
+!
+
+process_comment_
+    "'comment:' chunk (ST/X)"
+
+    ^ self handleClassCommentChange.
+!
+
+process_ignoredMethodsFor_
+    "'ignoredMethodsFor:' chunk (ST/X)"
+
+    ^ self handleMethodChange.
+!
+
+process_instanceVariableNames_
+    "'instanceVariableNames:' chunk (ST/X)"
+
+    ^ self handleClassInstanceVariableDefinitionChange.
+!
+
+process_methods
+    "'methods' chunk (ST/V and dolphin)"
+
+    ^ self handleMethodChange.
+!
+
+process_methodsFor
+    "'methodsFor' chunk (ST/V and dolphin)"
+
+    ^ self handleMethodChange.
+!
+
+process_methodsForUndefined_
+    "'methodsForUndefined:' chunk (?)"
+
+    ^ self handleMethodChange.
+!
+
+process_methodsFor_
+    "'methodsFor:' chunk (ST/80, Squeak, ST/X, VW, ...)"
+
+    ^ self handleMethodChange.
+!
+
+process_methodsFor_stamp_
+    "'methodsFor:stamp:' chunk (Squeak)"
+
+    ^ self handleMethodChange.
+!
+
+process_name_
+    "'name:' chunk (ST/X)"
+
+    ^ self handleNameSpaceCreationChange.
+!
+
+process_primitiveDefinitions
+    "'primitiveDefinitions' chunk (ST/X)"
+
+    ^ self handlePrimitiveChange.
+!
+
+process_primitiveFunctions
+    "'primitiveFunctions' chunk (ST/X)"
+
+    ^ self handlePrimitiveChange.
+!
+
+process_primitiveVariables
+    "'primitiveVariables' chunk (ST/X)"
+
+    ^ self handlePrimitiveChange.
+!
+
+process_privacy_
+    "'privacy:' chunk (ST/X)"
+
+    ^ self handleMethodPrivacyChange.
+!
+
+process_privateMethods
+    "'privateMethods' chunk (ST/V and dolphin)"
+
+    ^ self handleMethodChange.
+!
+
+process_privateMethodsFor_
+    "'privateMethodsFor:' chunk (ST/X)"
+
+    ^ self handleMethodChange.
+!
+
+process_protectedMethodsFor_
+    "'protectedMethodsFor:' chunk (ST/X)"
+
+    ^ self handleMethodChange.
+!
+
+process_publicMethods
+    "'publicMethods' chunk (ST/V and dolphin)"
+
+    ^ self handleMethodChange.
+!
+
+process_publicMethodsFor_
+    "'publicMethodsFor:' chunk (ST/X)"
+
+    ^ self handleMethodChange.
+!
+
+process_removeClass_
+    "'removeClass:' chunk (ST/X)"
+
+    ^ self handleRemoveClassChange.
+!
+
+process_removeSelector_
+    "'removeSelector:' chunk (ST/X)"
+
+    ^ self handleRemoveMethodChange.
+!
+
+process_renameCategory_to_
+    "'renameCategory:to:' chunk (ST/X)"
+
+    ^ self handleMethodCategoryRenameChange.
+!
+
+process_renameClass_to_
+    "'renameClass:to:' chunk (ST/X)"
+
+    ^ self handleRenameClassChange.
 ! !
 
 !ChangeSet::DiffSet methodsFor:'accessing'!
@@ -2342,5 +2483,5 @@
 !ChangeSet class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.157 2009-02-26 21:22:08 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.158 2009-09-17 13:14:17 cg Exp $'
 ! !