Merged JK's version from Monticello
Name: PetitParser-JanKurs.275
Author: JanKurs
Time: 31-03-2015, 05:51:24.398 PM
UUID: 9ab3be24-8393-4794-a7e6-e318f3195673
Name: PetitTests-JanKurs.73
Author: JanKurs
Time: 21-02-2015, 01:10:13.115 PM
UUID: de4f77e3-2d07-476b-855e-69f845edfc7c
"{ Package: 'stx:goodies/petitparser/gui' }"
Refactoring subclass:#PPRenameProdcutionRefactoring
instanceVariableNames:'oldProduction newProduction class'
classVariableNames:''
poolDictionaries:''
category:'PetitGui-Refactoring'
!
!PPRenameProdcutionRefactoring class methodsFor:'instance creation'!
onClass: aClass rename: anOldSelector to: aNewSelector
^ self new
setClass: aClass;
setOldProduction: anOldSelector;
setNewProduction: aNewSelector;
yourself
! !
!PPRenameProdcutionRefactoring methodsFor:'initialization'!
setClass: aClass
class := self classObjectFor: aClass
!
setNewProduction: aSymbol
newProduction := aSymbol
!
setOldProduction: aSymbol
oldProduction := aSymbol
! !
!PPRenameProdcutionRefactoring methodsFor:'preconditions'!
preconditions
^ self checkCompositeParser: class
! !
!PPRenameProdcutionRefactoring methodsFor:'transforming'!
transform
| baseClass oldEnvironment |
baseClass := class whoDefinesInstanceVariable: oldProduction asString.
self performComponentRefactoring: (RenameInstanceVariableRefactoring
model: model
rename: oldProduction asString
to: newProduction asString
in: baseClass).
oldEnvironment := model environment.
model environment: (model environment
forClasses: baseClass realClass withAllSubclasses).
[ self performComponentRefactoring: (RenameMethodRefactoring
model: model
renameMethod: oldProduction asSymbol
in: baseClass
to: newProduction asSymbol
permutation: #()) ]
ensure: [ model environment: oldEnvironment ]
! !
!PPRenameProdcutionRefactoring class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPRenameProdcutionRefactoring.st,v 1.3 2014-03-04 23:33:51 cg Exp $'
!
version_CVS
^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPRenameProdcutionRefactoring.st,v 1.3 2014-03-04 23:33:51 cg Exp $'
! !