work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
authorJakub Nesveda <jakubnesveda@seznam.cz>
Mon, 29 Sep 2014 23:23:13 +0200
changeset 681 34c671a3cf59
parent 680 df967659f3a4
child 682 4496a137b756
child 684 07bbc12ffdd6
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator completed rewriting access methods code generators
CustomAccessMethodsCodeGenerator.st
CustomAccessMethodsCodeGeneratorTests.st
CustomBrowserContext.st
CustomCodeGeneratorClassGenerator.st
CustomCodeGeneratorClassGeneratorTests.st
CustomCodeGeneratorOrRefactoring.st
CustomCodeGeneratorOrRefactoringTestCase.st
CustomContext.st
CustomSourceCodeBuilder.st
CustomSubContext.st
CustomValueHolderWithChangeNotificationAccessMethodsCodeGeneratorTests.st
Make.proto
abbrev.stc
bc.mak
extensions.st
jn_refactoring_custom.st
refactoring_custom.rc
--- a/CustomAccessMethodsCodeGenerator.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomAccessMethodsCodeGenerator.st	Mon Sep 29 23:23:13 2014 +0200
@@ -89,19 +89,18 @@
         ].
 
         variableNames do:[ :variableName |
-            | method source |
+            | source |
 
             source := self sourceForClass: class variableName: variableName.
 
-            method := codeBuilder createMethod.
-            method 
-                class: (self methodClass: class);
-                protocol: self protocol;
-                source: source.
+            codeBuilder
+                compile: source 
+                in: (self methodClass: class) 
+                classified: self protocol
         ]
     ]
 
-    "Modified: / 30-06-2014 / 10:26:37 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 24-09-2014 / 21:52:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomAccessMethodsCodeGenerator methodsFor:'protected'!
--- a/CustomAccessMethodsCodeGeneratorTests.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomAccessMethodsCodeGeneratorTests.st	Mon Sep 29 23:23:13 2014 +0200
@@ -11,9 +11,18 @@
 !CustomAccessMethodsCodeGeneratorTests methodsFor:'accessing'!
 
 generatorOrRefactoring
-    ^ mock mockOf:CustomAccessMethodsCodeGenerator
+    | mockClass mockClassInstance |
+
+    mockClass := mock mockClassOf:CustomAccessMethodsCodeGenerator.
+    mockClass compileMockMethod: 'description ^ ''some description'' '.
 
-    "Modified: / 01-07-2014 / 16:19:16 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    mockClassInstance := mockClass new.
+    mockClassInstance compileMockMethod: 'sourceForClass:aClass variableName:varName
+        ^ varName, '' ^ '', varName'.
+
+    ^ mockClassInstance
+
+    "Modified: / 26-09-2014 / 10:54:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomAccessMethodsCodeGeneratorTests methodsFor:'tests'!
@@ -39,99 +48,85 @@
 !
 
 test_build_in_context_with_none_selected_variable
-    | class methodCount |
+    | classWithInstVars testCompleted |
+
+    testCompleted := false.
 
-    class := self createClass.
-    class instanceVariableNames: 'instanceVariable_01 instanceVariable_02 instanceVariable_03'.
+    [ 
+        classWithInstVars := self createClass.
+        classWithInstVars
+            instanceVariableNames: #('instanceVariable_01' 'instanceVariable_02' 'instanceVariable_03');
+            compile.
+
+        context selectedClasses: (Array with: classWithInstVars).
+
+        generatorOrRefactoring executeInContext: context.
 
-    context selectedClasses: (Array with: class).
+        self assertMethodCount: 3 inClass: classWithInstVars.
+
+        expectedSource := 'instanceVariable_02 ^ instanceVariable_02'.
+        self assertMethodSource: expectedSource atSelector: #instanceVariable_02.
 
-    generatorOrRefactoring mockSelector: #sourceForClass:variableName: withBlockValue: [
-        :aClass :varName |
+        expectedSource := 'instanceVariable_01 ^ instanceVariable_01'.
+        self assertMethodSource: expectedSource atSelector: #instanceVariable_01.
 
-        ^ varName, ' ^ ', varName. 
+        expectedSource := 'instanceVariable_03 ^ instanceVariable_03'.
+        self assertMethodSource: expectedSource atSelector: #instanceVariable_03.
+
+        testCompleted := true.
+    ] ensure: [ 
+        self assert: testCompleted
     ].
 
-    methodCount := class methodDictionary size.
-
-    generatorOrRefactoring executeInContext: context.
-
-    self assert: (methodCount + 3) = class methodDictionary size.
-
-    expectedSource := 'instanceVariable_02
-    ^ instanceVariable_02'.
-    self assertMethodSource: expectedSource atSelector: #instanceVariable_02.
-
-    expectedSource := 'instanceVariable_01
-    ^ instanceVariable_01'.
-    self assertMethodSource: expectedSource atSelector: #instanceVariable_01.
-
-    expectedSource := 'instanceVariable_03
-    ^ instanceVariable_03'.
-    self assertMethodSource: expectedSource atSelector: #instanceVariable_03.
-
     "Created: / 20-06-2014 / 20:29:25 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 26-09-2014 / 10:51:58 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 test_build_in_context_with_one_selected_variable
-    | class methodCount |
+    | class |
 
     class := self createClass.
-    class instanceVariableNames: 'instanceVariable_01 instanceVariable_02 instanceVariable_03'.
+    class
+        instanceVariableNames: (Array with: 'instanceVariable_01' with: 'instanceVariable_02' with: 'instanceVariable_03');
+        compile.
 
     context selectedClasses: (Array with: class).
     context selectedVariables: (Array with: 'instanceVariable_02').
 
-    generatorOrRefactoring mockSelector: #sourceForClass:variableName: withBlockValue: [
-        :aClass :varName |
-
-        ^ varName, ' ^ ', varName. 
-    ].
-
-    methodCount := class methodDictionary size.
-
     generatorOrRefactoring executeInContext: context.
 
-    self assert: (methodCount + 1) = class methodDictionary size.
+    self assertMethodCount: 1 inClass: class.
 
-    expectedSource := 'instanceVariable_02
-    ^ instanceVariable_02'.
+    expectedSource := 'instanceVariable_02 ^ instanceVariable_02'.
     self assertMethodSource: expectedSource atSelector: #instanceVariable_02.
 
     "Created: / 17-06-2014 / 08:57:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified (format): / 20-06-2014 / 20:15:37 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 26-09-2014 / 10:57:18 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 test_build_in_context_with_two_selected_variables
-    | class methodCount |
+    | class |
 
     class := self createClass.
-    class instanceVariableNames: 'instanceVariable_01 instanceVariable_02 instanceVariable_03'.
+    class
+        instanceVariableNames: (Array with: 'instanceVariable_01' with: 'instanceVariable_02' with: 'instanceVariable_03');
+        compile.
 
     context selectedClasses: (Array with: class).
     context selectedVariables: (Array with: 'instanceVariable_02' with: 'instanceVariable_01').
 
-    generatorOrRefactoring mockSelector: #sourceForClass:variableName: withBlockValue: [
-        :aClass :varName |
-
-        ^ varName, ' ^ ', varName. 
-    ].
-
-    methodCount := class methodDictionary size.
-
     generatorOrRefactoring executeInContext: context.
 
