ClassDefinitionChange.st
changeset 2876 6a4f62f95771
parent 2834 7b578e35a658
child 2900 c21c251db4a0
--- a/ClassDefinitionChange.st	Tue Jul 31 14:31:47 2012 +0200
+++ b/ClassDefinitionChange.st	Tue Jul 31 14:33:10 2012 +0200
@@ -47,6 +47,12 @@
 "
 ! !
 
+!ClassDefinitionChange class methodsFor:'others'!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.71 2012-07-31 12:33:10 vrany Exp $'
+! !
+
 !ClassDefinitionChange methodsFor:'accessing'!
 
 basicSuperClassName 
@@ -403,6 +409,168 @@
     "Modified: / 13-06-2012 / 13:01:58 / cg"
 !
 
+definitionStringInNamespace: ns
+    | classNameUsed superClassNameUsed |
+
+    objectType == #variable ifTrue:[
+        ^ String streamContents:[:stream |
+            ns notNil ifTrue:[
+                stream 
+                    nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
+            ] ifFalse:[
+                self halt:'can this happen ?'.
+                stream 
+                    nextPutAll:'Smalltalk'
+            ].
+
+            stream 
+                nextPutAll:' addClassVarName:';
+                nextPutAll:className asString storeString
+          ].
+    ].
+
+    superClassNameUsed := self superClassName.
+    classNameUsed := self classNameWithoutNamespace.
+
+    ^ String streamContents:[:stream |
+        self isPrivateClassDefinitionChange ifFalse:[
+            stream 
+                nextPutAll:superClassNameUsed;
+                nextPutAll:' subclass:';
+                nextPutAll: classNameUsed asSymbol storeString
+                ;
+                cr;
+                tab;
+                nextPutAll:'instanceVariableNames:';
+                nextPutAll:(instanceVariableNames ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'classVariableNames:';
+                nextPutAll:(classVariableNames ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'poolDictionaries:';
+                nextPutAll:(poolDictionaries ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'category:';
+                nextPutAll:(category ? '') storeString;
+                cr
+        ] ifTrue:[
+            stream 
+                nextPutAll:superClassNameUsed;
+                nextPutAll:' subclass:';
+                nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString
+                ;
+                cr;
+                tab;
+                nextPutAll:'instanceVariableNames:';
+                nextPutAll:(instanceVariableNames ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'classVariableNames:';
+                nextPutAll:(classVariableNames ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'poolDictionaries:';
+                nextPutAll:(poolDictionaries ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'privateIn:';
+                nextPutAll:
+                    (ns isNil
+                        ifTrue:[owningClassName]
+                        ifFalse:[owningClassName copyFrom: ns size + 3]);
+                cr
+        ]
+    ]
+
+    "Modified: / 06-10-2011 / 17:02:05 / cg"
+    "Created: / 20-03-2012 / 19:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+definitionStringWithoutNamespace
+    |ns classNameUsed superClassNameUsed|
+
+    ns := self nameSpaceOverride.
+
+    objectType == #variable ifTrue:[
+        ^ String streamContents:[:stream |
+            ns notNil ifTrue:[
+                stream 
+                    nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
+            ] ifFalse:[
+                self halt:'can this happen ?'.
+                stream 
+                    nextPutAll:'Smalltalk'
+            ].
+
+            stream 
+                nextPutAll:' addClassVarName:';
+                nextPutAll:className asString storeString
+          ].
+    ].
+
+    superClassNameUsed := self superClassName.
+    classNameUsed := self classNameWithoutNamespace.
+
+    ^ String streamContents:[:stream |
+        self isPrivateClassDefinitionChange ifFalse:[
+            stream 
+                nextPutAll:superClassNameUsed;
+                nextPutAll:' subclass:';
+                nextPutAll: classNameUsed asSymbol storeString
+                ;
+                cr;
+                tab;
+                nextPutAll:'instanceVariableNames:';
+                nextPutAll:(instanceVariableNames ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'classVariableNames:';
+                nextPutAll:(classVariableNames ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'poolDictionaries:';
+                nextPutAll:(poolDictionaries ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'category:';
+                nextPutAll:(category ? '') storeString;
+                cr
+        ] ifTrue:[
+            stream 
+                nextPutAll:superClassNameUsed;
+                nextPutAll:' subclass:';
+                nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString
+                ;
+                cr;
+                tab;
+                nextPutAll:'instanceVariableNames:';
+                nextPutAll:(instanceVariableNames ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'classVariableNames:';
+                nextPutAll:(classVariableNames ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'poolDictionaries:';
+                nextPutAll:(poolDictionaries ? '') storeString;
+                cr;
+                tab;
+                nextPutAll:'privateIn:';
+                nextPutAll:
+                    ((ns := self nameSpaceName) isNil
+                        ifTrue:[owningClassName]
+                        ifFalse:[owningClassName copyFrom: ns size + 3]);
+                cr
+        ]
+    ]
+
+    "Modified: / 06-10-2011 / 17:02:05 / cg"
+    "Created: / 20-03-2012 / 16:37:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 printOn:aStream
     aStream 
         nextPutAll:className; nextPutAll:' {definition}'
@@ -592,13 +760,9 @@
 !ClassDefinitionChange class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.70 2012-06-13 11:03:04 cg Exp $'
-!
-
-version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.70 2012-06-13 11:03:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.71 2012-07-31 12:33:10 vrany Exp $'
 !
 
 version_SVN
-    ^ '§ Id: ClassDefinitionChange.st 1867 2011-06-08 21:57:08Z vranyj1  §'
+    ^ '§Id:: ClassDefinitionChange.st 1936 2012-07-24 15:47:21Z vranyj1                                                             §'
 ! !