SystemOrganization addCategory: #'Refactoring-Changes'! Object subclass: #RBRefactoryChange instanceVariableNames: 'name' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! RBRefactoryChange subclass: #RBCompositeRefactoryChange instanceVariableNames: 'changes' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBCompositeRefactoryChange class methodsFor: 'instance creation' stamp: 'lr 9/7/2010 19:43'! named: aString ^ self new name: aString; yourself! ! !RBCompositeRefactoryChange methodsFor: 'comparing' stamp: 'lr 9/6/2010 17:27'! = aRefactoryBuilder self class = aRefactoryBuilder class ifFalse: [ ^ false ]. changes size = aRefactoryBuilder changes size ifFalse: [ ^ false ]. changes with: aRefactoryBuilder changes do: [ :first :second | first = second ifFalse: [ ^ false ] ]. ^ true! ! !RBCompositeRefactoryChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:27'! addChange: aRefactoryChange changes add: aRefactoryChange. ^ aRefactoryChange! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! addClassVariable: variableName to: aClass ^ self addChange: (RBAddClassVariableChange add: variableName to: aClass)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! addInstanceVariable: variableName to: aClass ^ self addChange: (RBAddInstanceVariableChange add: variableName to: aClass)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! addPool: aPoolVariable to: aClass ^ self addChange: (RBAddPoolVariableChange add: aPoolVariable to: aClass)! ! !RBCompositeRefactoryChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 11:29'! changeForClass: aClassName selector: aSelector changes reverseDo: [ :each | | change | change := each changeForClass: aClassName selector: aSelector. change notNil ifTrue: [ ^ change ] ]. ^ nil! ! !RBCompositeRefactoryChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 11:30'! changeForMetaclass: aClassName selector: aSelector changes reverseDo: [ :each | | change | change := each changeForMetaclass: aClassName selector: aSelector. change notNil ifTrue: [ ^ change ] ]. ^ nil! ! !RBCompositeRefactoryChange methodsFor: 'private-inspector accessing' stamp: 'lr 9/6/2010 17:28'! changes ^ changes! ! !RBCompositeRefactoryChange methodsFor: 'private-inspector accessing' stamp: ''! changes: aCollection changes := aCollection! ! !RBCompositeRefactoryChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:27'! changesSize ^ changes inject: 0 into: [ :sum :each | sum + each changesSize ]! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! comment: aString in: aClass ^ self addChange: (RBCommentChange comment: aString in: aClass)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! compile: source in: class ^ self addChange: (RBAddMethodChange compile: source in: class)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! compile: source in: class classified: aProtocol ^ self addChange: (RBAddMethodChange compile: source in: class classified: aProtocol)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! defineClass: aString ^ self addChange: (RBAddClassChange definition: aString)! ! !RBCompositeRefactoryChange methodsFor: 'private' stamp: 'lr 5/9/2010 11:31'! executeNotifying: aBlock | undos undo | undos := changes collect: [ :each | each executeNotifying: aBlock ]. undo := self copy. undo changes: undos reversed. ^ undo! ! !RBCompositeRefactoryChange methodsFor: 'comparing' stamp: 'lr 9/6/2010 17:31'! hash ^ self class hash bitXor: self changes size hash! ! !RBCompositeRefactoryChange methodsFor: 'initialize-release' stamp: ''! initialize super initialize. changes := OrderedCollection new! ! !RBCompositeRefactoryChange methodsFor: 'copying' stamp: 'lr 9/6/2010 17:27'! postCopy super postCopy. changes := changes collect: [ :each | each copy ]! ! !RBCompositeRefactoryChange methodsFor: 'printing' stamp: 'lr 9/6/2010 17:28'! printOn: aStream name isNil ifTrue: [ ^ super printOn: aStream ]. aStream nextPutAll: name! ! !RBCompositeRefactoryChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:27'! problemCount ^ self changesSize! ! !RBCompositeRefactoryChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:29'! removeChange: aChange ^ changes remove: aChange ifAbsent: [ nil ]! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! removeClass: aClass ^ self addChange: (RBRemoveClassChange removeClassName: aClass name)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! removeClassNamed: aSymbol ^ self addChange: (RBRemoveClassChange removeClassName: aSymbol)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! removeClassVariable: variableName from: aClass ^ self addChange: (RBRemoveClassVariableChange remove: variableName from: aClass)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! removeInstanceVariable: variableName from: aClass ^ self addChange: (RBRemoveInstanceVariableChange remove: variableName from: aClass)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! removeMethod: aSelector from: aClass ^ self addChange: (RBRemoveMethodChange remove: aSelector from: aClass)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! removePool: aPoolVariable from: aClass ^ self addChange: (RBRemovePoolVariableChange remove: aPoolVariable from: aClass)! ! !RBCompositeRefactoryChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 13:56'! renameChangesForClass: oldClassName to: newClassName ^ self copy changes: (self changes collect: [ :each | each renameChangesForClass: oldClassName to: newClassName ]); yourself! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! renameClass: class to: newName ^ self addChange: (RBRenameClassChange rename: class name to: newName)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! renameClassVariable: oldName to: newName in: aClass ^ self addChange: (RBRenameClassVariableChange rename: oldName to: newName in: aClass)! ! !RBCompositeRefactoryChange methodsFor: 'refactory-changes' stamp: 'lr 9/8/2011 20:10'! renameInstanceVariable: oldName to: newName in: aClass ^ self addChange: (RBRenameInstanceVariableChange rename: oldName to: newName in: aClass)! ! RBCompositeRefactoryChange subclass: #RBRenameClassChange instanceVariableNames: 'oldName newName' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBRenameClassChange class methodsFor: 'instance creation' stamp: 'lr 9/7/2010 19:43'! rename: oldString to: newString ^ self new rename: oldString to: newString; yourself! ! !RBRenameClassChange methodsFor: 'comparing' stamp: 'lr 9/6/2010 17:33'! = aRenameClassChange super class = aRenameClassChange class ifFalse: [ ^ false ]. ^oldName = aRenameClassChange oldName and: [ newName = aRenameClassChange newName ]! ! !RBRenameClassChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:30'! changeClass ^ Smalltalk globals at: oldName asSymbol ifAbsent: [ Smalltalk globals at: newName asSymbol ]! ! !RBRenameClassChange methodsFor: 'private' stamp: 'lr 9/6/2010 17:31'! executeNotifying: aBlock | undos | self changeClass rename: newName. undos := changes collect: [ :each | (each renameChangesForClass: oldName asSymbol to: newName asSymbol) executeNotifying: aBlock ]. ^ self copy changes: undos reverse; rename: newName to: oldName; yourself! ! !RBRenameClassChange methodsFor: 'comparing' stamp: 'lr 5/18/2010 20:56'! hash ^ (self class hash bitXor: self oldName hash) bitXor: self newName hash! ! !RBRenameClassChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:31'! newName ^ newName! ! !RBRenameClassChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:31'! oldName ^ oldName! ! !RBRenameClassChange methodsFor: 'printing' stamp: 'lr 2/7/2008 22:18'! printOn: aStream aStream nextPutAll: self oldName; nextPutAll: ' rename: '; print: self newName; nextPut: $!!! ! !RBRenameClassChange methodsFor: 'initialize-release' stamp: ''! rename: oldString to: newString oldName := oldString. newName := newString! ! !RBRenameClassChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 13:57'! renameChangesForClass: oldClassName to: newClassName | change | change := super renameChangesForClass: oldClassName to: newClassName. oldName asSymbol = oldClassName ifTrue: [ change rename: newClassName to: newName ]. ^ change! ! RBCompositeRefactoryChange subclass: #RBRenameVariableChange instanceVariableNames: 'className isMeta oldName newName' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! RBRenameVariableChange subclass: #RBRenameClassVariableChange instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBRenameClassVariableChange methodsFor: 'private' stamp: 'lr 9/8/2011 20:10'! addNewVariable (RBAddClassVariableChange add: newName to: self changeClass) execute! ! !RBRenameClassVariableChange methodsFor: 'private' stamp: 'lr 9/6/2010 13:48'! copyOldValuesToNewVariable | oldValue | oldValue := self changeClass classPool at: oldName ifAbsent: [ nil ]. self changeClass classPool at: newName asSymbol put: oldValue! ! !RBRenameClassVariableChange methodsFor: 'printing' stamp: 'lr 5/18/2010 20:37'! printOn: aStream aStream nextPutAll: self displayClassName; nextPutAll: ' removeClassVarName: '; print: self oldName; nextPut: $!!; cr. aStream nextPutAll: self displayClassName; nextPutAll: ' addClassVarName: '; print: self newName; nextPut: $!!! ! !RBRenameClassVariableChange methodsFor: 'private' stamp: 'lr 9/8/2011 20:10'! removeOldVariable (RBRemoveClassVariableChange remove: oldName from: self changeClass) execute! ! RBRenameVariableChange subclass: #RBRenameInstanceVariableChange instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBRenameInstanceVariableChange methodsFor: 'private' stamp: 'lr 9/8/2011 20:10'! addNewVariable (RBAddInstanceVariableChange add: newName to: self changeClass) execute! ! !RBRenameInstanceVariableChange methodsFor: 'private' stamp: 'lr 9/6/2010 13:48'! copyOldValuesToNewVariable | newIndex oldIndex | oldIndex := self changeClass allInstVarNames indexOf: oldName asString. newIndex := self changeClass allInstVarNames indexOf: newName asString. self changeClass withAllSubclasses do: [ :class | class allInstances do: [ :each | each instVarAt: newIndex put: (each instVarAt: oldIndex) ] ]! ! !RBRenameInstanceVariableChange methodsFor: 'printing' stamp: 'lr 5/18/2010 20:39'! printOn: aStream aStream nextPutAll: self displayClassName; nextPutAll: ' removeInstVarName: '; print: self oldName; nextPut: $!!; cr. aStream nextPutAll: self displayClassName; nextPutAll: ' addInstVarName: '; print: self newName; nextPut: $!!! ! !RBRenameInstanceVariableChange methodsFor: 'private' stamp: 'lr 9/8/2011 20:10'! removeOldVariable (RBRemoveInstanceVariableChange remove: oldName from: self changeClass) execute! ! !RBRenameVariableChange class methodsFor: 'instance creation' stamp: 'lr 9/7/2010 19:43'! rename: oldName to: newName in: aClass ^ self new oldName: oldName; newName: newName; changeClass: aClass; yourself! ! !RBRenameVariableChange methodsFor: 'comparing' stamp: 'lr 9/6/2010 17:34'! = aRenameVariableChange self class = aRenameVariableChange class ifFalse: [ ^ false ]. ^ className = aRenameVariableChange changeClassName and: [ isMeta = aRenameVariableChange isMeta and: [ oldName = aRenameVariableChange oldName and: [ newName = aRenameVariableChange newName ] ] ]! ! !RBRenameVariableChange methodsFor: 'private' stamp: ''! addNewVariable self subclassResponsibility! ! !RBRenameVariableChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:32'! changeClass | class | class := Smalltalk globals at: self changeClassName ifAbsent: [ ^ nil ]. ^ isMeta ifTrue: [ class class ] ifFalse: [ class ]! ! !RBRenameVariableChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:32'! changeClass: aBehavior isMeta := aBehavior isMeta. className := isMeta ifTrue: [ aBehavior soleInstance name ] ifFalse: [ aBehavior name ]! ! !RBRenameVariableChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:32'! changeClassName ^ className! ! !RBRenameVariableChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:32'! changeClassName: aSymbol className := aSymbol. isMeta isNil ifTrue: [ isMeta := false ]! ! !RBRenameVariableChange methodsFor: 'printing' stamp: 'lr 9/6/2010 17:34'! changeString ^ 'Rename ' , oldName , ' to ' , newName! ! !RBRenameVariableChange methodsFor: 'private' stamp: ''! copyOldValuesToNewVariable self subclassResponsibility! ! !RBRenameVariableChange methodsFor: 'printing' stamp: 'lr 9/6/2010 21:17'! displayClassName ^ isMeta ifTrue: [ self changeClassName , ' class' ] ifFalse: [ self changeClassName asString ]! ! !RBRenameVariableChange methodsFor: 'private' stamp: 'lr 9/6/2010 13:46'! executeNotifying: aBlock | undo | self addNewVariable. self copyOldValuesToNewVariable. undo := super executeNotifying: aBlock. undo oldName: newName; newName: oldName. self removeOldVariable. ^ undo! ! !RBRenameVariableChange methodsFor: 'comparing' stamp: 'lr 9/6/2010 17:33'! hash ^ (self class hash bitXor: self oldName hash) bitXor: self newName hash! ! !RBRenameVariableChange methodsFor: 'private' stamp: 'lr 9/6/2010 13:46'! isMeta ^ isMeta! ! !RBRenameVariableChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:32'! newName ^ newName! ! !RBRenameVariableChange methodsFor: 'private' stamp: ''! newName: aString newName := aString! ! !RBRenameVariableChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 17:32'! oldName ^ oldName! ! !RBRenameVariableChange methodsFor: 'private' stamp: ''! oldName: aString oldName := aString! ! !RBRenameVariableChange methodsFor: 'printing' stamp: 'lr 9/6/2010 13:55'! printOn: aStream aStream nextPutAll: self displayString! ! !RBRenameVariableChange methodsFor: 'private' stamp: ''! removeOldVariable self subclassResponsibility! ! !RBRefactoryChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 11:29'! changeForClass: aClassName selector: aSelector ^ nil! ! !RBRefactoryChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 11:29'! changeForMetaclass: aClassName selector: aSelector ^ nil! ! !RBRefactoryChange methodsFor: 'printing' stamp: ''! changeString ^self class name! ! !RBRefactoryChange methodsFor: 'accessing' stamp: ''! changes ^Array with: self! ! !RBRefactoryChange methodsFor: 'accessing' stamp: ''! changesSize ^1! ! !RBRefactoryChange methodsFor: 'printing' stamp: ''! displayString ^name isNil ifTrue: [self changeString] ifFalse: [name]! ! !RBRefactoryChange methodsFor: 'performing-changes' stamp: ''! execute ^self executeNotifying: []! ! !RBRefactoryChange methodsFor: 'private' stamp: ''! executeNotifying: aBlock self subclassResponsibility! ! !RBRefactoryChange methodsFor: 'accessing' stamp: ''! name ^name isNil ifTrue: [self changeString] ifFalse: [name]! ! !RBRefactoryChange methodsFor: 'initialize-release' stamp: ''! name: aString name := aString! ! !RBRefactoryChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 13:56'! renameChangesForClass: oldClassName to: newClassName "We're in the middle of performing a rename operation. If we stored the class name, we need to change the class name to the new name to perform the compiles." self subclassResponsibility! ! RBRefactoryChange subclass: #RBRefactoryClassChange instanceVariableNames: 'className isMeta' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! RBRefactoryClassChange subclass: #RBAddMethodChange instanceVariableNames: 'source selector protocols controller definedSelector' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBAddMethodChange class methodsFor: 'instance creation' stamp: 'lr 9/30/2010 20:12'! compile: aString in: aClass ^ self compile: aString in: aClass for: nil! ! !RBAddMethodChange class methodsFor: 'instance creation' stamp: 'lr 9/30/2010 20:12'! compile: aString in: aBehavior classified: aProtocol ^ self compile: aString in: aBehavior classified: aProtocol for: nil! ! !RBAddMethodChange class methodsFor: 'instance creation' stamp: 'lr 9/30/2010 20:04'! compile: aString in: aBehavior classified: aProtocol for: aController ^ self new class: aBehavior protocol: aProtocol source: aString controller: aController! ! !RBAddMethodChange class methodsFor: 'instance creation' stamp: 'lr 9/30/2010 20:04'! compile: aString in: aClass for: aController ^ self new class: aClass source: aString contoller: aController! ! !RBAddMethodChange methodsFor: 'comparing' stamp: 'lr 9/6/2010 21:24'! = anAddMethodChange super = anAddMethodChange ifFalse: [ ^ false ]. ^ self parseTree = anAddMethodChange parseTree! ! !RBAddMethodChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:25'! asUndoOperation ^ (self changeClass includesSelector: self selector) ifTrue: [ | oldProtocol | oldProtocol := RBBrowserEnvironment new whichProtocolIncludes: self selector in: self changeClass. oldProtocol isNil ifTrue: [ oldProtocol := #accessing ]. RBAddMethodChange compile: (self methodSourceFor: self selector) in: self changeClass classified: oldProtocol ] ifFalse: [ RBRemoveMethodChange remove: selector from: self changeClass ]! ! !RBAddMethodChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 11:28'! changeForClass: aClassName selector: aSelector ^ (isMeta not and: [ self selector = aSelector and: [ className = aClassName ] ]) ifTrue: [ self ] ifFalse: [ nil ]! ! !RBAddMethodChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 11:29'! changeForMetaclass: aClassName selector: aSelector ^ (isMeta and: [ self selector = aSelector and: [ className = aClassName ] ]) ifTrue: [ self ] ifFalse: [ nil ]! ! !RBAddMethodChange methodsFor: 'printing' stamp: 'lr 4/7/2010 08:22'! changeString ^ self displayClassName , '>>' , self selector! ! !RBAddMethodChange methodsFor: 'initialize-release' stamp: ''! class: aClass protocol: aProtocol source: aString self changeClass: aClass. self protocols: aProtocol. source := aString! ! !RBAddMethodChange methodsFor: 'initialize-release' stamp: 'lr 9/30/2010 20:04'! class: aClass protocol: aProtocol source: aString controller: aController self changeClass: aClass. self protocols: aProtocol. source := aString. controller := aController! ! !RBAddMethodChange methodsFor: 'initialize-release' stamp: 'lr 9/8/2011 20:25'! class: aClass source: aString contoller: aController self changeClass: aClass. source := aString. self protocols: (RBBrowserEnvironment new whichProtocolIncludes: self selector in: aClass). controller := aController! ! !RBAddMethodChange methodsFor: 'private' stamp: 'lr 9/30/2010 20:02'! controller ^ controller! ! !RBAddMethodChange methodsFor: 'initialize-release' stamp: 'lr 9/30/2010 20:02'! controller: aController controller := aController! ! !RBAddMethodChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 20:02'! definedSelector ^ definedSelector! ! !RBAddMethodChange methodsFor: 'comparing' stamp: 'lr 9/6/2010 21:25'! hash ^ self parseTree hash! ! !RBAddMethodChange methodsFor: 'private' stamp: 'lr 9/6/2010 21:27'! parseTree ^ RBParser parseMethod: source onError: [ :str :pos | ^ nil ]! ! !RBAddMethodChange methodsFor: 'private' stamp: 'lr 10/14/2010 20:50'! primitiveExecute definedSelector := self changeClass compile: self source classified: self protocol notifying: self controller! ! !RBAddMethodChange methodsFor: 'printing' stamp: 'lr 12/29/2011 17:42'! printOn: aStream aStream nextPut: $!!; nextPutAll: self displayClassName; nextPutAll: ' methodsFor: '''; nextPutAll: self protocol; nextPutAll: ''' stamp: '; print: RBPlatform current changeStamp; nextPut: $!!; cr; nextPutAll: (source copyReplaceAll: '!!' with: '!!!!'); nextPutAll: '!! !!'! ! !RBAddMethodChange methodsFor: 'accessing' stamp: 'lr 9/7/2010 19:10'! protocol ^ self protocols first! ! !RBAddMethodChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 21:24'! protocols ^ protocols! ! !RBAddMethodChange methodsFor: 'initialize-release' stamp: 'lr 9/7/2010 19:10'! protocols: aCollection protocols := aCollection isString ifTrue: [ Array with: aCollection ] ifFalse: [ aCollection ]. protocols isNil ifTrue: [ protocols := #(accessing) ]! ! !RBAddMethodChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 21:24'! selector selector isNil ifTrue: [ selector := RBParser parseMethodPattern: source. selector isNil ifTrue: [ selector := #unknown ] ]. ^ selector! ! !RBAddMethodChange methodsFor: 'accessing' stamp: 'lr 11/1/2009 23:25'! source ^ source! ! RBRefactoryClassChange subclass: #RBCommentChange instanceVariableNames: 'comment' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBCommentChange class methodsFor: 'instance creation' stamp: 'lr 7/1/2008 10:50'! comment: aString in: aClass ^ self new changeClass: aClass; comment: aString; yourself! ! !RBCommentChange methodsFor: 'converting' stamp: 'lr 9/6/2010 10:48'! asUndoOperation ^ self copy comment: self changeClass organization classComment; yourself! ! !RBCommentChange methodsFor: 'accessing' stamp: 'lr 7/1/2008 10:44'! changeClass: aBehavior super changeClass: aBehavior. isMeta := false! ! !RBCommentChange methodsFor: 'printing' stamp: 'lr 7/1/2008 10:48'! changeString ^ 'Comment ' , self displayClassName! ! !RBCommentChange methodsFor: 'accessing' stamp: 'lr 7/1/2008 10:41'! comment ^ comment! ! !RBCommentChange methodsFor: 'accessing' stamp: 'lr 7/1/2008 10:41'! comment: aString comment := aString! ! !RBCommentChange methodsFor: 'private' stamp: 'lr 12/29/2011 17:42'! primitiveExecute self changeClass classComment: comment stamp: RBPlatform current changeStamp. SystemChangeNotifier uniqueInstance classCommented: self changeClass! ! !RBCommentChange methodsFor: 'printing' stamp: 'lr 12/29/2011 17:42'! printOn: aStream aStream nextPutAll: self displayClassName; nextPutAll: ' classComment: '; print: (self comment copyReplaceAll: '!!' with: '!!!!'); nextPutAll: ' stamp: '; print: (RBPlatform current changeStamp); nextPutAll: '!!'! ! !RBRefactoryClassChange methodsFor: 'comparing' stamp: 'lr 9/6/2010 21:18'! = aRefactoryClassChange self class = aRefactoryClassChange class ifFalse: [ ^ false ]. ^ className = aRefactoryClassChange changeClassName and: [ isMeta = aRefactoryClassChange isMeta ]! ! !RBRefactoryClassChange methodsFor: 'converting' stamp: ''! asUndoOperation ^self subclassResponsibility! ! !RBRefactoryClassChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 21:18'! changeClass | class | class := Smalltalk globals at: self changeClassName ifAbsent: [ ^ nil ]. ^ isMeta ifTrue: [ class classSide ] ifFalse: [ class ]! ! !RBRefactoryClassChange methodsFor: 'accessing' stamp: 'lr 10/31/2009 17:37'! changeClass: aBehavior isMeta := aBehavior isMeta. className := aBehavior theNonMetaClass name! ! !RBRefactoryClassChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 21:19'! changeClassName ^ className! ! !RBRefactoryClassChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 21:19'! changeClassName: aSymbol className := aSymbol. isMeta isNil ifTrue: [ isMeta := false ]! ! !RBRefactoryClassChange methodsFor: 'printing' stamp: 'lr 9/6/2010 21:19'! changeString ^ self displayClassName! ! !RBRefactoryClassChange methodsFor: 'printing' stamp: 'lr 9/6/2010 21:19'! displayClassName ^ isMeta ifTrue: [ self changeClassName , ' class' ] ifFalse: [ self changeClassName asString ]! ! !RBRefactoryClassChange methodsFor: 'private' stamp: 'lr 9/6/2010 21:19'! executeNotifying: aBlock | undo | undo := self asUndoOperation. undo name: self name. self primitiveExecute. aBlock value. ^ undo! ! !RBRefactoryClassChange methodsFor: 'comparing' stamp: 'lr 9/6/2010 21:19'! hash ^ self changeClassName hash! ! !RBRefactoryClassChange methodsFor: 'private' stamp: 'lr 9/6/2010 21:19'! isMeta ^ isMeta! ! !RBRefactoryClassChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 21:19'! methodSourceFor: aSymbol ^ (self changeClass includesSelector: aSymbol) ifTrue: [ self changeClass sourceCodeAt: aSymbol ]! ! !RBRefactoryClassChange methodsFor: 'private' stamp: 'lr 9/6/2010 13:29'! primitiveExecute ^ self subclassResponsibility! ! !RBRefactoryClassChange methodsFor: 'printing' stamp: ''! printOn: aStream aStream nextPutAll: self displayString! ! !RBRefactoryClassChange methodsFor: 'accessing' stamp: 'lr 9/6/2010 13:57'! renameChangesForClass: oldClassName to: newClassName ^ self changeClassName = oldClassName ifFalse: [ self ] ifTrue: [ self copy changeClassName: newClassName; yourself ]! ! RBRefactoryClassChange subclass: #RBRefactoryDefinitionChange instanceVariableNames: 'controller definition definedClass' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! RBRefactoryDefinitionChange subclass: #RBAddClassChange instanceVariableNames: 'superclassName instanceVariableNames classVariableNames poolDictionaryNames category' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBAddClassChange class methodsFor: 'private' stamp: 'lr 10/2/2010 13:32'! definitionPatterns ^ #('`@superclass subclass: `#className instanceVariableNames: `#instanceVariableNames classVariableNames: `#classVariableNames poolDictionaries: `#poolDictionaries category: `#category' '`@superclass subclass: `#className uses: `@traitComposition instanceVariableNames: `#instanceVariableNames classVariableNames: `#classVariableNames poolDictionaries: `#poolDictionaries category: `#category' '`@superclass variableByteSubclass: `#className instanceVariableNames: `#instanceVariableNames classVariableNames: `#classVariableNames poolDictionaries: `#poolDictionaries category: `#category' '`@superclass variableByteSubclass: `#className uses: `@traitComposition instanceVariableNames: `#instanceVariableNames classVariableNames: `#classVariableNames poolDictionaries: `#poolDictionaries category: `#category' '`@superclass variableSubclass: `#className instanceVariableNames: `#instanceVariableNames classVariableNames: `#classVariableNames poolDictionaries: `#poolDictionaries category: `#category' '`@superclass variableSubclass: `#className uses: `@traitComposition instanceVariableNames: `#instanceVariableNames classVariableNames: `#classVariableNames poolDictionaries: `#poolDictionaries category: `#category' '`@superclass variableWordSubclass: `#className instanceVariableNames: `#instanceVariableNames classVariableNames: `#classVariableNames poolDictionaries: `#poolDictionaries category: `#category' '`@superclass variableWordSubclass: `#className uses: `@traitComposition instanceVariableNames: `#instanceVariableNames classVariableNames: `#classVariableNames poolDictionaries: `#poolDictionaries category: `#category' '`@superclass weakSubclass: `#className instanceVariableNames: `#instanceVariableNames classVariableNames: `#classVariableNames poolDictionaries: `#poolDictionaries category: `#category' '`@superclass weakSubclass: `#className uses: `@traitComposition instanceVariableNames: `#instanceVariableNames classVariableNames: `#classVariableNames poolDictionaries: `#poolDictionaries category: `#category') gather: [ :each | Array with: each with: (each copyReplaceAll: '`@superclass' with: 'ProtoObject') , '. `className superclass: `@superclass' ]! ! !RBAddClassChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:10'! asUndoOperation | class | class := Smalltalk globals at: self changeClassName ifAbsent: [ nil ]. ^ class isBehavior ifTrue: [ RBAddClassChange definition: class definition ] ifFalse: [ RBRemoveClassChange removeClassName: self changeClassName ]! ! !RBAddClassChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 18:52'! category ^ category! ! !RBAddClassChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 18:52'! classVariableNames ^ classVariableNames! ! !RBAddClassChange methodsFor: 'private' stamp: 'lr 10/2/2010 13:37'! definitionClass ^ Smalltalk globals at: (self superclassName ifNil: [ ^ ProtoObject ])! ! !RBAddClassChange methodsFor: 'private' stamp: 'lr 10/1/2010 14:36'! fillOutDefinition: aDictionary superclassName := (aDictionary at: '`@superclass') ifNotNil: [ :value | value asSymbol ]. className := (aDictionary at: '`#className') asSymbol. instanceVariableNames := self namesIn: (aDictionary at: '`#instanceVariableNames' ifAbsent: [ String new ]). classVariableNames := self namesIn: (aDictionary at: '`#classVariableNames' ifAbsent: [ String new ]). poolDictionaryNames := self namesIn: (aDictionary at: '`#poolDictionaries' ifAbsent: [ String new ]). category := (aDictionary at: '`#category' ifAbsent: [ #Unclassified ]) asSymbol! ! !RBAddClassChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 18:52'! instanceVariableNames ^ instanceVariableNames! ! !RBAddClassChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 18:52'! poolDictionaryNames ^ poolDictionaryNames! ! !RBAddClassChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 18:52'! superclassName ^ superclassName! ! RBRefactoryDefinitionChange subclass: #RBAddClassTraitChange instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBAddClassTraitChange class methodsFor: 'private' stamp: 'lr 9/30/2010 19:46'! definitionPatterns ^ #('`traitName classTrait uses: `@traitComposition')! ! !RBAddClassTraitChange methodsFor: 'converting' stamp: 'lr 9/30/2010 19:47'! asUndoOperation ^ self class definition: self changeClass classTrait definition! ! !RBAddClassTraitChange methodsFor: 'private' stamp: 'lr 9/30/2010 19:47'! definitionClass ^ self changeClass! ! !RBAddClassTraitChange methodsFor: 'initialization' stamp: 'lr 10/1/2010 14:36'! fillOutDefinition: aDictionary className := (aDictionary at: '`traitName') asSymbol! ! RBRefactoryDefinitionChange subclass: #RBAddMetaclassChange instanceVariableNames: 'classInstanceVariableNames' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBAddMetaclassChange class methodsFor: 'private' stamp: 'lr 9/30/2010 19:19'! definitionPatterns ^ #('`className class instanceVariableNames: `#instanceVariableNames' '`className class uses: `@traitComposition instanceVariableNames: `#instanceVariableNames')! ! !RBAddMetaclassChange methodsFor: 'converting' stamp: 'lr 9/30/2010 14:32'! asUndoOperation ^ self class definition: self changeClass class definition! ! !RBAddMetaclassChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 18:57'! classInstanceVariableNames ^ classInstanceVariableNames! ! !RBAddMetaclassChange methodsFor: 'private' stamp: 'lr 9/30/2010 14:21'! definitionClass ^ self changeClass! ! !RBAddMetaclassChange methodsFor: 'initialization' stamp: 'lr 10/1/2010 14:37'! fillOutDefinition: aDictionary className := (aDictionary at: '`className') asSymbol. classInstanceVariableNames := self namesIn: (aDictionary at: '`#instanceVariableNames' ifAbsent: [ String new ])! ! RBRefactoryDefinitionChange subclass: #RBAddTraitChange instanceVariableNames: 'category' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBAddTraitChange class methodsFor: 'private' stamp: 'lr 9/30/2010 19:46'! definitionPatterns ^ #('Trait named: `#traitName uses: `@traitComposition category: `#category')! ! !RBAddTraitChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:10'! asUndoOperation | trait | trait := Smalltalk globals at: self changeClassName ifAbsent: [ nil ]. ^ trait isTrait ifTrue: [ RBAddTraitChange definition: trait definition ] ifFalse: [ RBRemoveClassChange removeClassName: self changeClassName ]! ! !RBAddTraitChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 19:29'! category ^ category! ! !RBAddTraitChange methodsFor: 'private' stamp: 'lr 9/30/2010 19:39'! definitionClass ^ Trait! ! !RBAddTraitChange methodsFor: 'initialization' stamp: 'lr 10/1/2010 14:37'! fillOutDefinition: aDictionary className := (aDictionary at: '`#traitName') asSymbol. category := (aDictionary at: '`#category' ifAbsent: [ #Unclassified ]) asSymbol! ! !RBRefactoryDefinitionChange class methodsFor: 'instance creation' stamp: 'lr 9/30/2010 14:01'! definition: aString ^ self definition: aString for: nil! ! !RBRefactoryDefinitionChange class methodsFor: 'instance creation' stamp: 'lr 9/8/2011 20:10'! definition: aString for: aController | parseTree context | parseTree := RBParser parseExpression: aString onError: [ :err :pos | ^ self error: 'Invalid definition string' ]. context := RBSmallDictionary new. RBRefactoryDefinitionChange allSubclassesDo: [ :class | class definitionPatterns do: [ :pattern | ((RBParser parseRewriteExpression: pattern) match: parseTree inContext: context empty) ifTrue: [ ^ class definition: aString for: aController context: context ] ] ]. ^ self error: 'Invalid definition string'! ! !RBRefactoryDefinitionChange class methodsFor: 'private' stamp: 'lr 9/30/2010 18:54'! definition: aString for: aController context: aDictionary | dictionary | dictionary := RBSmallDictionary new. aDictionary keysAndValuesDo: [ :key :node | dictionary at: key formattedCode put: (node isVariable ifTrue: [ node name ] ifFalse: [ node isLiteral ifTrue: [ node value ] ifFalse: [ node ] ]) ]. ^ self new definition: aString controller: aController; fillOutDefinition: dictionary; yourself! ! !RBRefactoryDefinitionChange class methodsFor: 'private' stamp: 'lr 10/1/2010 14:32'! definitionPatterns self subclassResponsibility! ! !RBRefactoryDefinitionChange methodsFor: 'comparing' stamp: 'lr 9/30/2010 14:07'! = aDefinitionChange ^ self class = aDefinitionChange class and: [ self definition = aDefinitionChange definition ]! ! !RBRefactoryDefinitionChange methodsFor: 'printing' stamp: 'lr 9/30/2010 14:12'! changeString ^ 'Define ' , self displayClassName! ! !RBRefactoryDefinitionChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 14:13'! controller ^ controller! ! !RBRefactoryDefinitionChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 14:09'! definedClass ^ definedClass! ! !RBRefactoryDefinitionChange methodsFor: 'accessing' stamp: 'lr 9/30/2010 14:08'! definition ^ definition! ! !RBRefactoryDefinitionChange methodsFor: 'initialization' stamp: 'lr 10/1/2010 14:37'! definition: aString controller: aController isMeta := false. definition := aString. controller := aController! ! !RBRefactoryDefinitionChange methodsFor: 'private' stamp: 'lr 9/30/2010 14:20'! definitionClass self subclassResponsibility! ! !RBRefactoryDefinitionChange methodsFor: 'initialization' stamp: 'lr 10/1/2010 14:32'! fillOutDefinition: aDictionary self subclassResponsibility! ! !RBRefactoryDefinitionChange methodsFor: 'comparing' stamp: 'lr 9/30/2010 14:07'! hash ^ definition hash! ! !RBRefactoryDefinitionChange methodsFor: 'private' stamp: 'lr 9/30/2010 19:21'! namesIn: aString | names scanner token | names := OrderedCollection new. scanner := RBScanner on: (ReadStream on: aString) errorBlock: [ :msg :pos | ^ names ]. [ scanner atEnd ] whileFalse: [ token := scanner next. token isIdentifier ifTrue: [ names add: token value ] ]. ^ names asArray! ! !RBRefactoryDefinitionChange methodsFor: 'private' stamp: 'lr 10/14/2010 20:50'! primitiveExecute definedClass := self definitionClass compilerClass evaluate: self definition notifying: self controller logged: true! ! !RBRefactoryDefinitionChange methodsFor: 'printing' stamp: 'lr 9/30/2010 14:12'! printOn: aStream aStream nextPutAll: definition; nextPut: $!!! ! RBRefactoryClassChange subclass: #RBRefactoryVariableChange instanceVariableNames: 'variable' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! RBRefactoryVariableChange subclass: #RBAddClassVariableChange instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBAddClassVariableChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:10'! asUndoOperation ^ RBRemoveClassVariableChange remove: self variable from: self changeClass! ! !RBAddClassVariableChange methodsFor: 'accessing' stamp: 'lr 10/15/2010 08:31'! changeClass: aBehavior super changeClass: aBehavior. isMeta := false! ! !RBAddClassVariableChange methodsFor: 'printing' stamp: 'lr 10/15/2010 09:37'! changeString ^ 'Add class variable <1s> to <2s>' expandMacrosWith: self variable with: self displayClassName! ! !RBAddClassVariableChange methodsFor: 'private' stamp: 'lr 3/20/2011 11:27'! changeSymbol ^ #addClassVarNamed:! ! RBRefactoryVariableChange subclass: #RBAddInstanceVariableChange instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBAddInstanceVariableChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:10'! asUndoOperation ^ RBRemoveInstanceVariableChange remove: self variable from: self changeClass! ! !RBAddInstanceVariableChange methodsFor: 'printing' stamp: 'lr 10/14/2010 20:52'! changeString ^ 'Add instance variable <1s> to <2s>' expandMacrosWith: self variable with: self displayClassName! ! !RBAddInstanceVariableChange methodsFor: 'private' stamp: 'lr 3/20/2011 11:26'! changeSymbol ^ #addInstVarNamed:! ! RBRefactoryVariableChange subclass: #RBAddPoolVariableChange instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBAddPoolVariableChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:10'! asUndoOperation ^ RBRemovePoolVariableChange remove: self variable from: self changeClass! ! !RBAddPoolVariableChange methodsFor: 'accessing' stamp: 'lr 10/15/2010 08:31'! changeClass: aBehavior super changeClass: aBehavior. isMeta := false! ! !RBAddPoolVariableChange methodsFor: 'printing' stamp: 'lr 4/7/2010 08:19'! changeString ^ 'Add pool variable <1s> to <2s>' expandMacrosWith: self variable with: self displayClassName! ! !RBAddPoolVariableChange methodsFor: 'private' stamp: 'lr 9/6/2010 21:30'! changeSymbol ^ #addSharedPool:! ! !RBRefactoryVariableChange class methodsFor: 'instance creation' stamp: 'lr 9/7/2010 19:44'! add: aVariable to: aBehavior "This should only be called on the Add*Change subclasses, but is here so we don't need to copy it to all subclasses" ^ self new class: aBehavior variable: aVariable! ! !RBRefactoryVariableChange class methodsFor: 'instance creation' stamp: 'lr 9/7/2010 19:44'! remove: aVariable from: aBehavior "This should only be called on the Remove*Change subclasses, but is here so we don't need to copy it to all subclasses" ^ self new class: aBehavior variable: aVariable! ! !RBRefactoryVariableChange methodsFor: 'comparing' stamp: 'lr 10/15/2010 09:37'! = aRefactoryVariableChange ^ super = aRefactoryVariableChange and: [ self variable = aRefactoryVariableChange variable ]! ! !RBRefactoryVariableChange methodsFor: 'private' stamp: 'lr 9/6/2010 21:27'! changeObject ^ self variable! ! !RBRefactoryVariableChange methodsFor: 'private' stamp: ''! changeSymbol self subclassResponsibility! ! !RBRefactoryVariableChange methodsFor: 'initialize-release' stamp: ''! class: aBehavior variable: aString self changeClass: aBehavior. variable := aString! ! !RBRefactoryVariableChange methodsFor: 'comparing' stamp: 'lr 10/15/2010 09:37'! hash ^ self changeClassName hash bitXor: self variable hash! ! !RBRefactoryVariableChange methodsFor: 'private' stamp: 'lr 10/15/2010 09:43'! primitiveExecute self changeClass perform: self changeSymbol with: self changeObject! ! !RBRefactoryVariableChange methodsFor: 'printing' stamp: 'lr 5/18/2010 20:48'! printOn: aStream aStream nextPutAll: self displayClassName; nextPut: $ ; nextPutAll: self changeSymbol; nextPut: $ ; print: self variable; nextPut: $!!! ! !RBRefactoryVariableChange methodsFor: 'private' stamp: 'lr 9/6/2010 21:29'! variable ^ variable! ! RBRefactoryVariableChange subclass: #RBRemoveClassVariableChange instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBRemoveClassVariableChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:10'! asUndoOperation ^ RBAddClassVariableChange add: self variable to: self changeClass! ! !RBRemoveClassVariableChange methodsFor: 'accessing' stamp: 'lr 10/15/2010 08:31'! changeClass: aBehavior super changeClass: aBehavior. isMeta := false! ! !RBRemoveClassVariableChange methodsFor: 'printing' stamp: 'lr 10/15/2010 09:37'! changeString ^ 'Remove class variable <1s> from <2s>' expandMacrosWith: self variable with: self displayClassName! ! !RBRemoveClassVariableChange methodsFor: 'private' stamp: 'lr 3/20/2011 11:28'! changeSymbol ^ #removeClassVarNamed:! ! RBRefactoryVariableChange subclass: #RBRemoveInstanceVariableChange instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBRemoveInstanceVariableChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:10'! asUndoOperation ^ RBAddInstanceVariableChange add: self variable to: self changeClass! ! !RBRemoveInstanceVariableChange methodsFor: 'printing' stamp: 'lr 10/14/2010 20:53'! changeString ^ 'Remove instance variable <1s> from <2s>' expandMacrosWith: self variable with: self displayClassName! ! !RBRemoveInstanceVariableChange methodsFor: 'private' stamp: 'lr 3/20/2011 11:27'! changeSymbol ^ #removeInstVarNamed:! ! RBRefactoryVariableChange subclass: #RBRemovePoolVariableChange instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBRemovePoolVariableChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:10'! asUndoOperation ^ RBAddPoolVariableChange add: self variable to: self changeClass! ! !RBRemovePoolVariableChange methodsFor: 'accessing' stamp: 'lr 10/15/2010 08:31'! changeClass: aBehavior super changeClass: aBehavior. isMeta := false! ! !RBRemovePoolVariableChange methodsFor: 'printing' stamp: 'lr 4/7/2010 08:20'! changeString ^ 'Remove pool variable <1s> from <2s>' expandMacrosWith: self variable with: self displayClassName! ! !RBRemovePoolVariableChange methodsFor: 'private' stamp: 'lr 9/6/2010 21:31'! changeSymbol ^ #removeSharedPool:! ! RBRefactoryClassChange subclass: #RBRemoveClassChange instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBRemoveClassChange class methodsFor: 'instance creation' stamp: 'lr 9/7/2010 19:44'! remove: aClass ^ self new changeClass: aClass! ! !RBRemoveClassChange class methodsFor: 'instance creation' stamp: 'lr 9/7/2010 19:45'! removeClassName: aSymbol ^ self new changeClassName: aSymbol! ! !RBRemoveClassChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:10'! asUndoOperation | classChanges | classChanges := RBCompositeRefactoryChange new. self changeClass withAllSubclasses do: [ :each | classChanges defineClass: each definition. each class instVarNames do: [ :varName | classChanges addInstanceVariable: varName to: each class ]. each selectors do: [ :selector | classChanges compile: (each sourceCodeAt: selector) in: each ]. each class selectors do: [ :selector | classChanges compile: (each class sourceCodeAt: selector) in: each class ] ]. ^ classChanges! ! !RBRemoveClassChange methodsFor: 'accessing' stamp: 'lr 10/15/2010 09:10'! changeClass: aBehavior super changeClass: aBehavior. isMeta := false! ! !RBRemoveClassChange methodsFor: 'printing' stamp: 'lr 4/7/2010 08:20'! changeString ^ 'Remove ' , self displayClassName! ! !RBRemoveClassChange methodsFor: 'private' stamp: ''! primitiveExecute self changeClass removeFromSystem! ! !RBRemoveClassChange methodsFor: 'printing' stamp: ''! printOn: aStream aStream nextPutAll: self displayClassName; nextPutAll: ' removeFromSystem'; nextPut: $!!! ! RBRefactoryClassChange subclass: #RBRemoveMethodChange instanceVariableNames: 'selector' classVariableNames: '' poolDictionaries: '' category: 'Refactoring-Changes'! !RBRemoveMethodChange class methodsFor: 'instance creation' stamp: 'lr 9/7/2010 19:45'! remove: aSymbol from: aClass ^ self new changeClass: aClass; selector: aSymbol; yourself! ! !RBRemoveMethodChange methodsFor: 'comparing' stamp: 'lr 9/7/2010 19:10'! = aRemoveMethodChange super = aRemoveMethodChange ifFalse: [ ^ false ]. ^ selector = aRemoveMethodChange selector! ! !RBRemoveMethodChange methodsFor: 'converting' stamp: 'lr 9/8/2011 20:10'! asUndoOperation ^ RBAddMethodChange compile: (self methodSourceFor: selector) in: self changeClass! ! !RBRemoveMethodChange methodsFor: 'printing' stamp: 'lr 4/7/2010 08:21'! changeString ^ 'Remove <1s>>>#<2s>' expandMacrosWith: self displayClassName with: selector! ! !RBRemoveMethodChange methodsFor: 'comparing' stamp: 'lr 9/7/2010 19:11'! hash ^ selector hash! ! !RBRemoveMethodChange methodsFor: 'private' stamp: 'lr 9/7/2010 19:11'! primitiveExecute ^ self changeClass removeSelector: selector! ! !RBRemoveMethodChange methodsFor: 'printing' stamp: 'lr 2/8/2008 09:29'! printOn: aStream aStream nextPutAll: self displayClassName; nextPutAll: ' removeSelector: '; print: self selector; nextPut: $!!! ! !RBRemoveMethodChange methodsFor: 'private' stamp: 'lr 9/7/2010 19:11'! selector ^ selector! ! !RBRemoveMethodChange methodsFor: 'initialize-release' stamp: 'lr 9/7/2010 19:11'! selector: aSymbol selector := aSymbol! ! Object subclass: #RBRefactoryChangeManager instanceVariableNames: 'undo redo isPerformingRefactoring' classVariableNames: 'Instance UndoSize' poolDictionaries: '' category: 'Refactoring-Changes'! !RBRefactoryChangeManager class methodsFor: 'class initialization' stamp: 'lr 4/4/2010 08:32'! initialize self nuke. UndoSize := 20! ! !RBRefactoryChangeManager class methodsFor: 'instance creation' stamp: 'lr 4/4/2010 08:35'! instance ^ Instance ifNil: [ Instance := self basicNew initialize ]! ! !RBRefactoryChangeManager class methodsFor: 'instance creation' stamp: 'lr 4/4/2010 08:33'! new ^ self shouldNotImplement! ! !RBRefactoryChangeManager class methodsFor: 'public' stamp: 'lr 4/4/2010 08:34'! nuke Instance notNil ifTrue: [ Instance release ]. Instance := nil! ! !RBRefactoryChangeManager class methodsFor: 'settings' stamp: 'LukasRenggli 12/18/2009 10:42'! settingsOn: aBuilder (aBuilder setting: #undoSize) target: self; label: 'Undo size'; parentName: #refactoring! ! !RBRefactoryChangeManager class methodsFor: 'class initialization' stamp: 'lr 4/4/2010 08:33'! undoSize ^ UndoSize! ! !RBRefactoryChangeManager class methodsFor: 'class initialization' stamp: ''! undoSize: anInteger UndoSize := anInteger max: 0! ! !RBRefactoryChangeManager class methodsFor: 'public' stamp: 'lr 4/4/2010 08:34'! unload self nuke! ! !RBRefactoryChangeManager methodsFor: 'public access' stamp: 'lr 9/7/2010 19:11'! addUndo: aRefactoringChange undo addLast: aRefactoringChange. undo size > UndoSize ifTrue: [ undo removeFirst ]. redo := OrderedCollection new! ! !RBRefactoryChangeManager methodsFor: 'private' stamp: ''! clearUndoRedoList undo := OrderedCollection new. redo := OrderedCollection new! ! !RBRefactoryChangeManager methodsFor: 'initialize-release' stamp: 'lr 3/13/2009 17:32'! connectToChanges SystemChangeNotifier uniqueInstance notify: self ofAllSystemChangesUsing: #update:! ! !RBRefactoryChangeManager methodsFor: 'initialize-release' stamp: 'lr 3/13/2009 17:29'! disconnectFromChanges SystemChangeNotifier uniqueInstance noMoreNotificationsFor: self! ! !RBRefactoryChangeManager methodsFor: 'testing' stamp: 'lr 9/7/2010 19:11'! hasRedoableOperations ^ redo isEmpty not! ! !RBRefactoryChangeManager methodsFor: 'testing' stamp: 'lr 9/7/2010 19:11'! hasUndoableOperations ^ undo isEmpty not! ! !RBRefactoryChangeManager methodsFor: 'public access' stamp: 'lr 9/7/2010 19:11'! ignoreChangesWhile: aBlock isPerformingRefactoring ifTrue: [ ^ aBlock value ]. isPerformingRefactoring := true. aBlock ensure: [ isPerformingRefactoring := false ]! ! !RBRefactoryChangeManager methodsFor: 'initialize-release' stamp: ''! initialize undo := OrderedCollection new. redo := OrderedCollection new. isPerformingRefactoring := false. self connectToChanges! ! !RBRefactoryChangeManager methodsFor: 'public access' stamp: 'lr 9/7/2010 19:11'! performChange: aRefactoringChange self ignoreChangesWhile: [ self addUndo: aRefactoringChange execute ]! ! !RBRefactoryChangeManager methodsFor: 'public access' stamp: 'lr 9/7/2010 19:11'! redoChange ^ redo last! ! !RBRefactoryChangeManager methodsFor: 'public access' stamp: 'lr 9/7/2010 19:12'! redoOperation redo isEmpty ifTrue: [ ^ self ]. self ignoreChangesWhile: [ | change | change := redo removeLast. undo add: change execute ]! ! !RBRefactoryChangeManager methodsFor: 'initialize-release' stamp: ''! release super release. self disconnectFromChanges! ! !RBRefactoryChangeManager methodsFor: 'public access' stamp: 'lr 9/7/2010 19:12'! undoChange ^ undo last! ! !RBRefactoryChangeManager methodsFor: 'public access' stamp: 'lr 9/7/2010 19:12'! undoOperation undo isEmpty ifTrue: [ ^ self ]. self ignoreChangesWhile: [ | change | change := undo removeLast. redo add: change execute ]! ! !RBRefactoryChangeManager methodsFor: 'updating' stamp: 'lr 3/13/2009 17:35'! update: anEvent (isPerformingRefactoring or: [ anEvent isDoIt or: [ anEvent isCommented or: [ anEvent isRecategorized ] ] ]) ifFalse: [ self clearUndoRedoList ]! ! RBRefactoryChangeManager initialize!