author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 03 Oct 2014 01:59:10 +0100 | |
changeset 376 | a2656b27cace |
parent 362 | 0809350b82c2 |
permissions | -rw-r--r-- |
340 | 1 |
"{ Package: 'stx:goodies/petitparser/gui' }" |
2 |
||
344
c0090f685ea8
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
340
diff
changeset
|
3 |
Refactoring subclass:#PPRenameProdcutionRefactoring |
340 | 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 |
|
362
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
44 |
| baseClass oldEnvironment | |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
45 |
baseClass := class whoDefinesInstanceVariable: oldProduction asString. |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
46 |
self performComponentRefactoring: (RenameInstanceVariableRefactoring |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
47 |
model: model |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
48 |
rename: oldProduction asString |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
49 |
to: newProduction asString |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
50 |
in: baseClass). |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
51 |
oldEnvironment := model environment. |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
52 |
model environment: (model environment |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
53 |
forClasses: baseClass realClass withAllSubclasses). |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
54 |
[ self performComponentRefactoring: (RenameMethodRefactoring |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
55 |
model: model |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
56 |
renameMethod: oldProduction asSymbol |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
57 |
in: baseClass |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
58 |
to: newProduction asSymbol |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
59 |
permutation: #()) ] |
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
60 |
ensure: [ model environment: oldEnvironment ] |
340 | 61 |
! ! |
62 |
||
63 |
!PPRenameProdcutionRefactoring class methodsFor:'documentation'! |
|
64 |
||
65 |
version |
|
362
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
66 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPRenameProdcutionRefactoring.st,v 1.3 2014-03-04 23:33:51 cg Exp $' |
340 | 67 |
! |
68 |
||
69 |
version_CVS |
|
362
0809350b82c2
class: PPRenameProdcutionRefactoring
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
70 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPRenameProdcutionRefactoring.st,v 1.3 2014-03-04 23:33:51 cg Exp $' |
340 | 71 |
! ! |
72 |