author | Claus Gittinger <cg@exept.de> |
Thu, 10 Aug 2017 10:05:49 +0200 | |
branch | cvs_MAIN |
changeset 1041 | 4413bae59f15 |
parent 969 | 123ea43adc5e |
child 1090 | 00020170fb98 |
permissions | -rw-r--r-- |
252
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
1 |
" |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
2 |
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
3 |
Copyright (C) 2013-2014 Jan Vrany |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
4 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
5 |
This library is free software; you can redistribute it and/or |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
6 |
modify it under the terms of the GNU Lesser General Public |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
7 |
License as published by the Free Software Foundation; either |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
8 |
version 2.1 of the License. |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
9 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
10 |
This library is distributed in the hope that it will be useful, |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
13 |
Lesser General Public License for more details. |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
14 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
15 |
You should have received a copy of the GNU Lesser General Public |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
16 |
License along with this library; if not, write to the Free Software |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
17 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
18 |
" |
249
8bc64027b189
Package renamed to stx:goodies/smallsense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
174
diff
changeset
|
19 |
"{ Package: 'stx:goodies/smallsense' }" |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
20 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
21 |
"{ NameSpace: SmallSense }" |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
22 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
23 |
Object subclass:#SmalltalkQuickFixer |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
24 |
instanceVariableNames:'view rule fixes' |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
25 |
classVariableNames:'' |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
26 |
poolDictionaries:'' |
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
27 |
category:'SmallSense-Smalltalk-Lint' |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
28 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
29 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
30 |
Object subclass:#QuickFix |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
31 |
instanceVariableNames:'rule label action' |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
32 |
classVariableNames:'' |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
33 |
poolDictionaries:'' |
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
34 |
privateIn:SmalltalkQuickFixer |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
35 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
36 |
|
252
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
37 |
!SmalltalkQuickFixer class methodsFor:'documentation'! |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
38 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
39 |
copyright |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
40 |
" |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
41 |
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
42 |
Copyright (C) 2013-2014 Jan Vrany |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
43 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
44 |
This library is free software; you can redistribute it and/or |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
45 |
modify it under the terms of the GNU Lesser General Public |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
46 |
License as published by the Free Software Foundation; either |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
47 |
version 2.1 of the License. |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
48 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
49 |
This library is distributed in the hope that it will be useful, |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
50 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
51 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
52 |
Lesser General Public License for more details. |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
53 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
54 |
You should have received a copy of the GNU Lesser General Public |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
55 |
License along with this library; if not, write to the Free Software |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
56 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
57 |
" |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
58 |
! ! |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
59 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
60 |
!SmalltalkQuickFixer class methodsFor:'instance creation'! |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
61 |
|
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
312
diff
changeset
|
62 |
forView: view |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
63 |
|
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
312
diff
changeset
|
64 |
^self new initializeForView: view |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
65 |
|
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
312
diff
changeset
|
66 |
"Created: / 15-12-2014 / 16:45:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
67 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
68 |
|
312 | 69 |
!SmalltalkQuickFixer methodsFor:'accessing'! |
70 |
||
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
312
diff
changeset
|
71 |
fixesForRule: rule |
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
312
diff
changeset
|
72 |
^ fixes select:[:fix | fix rule == rule ] |
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
312
diff
changeset
|
73 |
|
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
312
diff
changeset
|
74 |
"Created: / 15-12-2014 / 16:47:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
312 | 75 |
! ! |
76 |
||
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
77 |
!SmalltalkQuickFixer methodsFor:'adding'! |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
78 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
79 |
fix |
963 | 80 |
"Create and return new quick fix. |
81 |
Caller MUST set its rule, label and action" |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
82 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
83 |
| fix | |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
84 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
85 |
fix := QuickFix new. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
86 |
fixes add: fix. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
87 |
^fix |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
88 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
89 |
"Created: / 01-02-2012 / 10:51:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
312
diff
changeset
|
90 |
"Modified (comment): / 15-12-2014 / 16:48:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
91 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
92 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
93 |
!SmalltalkQuickFixer methodsFor:'initialization'! |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
94 |
|
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
312
diff
changeset
|
95 |
initializeForView: aCodeView2 |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
96 |
view := aCodeView2. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
97 |
fixes := OrderedCollection new: 3. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
98 |
|
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
312
diff
changeset
|
99 |
"Created: / 15-12-2014 / 16:46:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
100 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
101 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
102 |
!SmalltalkQuickFixer methodsFor:'performing fixes'! |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
103 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
104 |
performFix: index |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
105 |
|
963 | 106 |
index > fixes size ifTrue:[ |
107 |
Dialog warn: ('No such fix (%1)' bindWith: index). |
|
108 |
^ self |
|
109 |
]. |
|
110 |
(fixes at: index) performFix. |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
111 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
112 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
113 |
!SmalltalkQuickFixer methodsFor:'utilities'! |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
114 |
|
969 | 115 |
apply:aRefactoryChange |
116 |
|changes firstChange browser| |
|
117 |
||
118 |
changes := aRefactoryChange changes. |
|
119 |
||
97
062cd1535107
Fix in SmallSense::SmalltalkQuickFixer>>#apply:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
92
diff
changeset
|
120 |
changes isEmptyOrNil ifTrue: [ |
062cd1535107
Fix in SmallSense::SmalltalkQuickFixer>>#apply:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
92
diff
changeset
|
121 |
^ self |
062cd1535107
Fix in SmallSense::SmalltalkQuickFixer>>#apply:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
92
diff
changeset
|
122 |
]. |
969 | 123 |
firstChange := changes anElement. |
124 |
||
125 |
(changes size == 1 and: [ firstChange isMethodCodeChange ]) ifTrue: [ |
|
296
981a82217e4c
UX improvement for quick fixes: do not scroll to the top
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
126 |
"/ Only one change, modify the code directly in the editor |
981a82217e4c
UX improvement for quick fixes: do not scroll to the top
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
127 |
|
981a82217e4c
UX improvement for quick fixes: do not scroll to the top
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
128 |
| oldSource newSource | |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
129 |
|
92
67592095147e
Improvement in QuickFixer - if the fix is local to the method, only update codeview's contents.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
130 |
oldSource := view contents asString string. |
969 | 131 |
newSource := firstChange source asString. |
97
062cd1535107
Fix in SmallSense::SmalltalkQuickFixer>>#apply:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
92
diff
changeset
|
132 |
oldSource ~= newSource ifTrue: [ |
296
981a82217e4c
UX improvement for quick fixes: do not scroll to the top
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
133 |
| line | |
981a82217e4c
UX improvement for quick fixes: do not scroll to the top
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
134 |
|
876
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
135 |
view |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
136 |
undoableDo:[ |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
137 |
line := view firstLineShown. |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
138 |
view replaceContentsWith:newSource asStringCollection. |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
139 |
"/ view contents: newSource asStringCollection clear: false. |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
140 |
view modified: true. |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
141 |
view isCodeView2 ifTrue: [ |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
142 |
view reallyModifiedChannel value: true. |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
143 |
]. |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
144 |
view scrollToLine:line. |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
145 |
] |
43f96cd0eee1
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
844
diff
changeset
|
146 |
info:'Rewrite the code'. |
92
67592095147e
Improvement in QuickFixer - if the fix is local to the method, only update codeview's contents.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
147 |
]. |
969 | 148 |
^ self. |
149 |
]. |
|
150 |
||
151 |
browser := view application topApplication. |
|
152 |
(browser respondsTo: #performRefactoring:) ifTrue: [ |
|
153 |
browser performRefactoring: changes. |
|
97
062cd1535107
Fix in SmallSense::SmalltalkQuickFixer>>#apply:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
92
diff
changeset
|
154 |
] ifFalse: [ |
969 | 155 |
self breakPoint: #jv. |
156 |
Dialog warn:'Sorry, this application does not support quick fixes' |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
157 |
] |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
158 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
159 |
"Created: / 16-02-2012 / 14:46:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
296
981a82217e4c
UX improvement for quick fixes: do not scroll to the top
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
160 |
"Modified: / 16-10-2014 / 03:05:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
161 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
162 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
163 |
!SmalltalkQuickFixer::QuickFix methodsFor:'accessing'! |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
164 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
165 |
action |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
166 |
^ action |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
167 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
168 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
169 |
action:aBlock |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
170 |
action := aBlock. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
171 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
172 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
173 |
label |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
174 |
^ label |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
175 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
176 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
177 |
label:aString |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
178 |
label := aString. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
179 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
180 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
181 |
performFix |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
182 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
183 |
^action value |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
184 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
185 |
"Created: / 16-02-2012 / 14:48:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
186 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
187 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
188 |
rule |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
189 |
^ rule |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
190 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
191 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
192 |
rule:anRBLintRule |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
193 |
rule := anRBLintRule. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
194 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
195 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
196 |
!SmalltalkQuickFixer class methodsFor:'documentation'! |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
197 |
|
844
bd087277b82e
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
198 |
version_CVS |
bd087277b82e
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
199 |
|
bd087277b82e
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
200 |
^ '$Header$' |
bd087277b82e
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
201 |
! |
bd087277b82e
class: SmallSense::SmalltalkQuickFixer
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
202 |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
203 |
version_HG |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
204 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
205 |
^ '$Changeset: <not expanded> $' |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
206 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
207 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
208 |
version_SVN |
320
5242593726f0
Updated from upstream repository to revision 0a4845a0c211
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
315
diff
changeset
|
209 |
^ '$Id$' |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
210 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
211 |