SystemOrganization addCategory: #'OB-Refactory-Commands'! SystemOrganization addCategory: #'OB-Refactory-Browsers'! SystemOrganization addCategory: #'OB-Refactory-Tools'! OBFilter subclass: #OREnvironmentFilter instanceVariableNames: 'environment mode' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Browsers'! !OREnvironmentFilter class methodsFor: 'instance-creation' stamp: 'lr 5/21/2007 14:45'! on: anEnvironment ^ self new environment: anEnvironment! ! !OREnvironmentFilter methodsFor: 'filtering' stamp: 'lr 5/21/2007 21:23'! displayString: aString forParent: aParentNode child: aNode "Display elements that are part of the environment in bold." ^ (mode = #highlight and: [ aNode withinBrowserEnvironment: environment ]) ifTrue: [ Text string: aString attribute: TextEmphasis bold ] ifFalse: [ aString ]! ! !OREnvironmentFilter methodsFor: 'accessing' stamp: 'lr 5/19/2007 09:41'! environment ^ environment! ! !OREnvironmentFilter methodsFor: 'accessing' stamp: 'lr 5/21/2007 14:46'! environment: anEnvironment environment := anEnvironment! ! !OREnvironmentFilter methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:18'! mode ^ mode! ! !OREnvironmentFilter methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:17'! mode: aSymbol mode := aSymbol! ! !OREnvironmentFilter methodsFor: 'filtering' stamp: 'lr 5/21/2007 21:20'! nodesFrom: aCollection forNode: aNode "Remove elements that are not part of the environment if in filter mode." ^ mode = #filter ifTrue: [ aCollection select: [ :each | each withinBrowserEnvironment: environment ] ] ifFalse: [ aCollection ]! ! !OREnvironmentFilter methodsFor: 'initialization' stamp: 'lr 5/21/2007 21:23'! setMetaNode: aMetaNode super setMetaNode: aMetaNode. aMetaNode children do: [ :each | (each filters includes: self) ifFalse: [ each addFilter: self ] ]. mode := #highlight! ! !OBCodeBrowser methodsFor: '*ob-refactory-commands' stamp: 'lr 5/18/2007 13:10'! cmdClassRefactroings ^ ORCmdClassRefactoring allSubclasses! ! !OBCodeBrowser methodsFor: '*ob-refactory-commands' stamp: 'lr 5/18/2007 13:10'! cmdClassVarRefactroings ^ ORCmdClassVarRefactoring allSubclasses! ! !OBCodeBrowser methodsFor: '*ob-refactory-commands' stamp: 'lr 5/21/2007 19:24'! cmdEnvironments ^ ORCmdEnvironment allSubclasses! ! !OBCodeBrowser methodsFor: '*ob-refactory-commands' stamp: 'lr 5/18/2007 13:10'! cmdInstVarRefactroings ^ ORCmdInstVarRefactoring allSubclasses! ! !OBCodeBrowser methodsFor: '*ob-refactory-commands' stamp: 'lr 5/18/2007 13:10'! cmdMethodRefactroings ^ ORCmdMethodRefactoring allSubclasses! ! !OBCodeBrowser methodsFor: '*ob-refactory-commands' stamp: 'lr 5/18/2007 13:10'! cmdRefactoryTools ^ ORCmdRefactoringTools allSubclasses! ! !OBCodeBrowser methodsFor: '*ob-refactory-commands' stamp: 'lr 5/18/2007 13:10'! cmdSourceRefactroings ^ ORCmdSourceRefactoring allSubclasses! ! !OBCodeBrowser methodsFor: '*ob-refactory-accessing' stamp: 'lr 5/21/2007 14:48'! environment ^ BrowserEnvironment new! ! !OBClassAwareNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 19:39'! addToEnvironment: anEnvironment ^ anEnvironment addClass: self theNonMetaClass; addClass: self theMetaClass! ! !OBClassAwareNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 18:39'! removeFromEnvironment: anEnvironment ^ anEnvironment removeClass: self theClass! ! OBSystemBrowser subclass: #OREnvironmentBrowser instanceVariableNames: 'filter' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Browsers'! !OREnvironmentBrowser class methodsFor: 'configuration' stamp: 'lr 5/21/2007 13:47'! mercuryPanel ^ nil! ! !OREnvironmentBrowser class methodsFor: 'instance-creation' stamp: 'lr 5/21/2007 14:45'! onEnvironment: anEnvironment ^ self new environment: anEnvironment! ! !OREnvironmentBrowser class methodsFor: 'opening' stamp: 'lr 5/18/2007 11:19'! openEnvironment: anEnvironment ^ (self onEnvironment: anEnvironment) open! ! !OREnvironmentBrowser class methodsFor: 'configuration' stamp: 'lr 5/21/2007 18:20'! title ^ 'Environment Browser'! ! !OREnvironmentBrowser methodsFor: 'commands' stamp: 'lr 5/21/2007 21:14'! cmdToggleContainment ^ ORCmdToggleContainment! ! !OREnvironmentBrowser methodsFor: 'commands' stamp: 'lr 5/21/2007 21:13'! cmdToggleView ^ ORCmdToggleView ! ! !OREnvironmentBrowser methodsFor: 'morphic' stamp: 'lr 5/21/2007 13:16'! defaultBackgroundColor ^ Color yellow! ! !OREnvironmentBrowser methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:21'! environment ^ filter environment! ! !OREnvironmentBrowser methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:21'! environment: anEnvironment filter environment: anEnvironment! ! !OREnvironmentBrowser methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:21'! filter ^ filter! ! !OREnvironmentBrowser methodsFor: 'initialization' stamp: 'lr 5/21/2007 21:24'! setMetaNode: aMetaNode node: aNode super setMetaNode: aMetaNode node: aNode. filter := OREnvironmentFilter new. aMetaNode addFilter: filter! ! !OBCodeNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 18:38'! addToEnvironment: anEnvironment ^ anEnvironment! ! !OBCodeNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 18:37'! removeFromEnvironment: anEnvironment ^ anEnvironment! ! !OBCodeNode methodsFor: '*ob-refactory' stamp: 'lr 5/20/2007 08:59'! withinBrowserEnvironment: anEnvironment ^ true! ! !OBClassCategoryNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 18:57'! addToEnvironment: anEnvironment self classes , self metaclasses do: [ :each | each addToEnvironment: anEnvironment ]. ^ anEnvironment! ! !OBClassCategoryNode methodsFor: '*ob-refactory' stamp: 'lr 5/24/2007 20:17'! browseIn: anEnvironment ^ (OREnvironmentBrowser onEnvironment: environment category: name) environment: anEnvironment; open! ! !OBClassCategoryNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 18:57'! removeFromEnvironment: anEnvironment self classes , self metaclasses do: [ :each | each removeFromEnvironment: anEnvironment ]. ^ anEnvironment! ! !OBClassCategoryNode methodsFor: '*ob-refactory' stamp: 'lr 5/20/2007 09:08'! withinBrowserEnvironment: anEnvironment ^ anEnvironment includesCategory: name! ! !OBAllMethodCategoryNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 13:54'! withinBrowserEnvironment: anEnvironment anEnvironment selectorsForClass: self theClass do: [ :each | ^ true ]. ^ false ! ! !OBClassCommentNode methodsFor: '*ob-refactory' stamp: 'lr 5/20/2007 09:01'! withinBrowserEnvironment: anEnvironment ^ (anEnvironment includesClass: self theClass) or: [ anEnvironment includesClass: self theMetaClass ]! ! !OBMethodNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 18:41'! addToEnvironment: anEnvironment ^ anEnvironment addClass: self theClass selector: self selector! ! !OBMethodNode methodsFor: '*ob-refactory' stamp: 'lr 5/24/2007 20:19'! browseIn: anEnvironment ^ (OREnvironmentBrowser onClass: self theClass selector: selector) environment: anEnvironment; open! ! !OBMethodNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 18:41'! removeFromEnvironment: anEnvironment ^ anEnvironment removeClass: self theClass selector: self selector! ! !OBMethodNode methodsFor: '*ob-refactory' stamp: 'lr 5/20/2007 09:04'! withinBrowserEnvironment: anEnvironment ^ anEnvironment includesSelector: self selector in: self theClass! ! MethodRefactoring subclass: #ORSwapMethodChange instanceVariableNames: 'target selector' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Tools'! !ORSwapMethodChange class methodsFor: 'instance-creation' stamp: 'lr 4/5/2007 08:48'! model: aRBSmalltalk swapMethod: aSelector in: aClass ^ self new model: aRBSmalltalk; swapMethod: aSelector in: aClass; yourself! ! !ORSwapMethodChange class methodsFor: 'instance-creation' stamp: 'lr 4/5/2007 08:48'! swapMethod: aSelector in: aClass ^ self new swapMethod: aSelector in: aClass! ! !ORSwapMethodChange methodsFor: 'preconditions' stamp: 'lr 4/5/2007 09:06'! checkInstVars class instanceVariableNames do: [ :each | (target instanceVariableNames includes: each) ifFalse: [ ((class whichSelectorsReferToInstanceVariable: each) includes: selector) ifTrue: [ self refactoringError: ('<1p> refers to <2s> which not defined in <3p>' expandMacrosWith: selector with: each with: target) ] ] ]! ! !ORSwapMethodChange methodsFor: 'preconditions' stamp: 'lr 4/5/2007 09:07'! preconditions ^ (RBCondition definesSelector: selector in: class) & (RBCondition definesSelector: selector in: target) not & (RBCondition withBlock: [ self checkInstVars. true ])! ! !ORSwapMethodChange methodsFor: 'initialization' stamp: 'lr 4/5/2007 08:53'! swapMethod: aSelector in: aClass class := self classObjectFor: aClass. target := self classObjectFor: (class isMeta ifTrue: [ class nonMetaclass ] ifFalse: [ class metaclass ]). selector := aSelector! ! !ORSwapMethodChange methodsFor: 'transforming' stamp: 'lr 4/5/2007 09:00'! transform target compile: (class sourceCodeFor: selector) classified: (class protocolsFor: selector). class removeMethod: selector! ! !OBMetaclassNode methodsFor: '*ob-refactory' stamp: 'lr 5/20/2007 09:01'! withinBrowserEnvironment: anEnvironment ^ anEnvironment includesClass: self theMetaClass! ! !OBMethodCategoryNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 18:53'! addToEnvironment: anEnvironment self methods do: [ :each | each addToEnvironment: anEnvironment ]. ^ anEnvironment! ! !OBMethodCategoryNode methodsFor: '*ob-refactory' stamp: 'lr 5/24/2007 20:19'! browseIn: anEnvironment ^ (OREnvironmentBrowser onClass: self theClass category: name) environment: anEnvironment; open! ! !OBMethodCategoryNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 18:52'! removeFromEnvironment: anEnvironment self methods do: [ :each | each removeFromEnvironment: anEnvironment ]. ^ anEnvironment! ! !OBMethodCategoryNode methodsFor: '*ob-refactory' stamp: 'lr 5/20/2007 09:03'! withinBrowserEnvironment: anEnvironment ^ anEnvironment includesProtocol: name in: self theClass! ! OBCommand subclass: #ORCommand instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! ORCommand subclass: #ORCmdEnvironment instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! ORCmdEnvironment subclass: #ORCmdClassEnvironment instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdClassEnvironment methodsFor: 'accessing' stamp: 'lr 5/20/2007 20:10'! environment ^ ClassEnvironment onEnvironment: super environment classes: (Array with: target theNonMetaClass with: target theMetaClass)! ! !ORCmdClassEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 18:10'! label ^ 'span class'! ! ORCmdEnvironment subclass: #ORCmdClassHierarchyEnvironment instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdClassHierarchyEnvironment methodsFor: 'accessing' stamp: 'lr 5/20/2007 20:16'! environment | environment | environment := ClassEnvironment onEnvironment: super environment. target theNonMetaClass withAllSubAndSuperclassesDo: [ :each | environment addClass: each; addClass: each class ]. ^ environment! ! !ORCmdClassHierarchyEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 18:08'! label ^ 'span class hierarchy'! ! !ORCmdEnvironment methodsFor: 'execution' stamp: 'lr 5/24/2007 20:18'! execute target browseIn: self environment! ! !ORCmdEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 19:30'! group ^ #'refactory.environment'! ! !ORCmdEnvironment methodsFor: 'testing' stamp: 'lr 5/21/2007 19:27'! isActive ^ (requestor isSelected: target) and: [ target isKindOf: OBClassAwareNode ]! ! ORCmdEnvironment subclass: #ORCmdImplementorEnvironment instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdImplementorEnvironment methodsFor: 'accessing' stamp: 'lr 5/19/2007 09:21'! environment ^ SelectorEnvironment implementorsOf: target selector in: super environment! ! !ORCmdImplementorEnvironment methodsFor: 'testing' stamp: 'lr 5/19/2007 09:22'! isActive ^ super isActive and: [ target hasSelector ]! ! !ORCmdImplementorEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 18:09'! label ^ 'span implementors'! ! ORCmdEnvironment subclass: #ORCmdNegationEnvironment instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdNegationEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:05'! environment ^ super environment not! ! !ORCmdNegationEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:05'! label ^ 'span negation'! ! ORCmdEnvironment subclass: #ORCmdPackageEnvironment instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdPackageEnvironment methodsFor: 'accessing' stamp: 'lr 5/24/2007 00:11'! environment ^ PackageEnvironment onEnvironment: super environment package: (target hasSelector ifTrue: [ PackageOrganizer default packageOfMethod: target reference ] ifFalse: [ PackageOrganizer default packageOfClass: target theClass ])! ! !ORCmdPackageEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 19:44'! label ^ 'span package'! ! ORCmdEnvironment subclass: #ORCmdSenderEnvironment instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdSenderEnvironment methodsFor: 'accessing' stamp: 'lr 5/19/2007 09:21'! environment ^ SelectorEnvironment referencesTo: target selector in: super environment! ! !ORCmdSenderEnvironment methodsFor: 'testing' stamp: 'lr 5/19/2007 09:22'! isActive ^ super isActive and: [ target hasSelector ]! ! !ORCmdSenderEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 18:09'! label ^ 'span sender'! ! ORCmdEnvironment subclass: #ORCmdSubclassesHierarchyEnvironment instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdSubclassesHierarchyEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 18:11'! environment | environment | environment := ClassEnvironment onEnvironment: super environment. target theNonMetaClass allSubclassesDo: [ :each | environment addClass: each; addClass: each class ]. ^ environment! ! !ORCmdSubclassesHierarchyEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 18:11'! label ^ 'span sublcasses'! ! ORCmdEnvironment subclass: #ORCmdSuperclassesHierarchyEnvironment instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdSuperclassesHierarchyEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 18:11'! environment | environment | environment := ClassEnvironment onEnvironment: super environment. target theNonMetaClass allSuperclassesDo: [ :each | environment addClass: each; addClass: each class ]. ^ environment! ! !ORCmdSuperclassesHierarchyEnvironment methodsFor: 'accessing' stamp: 'lr 5/21/2007 18:11'! label ^ 'span superclasses'! ! ORCommand subclass: #ORCmdRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! ORCmdRefactoring subclass: #ORCmdClassRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! ORCmdClassRefactoring subclass: #ORCmdAddSubclassRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdAddSubclassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:52'! label ^ 'add subclass'! ! !ORCmdAddSubclassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:02'! refactoring ^ AddClassRefactoring addClass: (self request: 'Enter new subclass name:') superclass: target theNonMetaClass subclasses: #() category: target theNonMetaClass category! ! ORCmdClassRefactoring subclass: #ORCmdAddSuperclassRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdAddSuperclassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:01'! label ^ 'add superclass'! ! !ORCmdAddSuperclassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:02'! refactoring ^ ChildrenToSiblingsRefactoring name: (self request: 'Enter new superclass name:') class: target theNonMetaClass subclasses: #()! ! !ORCmdClassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:46'! group ^ #'refactory.class'! ! !ORCmdClassRefactoring methodsFor: 'testing' stamp: 'lr 3/16/2007 18:47'! isActive ^ super isActive and: [ target isKindOf: OBClassNode ]! ! ORCmdClassRefactoring subclass: #ORCmdRemoveClassRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRemoveClassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:48'! label ^ 'remove class'! ! !ORCmdRemoveClassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:05'! refactoring ^ RemoveClassRefactoring classNames: (Array with: target theNonMetaClass name)! ! ORCmdClassRefactoring subclass: #ORCmdRenameClassRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRenameClassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:48'! label ^ 'rename class'! ! !ORCmdRenameClassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:08'! refactoring ^ RenameClassRefactoring rename: target theNonMetaClass to: (self request: 'Enter new class name:' initialAnswer: target theNonMetaClass name)! ! ORCmdClassRefactoring subclass: #ORCmdSplitClassRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdSplitClassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:49'! label ^ 'split class'! ! !ORCmdSplitClassRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:11'! refactoring ^ SplitClassRefactoring class: target theNonMetaClass instanceVariables: #() newClassName: (self request: 'Enter new class name:') referenceVariableName: (self request: 'Enter new variable name where requests will be forwarded:')! ! ORCmdRefactoring subclass: #ORCmdClassVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! ORCmdClassVarRefactoring subclass: #ORCmdAbstractClassVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdAbstractClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:49'! label ^ 'abstract classvar'! ! !ORCmdAbstractClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:34'! refactoring ^ AbstractClassVariableRefactoring variable: (self chooseFrom: self classVariables) class: target theNonMetaClass! ! ORCmdClassVarRefactoring subclass: #ORCmdAccessorClassVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdAccessorClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:50'! label ^ 'accessors for classvar'! ! !ORCmdAccessorClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:34'! refactoring ^ CreateAccessorsForVariableRefactoring variable: (self chooseFrom: self classVariables) class: target theNonMetaClass classVariable: true! ! ORCmdClassVarRefactoring subclass: #ORCmdAddClassVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdAddClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:50'! label ^ 'add classvar'! ! !ORCmdAddClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:04'! refactoring ^ AddClassVariableRefactoring variable: (self request: 'Enter the new variable name:') class: target theNonMetaClass! ! !ORCmdClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:42'! group ^ #'refactory.classvar'! ! !ORCmdClassVarRefactoring methodsFor: 'testing' stamp: 'lr 3/16/2007 18:19'! isActive ^ super isActive and: [ target theClass isMeta not and: [ (target isKindOf: OBClassVariableNode) or: [ target isKindOf: OBClassNode ] ] ]! ! ORCmdClassVarRefactoring subclass: #ORCmdPullUpClassVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdPullUpClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:50'! label ^ 'pull up classvar'! ! !ORCmdPullUpClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:34'! refactoring ^ PullUpClassVariableRefactoring variable: (self chooseFrom: self classVariables) class: target theNonMetaClass superclass! ! ORCmdClassVarRefactoring subclass: #ORCmdPushDownClassVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdPushDownClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:50'! label ^ 'push down classvar'! ! !ORCmdPushDownClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:33'! refactoring ^ PushDownClassVariableRefactoring variable: (self chooseFrom: self classVariables) class: target theNonMetaClass! ! ORCmdClassVarRefactoring subclass: #ORCmdRemoveClassVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRemoveClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:50'! label ^ 'remove classvar'! ! !ORCmdRemoveClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:36'! refactoring ^ RemoveClassVariableRefactoring variable: (self chooseFrom: self classVariables) class: target theNonMetaClass! ! ORCmdClassVarRefactoring subclass: #ORCmdRenameClassVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRenameClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:51'! label ^ 'rename classvar'! ! !ORCmdRenameClassVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:04'! refactoring ^ RenameClassVariableRefactoring rename: (self chooseFrom: self classVariables) to: (self request: 'Enter the new variable name:') in: target theNonMetaClass! ! ORCmdRefactoring subclass: #ORCmdInstVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! ORCmdInstVarRefactoring subclass: #ORCmdAbstractInstVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdAbstractInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 16:24'! label ^ 'abstract instvar'! ! !ORCmdAbstractInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:31'! refactoring ^ AbstractInstanceVariableRefactoring variable: (self chooseFrom: self instanceVariables) class: target theClass! ! ORCmdInstVarRefactoring subclass: #ORCmdAccessorInstVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdAccessorInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 16:25'! label ^ 'accessors for instvar'! ! !ORCmdAccessorInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:31'! refactoring ^ CreateAccessorsForVariableRefactoring variable: (self chooseFrom: self instanceVariables) class: target theClass classVariable: false! ! ORCmdInstVarRefactoring subclass: #ORCmdAddInstVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdAddInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 16:25'! label ^ 'add instvar'! ! !ORCmdAddInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:04'! refactoring ^ AddInstanceVariableRefactoring variable: (self request: 'Enter the new variable name:') class: target theClass! ! !ORCmdInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:13'! group ^ #'refactory.instvar'! ! !ORCmdInstVarRefactoring methodsFor: 'testing' stamp: 'lr 3/16/2007 18:20'! isActive ^ super isActive and: [ (target isKindOf: OBInstanceVariableNode) or: [ target isKindOf: OBClassNode ] ]! ! ORCmdInstVarRefactoring subclass: #ORCmdProtectInstVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdProtectInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 16:25'! label ^ 'protect instvar'! ! !ORCmdProtectInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:31'! refactoring ^ ProtectInstanceVariableRefactoring variable: (self chooseFrom: self instanceVariables) class: target theClass! ! ORCmdInstVarRefactoring subclass: #ORCmdPullUpInstVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdPullUpInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:35'! label ^ 'pull up instvar'! ! !ORCmdPullUpInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:32'! refactoring ^ PullUpInstanceVariableRefactoring variable: (self chooseFrom: self instanceVariables) class: target theClass superclass! ! ORCmdInstVarRefactoring subclass: #ORCmdPushDownInstVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdPushDownInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 16:25'! label ^ 'push down instvar'! ! !ORCmdPushDownInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:32'! refactoring ^ PushDownInstanceVariableRefactoring variable: (self chooseFrom: self instanceVariables) class: target theClass! ! ORCmdInstVarRefactoring subclass: #ORCmdRemoveInstVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRemoveInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 16:25'! label ^ 'remove instvar'! ! !ORCmdRemoveInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:35'! refactoring ^ RemoveInstanceVariableRefactoring remove: (self chooseFrom: self instanceVariables) from: target theClass! ! ORCmdInstVarRefactoring subclass: #ORCmdRenameInstVarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRenameInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 16:25'! label ^ 'rename instvar'! ! !ORCmdRenameInstVarRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:03'! refactoring ^ RenameInstanceVariableRefactoring rename: (self chooseFrom: self instanceVariables) to: (self request: 'Enter the new variable name:') in: target theClass! ! ORCmdRefactoring subclass: #ORCmdMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! ORCmdMethodRefactoring subclass: #ORCmdAddParameterMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdAddParameterMethodRefactoring methodsFor: 'accessing' stamp: 'lr 1/22/2007 09:04'! label ^ 'add parameter'! ! !ORCmdAddParameterMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:22'! refactoring | initializer newSelector initialAnswer | initialAnswer := target selector numArgs = 0 ifTrue: [ target selector , ':' ] ifFalse: [ target selector ]. newSelector := self request: 'Enter new selector:' initialAnswer: initialAnswer. newSelector isEmpty ifTrue: [ ^ nil ]. initializer := self request: 'Enter default value for parameter:' initialAnswer: 'nil'. initializer isEmpty ifTrue: [ ^ nil ]. ^ AddParameterRefactoring addParameterToMethod: target selector in: target theClass newSelector: newSelector asSymbol initializer: initializer! ! ORCmdMethodRefactoring subclass: #ORCmdInlineParameterRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdInlineParameterRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 09:57'! label ^ 'inline parameter'! ! !ORCmdInlineParameterRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:20'! refactoring ^ InlineParameterRefactoring inlineParameter: (self chooseFrom: self arguments) in: target theClass selector: target selector! ! ORCmdMethodRefactoring subclass: #ORCmdInlineSelfSendsMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdInlineSelfSendsMethodRefactoring methodsFor: 'accessing' stamp: 'lr 1/22/2007 09:07'! label ^ 'inline self sends'! ! !ORCmdInlineSelfSendsMethodRefactoring methodsFor: 'accessing' stamp: 'lr 1/22/2007 09:09'! refactoring ^ InlineAllSendersRefactoring sendersOf: target selector in: target theClass! ! !ORCmdMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 11:31'! arguments | parser | parser := RBParser new. parser errorBlock: [ :error :position | ^ #() ]. parser initializeParserWith: self source type: #on:errorBlock:. ^ parser parseMessagePattern argumentNames! ! !ORCmdMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 09:49'! group ^ #'refactory.method'! ! !ORCmdMethodRefactoring methodsFor: 'testing' stamp: 'lr 3/16/2007 18:26'! isActive ^ super isActive and: [ target class = OBMethodNode ]! ! !ORCmdMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 11:35'! source ^ target source! ! ORCmdMethodRefactoring subclass: #ORCmdMoveMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdMoveMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:17'! label ^ 'move method'! ! !ORCmdMoveMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 18:40'! refactoring ^ MoveMethodRefactoring selector: target selector class: target theClass variable: (self chooseFrom: self instanceVariables)! ! ORCmdMethodRefactoring subclass: #ORCmdPushDownMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdPushDownMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:26'! label ^ 'push down method'! ! !ORCmdPushDownMethodRefactoring methodsFor: 'accessing' stamp: 'lr 1/22/2007 09:00'! refactoring ^ PushDownMethodRefactoring pushDown: (Array with: target selector) from: target theClass! ! ORCmdMethodRefactoring subclass: #ORCmdPushUpMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdPushUpMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:29'! label ^ 'push up method'! ! !ORCmdPushUpMethodRefactoring methodsFor: 'accessing' stamp: 'lr 1/22/2007 09:00'! refactoring ^ PushUpMethodRefactoring pushUp: (Array with: target selector) from: target theClass! ! ORCmdMethodRefactoring subclass: #ORCmdRemoveMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRemoveMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:27'! label ^ 'remove method'! ! !ORCmdRemoveMethodRefactoring methodsFor: 'accessing' stamp: 'lr 1/22/2007 09:10'! refactoring ^ RemoveMethodRefactoring removeMethods: (Array with: target selector) from: target theClass! ! ORCmdMethodRefactoring subclass: #ORCmdRemoveParameterRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRemoveParameterRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 10:09'! label ^ 'remove parameter'! ! !ORCmdRemoveParameterRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 17:20'! refactoring ^ RemoveParameterRefactoring removeParameter: (self chooseFrom: self arguments) in: target theClass selector: target selector! ! ORCmdMethodRefactoring subclass: #ORCmdRenameMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRenameMethodRefactoring methodsFor: 'accessing' stamp: 'lr 1/22/2007 09:07'! label ^ 'rename method'! ! !ORCmdRenameMethodRefactoring methodsFor: 'accessing' stamp: 'lr 1/22/2007 09:20'! refactoring | oldMethodName newMethodName oldArguments argumentPermutation | oldArguments := (RBParser parseMethod: (target theClass methodHeaderFor: target selector)) argumentNames. oldMethodName := RBMethodName selector: target selector arguments: oldArguments. (newMethodName := MethodNameEditor forMethodName: oldMethodName) ifNil: [ ^ nil ]. argumentPermutation := newMethodName arguments collect: [ :each | oldArguments indexOf: each ]. ^ RenameMethodRefactoring renameMethod: target selector in: target theClass to: newMethodName selector permutation: argumentPermutation! ! ORCmdMethodRefactoring subclass: #ORCmdSwapMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdSwapMethodRefactoring methodsFor: 'accessing' stamp: 'lr 5/20/2007 09:14'! label ^ target theClass isMeta ifTrue: [ 'move to instance side' ] ifFalse: [ 'move to class side' ]! ! !ORCmdSwapMethodRefactoring methodsFor: 'accessing' stamp: 'lr 5/18/2007 13:07'! refactoring ^ ORSwapMethodChange swapMethod: target selector in: target theClass! ! !ORCmdRefactoring methodsFor: 'utilities' stamp: 'lr 3/16/2007 17:20'! chooseFrom: anArray ^ self chooseFrom: anArray title: nil! ! !ORCmdRefactoring methodsFor: 'utilities' stamp: 'lr 3/16/2007 17:19'! chooseFrom: anArray title: aString anArray isEmpty ifTrue: [ ^ nil ]. anArray size = 1 ifTrue: [ ^ anArray first ]. ^ OBChoiceRequest prompt: aString labels: anArray values: anArray! ! !ORCmdRefactoring methodsFor: 'accessing-calculated' stamp: 'lr 3/16/2007 18:32'! classVariables ^ (target isKindOf: OBClassVariableNode) ifTrue: [ Array with: target name ] ifFalse: [ target theNonMetaClass classVarNames asArray sort ]! ! !ORCmdRefactoring methodsFor: 'utilities' stamp: 'lr 1/22/2007 08:49'! confirm: aString ^ OBConfirmationRequest prompt: aString confirm: 'Yes' cancel: 'No'! ! !ORCmdRefactoring methodsFor: 'execution' stamp: 'lr 5/21/2007 14:55'! execute | refactoring | refactoring := self refactoring ifNil: [ ^ nil ]. refactoring model: (RBNamespace onEnvironment: self environment). self handleError: [ refactoring execute ]. ^ refactoring! ! !ORCmdRefactoring methodsFor: 'private' stamp: 'lr 3/31/2007 13:16'! handleError: aBlock ^ aBlock on: Refactoring preconditionSignal do: [ :ex | ex isResumable ifTrue: [ (self confirm: (ex messageText last = $? ifTrue: [ ex messageText ] ifFalse: [ ex messageText , '\Do you want to proceed?' withCRs ])) ifTrue: [ ex resume ] ] ifFalse: [ ex parameter notNil ifTrue: [ (self confirm: ex messageText) ifTrue: [ ex parameter value ] ] ifFalse: [ self inform: ex messageText ] ]. ex return: nil ]! ! !ORCmdRefactoring methodsFor: 'accessing-calculated' stamp: 'lr 3/16/2007 18:28'! instanceVariables ^ (target isKindOf: OBInstanceVariableNode) ifTrue: [ Array with: target name ] ifFalse: [ target theClass instVarNames asArray sort ]! ! !ORCmdRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 10:15'! isActive ^ (target isKindOf: OBClassAwareNode) and: [ requestor isSelected: target ]! ! !ORCmdRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 16:02'! refactoring self subclassResponsibility! ! !ORCmdRefactoring methodsFor: 'utilities' stamp: 'lr 3/16/2007 17:41'! request: aString ^ self request: aString initialAnswer: String new! ! !ORCmdRefactoring methodsFor: 'utilities' stamp: 'lr 3/16/2007 17:18'! request: aString initialAnswer: aTemplateString ^ OBTextRequest prompt: aString template: aTemplateString! ! ORCmdRefactoring subclass: #ORCmdSourceRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! ORCmdSourceRefactoring subclass: #ORCmdExtractMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdExtractMethodRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 13:12'! isEnabled ^ self isExtractableSelected! ! !ORCmdExtractMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 10:06'! label ^ 'extract method'! ! !ORCmdExtractMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 12:03'! refactoring ^ ExtractMethodRefactoring extract: self interval from: self selector in: self theClass! ! ORCmdSourceRefactoring subclass: #ORCmdExtractMethodToComponentRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdExtractMethodToComponentRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 13:12'! isEnabled ^ self isExtractableSelected! ! !ORCmdExtractMethodToComponentRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 10:06'! label ^ 'extract method to component'! ! !ORCmdExtractMethodToComponentRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 12:03'! refactoring ^ ExtractMethodToComponentRefactoring extract: self interval from: self selector in: self theClass! ! ORCmdSourceRefactoring subclass: #ORCmdExtractToTemporaryRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdExtractToTemporaryRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 13:12'! isEnabled ^ self isExtractableSelected! ! !ORCmdExtractToTemporaryRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 12:05'! label ^ 'extract to temporary'! ! !ORCmdExtractToTemporaryRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 12:04'! refactoring ^ ExtractToTemporaryRefactoring extract: self interval to: (self request: 'Enter the new variable name:') from: self selector in: self theClass! ! ORCmdSourceRefactoring subclass: #ORCmdInlineMethodFromComponentRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdInlineMethodFromComponentRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 13:16'! isEnabled ^ self isNonSelfSendSelected! ! !ORCmdInlineMethodFromComponentRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 10:07'! label ^ 'inline method from component'! ! !ORCmdInlineMethodFromComponentRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 12:49'! refactoring ^ InlineMethodFromComponentRefactoring inline: self interval inMethod: self selector forClass: self theClass! ! ORCmdSourceRefactoring subclass: #ORCmdInlineMethodRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdInlineMethodRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 13:16'! isEnabled ^ self isSelfSendSelected! ! !ORCmdInlineMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 10:07'! label ^ 'inline method'! ! !ORCmdInlineMethodRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 12:48'! refactoring ^ InlineMethodRefactoring inline: self interval inMethod: self selector forClass: self theClass! ! ORCmdSourceRefactoring subclass: #ORCmdInlineTemporaryRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdInlineTemporaryRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 13:21'! isEnabled ^ self isAssignmentSelected! ! !ORCmdInlineTemporaryRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 10:07'! label ^ 'inline temporary'! ! !ORCmdInlineTemporaryRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 13:23'! refactoring ^ InlineTemporaryRefactoring inline: self interval from: self selector in: self theClass! ! ORCmdSourceRefactoring subclass: #ORCmdMoveVariableDefinitionRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdMoveVariableDefinitionRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 13:26'! isEnabled ^ self isVariableSelected! ! !ORCmdMoveVariableDefinitionRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 10:07'! label ^ 'move variable definition'! ! !ORCmdMoveVariableDefinitionRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 13:25'! refactoring ^ MoveVariableDefinitionRefactoring bindTight: self interval in: self theClass selector: self selector! ! ORCmdSourceRefactoring subclass: #ORCmdRenameTemporaryRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRenameTemporaryRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 13:31'! isEnabled ^ self isVariableSelected! ! !ORCmdRenameTemporaryRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 10:10'! label ^ 'rename temporary'! ! !ORCmdRenameTemporaryRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 13:32'! refactoring ^ RenameTemporaryRefactoring renameTemporaryFrom: self interval to: (self request: 'Enter the new variable name:' initialAnswer: self selection) in: self theClass selector: self selector! ! !ORCmdSourceRefactoring class methodsFor: 'testing' stamp: 'lr 3/17/2007 10:42'! takesNodes ^ false! ! !ORCmdSourceRefactoring class methodsFor: 'testing' stamp: 'lr 3/17/2007 10:41'! takesText ^ true! ! !ORCmdSourceRefactoring methodsFor: 'accessing' stamp: 'lr 3/16/2007 19:17'! group ^ #'refactory.source'! ! !ORCmdSourceRefactoring methodsFor: 'testing-private' stamp: 'lr 3/17/2007 13:00'! ifNodeSelected: aBlock "Answer the result of evaluating aBlock with the currently selected parse tree node as argument or false, if there is no valid selection." | node | self interval isEmpty ifTrue: [ ^ false ]. (node := self node) isNil ifTrue: [ ^ false ]. ^ aBlock value: node! ! !ORCmdSourceRefactoring methodsFor: 'testing-private' stamp: 'lr 3/17/2007 13:18'! ifSendSelected: aBlock ^ self ifNodeSelected: [ :node | node isMessage and: [ aBlock value: node ] ]! ! !ORCmdSourceRefactoring methodsFor: 'accessing-selection' stamp: 'lr 3/17/2007 12:03'! interval ^ target instVarNamed: 'selection'! ! !ORCmdSourceRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 10:42'! isActive ^ true "^ super isActive and: [ target class = OBMethodNode ]"! ! !ORCmdSourceRefactoring methodsFor: 'testing-selection' stamp: 'lr 3/17/2007 13:22'! isAssignmentSelected ^ self ifNodeSelected: [ :node | node isAssignment ]! ! !ORCmdSourceRefactoring methodsFor: 'testing-selection' stamp: 'lr 3/17/2007 13:12'! isExtractableSelected ^ self ifNodeSelected: [ :node | node isMethod not and: [ node isVariable not ] ]! ! !ORCmdSourceRefactoring methodsFor: 'testing-selection' stamp: 'lr 3/17/2007 13:09'! isNonSelfSendSelected ^ self ifSendSelected: [ :node | node receiver isVariable not or: [ node receiver name ~= 'self' ] ]! ! !ORCmdSourceRefactoring methodsFor: 'testing-selection' stamp: 'lr 3/17/2007 13:04'! isSelfSendSelected ^ self ifSendSelected: [ :node | node receiver isVariable and: [ node receiver name = 'self' ] ]! ! !ORCmdSourceRefactoring methodsFor: 'testing-selection' stamp: 'lr 3/17/2007 13:26'! isVariableSelected ^ self ifNodeSelected: [ :node | node isVariable ]! ! !ORCmdSourceRefactoring methodsFor: 'accessing-selection' stamp: 'lr 3/17/2007 13:33'! node ^ RBParser parseExpression: self selection onError: [ :str :pos | ^ nil ]! ! !ORCmdSourceRefactoring methodsFor: 'accessing-selection' stamp: 'lr 3/17/2007 13:42'! selection ^ target text asString! ! !ORCmdSourceRefactoring methodsFor: 'accessing-selection' stamp: 'lr 3/17/2007 11:44'! selector ^ RBParser parseMethodPattern: self text! ! !ORCmdSourceRefactoring methodsFor: 'accessing-selection' stamp: 'lr 3/17/2007 13:42'! text ^ target fullText asString! ! !ORCmdSourceRefactoring methodsFor: 'accessing-selection' stamp: 'lr 3/17/2007 10:50'! theClass ^ requestor selectedClass! ! ORCmdSourceRefactoring subclass: #ORCmdTemporaryToInstvarRefactoring instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdTemporaryToInstvarRefactoring methodsFor: 'testing' stamp: 'lr 3/17/2007 13:39'! isEnabled ^ self isVariableSelected! ! !ORCmdTemporaryToInstvarRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 10:10'! label ^ 'temporary to instvar'! ! !ORCmdTemporaryToInstvarRefactoring methodsFor: 'accessing' stamp: 'lr 3/17/2007 13:39'! refactoring ^ TemporaryToInstanceVariableRefactoring class: self theClass selector: self selector variable: self selection! ! ORCommand subclass: #ORCmdRefactoringTools instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! ORCmdRefactoringTools subclass: #ORCmdRefactoringRedo instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRefactoringRedo methodsFor: 'execution' stamp: 'lr 3/31/2007 13:33'! execute self changeManager redoOperation! ! !ORCmdRefactoringRedo methodsFor: 'testing' stamp: 'lr 3/31/2007 13:17'! isEnabled ^ self changeManager hasRedoableOperations! ! !ORCmdRefactoringRedo methodsFor: 'accessing' stamp: 'lr 3/31/2007 13:35'! label ^ self isEnabled ifTrue: [ 'redo ' , self changeManager redoChange name ] ifFalse: [ 'redo refactoring' ]! ! !ORCmdRefactoringTools methodsFor: 'accessing' stamp: 'lr 3/31/2007 13:16'! changeManager ^ RefactoryChangeManager instance! ! !ORCmdRefactoringTools methodsFor: 'accessing' stamp: 'lr 3/31/2007 13:19'! group ^ #'refactory.tools'! ! !ORCmdRefactoringTools methodsFor: 'testing' stamp: 'lr 3/31/2007 13:25'! isActive ^ (target isKindOf: OBClassAwareNode) and: [ requestor isSelected: target ]! ! ORCmdRefactoringTools subclass: #ORCmdRefactoringUndo instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdRefactoringUndo methodsFor: 'execution' stamp: 'lr 3/31/2007 13:33'! execute self changeManager undoOperation! ! !ORCmdRefactoringUndo methodsFor: 'testing' stamp: 'lr 3/31/2007 13:17'! isEnabled ^ self changeManager hasUndoableOperations! ! !ORCmdRefactoringUndo methodsFor: 'accessing' stamp: 'lr 3/31/2007 13:35'! label ^ self isEnabled ifTrue: [ 'undo ' , self changeManager undoChange name ] ifFalse: [ 'undo refactoring' ]! ! ORCommand subclass: #ORCmdToggleContainment instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdToggleContainment methodsFor: 'execution' stamp: 'lr 5/21/2007 19:28'! execute | environment | environment := self environment asSelectorEnvironment. requestor browser environment: (self isPresent ifTrue: [ target removeFromEnvironment: environment ] ifFalse: [ target addToEnvironment: environment ]). requestor announcer announce: OBRefreshRequired! ! !ORCmdToggleContainment methodsFor: 'accessing' stamp: 'lr 5/21/2007 19:30'! group ^ #'refactory.environment'! ! !ORCmdToggleContainment methodsFor: 'testing' stamp: 'lr 5/21/2007 19:28'! isActive ^ requestor isSelected: target! ! !ORCmdToggleContainment methodsFor: 'testing' stamp: 'lr 5/21/2007 19:28'! isPresent ^ target withinBrowserEnvironment: self environment! ! !ORCmdToggleContainment methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:27'! keystroke ^ $/! ! !ORCmdToggleContainment methodsFor: 'accessing' stamp: 'lr 5/21/2007 19:31'! label ^ 'toggle containment'! ! ORCommand subclass: #ORCmdToggleView instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Refactory-Commands'! !ORCmdToggleView methodsFor: 'execution' stamp: 'lr 5/21/2007 21:23'! execute | filter | filter := requestor browser filter. filter mode: (filter mode = #filter ifTrue: [ #highlight ] ifFalse: [ #filter ]). requestor browser announce: OBRefreshRequired! ! !ORCmdToggleView methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:15'! group ^ #'refactory.environment'! ! !ORCmdToggleView methodsFor: 'testing' stamp: 'lr 5/21/2007 21:35'! isActive ^ requestor isSelected: target! ! !ORCmdToggleView methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:36'! keystroke ^ $\! ! !ORCmdToggleView methodsFor: 'accessing' stamp: 'lr 5/21/2007 21:11'! label ^ 'toggle view'! ! !ORCommand methodsFor: 'accessing' stamp: 'lr 5/21/2007 14:57'! environment ^ requestor browser environment! ! !OBClassNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 14:34'! withinBrowserEnvironment: anEnvironment ^ anEnvironment includesClass: self theNonMetaClass! ! !OBMetaNode methodsFor: '*ob-refactory' stamp: 'lr 5/21/2007 13:24'! filters ^ filters! !