-    self assert: (methodCount + 2) = class methodDictionary size.
+    self assertMethodCount: 2 inClass: class.
 
-    expectedSource := 'instanceVariable_02
-    ^ instanceVariable_02'.
+    expectedSource := 'instanceVariable_02 ^ instanceVariable_02'.
     self assertMethodSource: expectedSource atSelector: #instanceVariable_02.
 
-    expectedSource := 'instanceVariable_01
-    ^ instanceVariable_01'.
+    expectedSource := 'instanceVariable_01 ^ instanceVariable_01'.
     self assertMethodSource: expectedSource atSelector: #instanceVariable_01.
 
     "Created: / 20-06-2014 / 20:26:02 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 26-09-2014 / 11:03:39 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 test_default_method_name_for_variable_name
@@ -184,10 +179,9 @@
 test_var_type_of_class_instance_variable
     | actualVarType |
 
-    class := self createClass.
+    class := self createClass theMetaclass.
     class
-        isMeta: true;
-        instanceVariableNames: 'ClassInstVar1 ClassInstVar2'.
+        instanceVariableNames: (Array with: 'ClassInstVar1' with: 'ClassInstVar2').
 
     self assert: class isMeta.
 
@@ -196,6 +190,7 @@
     self assert: 'classInstVar' = actualVarType
 
     "Created: / 23-06-2014 / 19:27:17 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 26-09-2014 / 21:33:53 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 test_var_type_of_instance_variable
@@ -215,13 +210,14 @@
     | actualVarType |
 
     class := self createClass.
-    class classVariableNames: 'ClassVar1 ClassVar2'.
+    class classVariableNames: (Array with: 'ClassVar1' with: 'ClassVar2').
 
     actualVarType := generatorOrRefactoring varTypeOf: 'ClassVar2' class: class.
 
     self assert: 'static' = actualVarType
 
     "Created: / 20-06-2014 / 21:22:15 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 26-09-2014 / 21:47:26 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomAccessMethodsCodeGeneratorTests class methodsFor:'documentation'!
--- a/CustomBrowserContext.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomBrowserContext.st	Mon Sep 29 23:23:13 2014 +0200
@@ -114,6 +114,15 @@
     "Created: / 26-01-2014 / 13:39:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!CustomBrowserContext methodsFor:'queries'!
+
+isInteractiveContext
+
+    ^ true
+
+    "Created: / 21-09-2014 / 23:10:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
 !CustomBrowserContext class methodsFor:'documentation'!
 
 version_HG
--- a/CustomCodeGeneratorClassGenerator.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomCodeGeneratorClassGenerator.st	Mon Sep 29 23:23:13 2014 +0200
@@ -71,8 +71,8 @@
 
     class := codeBuilder createClass.
     class
-        superclassName: 'CustomCodeGenerator';
-        className: aClassName;
+        superclassName: #CustomCodeGenerator;
+        name: aClassName;
         category: self class category.
 
     subContext := CustomSubContext new.
@@ -82,8 +82,8 @@
     generator executeInContext: subContext
 
     "Created: / 24-04-2014 / 10:15:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 26-04-2014 / 16:23:02 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
     "Modified: / 05-08-2014 / 13:37:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 28-09-2014 / 22:54:43 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomCodeGeneratorClassGenerator methodsFor:'executing'!
--- a/CustomCodeGeneratorClassGeneratorTests.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomCodeGeneratorClassGeneratorTests.st	Mon Sep 29 23:23:13 2014 +0200
@@ -1,6 +1,6 @@
 "{ Package: 'jn:refactoring_custom' }"
 
-TestCase subclass:#CustomCodeGeneratorClassGeneratorTests
+CustomCodeGeneratorOrRefactoringTestCase subclass:#CustomCodeGeneratorClassGeneratorTests
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
@@ -8,56 +8,44 @@
 !
 
 
+!CustomCodeGeneratorClassGeneratorTests methodsFor:'accessing'!
+
+generatorOrRefactoring
+    | generator |
+
+    generator := CustomCodeGeneratorClassGenerator new.
+    generator dialog: CustomSilentDialog new.
+
+    ^ generator
+
+    "Created: / 27-09-2014 / 11:27:33 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 27-09-2014 / 14:28:43 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
 !CustomCodeGeneratorClassGeneratorTests methodsFor:'tests'!
 
 test_code_generator_class_created
 
-    | codeGenerator testClassName |
+    | newGenerator testClassName |
 
     testClassName := 'CustomCodeGeneratorForTestCase'.
-    codeGenerator := CustomCodeGeneratorClassGenerator new.
 
     self assert: (Smalltalk classNamed: testClassName) isNil.
 
-    codeGenerator buildForClassName: testClassName.
-    codeGenerator codeBuilder compile.
+    generatorOrRefactoring dialog answer: testClassName forSelector: #requestClassName:initialAnswer:.
+
+    generatorOrRefactoring executeInContext: context.
+
+    newGenerator := Smalltalk classNamed: testClassName.
 
