author | Jakub Nesveda <jakubnesveda@seznam.cz> |
Mon, 25 Aug 2014 23:45:19 +0200 | |
changeset 645 | 38a38c28ddb1 |
parent 634 | d77d9a7561be |
child 650 | 7514c13d6dd8 |
permissions | -rw-r--r-- |
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
1 |
"{ Package: 'jn:refactoring_custom' }" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
2 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
3 |
RefactoryBuilder subclass:#CustomRefactoryBuilder |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
4 |
instanceVariableNames:'changeManager' |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
5 |
classVariableNames:'' |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
6 |
poolDictionaries:'' |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
7 |
category:'Interface-Refactoring-Custom' |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
8 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
9 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
10 |
!CustomRefactoryBuilder class methodsFor:'documentation'! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
11 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
12 |
documentation |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
13 |
" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
14 |
Encapsulates performing refactoring changes on the source code within single object. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
15 |
Single refactorings are stored as change objects which represens changes in the source code. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
16 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
17 |
[author:] |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
18 |
Jakub Nesveda <nesvejak@fit.cvut.cz> |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
19 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
20 |
" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
21 |
! ! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
22 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
23 |
!CustomRefactoryBuilder methodsFor:'accessing'! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
24 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
25 |
change |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
26 |
"Returns single code change from collected code changes." |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
27 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
28 |
| change | |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
29 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
30 |
changes isEmpty ifTrue: [ |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
31 |
^ nil |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
32 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
33 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
34 |
change := CompositeRefactoryChange new. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
35 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
36 |
changes do: [ :codeChange | |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
37 |
change addChange: codeChange |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
38 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
39 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
40 |
^ change |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
41 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
42 |
"Created: / 15-08-2014 / 00:45:10 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
43 |
"Modified (comment): / 17-08-2014 / 17:16:38 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
44 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
45 |
|
634
d77d9a7561be
move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
632
diff
changeset
|
46 |
changeManager |
d77d9a7561be
move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
632
diff
changeset
|
47 |
^ changeManager |
d77d9a7561be
move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
632
diff
changeset
|
48 |
! |
d77d9a7561be
move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
632
diff
changeset
|
49 |
|
d77d9a7561be
move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
632
diff
changeset
|
50 |
changeManager:something |
d77d9a7561be
move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
632
diff
changeset
|
51 |
changeManager := something. |
d77d9a7561be
move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
632
diff
changeset
|
52 |
! |
d77d9a7561be
move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
632
diff
changeset
|
53 |
|
645
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
54 |
parser |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
55 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
56 |
^ RBParser |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
57 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
58 |
"Created: / 24-08-2014 / 23:36:55 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
59 |
! |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
60 |
|
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
61 |
searcher |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
62 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
63 |
^ ParseTreeSearcher new |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
64 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
65 |
"Created: / 16-08-2014 / 22:13:25 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
66 |
! ! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
67 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
68 |
!CustomRefactoryBuilder methodsFor:'compiling'! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
69 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
70 |
execute |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
71 |
" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
72 |
Most likely as compile method, but without undo change |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
73 |
in global RefactoryChangeManager |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
74 |
(true for CustomLocalChangeManager changeManager implementation) |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
75 |
" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
76 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
77 |
changeManager performChange: self change |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
78 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
79 |
"Created: / 15-08-2014 / 00:45:10 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
80 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
81 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
82 |
redoChanges |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
83 |
"redo all changes made by execute method" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
84 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
85 |
changeManager redoChanges |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
86 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
87 |
"Created: / 15-08-2014 / 00:46:47 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
88 |
! ! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
89 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
90 |
!CustomRefactoryBuilder methodsFor:'initialization'! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
91 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
92 |
initialize |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
93 |
"Invoked when a new instance is created." |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
94 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
95 |
super initialize. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
96 |
changeManager := CustomLocalChangeManager new. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
97 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
98 |
"Created: / 15-08-2014 / 00:42:39 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
99 |
! ! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
100 |
|
645
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
101 |
!CustomRefactoryBuilder methodsFor:'parsing'! |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
102 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
103 |
parseExpression: aSourceCode |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
104 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
105 |
^ self parser parseExpression: aSourceCode onError: [ :string :pos | |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
106 |
self parser parseMethod: aSourceCode onError: [ :string :pos | |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
107 |
self error: 'Could not parse ', string, ' at pos ', pos asString |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
108 |
] |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
109 |
] |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
110 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
111 |
"Created: / 25-08-2014 / 22:34:49 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
112 |
! |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
113 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
114 |
parseMethod: aSourceCode |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
115 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
116 |
^ self parser parseMethod: aSourceCode onError: [ :string :pos | |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
117 |
self parser parseExpression: aSourceCode onError: [ :string :pos | |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
118 |
self error: 'Could not parse ', string, ' at pos ', pos asString |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
119 |
] |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
120 |
] |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
121 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
122 |
"Created: / 25-08-2014 / 22:35:32 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
123 |
! ! |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
124 |
|
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
125 |
!CustomRefactoryBuilder methodsFor:'refactory-changes'! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
126 |
|
645
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
127 |
executeReplace: searchPattern with: rewritePattern inCodeSelection: aCodeSelection |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
128 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
129 |
| newTree change parseTree selectedParseTree newSelectedParseTree | |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
130 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
131 |
selectedParseTree := (self parseExpression: aCodeSelection selectedSourceCode) formattedCode. |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
132 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
133 |
newSelectedParseTree := (CustomParseTreeRewriter new) |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
134 |
replace: searchPattern with: rewritePattern; |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
135 |
executeTree: selectedParseTree; |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
136 |
tree. |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
137 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
138 |
parseTree := self parseMethod: aCodeSelection currentSourceCode. |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
139 |
newTree := CustomParseTreeRewriter |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
140 |
replace: aCodeSelection selectedSourceCode |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
141 |
with: newSelectedParseTree formattedCode |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
142 |
in: parseTree |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
143 |
onInterval: aCodeSelection selectedInterval. |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
144 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
145 |
change := InteractiveAddMethodChange |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
146 |
compile: newTree newSource |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
147 |
in: aCodeSelection selectedMethod mclass |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
148 |
classified: aCodeSelection selectedMethod category. |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
149 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
150 |
changes add: change |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
151 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
152 |
"Created: / 24-08-2014 / 10:24:52 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
153 |
"Modified: / 25-08-2014 / 23:33:15 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
154 |
! |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
155 |
|
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
156 |
executeReplace: searchPattern with: rewritePattern inMethod: aMethod |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
157 |
"Executes replace in a method source and then creates a method change" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
158 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
159 |
| newTree change | |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
160 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
161 |
newTree := (CustomParseTreeRewriter new) |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
162 |
replace: searchPattern with: rewritePattern; |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
163 |
executeTree: aMethod parseTree; |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
164 |
tree. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
165 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
166 |
change := InteractiveAddMethodChange |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
167 |
compile: newTree newSource |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
168 |
in: aMethod mclass |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
169 |
classified: aMethod category. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
170 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
171 |
changes add: change |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
172 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
173 |
"Created: / 17-08-2014 / 18:45:20 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
174 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
175 |
|
645
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
176 |
replace:searchPattern with:rewritePattern inCodeSelections:aCustomContext |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
177 |
"Searches for given pattern in methods source code and if source code matches then executes replacement" |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
178 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
179 |
self |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
180 |
search:searchPattern |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
181 |
inCodeSelections:aCustomContext selectedCodes |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
182 |
withResultDo:[:codeSelection | |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
183 |
self |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
184 |
executeReplace:searchPattern |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
185 |
with:rewritePattern |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
186 |
inCodeSelection:codeSelection |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
187 |
] |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
188 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
189 |
"Created: / 24-08-2014 / 10:10:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
190 |
! |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
191 |
|
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
192 |
replace: searchPattern with: rewritePattern inContext: aCustomContext |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
193 |
"Searches for given pattern in methods source code and if source code matches then executes replacement" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
194 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
195 |
self |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
196 |
search: searchPattern |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
197 |
inContext: aCustomContext |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
198 |
withResultDo: [ :method | |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
199 |
self executeReplace: searchPattern with: rewritePattern inMethod: method |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
200 |
] |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
201 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
202 |
"Created: / 16-08-2014 / 19:15:10 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
203 |
"Modified (comment): / 17-08-2014 / 19:30:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
204 |
! ! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
205 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
206 |
!CustomRefactoryBuilder methodsFor:'searching'! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
207 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
208 |
search: searchPattern inClass: aClass withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
209 |
| methods | |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
210 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
211 |
methods := OrderedCollection new. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
212 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
213 |
methods addAll: aClass theNonMetaclass methodDictionary values. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
214 |
methods addAll: aClass theMetaclass methodDictionary values. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
215 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
216 |
self search: searchPattern inMethods: methods withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
217 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
218 |
"Created: / 17-08-2014 / 13:15:03 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
219 |
"Modified: / 17-08-2014 / 17:18:27 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
220 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
221 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
222 |
search: searchPattern inClassCategories: aCategoryCollection withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
223 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
224 |
"To be implemented" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
225 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
226 |
"Created: / 17-08-2014 / 16:21:23 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
227 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
228 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
229 |
search: searchPattern inClasses: aClassCollection withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
230 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
231 |
aClassCollection do:[ :class | |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
232 |
self search: searchPattern inClass: class withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
233 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
234 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
235 |
"Created: / 17-08-2014 / 16:21:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
236 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
237 |
|
645
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
238 |
search:searchPattern inCodeSelections:aCodeSelectionCollection withResultDo:aBlock |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
239 |
|
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
240 |
aCodeSelectionCollection do:[ :codeSelection | |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
241 |
| parseTree selectedCode | |
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
242 |
|
645
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
243 |
selectedCode := codeSelection selectedSourceCode. |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
244 |
parseTree := self parseExpression: selectedCode. |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
245 |
"/ Transcript showCR: 'PP', parseTree asString. |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
246 |
(self searcher) |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
247 |
matches: searchPattern do: [ :aNode :answer | |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
248 |
aBlock value: codeSelection |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
249 |
]; |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
250 |
executeTree: parseTree |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
251 |
]. |
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
252 |
|
632
7a0f27afd9e0
change CustomRefactoryBuilder to work with CustomSourceCodeSelection
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
629
diff
changeset
|
253 |
"Created: / 21-08-2014 / 21:22:13 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
645
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
254 |
"Modified: / 25-08-2014 / 22:36:07 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
255 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
256 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
257 |
search: searchPattern inContext: aCustomContext withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
258 |
"Searches for source code pattern in whole context which contains code, methods, classes... " |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
259 |
|
632
7a0f27afd9e0
change CustomRefactoryBuilder to work with CustomSourceCodeSelection
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
629
diff
changeset
|
260 |
aCustomContext selectedCodes notNil ifTrue: [ |
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
261 |
self |
645
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
262 |
search:searchPattern |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
263 |
inCodeSelections:aCustomContext selectedCodes |
38a38c28ddb1
work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
264 |
withResultDo:aBlock |
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
265 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
266 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
267 |
aCustomContext selectedMethods notNil ifTrue: [ |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
268 |
self |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
269 |
search: searchPattern |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
270 |
inMethods: aCustomContext selectedMethods |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
271 |
withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
272 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
273 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
274 |
aCustomContext selectedMethodProtocols notNil ifTrue: [ |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
275 |
self |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
276 |
search: searchPattern |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
277 |
inMethodProtocols: aCustomContext selectedMethodProtocols |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
278 |
withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
279 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
280 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
281 |
aCustomContext selectedClasses notNil ifTrue: [ |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
282 |
self |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
283 |
search: searchPattern |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
284 |
inClasses: aCustomContext selectedClasses |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
285 |
withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
286 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
287 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
288 |
aCustomContext selectedClassCategories notNil ifTrue: [ |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
289 |
self |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
290 |
search: searchPattern |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
291 |
inClassCategories: aCustomContext selectedClassCategories |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
292 |
withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
293 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
294 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
295 |
aCustomContext selectedPackages notNil ifTrue: [ |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
296 |
self |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
297 |
search: searchPattern |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
298 |
inPackages: aCustomContext selectedPackages |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
299 |
withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
300 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
301 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
302 |
"Created: / 17-08-2014 / 16:21:24 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
632
7a0f27afd9e0
change CustomRefactoryBuilder to work with CustomSourceCodeSelection
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
629
diff
changeset
|
303 |
"Modified: / 21-08-2014 / 21:22:03 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
629
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
304 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
305 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
306 |
search: searchPattern inMethod: aMethod withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
307 |
| parseTree | |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
308 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
309 |
parseTree := aMethod parseTree. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
310 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
311 |
parseTree isNil ifTrue: [ |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
312 |
self error: 'Cannot retrieve parseTree for method: ', aMethod asString. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
313 |
] |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
314 |
ifFalse: [ |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
315 |
(self searcher) |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
316 |
matches: searchPattern do: [ :aNode :answer | |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
317 |
aBlock value: aMethod |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
318 |
]; |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
319 |
executeTree: parseTree |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
320 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
321 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
322 |
"Created: / 16-08-2014 / 22:27:35 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
323 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
324 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
325 |
search: searchPattern inMethodProtocols: aProtocolCollection withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
326 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
327 |
"To be implemented" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
328 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
329 |
"Created: / 17-08-2014 / 16:21:21 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
330 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
331 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
332 |
search: searchPattern inMethods: aMethodCollection withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
333 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
334 |
aMethodCollection do: [ :method | |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
335 |
self search: searchPattern inMethod: method withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
336 |
]. |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
337 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
338 |
"Created: / 17-08-2014 / 11:56:23 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
339 |
"Modified: / 17-08-2014 / 20:35:16 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
340 |
! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
341 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
342 |
search: searchPattern inPackages: aPackageCollection withResultDo: aBlock |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
343 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
344 |
"To be implemented" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
345 |
|
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
346 |
"Created: / 17-08-2014 / 16:21:24 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
347 |
! ! |
e85070e8c11b
add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
348 |