CodeGeneratorTool.st
changeset 7037 ec9705009031
parent 6993 22233dd2489d
child 7085 19f72b29a012
--- a/CodeGeneratorTool.st	Mon Aug 28 17:22:14 2006 +0200
+++ b/CodeGeneratorTool.st	Mon Aug 28 19:11:45 2006 +0200
@@ -443,7 +443,7 @@
             compositeChangeCollector changesSize == 0 ifTrue:[
                 self information:'Nothing generated.'.
             ] ifFalse:[
-                RefactoryChangeManager instance performChange:compositeChangeCollector.
+                RefactoryChangeManager performChange:compositeChangeCollector.
             ].
             compositeChangeCollector := nil.
         ]
@@ -1853,17 +1853,27 @@
     "install some code for a class.
      If refactory browser stuff is avaliable the refactory tools are used to support undo"
 
-    |change compiler selector oldMthd|
+    self
+        compile:theCode forClass:aClass inCategory:cat 
+        skipIfSame:true
+!
 
-    "/ skip if same
-    compiler := aClass compilerClass new.
-    compiler parseMethod:theCode in:aClass ignoreErrors:true ignoreWarnings:true.
+compile:theCode forClass:aClass inCategory:cat skipIfSame:skipIfSame 
+    "install some code for a class.
+     If refactory browser stuff is avaliable the refactory tools are used to support undo"
+
+    |change compiler selector oldMthd isSame|
 
-    selector := compiler selector.
-    selector notNil ifTrue:[
-        oldMthd := aClass compiledMethodAt:selector.
-        (oldMthd notNil and:[oldMthd source = theCode]) ifTrue:[
-            ^ self.
+    isSame := false.
+    skipIfSame ifTrue:[
+        compiler := aClass compilerClass new.
+        compiler parseMethod:theCode in:aClass ignoreErrors:true ignoreWarnings:true.
+
+        selector := compiler selector.
+        selector notNil ifTrue:[
+            oldMthd := aClass compiledMethodAt:selector.
+            isSame := (oldMthd notNil and:[oldMthd source = theCode]).
+            isSame ifTrue:[ ^ self ].
         ].
     ].
 
@@ -1880,7 +1890,7 @@
     compositeChangeCollector notNil ifTrue:[
         compositeChangeCollector addChange:change
     ] ifFalse:[
-        RefactoryChangeManager instance performChange:change.
+        RefactoryChangeManager performChange:change.
     ]
 
     "Modified: / 21-08-2006 / 18:39:06 / cg"
@@ -1950,5 +1960,5 @@
 !CodeGeneratorTool class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.47 2006-08-25 13:41:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.48 2006-08-28 17:11:45 cg Exp $'
 ! !