-    self assert: (Smalltalk classNamed: testClassName) isNil not.
-    self assert: ((Smalltalk classNamed: testClassName) includesSelector: #buildInContext:).
-    self assert: ((Smalltalk classNamed: testClassName) class includesSelector: #buildInContext:) not.
-    self assert: ((Smalltalk classNamed: testClassName) includesSelector: #availableInContext:) not.
-    self assert: ((Smalltalk classNamed: testClassName) class includesSelector: #availableInContext:).
-
-    (Smalltalk classNamed: testClassName) removeFromSystem.
+    self assert: newGenerator isNil not.
+    self assert: (newGenerator includesSelector: #buildInContext:).
+    self assert: (newGenerator class includesSelector: #buildInContext:) not.
+    self assert: (newGenerator includesSelector: #availableInContext:) not.
+    self assert: (newGenerator class includesSelector: #availableInContext:).
 
     "Created: / 31-03-2014 / 23:20:33 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 23-08-2014 / 00:09:01 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-test_code_generator_class_created_with_mock_dialog
-
-    | codeGenerator testClassName mockDialog |
-
-    testClassName := 'CustomCodeGeneratorForTestCase'.
-    codeGenerator := CustomCodeGeneratorClassGenerator new.
-    mockDialog := CustomSilentDialog new.
-    mockDialog answer: testClassName forSelector: #requestClassName:initialAnswer:.
-    codeGenerator dialog: mockDialog.  
-
-    self assert: (Smalltalk classNamed: testClassName) isNil.
-
-    codeGenerator executeInContext: (CustomSubContext new).  
-
-    self assert: (Smalltalk classNamed: testClassName) isNil not.
-    self assert: ((Smalltalk classNamed: testClassName) includesSelector: #buildInContext:).
-    self assert: ((Smalltalk classNamed: testClassName) class includesSelector: #buildInContext:) not.
-    self assert: ((Smalltalk classNamed: testClassName) includesSelector: #availableInContext:) not.
-    self assert: ((Smalltalk classNamed: testClassName) class includesSelector: #availableInContext:).
-
-    (Smalltalk classNamed: testClassName) removeFromSystem.
-
-    "Created: / 11-05-2014 / 00:02:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 02-06-2014 / 22:10:37 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 27-09-2014 / 14:30:29 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomCodeGeneratorClassGeneratorTests class methodsFor:'documentation'!
--- a/CustomCodeGeneratorOrRefactoring.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomCodeGeneratorOrRefactoring.st	Mon Sep 29 23:23:13 2014 +0200
@@ -281,11 +281,11 @@
 
 addBuilderChanges
 
-    self addChange: codeBuilder change.
+    self addChange: codeBuilder changes.
     self addChange: refactoryBuilder change
 
     "Created: / 10-04-2014 / 23:26:12 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 23-08-2014 / 15:41:16 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 21-09-2014 / 23:14:45 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 addChange: aCodeChange
@@ -346,15 +346,30 @@
     compositeChangeCollector notNil ifTrue:[
         compositeChangeCollector addChange:change
     ] ifFalse:[
-        RefactoryChangeManager performChange:change.
+        changeManager performChange:change
     ]
 
     "Modified: / 21-08-2006 / 18:39:06 / cg"
     "Modified (format): / 21-01-2012 / 10:40:59 / cg"
+    "Modified: / 21-09-2014 / 20:21:33 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomCodeGeneratorOrRefactoring methodsFor:'executing'!
 
+buildInContext: aCustomContext
+
+    self subclassResponsibility
+
+    "Created: / 18-03-2014 / 22:52:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+configureInContext:arg
+
+    ^ self
+
+    "Created: / 21-09-2014 / 20:42:00 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
 executeChangesInContext: aCustomContext changesName: aName
 
     self executeCollectedChangesNamed: aName.
@@ -364,14 +379,20 @@
 
 executeInContext: aCustomContext
 
-    self startCollectChanges.       
+    self startCollectChanges.
+
+    aCustomContext isInteractiveContext ifTrue:[    
+        self configureInContext:aCustomContext.
+    ].
+    self validateInContext: aCustomContext.
     self buildInContext: aCustomContext.
+
     self addBuilderChanges.
     self executeChangesInContext: aCustomContext changesName: self class description.
 
     "Created: / 19-03-2014 / 18:45:26 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
     "Modified: / 03-04-2014 / 11:04:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 07-08-2014 / 23:22:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 21-09-2014 / 20:42:18 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 executeInContextWithWaitCursor: aCustomContext
@@ -391,6 +412,13 @@
     ]
 
     "Created: / 07-08-2014 / 23:17:17 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+validateInContext:arg
+
+    ^ self
+
+    "Created: / 21-09-2014 / 20:42:02 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomCodeGeneratorOrRefactoring methodsFor:'initialization'!
--- a/CustomCodeGeneratorOrRefactoringTestCase.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomCodeGeneratorOrRefactoringTestCase.st	Mon Sep 29 23:23:13 2014 +0200
@@ -70,18 +70,28 @@
     "Created: / 15-06-2014 / 16:42:37 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
+assertMethodCount: aNumber inClass: aClass
+    | realClass |
+
+    realClass := Smalltalk at: (aClass theNonMetaclass name asSymbol).
+
+    self assert: aNumber = (realClass methodDictionary size).
+
+    "Created: / 26-09-2014 / 10:48:59 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
 assertMethodSource: aSourceCode atSelector: aSelector
     "Assert that source code is same at given selector for first generated class"
 
     | className class |
 
-    className := classes first classNameBuilded.
-    class := Smalltalk classNamed: className.
+    className := classes first name.
+    class := Smalltalk at: className.
 
     ^ self assertMethodSource: aSourceCode atSelector: aSelector forClass: class
 
     "Created: / 27-05-2014 / 20:06:17 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 30-05-2014 / 22:36:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 26-09-2014 / 00:15:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 assertMethodSource: expectedSource atSelector: aSelector forClass: aClass
@@ -112,13 +122,16 @@
     | class |
 
     class := codeBuilder createClass.
-    class name: 'DummyClassForGeneratorTestCase'.
+    class
+        name: #DummyClassForGeneratorTestCase;
+        compile.
+
     classes add: class.
 
     ^ class
 
     "Created: / 29-05-2014 / 23:22:52 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 21-09-2014 / 23:04:38 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified (format): / 25-09-2014 / 23:39:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomCodeGeneratorOrRefactoringTestCase methodsFor:'context templates'!
@@ -127,36 +140,38 @@
     | class |
 
     class := self createClass.
-    class instanceVariableNames: 'instanceVariable'.
+    class instanceVariableNames: (Array with: 'instanceVariable').
 
     context selectedClasses: (Array with: class)
 
     "Created: / 29-05-2014 / 00:33:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 29-05-2014 / 23:44:20 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 26-09-2014 / 21:54:14 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 classWithThreeInstanceVariables
     | class |
 
     class := self createClass.
-    class instanceVariableNames: 'instanceVariable_01 instanceVariable_02 instanceVariable_03'.
+    class instanceVariableNames: (Array with: 'instanceVariable_01' with: 'instanceVariable_02' with: 'instanceVariable_03').
 
     context selectedClasses: (Array with: class).
     context selectedVariables: (class instanceVariableNames).
 
     "Created: / 13-07-2014 / 21:56:12 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 26-09-2014 / 21:55:20 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 classWithTwoInstanceVariables
     | class |
 
     class := self createClass.
-    class instanceVariableNames: 'instanceVariable_01 instanceVariable_02'.
+    class instanceVariableNames: (Array with: 'instanceVariable_01' with: 'instanceVariable_02').
 
     context selectedClasses: (Array with: class).
     context selectedVariables: (class instanceVariableNames).
 
     "Created: / 13-07-2014 / 21:45:06 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 26-09-2014 / 22:01:29 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomCodeGeneratorOrRefactoringTestCase methodsFor:'executing'!
--- a/CustomContext.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomContext.st	Mon Sep 29 23:23:13 2014 +0200
@@ -79,6 +79,15 @@
     "Created: / 05-05-2014 / 00:14:59 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
+!CustomContext methodsFor:'queries'!
+
+isInteractiveContext
+
+    self subclassResponsibility
+
+    "Created: / 21-09-2014 / 23:10:12 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
 !CustomContext class methodsFor:'documentation'!
 
 version_HG
--- a/CustomSourceCodeBuilder.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomSourceCodeBuilder.st	Mon Sep 29 23:23:13 2014 +0200
@@ -1,6 +1,6 @@
 "{ Package: 'jn:refactoring_custom' }"
 
-CodeGenerator subclass:#CustomSourceCodeBuilder
+RBNamespace subclass:#CustomSourceCodeBuilder
 	instanceVariableNames:'codeBuilds changeManager formatter defaultValues
 		defaultReplacements package'
 	classVariableNames:''
@@ -8,9 +8,8 @@
 	category:'Interface-Refactoring-Custom'
 !
 
-CustomSourceCodeBuilder subclass:#Class
-	instanceVariableNames:'className isMeta superclassName instanceVariableNames
-		classVariableNames poolDictionaryNames category'
+RBClass subclass:#Class
+	instanceVariableNames:'formatter changeManager'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:CustomSourceCodeBuilder
@@ -23,8 +22,8 @@
 	privateIn:CustomSourceCodeBuilder
 !
 
-CustomSourceCodeBuilder subclass:#Method
-	instanceVariableNames:'classes commentPlaceholderMarker commentReplacements'
+RBMethod subclass:#Method
+	instanceVariableNames:'formatter changeManager'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:CustomSourceCodeBuilder
@@ -56,21 +55,6 @@
 
 !CustomSourceCodeBuilder methodsFor:'accessing'!
 
-buildedSource
-
-    self subclassResponsibility
-
-    "Created: / 18-05-2014 / 16:48:53 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-change
-
-   self createChange.
-   ^change
-
-    "Created: / 24-03-2014 / 09:02:36 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
 changeManager
     ^ changeManager
 !
@@ -79,10 +63,6 @@
     changeManager := something.
 !
 
-codeBuilds
-    ^ codeBuilds
-!
-
 formatter
     ^ formatter
 
@@ -102,13 +82,19 @@
     | classBuilder |
 
     classBuilder := self class classBuilder.
+    classBuilder
+        model: self;
+        superclass: (self classNamed: #Object);
+        instanceVariableNames: #();
+        classVariableNames: #();
+        poolDictionaryNames: #().
+
     self fillDefaultValuesTo: classBuilder.  
-    codeBuilds add: classBuilder.
     self storeDefaultClassWhenNoneStored: classBuilder.
     ^ classBuilder
 
     "Created: / 09-04-2014 / 21:38:20 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 31-08-2014 / 16:24:38 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 25-09-2014 / 23:51:21 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 createClassImmediate: aClassName
@@ -147,17 +133,20 @@
 createClassImmediate: aClassName superClassName: aSuperClassName instanceVariableNames: instVarNames classVariableNames: classVarNames
     "Creates class immediately and returns the real class"
 
-    (self createClass)
-        className: aClassName;
-        superclassName: aSuperClassName;
-        instanceVariableNames: instVarNames;
-        classVariableNames: classVarNames.
+    changes addChange: (InteractiveAddClassChange definition:
+        aSuperClassName, ' subclass:#', aClassName, '
+            instanceVariableNames:''', instVarNames, '''
+            classVariableNames:''', classVarNames, '''
+            poolDictionaries:''''
+            category:''''
+    ').
 
     self execute.
 
     ^ Smalltalk classNamed: aClassName
 
     "Created: / 23-08-2014 / 22:18:07 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 21-09-2014 / 22:39:33 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 createMethod
@@ -169,24 +158,22 @@
     | methodBuilder |
 
     methodBuilder := self methodBuilder.
-    codeBuilds add: methodBuilder.  
+    "/ codeBuilds add: methodBuilder.  
     ^ methodBuilder
 
     "Created: / 09-04-2014 / 23:54:03 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified (comment): / 18-05-2014 / 11:57:59 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 29-09-2014 / 23:14:25 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 createMethodImmediate: aClass protocol: aProtocol source: aSource
     "Much like createClassImmediate:superClassName:, but for method"
 
-    (self createMethod)
-        class: aClass;
-        protocol: aProtocol;
-        source: aSource.
+    changes addChange: (InteractiveAddMethodChange compile: aSource in: aClass classified: aProtocol).
 
     self execute
 
     "Created: / 15-06-2014 / 16:06:00 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 21-09-2014 / 22:43:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 createMethodImmediate: aClass source: aSource
@@ -206,10 +193,10 @@
     (true for CustomLocalChangeManager changeManager implementation)
     "
 
-    changeManager performChange: self change
+    changeManager performChange: changes
 
     "Created: / 27-04-2014 / 16:30:05 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified (comment): / 31-05-2014 / 19:45:47 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 21-09-2014 / 22:34:58 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 redoChanges
@@ -344,13 +331,13 @@
             put: code
     ]
     ifFalse: [
-        replacements 
+        "replacements 
             at: placeholder
-            put: (self replacementFromCode: code)
+            put: (self replacementFromCode: code)"
     ]
 
     "Created: / 29-04-2014 / 20:02:45 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 29-07-2014 / 00:29:06 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 29-09-2014 / 23:18:59 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 source:aString
@@ -411,14 +398,13 @@
     "Invoked when a new instance is created."
 
     super initialize.
-    codeBuilds := OrderedCollection new.
     changeManager := CustomLocalChangeManager new.
     defaultValues := Dictionary new.
     defaultReplacements := Dictionary new.
     formatter := CustomRBLocalSourceCodeFormatter new.
 
     "Created: / 09-04-2014 / 23:44:04 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 28-08-2014 / 23:24:38 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 24-09-2014 / 20:41:37 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomSourceCodeBuilder methodsFor:'instance creation'!
@@ -440,7 +426,7 @@
 createChange
     "Creates refactory change from builder items - codeBuilds"
 
-    change := nil.
+    "change := nil.
     codeBuilds do: [ :builder |
         | codeChange |
 
@@ -452,10 +438,10 @@
 
             change addChange: codeChange    
         ]
-    ]
+    ]"
 
     "Created: / 10-04-2014 / 00:14:39 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 22-07-2014 / 22:27:12 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 29-09-2014 / 23:19:18 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 isSharedAttribute: aSelector
@@ -464,58 +450,6 @@
     ^ (aSelector = #package:)
 
     "Created: / 30-08-2014 / 21:38:21 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-replacePlaceholdersInSelectorPartsOf:aMessageNode 
-    aMessageNode selectorParts do:[:part | 
-        part isPatternVariable ifTrue:[
-            |replacement|
-
-            replacement := self replacementFor:part value.
-            "(replacement isSymbol or:[ replacement isVariable ]) ifFalse:[
-                self error:'Replacement for selector parts must be a single selector'
-            ]."
-            replacement isNil ifTrue: [ 
-                self error: 'None replacement for: ', part value asString.
-            ].
-            source notNil ifTrue:[
-                self 
-                      recordReplaceInSourceFrom:part start
-                      to:part stop
-                      by:replacement formattedCode.
-            ].
-            part value:replacement formattedCode.
-        ]
-    ]
-
-    "Created: / 28-07-2014 / 23:32:49 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 26-08-2014 / 23:37:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 28-08-2014 / 23:44:53 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-replacementFromCode: aCode
-
-    ^ aCode isSymbol 
-        ifTrue:[aCode]
-        ifFalse:[
-            RBParser parseRewriteExpression: aCode onError: [ :str :pos |
-                RBParser parseRewriteMethod: aCode onError: [ :str :pos | 
-                    self error: 'Cannot parse: ', str, ' at pos: ', pos asString 
-                ]
-            ]
-        ]
-
-    "Created: / 28-07-2014 / 23:47:51 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-! !
-
-!CustomSourceCodeBuilder methodsFor:'queries'!
-
-sourceExists
-    "Tells whether source is already present in the target class, package ..."
-
-    self subclassResponsibility
-
-    "Created: / 23-03-2014 / 23:02:08 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomSourceCodeBuilder methodsFor:'refactory-changes'!
@@ -536,243 +470,20 @@
 
 !CustomSourceCodeBuilder::Class methodsFor:'accessing'!
 
-category:something
-    category := something.
-
-    "Created: / 04-05-2014 / 21:18:07 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-className:something
-    className := something.
-!
-
-classNameBuilded
-    ^ className
-
-    "Created: / 14-04-2014 / 14:14:57 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-classVariableNames:something
-    classVariableNames := something.
-!
-
-instVarNames
-
-    ^ (instanceVariableNames asCollectionOfWords collect:[:varName| varName asSymbol]) asArray.
-"    instanceVariableNames isNil ifTrue:[
-        ^ #()
-    ].
-
-    instanceVariableNames isString ifTrue:[
-        instanceVariableNames := (instanceVariableNames asCollectionOfWords collect:[:varName| varName asSymbol]) asArray.
-    ].
-
-    ^ instanceVariableNames"
-
-    "Created: / 29-05-2014 / 23:46:45 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-instanceVariableNames
-
-    ^ self instVarNames.
-
-    "Created: / 13-07-2014 / 21:49:55 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-instanceVariableNames:something
-    instanceVariableNames := something.
-!
-
-isMeta
-    ^ isMeta
-
-    "Created: / 23-06-2014 / 19:22:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-isMeta:aBoolean
-    isMeta := aBoolean.
-!
-
-poolDictionaryNames:something
-    poolDictionaryNames := something.
-!
-
-superclassName:something
-    superclassName := something.
-!
-
-theMetaclass
-
-    isMeta ifTrue: [
-        ^ self 
-    ].
-
-    ^ (self deepCopy) 
-        isMeta: true;
-        yourself
-
-    "Created: / 26-04-2014 / 17:10:52 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-theNonMetaclass
-
-    isMeta ifTrue: [
-        ^ (self deepCopy) 
-            isMeta: false;
-            yourself
-    ].  
-
-    ^ self
-
-    "Created: / 26-04-2014 / 17:11:30 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-! !
-
-!CustomSourceCodeBuilder::Class methodsFor:'class method stubs'!
-
-allClassVarNames
-    | variableNames |
-
-    variableNames := self asRBClass allClassVariableNames.
-
-    variableNames isNil ifTrue: [ 
-        ^ #()
-    ].
-
-    ^ variableNames
-
-    "Created: / 01-06-2014 / 23:40:50 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 02-06-2014 / 08:31:19 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-allSuperclassesDo: aBlock
-
-    self superclass withAllSuperclassesDo: aBlock
-
-    "Created: / 21-04-2014 / 19:15:49 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 21-04-2014 / 21:35:17 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+changeManager
+    ^ changeManager
 !
 
-methodDictionary
-
-    ^ MethodDictionary new
-
-    "Created: / 21-04-2014 / 19:16:17 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-nameWithoutPrefix
-    "see ClassDescription >> nameWithoutPrefix"
-
-    ^ (Smalltalk at: #Class) nameWithoutPrefix: className
-
-    "Created: / 03-08-2014 / 23:29:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 29-08-2014 / 21:13:14 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+changeManager:something
+    changeManager := something.
 !
 
-superclass
-    | superclass |
-
-    superclass := Smalltalk classNamed: superclassName.
-
-    isMeta ifTrue: [
-        ^ superclass class
-    ].  
-
-    ^ superclass
-
-    "Created: / 21-04-2014 / 20:23:21 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 21-04-2014 / 21:34:59 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-! !
-
-!CustomSourceCodeBuilder::Class methodsFor:'conversion'!
-
-asRBClass
-    "Creates instance of RBClass for usage in Refactory Browser package "
-    | namespace |
-
-    namespace := RBNamespace new.
-    namespace defineClass: self definitionString. 
-
-    isMeta ifTrue: [
-        ^ namespace metaclassNamed: className asSymbol.
-    ] ifFalse: [
-        ^ namespace classNamed: className asSymbol        
-    ]
-
-    "Created: / 21-04-2014 / 21:17:08 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 23-06-2014 / 18:59:31 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-! !
-
-!CustomSourceCodeBuilder::Class methodsFor:'initialization'!
-
-initialize
-
-    className := ''.
-    isMeta := false.
-    superclassName := 'Object'.
-    instanceVariableNames := ''.
-    classVariableNames := ''.
-    poolDictionaryNames := ''.
-    category := ''.
-
-    "Created: / 30-03-2014 / 22:34:15 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-! !
-
-!CustomSourceCodeBuilder::Class methodsFor:'message delegation'!
-
-doesNotUnderstand: aMessage
-    "Delegate messages (when implemented) to RBClass or RBMetaclass
-    depending on isMeta attribute. (To not duplicate implementation in this class)"
-
-    | rbClass selector |
-
-    rbClass := self asRBClass.
-    selector := aMessage selector.
-
-    (rbClass class canUnderstand: selector) ifTrue: [ 
-        ^ aMessage sendTo: rbClass
-    ].
-
-    ^ super doesNotUnderstand: aMessage
-
-    "Created: / 01-06-2014 / 20:36:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 23-06-2014 / 18:55:31 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-! !
-
-!CustomSourceCodeBuilder::Class methodsFor:'private'!
-
-createChange
-
-    change := nil.
-    className length > 0 ifTrue: [ 
-        change := self classChange definition: self definitionString.
-        package notNil ifTrue: [
-            change package: package
-        ]
-    ].
-
-    "Created: / 30-03-2014 / 19:19:38 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 30-08-2014 / 20:16:45 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+formatter
+    ^ formatter
 !
 
-definitionString
-
-    ^ (superclassName, ' subclass:#', className, '
-        instanceVariableNames:''', instanceVariableNames, '''
-        classVariableNames:''', classVariableNames, '''
-        poolDictionaries:''', poolDictionaryNames, '''
-        category:''', category, '''').
-
-    "Created: / 18-04-2014 / 21:57:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-! !
-
-!CustomSourceCodeBuilder::Class methodsFor:'queries'!
-
-sourceExists
-
-    ^ Smalltalk hasClassNamed: className
-
-    "Created: / 29-03-2014 / 21:21:59 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 01-04-2014 / 21:20:25 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+formatter:something
+    formatter := something.
 ! !
 
 !CustomSourceCodeBuilder::ClassChange class methodsFor:'documentation'!
@@ -810,173 +521,20 @@
 
 !CustomSourceCodeBuilder::Method methodsFor:'accessing'!
 
-buildedSource
-    "
-    Returns builded and formatted method source
-    code as string (with replacements and so on)
-    "
-
-    | parser method |  
-
-    source := self replaceCommentsInSource: source.
-    parser := RBParser new.
-    recordedReplacementsInSource := OrderedCollection new.
-    parser errorBlock:[ :str :pos | self error: ('Error: %1: %2' bindWith: pos with: str). ^ self ].
-    "/ Transcript showCR: 'SRC: ', source.
-    parser initializeParserWith: source type: #rewriteSavingCommentsOn:errorBlock:.
-    method := parser parseMethod: source.    
-
-    method source: nil.
-    method acceptVisitor: self.
-    self replaceInSourceCode.
-    method source: source.
-
-    ^ formatter formatParseTree: method.
-
-    "Created: / 18-05-2014 / 16:48:27 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 26-08-2014 / 23:54:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (comment): / 29-08-2014 / 22:40:19 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-category:aString
-
-    self protocol: aString
-
-    "Created: / 02-05-2014 / 22:49:19 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-class:aClass
-
-    self classes: (Array with: aClass)
-
-    "Created: / 02-05-2014 / 22:49:42 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-classes: aClassCollection
-
-    classes := aClassCollection
-
-    "Created: / 24-04-2014 / 23:50:51 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-commentPlaceholderMarker: aString
-    "
-    Sets prefix string which will mark comment replace 
-    in code replacements given by:
-    replace: '`comment' with: 'comment'
-    "
-
-    commentPlaceholderMarker := aString
-
-    "Created: / 25-05-2014 / 17:41:20 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-protocol:aString
-
-    protocol := aString
-
-    "Created: / 02-05-2014 / 22:53:31 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-replace: placeholder with: code
-
-    (placeholder startsWith: commentPlaceholderMarker) ifTrue: [
-        commentReplacements
-            at: placeholder 
-            put: code
-    ]
-    ifFalse: [
-        super replace: placeholder with: code
-    ]
-
-    "Created: / 02-05-2014 / 22:54:02 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 28-07-2014 / 23:50:21 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+changeManager
+    ^ changeManager
 !
 
-source:aString
-
-    source := aString
-
-    "Created: / 02-05-2014 / 22:54:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-! !
-
-!CustomSourceCodeBuilder::Method methodsFor:'initialization'!
-
-initialize
-    "Invoked when a new instance is created."
-
-    super initialize.
-    commentPlaceholderMarker := '`"'.
-    commentReplacements := Dictionary new.
-    classes := #()
-
-    "Created: / 25-05-2014 / 17:46:58 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 10-07-2014 / 14:28:16 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-! !
-
-!CustomSourceCodeBuilder::Method methodsFor:'private'!
-
-createChange
-    "Creates a refactory browser change (add method change)"
-
-    change := nil.
-    (classes length > 0) ifTrue: [
-        change := CompositeRefactoryChange new.        
-    ].
-
-    classes do: [ :class |
-        | methodClass methodChange |
-
-        methodClass := class.
-        (class isKindOf: CustomSourceCodeBuilder) ifTrue: [
-            methodClass := class asRBClass
-        ].  
-
-        methodChange := (self methodChange
-                            class: methodClass
-                            protocol: protocol
-                            source: self buildedSource).
-
-        package notNil ifTrue: [
-            methodChange package: package
-        ].
-
-        change addChange: methodChange.
-    ]
-
-    "Created: / 10-04-2014 / 00:03:34 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 30-08-2014 / 18:31:07 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+changeManager:something
+    changeManager := something.
 !
 
-replaceCommentsInSource: aSourceString
-    "
-    Returns source string with replaced occurences of comment
-    replaces given by:
-    replace: '`{double_quote_char}comment' with: '{double_quote_char}a comment{double_quote_char}'
-    where {double_quote_char} is "" (but not escaped like in this comment)
-    "
-
-    | sourceCode |
-
-    sourceCode := source.
+formatter
+    ^ formatter
+!
 
-    commentReplacements keysAndValuesDo: [ :placeholder :code | 
-        sourceCode := sourceCode copyReplaceString: placeholder withString: code       
-    ].
-
-    ^ sourceCode
-
-    "Created: / 25-05-2014 / 16:55:56 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 25-05-2014 / 20:20:02 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-! !
-
-!CustomSourceCodeBuilder::Method methodsFor:'queries'!
-
-sourceExists
-
-    ^ (class includesSelector: (self change selector)).
-
-    "Modified: / 24-03-2014 / 22:44:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+formatter:something
+    formatter := something.
 ! !
 
 !CustomSourceCodeBuilder::MethodChange class methodsFor:'documentation'!
--- a/CustomSubContext.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomSubContext.st	Mon Sep 29 23:23:13 2014 +0200
@@ -123,6 +123,15 @@
     "Created: / 19-12-2013 / 12:37:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
+!CustomSubContext methodsFor:'queries'!
+
+isInteractiveContext
+
+    ^ false
+
+    "Created: / 21-09-2014 / 23:10:56 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
 !CustomSubContext class methodsFor:'documentation'!
 
 version_HG
--- a/CustomValueHolderWithChangeNotificationAccessMethodsCodeGeneratorTests.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/CustomValueHolderWithChangeNotificationAccessMethodsCodeGeneratorTests.st	Mon Sep 29 23:23:13 2014 +0200
@@ -7,6 +7,7 @@
 	category:'Interface-Refactoring-Custom-Tests'
 !
 
+
 !CustomValueHolderWithChangeNotificationAccessMethodsCodeGeneratorTests methodsFor:'accessing'!
 
 generatorOrRefactoring
@@ -99,3 +100,10 @@
     "Created: / 13-07-2014 / 17:23:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
+!CustomValueHolderWithChangeNotificationAccessMethodsCodeGeneratorTests class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/Make.proto	Thu Sep 25 22:44:09 2014 +0200
+++ b/Make.proto	Mon Sep 29 23:23:13 2014 +0200
@@ -103,6 +103,7 @@
 prereq:
 	cd $(TOP)/libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd $(TOP)/goodies/refactoryBrowser/changes && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd $(TOP)/goodies/refactoryBrowser/helpers && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd $(TOP)/goodies/refactoryBrowser/parser && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd $(TOP)/goodies/refactoryBrowser/refactoring && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd $(TOP)/libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
@@ -145,7 +146,7 @@
 $(OUTDIR)CustomParseTreeRewriter.$(O) CustomParseTreeRewriter.$(H): CustomParseTreeRewriter.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/ParseTreeRewriter.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/ParseTreeSearcher.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomPerspective.$(O) CustomPerspective.$(H): CustomPerspective.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomRefactoryBuilder.$(O) CustomRefactoryBuilder.$(H): CustomRefactoryBuilder.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/refactoring/RefactoryBuilder.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)CustomSourceCodeBuilder.$(O) CustomSourceCodeBuilder.$(H): CustomSourceCodeBuilder.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/AddClassChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/AddMethodChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/InteractiveAddClassChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/InteractiveAddMethodChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/RefactoryChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/RefactoryClassChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libtool/CodeGenerator.$(H) $(STCHDR)
+$(OUTDIR)CustomSourceCodeBuilder.$(O) CustomSourceCodeBuilder.$(H): CustomSourceCodeBuilder.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/AddClassChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/AddMethodChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/InteractiveAddClassChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/InteractiveAddMethodChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/RefactoryChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/changes/RefactoryClassChange.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBAbstractClass.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBClass.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBMethod.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBNamespace.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomSourceCodeFormatter.$(O) CustomSourceCodeFormatter.$(H): CustomSourceCodeFormatter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomSourceCodeGenerator.$(O) CustomSourceCodeGenerator.$(H): CustomSourceCodeGenerator.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libtool/CodeGenerator.$(H) $(STCHDR)
 $(OUTDIR)CustomSourceCodeSelection.$(O) CustomSourceCodeSelection.$(H): CustomSourceCodeSelection.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
@@ -190,7 +191,7 @@
 $(OUTDIR)CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.$(O) CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.$(H): CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomValueHolderWithChangeNotificationSetterMethodsCodeGenerator.$(O) CustomValueHolderWithChangeNotificationSetterMethodsCodeGenerator.$(H): CustomValueHolderWithChangeNotificationSetterMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomVisitorCodeGeneratorAcceptVisitor.$(O) CustomVisitorCodeGeneratorAcceptVisitor.$(H): CustomVisitorCodeGeneratorAcceptVisitor.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomVisitorCodeGenerator.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libtool/SystemBrowser.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__NewSystemBrowser.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBAbstractClass.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBClass.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBMetaclass.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libtool/SystemBrowser.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__NewSystemBrowser.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/abbrev.stc	Thu Sep 25 22:44:09 2014 +0200
+++ b/abbrev.stc	Mon Sep 29 23:23:13 2014 +0200
@@ -4,7 +4,6 @@
 CustomChangeManager CustomChangeManager jn:refactoring_custom 'Interface-Refactoring-Custom' 0
 CustomClassQuery CustomClassQuery jn:refactoring_custom 'Interface-Refactoring-Custom' 0
 CustomClassQueryTests CustomClassQueryTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
-CustomCodeGeneratorClassGeneratorTests CustomCodeGeneratorClassGeneratorTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
 CustomCodeGeneratorOrRefactoring CustomCodeGeneratorOrRefactoring jn:refactoring_custom 'Interface-Refactoring-Custom' 0
 CustomCodeGeneratorOrRefactoringTestCase CustomCodeGeneratorOrRefactoringTestCase jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
 CustomContext CustomContext jn:refactoring_custom 'Interface-Refactoring-Custom' 0
@@ -34,6 +33,7 @@
 CustomChangeNotificationAccessMethodsCodeGeneratorTests CustomChangeNotificationAccessMethodsCodeGeneratorTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
 CustomChangeNotificationSetterMethodsCodeGeneratorTests CustomChangeNotificationSetterMethodsCodeGeneratorTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
 CustomCodeGenerator CustomCodeGenerator jn:refactoring_custom 'Interface-Refactoring-Custom-Generators' 0
+CustomCodeGeneratorClassGeneratorTests CustomCodeGeneratorClassGeneratorTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
 CustomCodeGeneratorTests CustomCodeGeneratorTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
 CustomCodeGeneratorUserPreferencesTests CustomCodeGeneratorUserPreferencesTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
 CustomCodeSelectionToResourceTranslationTests CustomCodeSelectionToResourceTranslationTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
--- a/bc.mak	Thu Sep 25 22:44:09 2014 +0200
+++ b/bc.mak	Mon Sep 29 23:23:13 2014 +0200
@@ -52,6 +52,7 @@
 prereq:
 	pushd ..\..\stx\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\stx\goodies\refactoryBrowser\changes & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\stx\goodies\refactoryBrowser\helpers & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\stx\goodies\refactoryBrowser\parser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\stx\goodies\refactoryBrowser\refactoring & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\stx\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
@@ -91,7 +92,7 @@
 $(OUTDIR)CustomParseTreeRewriter.$(O) CustomParseTreeRewriter.$(H): CustomParseTreeRewriter.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\ParseTreeRewriter.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\ParseTreeSearcher.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomPerspective.$(O) CustomPerspective.$(H): CustomPerspective.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomRefactoryBuilder.$(O) CustomRefactoryBuilder.$(H): CustomRefactoryBuilder.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\refactoring\RefactoryBuilder.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)CustomSourceCodeBuilder.$(O) CustomSourceCodeBuilder.$(H): CustomSourceCodeBuilder.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\AddClassChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\AddMethodChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\InteractiveAddClassChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\InteractiveAddMethodChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\RefactoryChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\RefactoryClassChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libtool\CodeGenerator.$(H) $(STCHDR)
+$(OUTDIR)CustomSourceCodeBuilder.$(O) CustomSourceCodeBuilder.$(H): CustomSourceCodeBuilder.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\AddClassChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\AddMethodChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\InteractiveAddClassChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\InteractiveAddMethodChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\RefactoryChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\changes\RefactoryClassChange.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBAbstractClass.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBClass.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBMethod.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBNamespace.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomSourceCodeFormatter.$(O) CustomSourceCodeFormatter.$(H): CustomSourceCodeFormatter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomSourceCodeGenerator.$(O) CustomSourceCodeGenerator.$(H): CustomSourceCodeGenerator.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libtool\CodeGenerator.$(H) $(STCHDR)
 $(OUTDIR)CustomSourceCodeSelection.$(O) CustomSourceCodeSelection.$(H): CustomSourceCodeSelection.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
@@ -136,7 +137,7 @@
 $(OUTDIR)CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.$(O) CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.$(H): CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomValueHolderWithChangeNotificationSetterMethodsCodeGenerator.$(O) CustomValueHolderWithChangeNotificationSetterMethodsCodeGenerator.$(H): CustomValueHolderWithChangeNotificationSetterMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomVisitorCodeGeneratorAcceptVisitor.$(O) CustomVisitorCodeGeneratorAcceptVisitor.$(H): CustomVisitorCodeGeneratorAcceptVisitor.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomVisitorCodeGenerator.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libtool\SystemBrowser.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__NewSystemBrowser.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBAbstractClass.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBClass.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBMetaclass.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libtool\SystemBrowser.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__NewSystemBrowser.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/extensions.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/extensions.st	Mon Sep 29 23:23:13 2014 +0200
@@ -1,5 +1,191 @@
 "{ Package: 'jn:refactoring_custom' }"!
 
+!RBAbstractClass methodsFor:'accessing'!
+
+allClassVarNames
+    | variableNames |
+
+    variableNames := self allClassVariableNames.
+
+    variableNames isNil ifTrue: [ 
+        ^ #()
+    ].
+
+    ^ variableNames
+
+    "Created: / 01-06-2014 / 23:40:50 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 20-09-2014 / 19:26:24 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'enumerating'!
+
+allSuperclassesDo: aBlock
+    | superclass |
+
+    superclass := self superclass.
+
+    (superclass isNil and: [ self name = #Object ]) ifTrue: [ 
+        self isMeta ifTrue: [ 
+            superclass := Object metaclass
+        ] ifFalse: [ 
+            superclass := Object
+        ]
+    ].
+
+    superclass withAllSuperclassesDo: aBlock
+
+    "Created: / 21-04-2014 / 19:15:49 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 29-09-2014 / 23:08:10 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'accessing'!
+
+instVarNames
+
+    ^ self instanceVariableNames
+
+    "Created: / 29-05-2014 / 23:46:45 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 24-09-2014 / 20:36:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'accessing'!
+
+methodDictionary
+    "Stub method, returns real class MethodDictionary, although full MethodDictionary
+    implementation would be better here."
+
+    | methodDictionary |
+
+    self realClass isNil ifTrue: [
+        methodDictionary := MethodDictionary new
+    ] ifFalse: [ 
+        methodDictionary := self realClass methodDictionary deepCopy
+    ].
+
+    removedMethods isNil ifFalse: [
+        removedMethods do: [ :removedMethod | 
+            | method |
+
+            method := methodDictionary at: removedMethod selector asSymbol ifAbsent: [ nil ].  
+            method isNil ifFalse: [
+                methodDictionary := methodDictionary removeKeyAndCompress: removedMethod selector asSymbol.
+            ]
+        ]
+    ].
+
+    newMethods isNil ifFalse: [
+        newMethods do: [ :newMethod | 
+            | method |
+
+            method := Method new.
+            method 
+                selector: newMethod selector asSymbol; 
+                protocol: newMethod category asString;
+                source: newMethod source.
+
+            methodDictionary at: newMethod selector asSymbol put: method.
+        ]
+    ].
+
+    ^ methodDictionary
+
+    "Created: / 28-09-2014 / 22:57:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 29-09-2014 / 22:43:30 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'accessing'!
+
+nameWithoutPrefix
+    "see ClassDescription >> nameWithoutPrefix"
+
+    ^ (Smalltalk at: #Class) nameWithoutPrefix: name
+
+    "Created: / 03-08-2014 / 23:29:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 20-09-2014 / 19:21:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'accessing'!
+
+superclassName: aName
+    "Assign superclass by its name"
+
+    self superclass: (self model classNamed: aName asSymbol)
+
+    "Created: / 28-09-2014 / 22:53:46 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'accessing'!
+
+theMetaclass
+    "alias for theMetaClass - STX compatibility"
+
+    ^ self theMetaClass.
+
+    "Created: / 26-09-2014 / 16:26:07 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'accessing'!
+
+theNonMetaclass
+    "alias for theNonMetaClass - STX compatibility"
+
+    ^ self theNonMetaClass
+
+    "Created: / 26-09-2014 / 16:36:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'enumerating'!
+
+withAllSuperclassesDo:aBlock
+    "evaluate aBlock for the class and all of its superclasses"
+
+    aBlock value:self.
+    self allSuperclassesDo:aBlock
+
+    "Created: / 29-09-2014 / 22:48:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBClass methodsFor:'accessing'!
+
+compile
+    "Updates class definition in the namespace along with code changes"
+
+    model defineClass: self definitionString.
+
+    "Created: / 25-09-2014 / 22:31:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 25-09-2014 / 23:36:04 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBClass methodsFor:'accessing'!
+
+theNonMetaClass
+    "alias for theNonMetaclass - squeak compatibility"
+
+    ^ self theNonMetaclass
+
+    "Created: / 26-09-2014 / 16:50:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMetaclass methodsFor:'accessing'!
+
+theMetaClass
+    "alias for metaclass - sqeak compatibility"
+
+    ^ self metaclass.
+
+    "Created: / 26-09-2014 / 21:32:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMetaclass methodsFor:'accessing'!
+
+theMetaclass
+    "alias for metaclass - STX compatibility"
+
+    ^ self metaclass.
+
+    "Created: / 26-09-2014 / 21:28:37 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
 !Tools::NewSystemBrowser methodsFor:'menus extensions-custom refactorings'!
 
 classMenuExtensionCustomGenerators:aMenu 
--- a/jn_refactoring_custom.st	Thu Sep 25 22:44:09 2014 +0200
+++ b/jn_refactoring_custom.st	Mon Sep 29 23:23:13 2014 +0200
@@ -28,11 +28,12 @@
 
     ^ #(
         #'stx:goodies/refactoryBrowser/changes'    "AddClassChange - superclass of CustomSourceCodeBuilder::ClassChange"
+        #'stx:goodies/refactoryBrowser/helpers'    "RBAbstractClass - extended"
         #'stx:goodies/refactoryBrowser/parser'    "ParseTreeRewriter - superclass of CustomParseTreeRewriter"
         #'stx:goodies/refactoryBrowser/refactoring'    "RefactoryBuilder - superclass of CustomRefactoryBuilder"
         #'stx:goodies/sunit'    "TestAsserter - superclass of CustomAccessMethodsCodeGeneratorTests"
         #'stx:libbasic'    "LibraryDefinition - superclass of jn_refactoring_custom"
-        #'stx:libtool'    "CodeGenerator - superclass of CustomSourceCodeBuilder"
+        #'stx:libtool'    "CodeGenerator - superclass of CustomSourceCodeGenerator"
         #'stx:libview2'    "ApplicationModel - extended"
     )
 !
@@ -45,7 +46,6 @@
      by searching all classes (and their packages) which are referenced by my classes."
 
     ^ #(
-        #'stx:goodies/refactoryBrowser/helpers'    "RBNamespace - referenced by CustomSourceCodeBuilder::Class>>asRBClass"
         #'stx:libbasic3'    "Change - referenced by CustomCodeGeneratorOrRefactoringTestCase>>assertSource:sameAs:"
         #'stx:libview'    "WindowGroup - referenced by CustomCodeGeneratorOrRefactoring>>executeInContextWithWaitCursor:"
     )
@@ -74,7 +74,6 @@
         CustomChangeManager
         CustomClassQuery
         (CustomClassQueryTests autoload)
-        (CustomCodeGeneratorClassGeneratorTests autoload)
         CustomCodeGeneratorOrRefactoring
         (CustomCodeGeneratorOrRefactoringTestCase autoload)
         CustomContext
@@ -104,6 +103,7 @@
         (CustomChangeNotificationAccessMethodsCodeGeneratorTests autoload)
         (CustomChangeNotificationSetterMethodsCodeGeneratorTests autoload)
         CustomCodeGenerator
+        (CustomCodeGeneratorClassGeneratorTests autoload)
         (CustomCodeGeneratorTests autoload)
         (CustomCodeGeneratorUserPreferencesTests autoload)
         (CustomCodeSelectionToResourceTranslationTests autoload)
@@ -174,6 +174,19 @@
         #'Tools::NewSystemBrowser' codeViewMenuExtensionCustomRefactorings:
         #'Tools::NewSystemBrowser' selectorMenuExtensionCustomGenerators:
         #'Tools::NewSystemBrowser' variablesMenuExtensionCustomGenerators:
+        RBAbstractClass allClassVarNames
+        RBAbstractClass allSuperclassesDo:
+        RBAbstractClass instVarNames
+        RBAbstractClass methodDictionary
+        RBAbstractClass nameWithoutPrefix
+        RBAbstractClass superclassName:
+        RBAbstractClass theMetaclass
+        RBAbstractClass theNonMetaclass
+        RBAbstractClass withAllSuperclassesDo:
+        RBClass compile
+        RBClass theNonMetaClass
+        RBMetaclass theMetaClass
+        RBMetaclass theMetaclass
     )
 ! !
 
--- a/refactoring_custom.rc	Thu Sep 25 22:44:09 2014 +0200
+++ b/refactoring_custom.rc	Mon Sep 29 23:23:13 2014 +0200
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "ProductName\0"
       VALUE "ProductVersion", "6.2.4.1333\0"
-      VALUE "ProductDate", "Sat, 20 Sep 2014 16:50:03 GMT\0"
+      VALUE "ProductDate", "Mon, 29 Sep 2014 21:22:00 GMT\0"
     END
 
   END