340
|
1 |
"{ Package: 'stx:goodies/petitparser/gui' }"
|
|
2 |
|
|
3 |
RBRefactoring subclass:#PPRenameProdcutionRefactoring
|
|
4 |
instanceVariableNames:'oldProduction newProduction class'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitGui-Refactoring'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!PPRenameProdcutionRefactoring class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
onClass: aClass rename: anOldSelector to: aNewSelector
|
|
14 |
^ self new
|
|
15 |
setClass: aClass;
|
|
16 |
setOldProduction: anOldSelector;
|
|
17 |
setNewProduction: aNewSelector;
|
|
18 |
yourself
|
|
19 |
! !
|
|
20 |
|
|
21 |
!PPRenameProdcutionRefactoring methodsFor:'initialization'!
|
|
22 |
|
|
23 |
setClass: aClass
|
|
24 |
class := self classObjectFor: aClass
|
|
25 |
!
|
|
26 |
|
|
27 |
setNewProduction: aSymbol
|
|
28 |
newProduction := aSymbol
|
|
29 |
!
|
|
30 |
|
|
31 |
setOldProduction: aSymbol
|
|
32 |
oldProduction := aSymbol
|
|
33 |
! !
|
|
34 |
|
|
35 |
!PPRenameProdcutionRefactoring methodsFor:'preconditions'!
|
|
36 |
|
|
37 |
preconditions
|
|
38 |
^ self checkCompositeParser: class
|
|
39 |
! !
|
|
40 |
|
|
41 |
!PPRenameProdcutionRefactoring methodsFor:'transforming'!
|
|
42 |
|
|
43 |
transform
|
|
44 |
| baseClass oldEnvironment |
|
|
45 |
baseClass := class whoDefinesInstanceVariable: oldProduction asString.
|
|
46 |
self performComponentRefactoring: (RBRenameInstanceVariableRefactoring
|
|
47 |
model: model
|
|
48 |
rename: oldProduction asString
|
|
49 |
to: newProduction asString
|
|
50 |
in: baseClass).
|
|
51 |
oldEnvironment := model environment.
|
|
52 |
model environment: (model environment
|
|
53 |
forClasses: baseClass realClass withAllSubclasses).
|
|
54 |
[ self performComponentRefactoring: (RBRenameMethodRefactoring
|
|
55 |
model: model
|
|
56 |
renameMethod: oldProduction asSymbol
|
|
57 |
in: baseClass
|
|
58 |
to: newProduction asSymbol
|
|
59 |
permutation: #()) ]
|
|
60 |
ensure: [ model environment: oldEnvironment ]
|
|
61 |
! !
|
|
62 |
|
|
63 |
!PPRenameProdcutionRefactoring class methodsFor:'documentation'!
|
|
64 |
|
|
65 |
version
|
|
66 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPRenameProdcutionRefactoring.st,v 1.1 2014-03-04 21:15:55 cg Exp $'
|
|
67 |
!
|
|
68 |
|
|
69 |
version_CVS
|
|
70 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPRenameProdcutionRefactoring.st,v 1.1 2014-03-04 21:15:55 cg Exp $'
|
|
71 |
! !
|
|
72 |
|