author | Claus Gittinger <cg@exept.de> |
Wed, 06 Jul 2011 20:13:33 +0200 | |
changeset 10228 | 18cbae55c53b |
parent 10200 | 454d96e87e85 |
child 10257 | bdc20c20c46c |
permissions | -rw-r--r-- |
5591 | 1 |
" |
2 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libtool' }" |
|
13 |
||
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
BrowserList subclass:#MethodList |
|
17 |
instanceVariableNames:'classes selectedMethodNameIndices methodList lastSelectedMethods |
|
18 |
browserNameList variableFilter filterClassVars updateProcess |
|
19 |
lastShowClass lastShowCategory lastShowClassFirst |
|
20 |
showMethodInheritance lastMethodClass lastMethodClassesSubclasses |
|
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
21 |
classAndSelectorsRedefinedBySubclassesOfClass showClass |
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
22 |
showMethodComplexity showMethodTypeIcon |
10228 | 23 |
showImageResourceMethodsImages' |
6271 | 24 |
classVariableNames:'ShowComplexityValue' |
5591 | 25 |
poolDictionaries:'' |
26 |
category:'Interface-Browsers-New' |
|
27 |
! |
|
28 |
||
29 |
!MethodList class methodsFor:'documentation'! |
|
30 |
||
31 |
copyright |
|
32 |
" |
|
33 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
34 |
All Rights Reserved |
|
35 |
||
36 |
This software is furnished under a license and may be used |
|
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! ! |
|
44 |
||
45 |
!MethodList class methodsFor:'interface specs'! |
|
46 |
||
47 |
singleMethodWindowSpec |
|
48 |
"This resource specification was automatically generated |
|
49 |
by the UIPainter of ST/X." |
|
50 |
||
51 |
"Do not manually edit this!! If it is corrupted, |
|
52 |
the UIPainter may not be able to read the specification." |
|
53 |
||
54 |
" |
|
55 |
UIPainter new openOnClass:MethodList andSelector:#singleMethodWindowSpec |
|
56 |
MethodList new openInterface:#singleMethodWindowSpec |
|
57 |
" |
|
58 |
||
59 |
<resource: #canvas> |
|
60 |
||
61 |
^ |
|
62 |
#(#FullSpec |
|
63 |
#name: #singleMethodWindowSpec |
|
64 |
#window: |
|
65 |
#(#WindowSpec |
|
66 |
#label: 'SingleSelectorList' |
|
67 |
#name: 'SingleSelectorList' |
|
68 |
#min: #(#Point 0 0) |
|
69 |
#max: #(#Point 1024 721) |
|
70 |
#bounds: #(#Rectangle 12 22 312 322) |
|
71 |
) |
|
72 |
#component: |
|
73 |
#(#SpecCollection |
|
74 |
#collection: #( |
|
75 |
#(#LabelSpec |
|
76 |
#label: 'MethodName' |
|
77 |
#name: 'MethodLabel' |
|
78 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 25 0) |
|
79 |
#translateLabel: true |
|
80 |
#labelChannel: #methodLabelHolder |
|
81 |
#menu: #menuHolder |
|
82 |
) |
|
83 |
) |
|
84 |
||
85 |
) |
|
86 |
) |
|
87 |
||
88 |
"Modified: / 1.3.2000 / 20:50:15 / cg" |
|
89 |
! |
|
90 |
||
91 |
windowSpec |
|
92 |
"This resource specification was automatically generated |
|
93 |
by the UIPainter of ST/X." |
|
94 |
||
95 |
"Do not manually edit this!! If it is corrupted, |
|
96 |
the UIPainter may not be able to read the specification." |
|
97 |
||
98 |
" |
|
99 |
UIPainter new openOnClass:MethodList andSelector:#windowSpec |
|
100 |
MethodList new openInterface:#windowSpec |
|
101 |
MethodList open |
|
102 |
" |
|
103 |
||
104 |
<resource: #canvas> |
|
105 |
||
106 |
^ |
|
107 |
#(#FullSpec |
|
108 |
#name: #windowSpec |
|
109 |
#window: |
|
110 |
#(#WindowSpec |
|
111 |
#label: 'SelectorList' |
|
112 |
#name: 'SelectorList' |
|
113 |
#min: #(#Point 0 0) |
|
114 |
#bounds: #(#Rectangle 12 22 312 322) |
|
115 |
) |
|
116 |
#component: |
|
117 |
#(#SpecCollection |
|
118 |
#collection: #( |
|
119 |
#(#SequenceViewSpec |
|
120 |
#name: 'List' |
|
121 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
122 |
#tabable: true |
|
123 |
#model: #selectedMethodNameIndices |
|
124 |
#menu: #menuHolder |
|
125 |
#hasHorizontalScrollBar: true |
|
126 |
#hasVerticalScrollBar: true |
|
127 |
#miniScrollerHorizontal: true |
|
128 |
#isMultiSelect: true |
|
129 |
#valueChangeSelector: #selectionChangedByClick |
|
130 |
#useIndex: true |
|
131 |
#sequenceList: #browserNameList |
|
132 |
#doubleClickChannel: #doubleClickChannel |
|
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
133 |
#properties: |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
134 |
#(#PropertyListDictionary |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
135 |
#dragArgument: nil |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
136 |
#dropArgument: nil |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
137 |
#canDropSelector: #canDropContext: |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
138 |
#dropSelector: #doDropContext: |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
139 |
) |
5591 | 140 |
) |
141 |
) |
|
142 |
||
143 |
) |
|
144 |
) |
|
145 |
! ! |
|
146 |
||
147 |
!MethodList class methodsFor:'plugIn spec'! |
|
148 |
||
149 |
aspectSelectors |
|
150 |
"This resource specification was automatically generated |
|
151 |
by the UIPainter of ST/X." |
|
152 |
||
153 |
"Do not manually edit this. If it is corrupted, |
|
154 |
the UIPainter may not be able to read the specification." |
|
155 |
||
156 |
"Return a description of exported aspects; |
|
157 |
these can be connected to aspects of an embedding application |
|
158 |
(if this app is embedded in a subCanvas)." |
|
159 |
||
160 |
^ #( |
|
9421 | 161 |
"/ #classHolder |
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
162 |
#(#doubleClickChannel #action ) |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
163 |
#forceGeneratorTrigger |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
164 |
#immediateUpdate |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
165 |
#inGeneratorHolder |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
166 |
#menuHolder |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
167 |
#methodCategoryHolder |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
168 |
#packageFilter |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
169 |
#selectedMethods |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
170 |
#selectionChangeCondition |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
171 |
#updateTrigger |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
172 |
#variableFilter |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
173 |
#filterClassVars |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
174 |
#showMethodInheritance |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
175 |
#showMethodComplexity |
6268 | 176 |
#showMethodTypeIcon |
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
177 |
#showImageResourceMethodsImages |
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
178 |
#sortBy |
9438 | 179 |
#showCoverageInformation |
5591 | 180 |
). |
9421 | 181 |
|
9438 | 182 |
"Modified: / 27-04-2010 / 16:13:57 / cg" |
5591 | 183 |
! ! |
184 |
||
185 |
!MethodList methodsFor:'aspects'! |
|
186 |
||
187 |
browserNameList |
|
188 |
browserNameList isNil ifTrue:[ |
|
189 |
browserNameList := List new. |
|
190 |
]. |
|
191 |
^ browserNameList. |
|
192 |
||
193 |
"Modified: / 31.1.2000 / 00:42:44 / cg" |
|
194 |
"Created: / 5.2.2000 / 22:38:32 / cg" |
|
195 |
! |
|
196 |
||
197 |
defaultSlaveModeValue |
|
198 |
^ false. |
|
199 |
! |
|
200 |
||
201 |
filterClassVars |
|
202 |
filterClassVars isNil ifTrue:[ |
|
203 |
filterClassVars := false asValue. |
|
204 |
filterClassVars addDependent:self |
|
205 |
]. |
|
206 |
^ filterClassVars |
|
207 |
! |
|
208 |
||
209 |
filterClassVars:aValueHolder |
|
210 |
filterClassVars notNil ifTrue:[ |
|
211 |
filterClassVars removeDependent:self |
|
212 |
]. |
|
213 |
filterClassVars := aValueHolder. |
|
214 |
filterClassVars notNil ifTrue:[ |
|
215 |
filterClassVars addDependent:self |
|
216 |
]. |
|
217 |
! |
|
218 |
||
219 |
methodLabelHolder |
|
220 |
^ self pseudoListLabelHolder |
|
221 |
||
222 |
"Created: / 1.3.2000 / 20:50:07 / cg" |
|
223 |
! |
|
224 |
||
225 |
methodList |
|
226 |
^ methodList |
|
227 |
! |
|
228 |
||
229 |
selectedMethodNameIndices |
|
230 |
selectedMethodNameIndices isNil ifTrue:[ |
|
231 |
selectedMethodNameIndices := ValueHolder new. |
|
232 |
selectedMethodNameIndices addDependent:self |
|
233 |
]. |
|
234 |
^ selectedMethodNameIndices. |
|
235 |
||
236 |
"Modified: / 5.2.2000 / 00:31:48 / cg" |
|
237 |
"Created: / 5.2.2000 / 22:59:31 / cg" |
|
238 |
! |
|
239 |
||
240 |
selectedMethods |
|
241 |
^ self selectionHolder |
|
242 |
! |
|
243 |
||
244 |
selectedMethods:aValueHolder |
|
245 |
^ self selectionHolder:aValueHolder |
|
246 |
! |
|
247 |
||
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
248 |
showImageResourceMethodsImages |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
249 |
showImageResourceMethodsImages isNil ifTrue:[ |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
250 |
showImageResourceMethodsImages := false asValue. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
251 |
showImageResourceMethodsImages addDependent:self |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
252 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
253 |
^ showImageResourceMethodsImages |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
254 |
! |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
255 |
|
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
256 |
showImageResourceMethodsImages:aValueHolder |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
257 |
showImageResourceMethodsImages notNil ifTrue:[ |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
258 |
showImageResourceMethodsImages removeDependent:self |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
259 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
260 |
showImageResourceMethodsImages := aValueHolder. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
261 |
showImageResourceMethodsImages notNil ifTrue:[ |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
262 |
showImageResourceMethodsImages addDependent:self |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
263 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
264 |
! |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
265 |
|
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
266 |
showMethodComplexity |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
267 |
showMethodComplexity isNil ifTrue:[ |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
268 |
showMethodComplexity := false asValue. |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
269 |
showMethodComplexity addDependent:self |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
270 |
]. |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
271 |
^ showMethodComplexity |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
272 |
! |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
273 |
|
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
274 |
showMethodComplexity:aValueHolder |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
275 |
showMethodComplexity notNil ifTrue:[ |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
276 |
showMethodComplexity removeDependent:self |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
277 |
]. |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
278 |
showMethodComplexity := aValueHolder. |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
279 |
showMethodComplexity notNil ifTrue:[ |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
280 |
showMethodComplexity addDependent:self |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
281 |
]. |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
282 |
! |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
283 |
|
5591 | 284 |
showMethodInheritance |
285 |
showMethodInheritance isNil ifTrue:[ |
|
286 |
showMethodInheritance := false asValue. |
|
287 |
showMethodInheritance addDependent:self |
|
288 |
]. |
|
289 |
^ showMethodInheritance |
|
290 |
! |
|
291 |
||
292 |
showMethodInheritance:aValueHolder |
|
293 |
showMethodInheritance notNil ifTrue:[ |
|
294 |
showMethodInheritance removeDependent:self |
|
295 |
]. |
|
296 |
showMethodInheritance := aValueHolder. |
|
297 |
showMethodInheritance notNil ifTrue:[ |
|
298 |
showMethodInheritance addDependent:self |
|
299 |
]. |
|
300 |
! |
|
301 |
||
6268 | 302 |
showMethodTypeIcon |
303 |
showMethodTypeIcon isNil ifTrue:[ |
|
304 |
showMethodTypeIcon := true asValue. |
|
305 |
showMethodTypeIcon addDependent:self |
|
306 |
]. |
|
307 |
^ showMethodTypeIcon |
|
308 |
! |
|
309 |
||
310 |
showMethodTypeIcon:aValueHolder |
|
311 |
showMethodTypeIcon notNil ifTrue:[ |
|
312 |
showMethodTypeIcon removeDependent:self |
|
313 |
]. |
|
314 |
showMethodTypeIcon := aValueHolder. |
|
315 |
showMethodTypeIcon notNil ifTrue:[ |
|
316 |
showMethodTypeIcon addDependent:self |
|
317 |
]. |
|
318 |
! |
|
319 |
||
5591 | 320 |
variableFilter |
321 |
variableFilter isNil ifTrue:[ |
|
322 |
variableFilter := nil asValue. |
|
323 |
variableFilter addDependent:self |
|
324 |
]. |
|
325 |
^ variableFilter |
|
326 |
! |
|
327 |
||
328 |
variableFilter:aValueHolder |
|
329 |
variableFilter notNil ifTrue:[ |
|
330 |
variableFilter removeDependent:self |
|
331 |
]. |
|
332 |
variableFilter := aValueHolder. |
|
333 |
variableFilter notNil ifTrue:[ |
|
334 |
variableFilter addDependent:self |
|
335 |
]. |
|
336 |
! ! |
|
337 |
||
338 |
!MethodList methodsFor:'change & update'! |
|
339 |
||
340 |
delayedUpdate:something with:aParameter from:changedObject |
|
341 |
|cls sel oldMethod newMethod methods newSelection |
|
342 |
selectionHolder selection needSelectionChange| |
|
343 |
||
344 |
selectionHolder := self selectedMethods. |
|
345 |
selection := selectionHolder value. |
|
346 |
||
347 |
changedObject == Smalltalk ifTrue:[ |
|
5998 | 348 |
classes notNil ifTrue:[ |
349 |
something == #methodCategory ifTrue:[ |
|
350 |
"/ ignore here - methodCategoryList will tell me if required |
|
351 |
^ self |
|
352 |
]. |
|
6663
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
353 |
(something == #classOrganization |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
354 |
or:[ something == #methodCategoryAdded |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
355 |
or:[ something == #methodCategoryRemoved |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
356 |
or:[ something == #methodCategoriesRemoved |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
357 |
or:[ something == #methodCategoryRenamed ]]]]) ifTrue:[ |
5998 | 358 |
"/ ignore here - methodCategoryList will tell me if required |
359 |
^ self |
|
360 |
]. |
|
5591 | 361 |
|
5998 | 362 |
something == #methodInClass ifTrue:[ |
363 |
"/ a method has been added/changed |
|
364 |
cls := aParameter at:1. |
|
365 |
(classes includesIdentical:cls) ifTrue:[ |
|
366 |
sel := aParameter at:2. |
|
367 |
oldMethod := aParameter at:3. |
|
368 |
newMethod := cls compiledMethodAt:sel. |
|
369 |
(oldMethod notNil and:[newMethod notNil]) ifTrue:[ |
|
370 |
"a method was changed & acccepted; |
|
371 |
No need for a rescan of the methodDictionary; |
|
372 |
however, ensure that the refs to the old method are updated |
|
373 |
" |
|
374 |
methods := selection. |
|
375 |
methods size > 0 ifTrue:[ |
|
376 |
(methods includesIdentical:oldMethod) ifTrue:[ |
|
377 |
needSelectionChange := true. |
|
378 |
] |
|
379 |
]. |
|
380 |
methodList replaceAllIdentical:oldMethod with:newMethod. |
|
381 |
lastSelectedMethods notNil ifTrue:[ |
|
382 |
lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod |
|
383 |
]. |
|
384 |
methods size > 0 ifTrue:[ |
|
385 |
methods := methods asOrderedCollection. |
|
386 |
methods replaceAllIdentical:oldMethod with:newMethod. |
|
387 |
]. |
|
5591 | 388 |
|
5998 | 389 |
needSelectionChange == true ifTrue:[ |
390 |
selectionHolder setValue:methods. |
|
6575
94f336bcb07b
update notifiaction from other browsers (refix)
Claus Gittinger <cg@exept.de>
parents:
6490
diff
changeset
|
391 |
"/ self enqueueDelayedMethodsSelectionChanged. |
94f336bcb07b
update notifiaction from other browsers (refix)
Claus Gittinger <cg@exept.de>
parents:
6490
diff
changeset
|
392 |
"/ need this to inform my browser that method was changed |
94f336bcb07b
update notifiaction from other browsers (refix)
Claus Gittinger <cg@exept.de>
parents:
6490
diff
changeset
|
393 |
"/ by someone else. |
94f336bcb07b
update notifiaction from other browsers (refix)
Claus Gittinger <cg@exept.de>
parents:
6490
diff
changeset
|
394 |
selectionHolder changed. |
5998 | 395 |
]. |
396 |
(variableFilter value size > 0 |
|
397 |
or:[oldMethod package ~= newMethod package |
|
6260 | 398 |
or:[oldMethod resources ~= newMethod resources |
6694 | 399 |
or:[showMethodComplexity value == true]]]) ifTrue:[ |
5998 | 400 |
"/ only update that methods entry |
401 |
self updateListEntryFor:newMethod. |
|
402 |
"/ sigh - must invalidate |
|
403 |
"/ self invalidateList. |
|
404 |
]. |
|
405 |
^ self. |
|
406 |
]. |
|
407 |
"/ method was added - update the methodList |
|
408 |
"/ Q: is this needed (methodCategoryList should send me a new inGenerator) |
|
409 |
self invalidateList. |
|
410 |
]. |
|
411 |
^ self. |
|
412 |
]. |
|
413 |
||
414 |
something == #methodInClassRemoved ifTrue:[ |
|
415 |
cls := aParameter at:1. |
|
416 |
(classes includesIdentical:cls) ifTrue:[ |
|
417 |
sel := aParameter at:2. |
|
418 |
"/ method was removed - update the methodList |
|
419 |
"/ Q: is this needed (methodCategoryList should send me a new inGenerator) |
|
420 |
self invalidateList. |
|
421 |
]. |
|
422 |
^ self. |
|
423 |
]. |
|
5591 | 424 |
|
5998 | 425 |
(something == #methodTrap |
426 |
or:[ something == #privacyOfMethod ]) ifTrue:[ |
|
427 |
cls := aParameter at:1. |
|
428 |
sel := aParameter at:2. |
|
429 |
(classes includesIdentical:cls) ifFalse:[ ^ self]. |
|
430 |
newMethod := cls compiledMethodAt:sel. |
|
431 |
newMethod isNil ifTrue:[ |
|
432 |
self invalidateList. |
|
433 |
^ self |
|
434 |
]. |
|
5591 | 435 |
|
5998 | 436 |
(something == #privacyOfMethod) ifTrue:[ |
437 |
self updateListEntryFor:newMethod. |
|
438 |
]. |
|
439 |
||
440 |
(something == #methodTrap) ifTrue:[ |
|
441 |
newMethod isWrapped ifTrue:[ |
|
442 |
oldMethod := newMethod originalMethod |
|
443 |
] ifFalse:[ |
|
444 |
selection size > 0 ifTrue:[ |
|
445 |
oldMethod := selection detect:[:each | each isWrapped and:[each originalMethod == newMethod]] ifNone:nil. |
|
446 |
] |
|
447 |
]. |
|
5591 | 448 |
|
5998 | 449 |
selection size > 0 ifTrue:[ |
450 |
(selection includesIdentical:oldMethod) ifTrue:[ |
|
451 |
needSelectionChange := true. |
|
452 |
] |
|
453 |
]. |
|
454 |
methodList replaceAllIdentical:oldMethod with:newMethod. |
|
455 |
lastSelectedMethods notNil ifTrue:[ |
|
456 |
lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod |
|
457 |
]. |
|
458 |
selection size > 0 ifTrue:[ |
|
459 |
selection := selection asOrderedCollection. |
|
460 |
selection replaceAllIdentical:oldMethod with:newMethod. |
|
461 |
]. |
|
462 |
needSelectionChange == true ifTrue:[ |
|
463 |
selectionHolder changed. |
|
464 |
]. |
|
5591 | 465 |
|
5998 | 466 |
"/ actually, could just change that single item ... |
467 |
"/ ... might be cheaper, if list is huge. |
|
468 |
"/ only update that methods entry |
|
469 |
self updateListEntryFor:newMethod. |
|
470 |
"/ self invalidateList. |
|
471 |
]. |
|
472 |
^ self |
|
473 |
]. |
|
5591 | 474 |
|
6846 | 475 |
(something == #projectOrganization |
476 |
or:[something == #lastTestRunResult]) ifTrue:[ |
|
5998 | 477 |
aParameter notNil ifTrue:[ |
478 |
cls := aParameter at:1. |
|
479 |
cls notNil ifTrue:[ |
|
480 |
((classes includesIdentical:cls theNonMetaclass) |
|
481 |
or:[(classes includesIdentical:cls theMetaclass)]) ifTrue:[ |
|
482 |
self invalidateList. |
|
483 |
]. |
|
484 |
]. |
|
485 |
] ifFalse:[ |
|
486 |
self invalidateList. |
|
487 |
]. |
|
488 |
^ self |
|
489 |
]. |
|
6846 | 490 |
|
5998 | 491 |
"/ everything else is ignored |
492 |
"/ self halt. |
|
493 |
]. |
|
494 |
^ self |
|
5591 | 495 |
]. |
496 |
||
497 |
"/ something == #organization ifTrue:[ |
|
498 |
"/self halt:'no longer'. |
|
499 |
"/^ self. |
|
500 |
"/ "/ a methods cateory has changed |
|
501 |
"/ (classes includesIdentical:changedObject) ifTrue:[ |
|
502 |
"/ aParameter isSymbol ifTrue:[ |
|
503 |
"/ "/ a method with a new category |
|
504 |
"/ (self methodList includesIdentical:(changedObject compiledMethodAt:aParameter)) ifTrue:[ |
|
505 |
"/ self invalidateList. |
|
506 |
"/ ]. |
|
507 |
"/ ^ self. |
|
508 |
"/ ]. |
|
509 |
"/ "/ a new category (no method yet) |
|
510 |
"/ self invalidateList |
|
511 |
"/ ]. |
|
512 |
"/ ^ self |
|
513 |
"/ ]. |
|
514 |
||
515 |
"/ something == #methodDictionary ifTrue:[ |
|
516 |
"/self halt:'no longer'. |
|
517 |
"/^ self. |
|
518 |
"/ "/ a method has been added/removed |
|
519 |
"/ (classes includesIdentical:changedObject) ifTrue:[ |
|
520 |
"/ aParameter isArray ifTrue:[ |
|
521 |
"/ sel := aParameter at:1. |
|
522 |
"/ oldMethod := aParameter at:2. |
|
523 |
"/ newMethod := changedObject compiledMethodAt:sel. |
|
524 |
"/ oldMethod notNil ifTrue:[ |
|
525 |
"/ "a method was changed & acccepted; |
|
526 |
"/ No need for a rescan of the methodDictionary; |
|
527 |
"/ however, ensure that the refs to the old method are updated |
|
528 |
"/ " |
|
529 |
"/ methods := selection. |
|
530 |
"/ methods size > 0 ifTrue:[ |
|
531 |
"/ (methods includesIdentical:oldMethod) ifTrue:[ |
|
532 |
"/ needSelectionChange := true. |
|
533 |
"/ ] |
|
534 |
"/ ]. |
|
535 |
"/ methodList replaceAllIdentical:oldMethod with:newMethod. |
|
536 |
"/ lastSelectedMethods notNil ifTrue:[ |
|
537 |
"/ lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod |
|
538 |
"/ ]. |
|
539 |
"/ methods size > 0 ifTrue:[ |
|
540 |
"/ methods := methods asOrderedCollection. |
|
541 |
"/ methods replaceAllIdentical:oldMethod with:newMethod. |
|
542 |
"/ ]. |
|
543 |
"/ needSelectionChange == true ifTrue:[ |
|
544 |
"/ selectionHolder setValue:methods. |
|
545 |
"/ selectionHolder changed. |
|
546 |
"/ ]. |
|
547 |
"/ ^ self. |
|
548 |
"/ ] |
|
549 |
"/ ]. |
|
550 |
"/ "/ class has changed must update the methodList |
|
551 |
"/ self invalidateList. |
|
552 |
"/ ]. |
|
553 |
"/ ^ self. |
|
554 |
"/ ]. |
|
555 |
||
556 |
"/ something == #projectOrganization ifTrue:[ |
|
557 |
"/ ((classes includesIdentical:changedObject theNonMetaclass) |
|
558 |
"/ or:[(classes includesIdentical:changedObject theMetaclass)]) ifTrue:[ |
|
559 |
"/ self invalidateList. |
|
560 |
"/ ]. |
|
561 |
"/ ^ self |
|
562 |
"/ ]. |
|
563 |
||
564 |
changedObject == sortBy ifTrue:[ |
|
5998 | 565 |
listValid ~~ true ifTrue:[ "/ could be nil |
566 |
inGeneratorHolder value isNil ifTrue:[ |
|
567 |
"/ ok, no need to react on that one |
|
568 |
"/ (will invalidate anyway, once I have more info at hand) |
|
569 |
^ self |
|
570 |
]. |
|
571 |
]. |
|
572 |
self invalidateList. |
|
573 |
^ self |
|
5591 | 574 |
]. |
575 |
||
576 |
(changedObject == variableFilter |
|
577 |
or:[changedObject == filterClassVars |
|
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
578 |
or:[changedObject == showMethodInheritance |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
579 |
or:[changedObject == showMethodComplexity]]]) ifTrue:[ |
5998 | 580 |
self invalidateList. |
581 |
^ self |
|
5591 | 582 |
]. |
583 |
||
584 |
changedObject == selectedMethodNameIndices ifTrue:[ |
|
5998 | 585 |
newSelection := self selectedMethodNameIndices value collect:[:idx | methodList at:idx]. |
586 |
newSelection ~= selection ifTrue:[ |
|
587 |
selectionHolder value:newSelection. |
|
588 |
lastSelectedMethods := newSelection. |
|
589 |
lastSelectedMethods notNil ifTrue:[ |
|
590 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection |
|
591 |
]. |
|
592 |
] ifFalse:[ |
|
593 |
"/ a reselect - force update |
|
5591 | 594 |
"/ selection size == 1 ifTrue:[ |
5998 | 595 |
selectionHolder setValue:newSelection. |
596 |
selectionHolder changed:#value. |
|
5591 | 597 |
"/ ]. |
5998 | 598 |
]. |
599 |
^ self |
|
5591 | 600 |
]. |
601 |
changedObject == selectionHolder ifTrue:[ |
|
5998 | 602 |
self selectedMethodsChanged. |
603 |
lastSelectedMethods := selectionHolder value. |
|
604 |
lastSelectedMethods notNil ifTrue:[ |
|
605 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection |
|
606 |
]. |
|
607 |
^ self |
|
5591 | 608 |
]. |
609 |
"/ something == #methodTrap ifTrue:[ |
|
610 |
"/self halt:'no longer'. |
|
611 |
"/^ self. |
|
612 |
"/ (classes includesIdentical:changedObject) ifTrue:[ |
|
613 |
"/ newMethod := changedObject compiledMethodAt:aParameter. |
|
614 |
"/ newMethod isNil ifTrue:[ |
|
615 |
"/ self invalidateList. |
|
616 |
"/ ^ self |
|
617 |
"/ ]. |
|
618 |
"/ newMethod isWrapped ifTrue:[ |
|
619 |
"/ oldMethod := newMethod originalMethod |
|
620 |
"/ ] ifFalse:[ |
|
621 |
"/ selection size > 0 ifTrue:[ |
|
622 |
"/ oldMethod := selection detect:[:each | each isWrapped and:[each originalMethod == newMethod]] ifNone:nil. |
|
623 |
"/ ] |
|
624 |
"/ ]. |
|
625 |
"/ |
|
626 |
"/ selection size > 0 ifTrue:[ |
|
627 |
"/ (selection includesIdentical:oldMethod) ifTrue:[ |
|
628 |
"/ needSelectionChange := true. |
|
629 |
"/ ] |
|
630 |
"/ ]. |
|
631 |
"/"/ methodList replaceAllIdentical:oldMethod with:newMethod. |
|
632 |
"/ lastSelectedMethods notNil ifTrue:[ |
|
633 |
"/ lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod |
|
634 |
"/ ]. |
|
635 |
"/ selection size > 0 ifTrue:[ |
|
636 |
"/ selection := selection asOrderedCollection. |
|
637 |
"/ selection replaceAllIdentical:oldMethod with:newMethod. |
|
638 |
"/ ]. |
|
639 |
"/ needSelectionChange == true ifTrue:[ |
|
640 |
"/ selectionHolder changed. |
|
641 |
"/ ]. |
|
642 |
"/ self invalidateList. |
|
643 |
"/ ^ self |
|
644 |
"/ ]. |
|
645 |
"/ ^ self |
|
646 |
"/ ]. |
|
647 |
super delayedUpdate:something with:aParameter from:changedObject |
|
648 |
||
6846 | 649 |
"Created: / 05-02-2000 / 13:42:14 / cg" |
650 |
"Modified: / 06-08-2006 / 10:36:49 / cg" |
|
5591 | 651 |
! |
652 |
||
653 |
selectedMethodsChanged |
|
654 |
"the set of selected methods has changed; |
|
655 |
update the selection-index collection (for the selectionInListView)" |
|
656 |
||
657 |
|indices methods reverseMap |
|
658 |
selectedMethodsHolder selectedMethods selectedMethodNameIndicesHolder| |
|
659 |
||
660 |
methods := methodList ? #(). |
|
661 |
methods size == 0 ifTrue:[ |
|
662 |
"/ this may happen during early startup, |
|
663 |
"/ when invoked with a preset methodSelection, |
|
664 |
"/ and the methodGenerator has not yet been setup |
|
665 |
"/ to not clobber the selection, defer the update |
|
666 |
"/ until the methodList arrives ... |
|
667 |
^ self |
|
668 |
]. |
|
669 |
||
670 |
selectedMethodsHolder := self selectedMethods. |
|
671 |
selectedMethods := selectedMethodsHolder value. |
|
672 |
||
673 |
"/ check if all is selected (likely) |
|
674 |
((selectedMethods size == methodList size) |
|
675 |
and:[selectedMethods = methodList]) ifTrue:[ |
|
676 |
indices := (1 to:selectedMethods size) |
|
677 |
] ifFalse:[ |
|
678 |
selectedMethods size > 100 ifTrue:[ |
|
679 |
"/ check if all is selected (likely) |
|
680 |
((selectedMethods size == methodList size) |
|
681 |
and:[selectedMethods = methodList]) ifTrue:[ |
|
682 |
indices := (1 to:selectedMethods size) |
|
683 |
] ifFalse:[ |
|
684 |
"/ for big collections, generate a reverse map |
|
685 |
reverseMap := IdentityDictionary new. |
|
686 |
methods keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. |
|
687 |
indices := selectedMethods collect:[:eachSelectedMethod | |
|
688 |
reverseMap at:eachSelectedMethod ifAbsent:0 |
|
689 |
] |
|
690 |
] |
|
691 |
] ifFalse:[ |
|
692 |
indices := (selectedMethods ? #()) collect:[:eachSelectedMethod | |
|
693 |
methods identityIndexOf:eachSelectedMethod. |
|
694 |
] |
|
695 |
]. |
|
696 |
indices := indices select:[:idx | idx ~= 0]. |
|
697 |
]. |
|
698 |
||
699 |
selectedMethodNameIndicesHolder := self selectedMethodNameIndices. |
|
700 |
selectedMethodNameIndicesHolder value ~= indices ifTrue:[ |
|
701 |
selectedMethodNameIndicesHolder value:indices. |
|
702 |
] |
|
703 |
! |
|
704 |
||
705 |
selectionChanged |
|
706 |
|methods| |
|
707 |
||
708 |
methods := ((self selectedMethodNameIndices value) ? #()) collect:[:idx | methodList at:idx]. |
|
709 |
methods notEmpty ifTrue:[ |
|
710 |
lastSelectedMethods := methods asOrderedCollection. |
|
711 |
]. |
|
712 |
"/ to allow reselect, change my valueHolder, even if the same collection |
|
713 |
"/ self selectedMethods value ~= methods ifTrue:[ |
|
714 |
self selectedMethods value:methods |
|
715 |
"/ ] |
|
716 |
||
717 |
"Created: / 5.2.2000 / 13:42:14 / cg" |
|
718 |
"Modified: / 5.2.2000 / 23:32:20 / cg" |
|
719 |
! |
|
720 |
||
721 |
selectionChangedByClick |
|
722 |
"we are not interested in that - get another notification |
|
723 |
via the changed valueHolder" |
|
724 |
||
725 |
! |
|
726 |
||
727 |
update:something with:aParameter from:changedObject |
|
728 |
|cls| |
|
729 |
||
10228 | 730 |
changedObject == showCoverageInformation ifTrue:[self halt]. |
731 |
||
5591 | 732 |
"/ some can be ignored immediately |
733 |
changedObject == Smalltalk ifTrue:[ |
|
734 |
classes isNil ifTrue:[ |
|
735 |
^ self. |
|
736 |
]. |
|
737 |
something isNil ifTrue:[ |
|
738 |
"/ self halt "/ huh - Smalltalk changed - so what ? |
|
739 |
^ self. |
|
740 |
]. |
|
5998 | 741 |
|
5591 | 742 |
something == #classComment ifTrue:[ |
743 |
^ self. |
|
744 |
]. |
|
745 |
something == #classVariables ifTrue:[ |
|
746 |
^ self. |
|
747 |
]. |
|
748 |
something == #organization ifTrue:[ |
|
749 |
^ self. |
|
750 |
]. |
|
751 |
something == #methodCategory ifTrue:[ |
|
752 |
"/ ignore here - methodCategoryList will tell me if required |
|
753 |
^ self |
|
754 |
]. |
|
6663
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
755 |
(something == #classOrganization |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
756 |
or:[ something == #methodCategoryAdded |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
757 |
or:[ something == #methodCategoryRemoved |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
758 |
or:[ something == #methodCategoriesRemoved |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
759 |
or:[ something == #methodCategoryRenamed ]]]]) ifTrue:[ |
5591 | 760 |
"/ ignore here - methodCategoryList will tell me if required |
761 |
^ self |
|
762 |
]. |
|
5998 | 763 |
(something == #methodTrap |
6846 | 764 |
or:[ something == #methodPrivacy |
765 |
or:[ something == #lastTestRunResult] ]) ifTrue:[ |
|
5998 | 766 |
self window shown ifFalse:[ |
767 |
changedObject removeDependent:self. "/ ????? |
|
768 |
^ self |
|
769 |
]. |
|
5591 | 770 |
cls := aParameter at:1. |
771 |
(classes includesIdentical:cls) ifFalse:[ |
|
5998 | 772 |
^ self "/ I dont care for that class |
5591 | 773 |
]. |
774 |
]. |
|
775 |
||
6846 | 776 |
"/ as the organisation changes, flush my remembered redefinition-cache-info |
5591 | 777 |
classAndSelectorsRedefinedBySubclassesOfClass := nil. |
778 |
||
779 |
something == #classDefinition ifTrue:[ |
|
780 |
cls := aParameter. |
|
781 |
(classes contains:[:aClass | aClass name == cls name]) ifFalse:[ |
|
782 |
^ self "/ I dont care for that class |
|
783 |
]. |
|
784 |
classes := classes collect:[:eachClass | eachClass isMeta ifTrue:[ |
|
785 |
(Smalltalk at:eachClass theNonMetaclass name) class |
|
786 |
] ifFalse:[ |
|
787 |
Smalltalk at:eachClass name |
|
788 |
] |
|
789 |
]. |
|
790 |
self updateList. |
|
791 |
^ self. |
|
792 |
]. |
|
793 |
something == #newClass ifTrue:[ |
|
794 |
^ self. |
|
795 |
]. |
|
796 |
something == #classRemove ifTrue:[ |
|
797 |
^ self. |
|
798 |
]. |
|
799 |
something == #classRename ifTrue:[ |
|
800 |
^ self. |
|
801 |
]. |
|
802 |
]. |
|
803 |
||
804 |
"/ these must lead to immediate update of the selectedMethods collection |
|
805 |
"/ (otherwise, that collection might be updated too late, leading to |
|
806 |
"/ an obsolete methods code being shown by the codeView. |
|
807 |
something == #methodInClass ifTrue:[ |
|
6846 | 808 |
"/ as the organisation changes, flush my remembered redefinition-cache-info |
5591 | 809 |
classAndSelectorsRedefinedBySubclassesOfClass := nil. |
810 |
cls := aParameter at:1. |
|
811 |
(classes includesIdentical:cls) ifFalse:[ |
|
812 |
^ self "/ I dont care for that class |
|
813 |
]. |
|
814 |
self enqueueDelayedUpdate:something with:aParameter from:changedObject. |
|
815 |
^ self |
|
816 |
]. |
|
817 |
||
818 |
something == #methodInClassRemoved ifTrue:[ |
|
819 |
cls := aParameter at:1. |
|
820 |
(classes includesIdentical:cls) ifFalse:[ |
|
821 |
^ self "/ I dont care for that class |
|
822 |
]. |
|
823 |
]. |
|
824 |
||
825 |
super update:something with:aParameter from:changedObject |
|
6846 | 826 |
|
10228 | 827 |
"Modified: / 06-07-2011 / 19:50:58 / cg" |
5591 | 828 |
! ! |
829 |
||
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
830 |
!MethodList methodsFor:'drag & drop'! |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
831 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
832 |
canDropContext:aDropContext |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
833 |
|methods| |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
834 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
835 |
aDropContext sourceWidget == aDropContext targetWidget ifTrue:[^ false]. |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
836 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
837 |
methods := aDropContext dropObjects collect:[:obj | obj theObject]. |
7122 | 838 |
(methods conform:[:aMethod | aMethod isMethod]) ifFalse:[^ false]. |
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
839 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
840 |
self masterApplication theSingleSelectedClass isNil ifTrue:[^ false]. |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
841 |
^ true |
7122 | 842 |
|
843 |
"Modified: / 13-09-2006 / 11:43:54 / cg" |
|
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
844 |
! |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
845 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
846 |
doDropContext:aDropContext |
8596 | 847 |
|methods browser| |
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
848 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
849 |
methods := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject]. |
7122 | 850 |
(methods conform:[:something | something isMethod]) ifFalse:[^ self]. |
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
851 |
|
8596 | 852 |
browser := self masterApplication. |
853 |
aDropContext dragType == DropContext dragTypeCopy ifTrue:[ |
|
854 |
browser |
|
855 |
copyMethods:methods |
|
856 |
toClass:(browser theSingleSelectedClass). |
|
857 |
] ifFalse:[ |
|
858 |
browser |
|
859 |
moveMethods:methods |
|
860 |
toClass:(browser theSingleSelectedClass). |
|
861 |
]. |
|
7122 | 862 |
|
863 |
"Modified: / 13-09-2006 / 11:43:44 / cg" |
|
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
864 |
! ! |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
865 |
|
5591 | 866 |
!MethodList methodsFor:'private'! |
867 |
||
868 |
listOfMethodNames |
|
869 |
|methods entries selectorBag newNameList |
|
870 |
allClasses newClasses allCategories "allSelectors" generator |
|
871 |
doShowClass doShowClassFirst doShowCategory |
|
872 |
enforceClassAndProtocolInList theMethod sortByClass anyMethodToWatch mclass| |
|
873 |
||
874 |
generator := inGeneratorHolder value. |
|
875 |
generator isNil ifTrue:[^ #() ]. |
|
876 |
||
877 |
allClasses := IdentitySet new. |
|
878 |
allCategories := IdentitySet new. "/ not needed - all I need to know is if there is more than 1 category |
|
879 |
"/ allSelectors := Set new. |
|
880 |
newClasses := IdentitySet new. |
|
881 |
selectorBag := Bag new. |
|
882 |
entries := OrderedCollection new. |
|
883 |
enforceClassAndProtocolInList := false. |
|
884 |
anyMethodToWatch := false. |
|
885 |
||
886 |
"/ generator generates nil-selector entries |
|
887 |
"/ to pass multiple-class and multiple-protocol info |
|
888 |
generator do:[:cls :cat :sel :mthd | |
|
889 |
(cls isNil and:[cat isNil and:[sel isNil]]) |
|
890 |
ifTrue:[ |
|
891 |
enforceClassAndProtocolInList := true |
|
892 |
] ifFalse:[ |
|
893 |
cls notNil ifTrue:[ |
|
894 |
allClasses add:cls. |
|
895 |
]. |
|
896 |
cat notNil ifTrue:[ |
|
897 |
allCategories add:cat. |
|
898 |
]. |
|
899 |
sel notNil ifTrue:[ |
|
900 |
entries add:(Array with:cls with:sel with:mthd). |
|
901 |
selectorBag add:sel. |
|
902 |
newClasses add:cls. |
|
903 |
"/ allSelectors add:sel. |
|
904 |
] |
|
905 |
]. |
|
906 |
(mthd notNil and:[mthd isWrapped]) ifTrue:[ |
|
907 |
(mthd isTiming |
|
908 |
or:[mthd isCounting |
|
909 |
or:[mthd isCountingMemoryUsage]]) |
|
910 |
ifTrue:[ |
|
911 |
anyMethodToWatch := true |
|
912 |
] |
|
913 |
]. |
|
914 |
]. |
|
915 |
||
916 |
showMethodInheritance value ~~ false ifTrue:[ |
|
917 |
"/ collect redefinition information once (big speedup for #methodIsRedefinedbelow) |
|
918 |
classAndSelectorsRedefinedBySubclassesOfClass isNil ifTrue:[ |
|
919 |
classAndSelectorsRedefinedBySubclassesOfClass := IdentityDictionary new. |
|
920 |
]. |
|
921 |
allClasses do:[:cls | |d| |
|
922 |
d := classAndSelectorsRedefinedBySubclassesOfClass. |
|
923 |
(d notNil and:[ (d includesKey:cls) not ]) ifTrue:[ |
|
8206 | 924 |
cls isLoaded ifTrue:[ |
925 |
d at:cls put:(self setOfAllSelectorsImplementedBelow:cls) |
|
926 |
] |
|
5591 | 927 |
] |
928 |
]. |
|
929 |
]. |
|
930 |
||
931 |
"/ multiple classes must: add the className for some |
|
932 |
doShowClass := enforceClassAndProtocolInList or:[allClasses size > 1]. |
|
933 |
"/ multiple categories: must add the categorie for some |
|
934 |
doShowCategory := enforceClassAndProtocolInList or:[allCategories size > 1]. |
|
935 |
||
936 |
doShowClassFirst := doShowClass. "/ (doShowClass and:[allSelectors size == 1]). |
|
937 |
doShowClassFirst := doShowClass and:[ sortBy value == #class ]. |
|
938 |
||
939 |
sortBy value == false ifTrue:[ |
|
940 |
"/ do not sort |
|
941 |
] ifFalse:[ |
|
942 |
(doShowClass not and:[ sortBy value == #class ]) ifTrue:[ |
|
943 |
"/ multiple classes must add the className for some |
|
944 |
"/ check, if doShowClass must be enforced |
|
945 |
entries do:[:entry | |
|
946 |
|cls sel mthd s needClass| |
|
947 |
||
948 |
cls := entry at:1. |
|
949 |
sel := entry at:2. |
|
950 |
mthd := entry at:3. |
|
951 |
doShowClass ifFalse:[ |
|
952 |
doShowClass := (selectorBag occurrencesOf:sel) > 1 |
|
953 |
]. |
|
954 |
]. |
|
955 |
]. |
|
956 |
||
957 |
sortByClass := doShowClass and:[ sortBy value == #class ]. |
|
958 |
||
959 |
sortByClass ifTrue:[ |
|
960 |
entries sort:[:a :b | |nmA nmB clsNmA clsNmB| |
|
961 |
clsNmA := (a at:1) name. |
|
962 |
clsNmB := (b at:1) name. |
|
963 |
clsNmA = clsNmB ifTrue:[ |
|
964 |
nmA := (a at:2). |
|
965 |
nmB := (b at:2). |
|
966 |
nmA < nmB |
|
967 |
] ifFalse:[ |
|
968 |
clsNmA < clsNmB |
|
969 |
] |
|
970 |
]. |
|
971 |
] ifFalse:[ |
|
7610 | 972 |
sortBy value == #category ifTrue:[ |
973 |
entries sort:[:a :b | |nmA nmB catA catB clsNmA clsNmB| |
|
974 |
catA := (a at:3) category. |
|
975 |
catB := (b at:3) category. |
|
976 |
catA = catB ifTrue:[ |
|
977 |
nmA := (a at:2). |
|
978 |
nmB := (b at:2). |
|
979 |
nmA = nmB ifTrue:[ |
|
980 |
clsNmA := (a at:1) name. |
|
981 |
clsNmB := (b at:1) name. |
|
982 |
clsNmA < clsNmB |
|
983 |
] ifFalse:[ |
|
984 |
nmA < nmB |
|
985 |
] |
|
986 |
] ifFalse:[ |
|
987 |
catA < catB |
|
988 |
] |
|
989 |
]. |
|
990 |
] ifFalse:[ |
|
991 |
entries sort:[:a :b | |nmA nmB clsNmA clsNmB| |
|
992 |
nmA := (a at:2). |
|
993 |
nmB := (b at:2). |
|
994 |
nmA = nmB ifTrue:[ |
|
995 |
clsNmA := (a at:1) name. |
|
996 |
clsNmB := (b at:1) name. |
|
997 |
clsNmA < clsNmB |
|
998 |
] ifFalse:[ |
|
999 |
nmA < nmB |
|
1000 |
] |
|
1001 |
]. |
|
1002 |
]. |
|
5591 | 1003 |
]. |
1004 |
]. |
|
1005 |
||
1006 |
methods := OrderedCollection new:(entries size). |
|
1007 |
||
1008 |
"/ first generate the new methodList, and see if it is different ... |
|
1009 |
entries do:[:entry | |
|
1010 |
|sel mthd| |
|
1011 |
||
1012 |
mthd := entry at:3. |
|
1013 |
methods add:mthd. |
|
1014 |
]. |
|
1015 |
||
1016 |
false "methodList = methods" "does not care for changed icons" ifTrue:[ |
|
1017 |
"/ same list |
|
1018 |
newNameList := self browserNameList. |
|
1019 |
] ifFalse:[ |
|
1020 |
newNameList := OrderedCollection new:(entries size). |
|
1021 |
||
1022 |
"/ multiple classes must add the className for some |
|
1023 |
entries do:[:entry | |
|
1024 |
|cls sel mthd s needClass| |
|
1025 |
||
1026 |
cls := entry at:1. |
|
1027 |
sel := entry at:2. |
|
1028 |
mthd := entry at:3. |
|
1029 |
needClass := doShowClass. |
|
1030 |
"/ needClass ifFalse:[ |
|
1031 |
"/ needClass := (selectorBag occurrencesOf:sel) > 1 |
|
1032 |
"/ ]. |
|
1033 |
s := self |
|
1034 |
listEntryForMethod:mthd |
|
1035 |
selector:sel |
|
1036 |
class:cls |
|
1037 |
showClass:needClass |
|
1038 |
showCategory:doShowCategory |
|
1039 |
classFirst:doShowClassFirst. |
|
1040 |
||
1041 |
"/ s := mthd printStringForBrowserWithSelector:sel inClass:cls. |
|
1042 |
"/ needClass ifTrue:[ |
|
1043 |
"/ s := s , ' [' , cls name , ']'. |
|
1044 |
"/ ]. |
|
1045 |
"/ doShowCategory ifTrue:[ |
|
1046 |
"/ s := s , ' {' , mthd category "asText allItalic" , '}' |
|
1047 |
"/ ]. |
|
1048 |
newNameList add:s. |
|
1049 |
]. |
|
1050 |
]. |
|
1051 |
||
1052 |
self makeIndependent. |
|
1053 |
classes := newClasses. |
|
1054 |
self makeDependent. |
|
1055 |
||
1056 |
methodList := methods. |
|
1057 |
methods size == 1 ifTrue:[ |
|
1058 |
theMethod := methods first. |
|
1059 |
mclass := theMethod mclass. |
|
1060 |
mclass isNil ifTrue:[ |
|
1061 |
theMethod isWrapped ifTrue:[ |
|
1062 |
theMethod := theMethod originalMethod. |
|
1063 |
mclass := theMethod mclass. |
|
1064 |
]. |
|
1065 |
]. |
|
6697 | 1066 |
self methodLabelHolder value:( |
1067 |
mclass isNil |
|
1068 |
ifTrue:[('???' , ' ' , '???')] |
|
1069 |
ifFalse:[(mclass name , ' ' , theMethod selector)]) |
|
5591 | 1070 |
]. |
1071 |
||
1072 |
anyMethodToWatch ifTrue:[ |
|
1073 |
self startWatchProcess. |
|
1074 |
] ifFalse:[ |
|
1075 |
self stopWatchProcess. |
|
1076 |
]. |
|
1077 |
||
1078 |
"/ remember these, in case of an incremental (single method only) |
|
1079 |
"/ update in the future. |
|
1080 |
lastShowClass := doShowClass. |
|
1081 |
lastShowClassFirst := doShowClassFirst. |
|
1082 |
lastShowCategory := doShowCategory. |
|
1083 |
||
1084 |
^ newNameList. |
|
1085 |
||
7610 | 1086 |
"Created: / 05-02-2000 / 22:43:40 / cg" |
1087 |
"Modified: / 26-01-2007 / 14:58:59 / cg" |
|
5591 | 1088 |
! |
1089 |
||
1090 |
makeDependent |
|
1091 |
Smalltalk addDependent:self. |
|
7502 | 1092 |
"/ ChangeSet addDependent:self. |
1093 |
||
1094 |
"Modified: / 10-11-2006 / 17:57:01 / cg" |
|
5591 | 1095 |
! |
1096 |
||
1097 |
makeIndependent |
|
1098 |
Smalltalk removeDependent:self. |
|
8218 | 1099 |
"/ ChangeSet removeDependent:self. |
5591 | 1100 |
! |
1101 |
||
1102 |
method:mthd includesModsOfClassVariable:variablesToHighLight |
|
1103 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#modifiedClassVars |
|
1104 |
! |
|
1105 |
||
1106 |
method:mthd includesModsOfInstanceVariable:variablesToHighLight |
|
1107 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#modifiedInstVars |
|
1108 |
! |
|
1109 |
||
1110 |
method:mthd includesRefsToClassVariable:variablesToHighLight |
|
1111 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#usedClassVars |
|
1112 |
! |
|
1113 |
||
1114 |
method:mthd includesRefsToInstanceVariable:variablesToHighLight |
|
1115 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#usedInstVars |
|
1116 |
! |
|
1117 |
||
1118 |
method:mthd includesRefsToVariable:variablesToHighLight askParserWith:querySelector |
|
1119 |
|cls src parser usedVars anyVarNameAccessable| |
|
1120 |
||
1121 |
cls := mthd mclass. |
|
5885 | 1122 |
cls isNil ifTrue:[^ false]. |
1123 |
||
5591 | 1124 |
anyVarNameAccessable := cls allInstVarNames includesAny:variablesToHighLight. |
1125 |
anyVarNameAccessable ifFalse:[ |
|
5885 | 1126 |
anyVarNameAccessable := cls theNonMetaclass allClassVarNames includesAny:variablesToHighLight. |
5591 | 1127 |
]. |
1128 |
anyVarNameAccessable ifFalse:[ |
|
5885 | 1129 |
"/ no need to parse |
1130 |
^ false |
|
5591 | 1131 |
]. |
1132 |
||
1133 |
src := mthd source. |
|
1134 |
src notNil ifTrue:[ |
|
5885 | 1135 |
" |
1136 |
before doing a slow parse, quickly scan the |
|
1137 |
methods source for the variables name ... |
|
1138 |
" |
|
1139 |
(variablesToHighLight contains:[:varName | (src findString:varName) ~~ 0]) ifTrue:[ |
|
1140 |
parser := Parser |
|
1141 |
parseMethod:src |
|
1142 |
in:cls |
|
1143 |
ignoreErrors:true |
|
1144 |
ignoreWarnings:true. |
|
1145 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
|
1146 |
usedVars := parser perform:querySelector. |
|
1147 |
(usedVars includesAny:variablesToHighLight) |
|
1148 |
ifTrue:[ |
|
1149 |
^ true |
|
1150 |
] |
|
1151 |
] |
|
1152 |
] |
|
5591 | 1153 |
]. |
1154 |
^ false |
|
1155 |
! |
|
1156 |
||
1157 |
methodIsInheritedFromAbove:aMethod |
|
1158 |
|mClass| |
|
1159 |
||
1160 |
mClass := aMethod mclass. |
|
1161 |
(mClass notNil and:[mClass superclass notNil]) ifTrue:[ |
|
6789 | 1162 |
^ (mClass superclass whichClassIncludesSelector:aMethod selector) notNil. |
5591 | 1163 |
]. |
1164 |
^ false |
|
1165 |
! |
|
1166 |
||
1167 |
methodIsRedefinedBelow:aMethod |
|
1168 |
|mclass subClasses setOfRedefinedSelectors| |
|
1169 |
||
1170 |
mclass := aMethod mclass. |
|
1171 |
mclass isNil ifTrue:[^ false]. |
|
1172 |
||
1173 |
"/ if possible, make use of info prepared by listOfMethodNames |
|
1174 |
classAndSelectorsRedefinedBySubclassesOfClass notNil |
|
1175 |
ifTrue:[ |
|
9004
fbd6a4c325f6
changed: #methodIsRedefinedBelow:
Claus Gittinger <cg@exept.de>
parents:
8644
diff
changeset
|
1176 |
setOfRedefinedSelectors := classAndSelectorsRedefinedBySubclassesOfClass at:mclass ifAbsent:nil. |
fbd6a4c325f6
changed: #methodIsRedefinedBelow:
Claus Gittinger <cg@exept.de>
parents:
8644
diff
changeset
|
1177 |
setOfRedefinedSelectors notNil ifTrue:[ |
fbd6a4c325f6
changed: #methodIsRedefinedBelow:
Claus Gittinger <cg@exept.de>
parents:
8644
diff
changeset
|
1178 |
^ setOfRedefinedSelectors includes:aMethod selector |
fbd6a4c325f6
changed: #methodIsRedefinedBelow:
Claus Gittinger <cg@exept.de>
parents:
8644
diff
changeset
|
1179 |
] |
5591 | 1180 |
]. |
1181 |
||
1182 |
lastMethodClass == mclass ifTrue:[ |
|
9004
fbd6a4c325f6
changed: #methodIsRedefinedBelow:
Claus Gittinger <cg@exept.de>
parents:
8644
diff
changeset
|
1183 |
subClasses := lastMethodClassesSubclasses |
5591 | 1184 |
] ifFalse:[ |
9004
fbd6a4c325f6
changed: #methodIsRedefinedBelow:
Claus Gittinger <cg@exept.de>
parents:
8644
diff
changeset
|
1185 |
subClasses := aMethod mclass allSubclasses. |
fbd6a4c325f6
changed: #methodIsRedefinedBelow:
Claus Gittinger <cg@exept.de>
parents:
8644
diff
changeset
|
1186 |
lastMethodClassesSubclasses := subClasses. |
fbd6a4c325f6
changed: #methodIsRedefinedBelow:
Claus Gittinger <cg@exept.de>
parents:
8644
diff
changeset
|
1187 |
lastMethodClass := mclass. |
5591 | 1188 |
]. |
9004
fbd6a4c325f6
changed: #methodIsRedefinedBelow:
Claus Gittinger <cg@exept.de>
parents:
8644
diff
changeset
|
1189 |
^ subClasses contains:[:cls | cls includesSelector:aMethod selector]. |
5591 | 1190 |
! |
1191 |
||
1192 |
redefinedOrInheritedIconFor:aMethod |
|
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1193 |
|inherited redefined subclassResponsibility| |
5591 | 1194 |
|
1195 |
inherited := self methodIsInheritedFromAbove:aMethod. |
|
1196 |
redefined := self methodIsRedefinedBelow:aMethod. |
|
1197 |
||
1198 |
inherited ifTrue:[ |
|
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1199 |
redefined ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1200 |
^ self methodInheritedFromAboveAndRedefinedBelowIcon. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1201 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1202 |
^ self methodInheritedFromAboveIcon. |
5591 | 1203 |
]. |
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1204 |
|
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1205 |
subclassResponsibility := aMethod sends:#subclassResponsibility. |
5591 | 1206 |
redefined ifTrue:[ |
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1207 |
subclassResponsibility ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1208 |
^ self methodIsSubclassResponsibilityAndRedefinedBelowIcon. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1209 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1210 |
^ self methodRedefinedBelowIcon. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1211 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1212 |
subclassResponsibility ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1213 |
^ self methodIsSubclassResponsibilityIcon. |
5591 | 1214 |
]. |
1215 |
||
1216 |
^ self methodEmptyInheritedIcon |
|
1217 |
! |
|
1218 |
||
1219 |
release |
|
1220 |
super release. |
|
1221 |
||
1222 |
filterClassVars removeDependent:self. |
|
1223 |
selectedMethodNameIndices removeDependent:self. |
|
1224 |
showMethodInheritance removeDependent:self. |
|
1225 |
variableFilter removeDependent:self. |
|
1226 |
! |
|
1227 |
||
1228 |
resourceIconForMethod:aMethod |
|
6903 | 1229 |
^ SystemBrowser resourceIconForMethod:aMethod |
5591 | 1230 |
|
6903 | 1231 |
"Modified: / 17-08-2006 / 09:09:01 / cg" |
5591 | 1232 |
! |
1233 |
||
1234 |
setOfAllSelectorsImplementedBelow:aClass |
|
1235 |
|set| |
|
1236 |
||
1237 |
set := IdentitySet new. |
|
1238 |
aClass allSubclassesDo:[:eachSubclass | |
|
1239 |
set addAll:(eachSubclass methodDictionary keys). |
|
1240 |
]. |
|
1241 |
^ set |
|
1242 |
! |
|
1243 |
||
1244 |
updateList |
|
1245 |
|prevSelection newList newSelection newSelIdx reverseMap sameContents newListSize oldListSize |
|
1246 |
prevClasses methodSet selectedMethodsHolder| |
|
1247 |
||
1248 |
selectedMethodsHolder := self selectedMethods. |
|
1249 |
prevSelection := selectedMethodsHolder value ? #(). |
|
1250 |
||
1251 |
prevClasses := classes ifNil:[ #() ] ifNotNil:[ classes copy ]. |
|
1252 |
||
1253 |
oldListSize := self browserNameList size. |
|
1254 |
||
8644 | 1255 |
self topApplication withWaitCursorDo:[ |
1256 |
newList := self listOfMethodNames. |
|
1257 |
]. |
|
7702 | 1258 |
newListSize := newList size. |
1259 |
sameContents := self updateListFor:newList. |
|
5591 | 1260 |
|
7702 | 1261 |
sameContents ifFalse:[ |
5591 | 1262 |
"/ self browserNameList value:newList. |
1263 |
||
7702 | 1264 |
(prevSelection size == 0 |
1265 |
and:[selectedMethodsHolder value size ~~ 0]) ifTrue:[ |
|
1266 |
"/ this happens during early startup time, |
|
1267 |
"/ when the selection is already (pre-)set, |
|
1268 |
"/ and the methodList is generated the first time |
|
1269 |
"/ (i.e. when opened with preset selection |
|
5591 | 1270 |
|
7702 | 1271 |
"/ do not clobber the selection in this case. |
1272 |
prevSelection := selectedMethodsHolder value. |
|
1273 |
]. |
|
5591 | 1274 |
|
7702 | 1275 |
(methodList size == 0 or:[prevSelection size == 0]) ifTrue:[ |
1276 |
newSelection := #() |
|
1277 |
] ifFalse:[ |
|
1278 |
methodSet := methodList. |
|
5591 | 1279 |
|
7702 | 1280 |
"/ inclusion test is much faster with sets, if the number of items is large |
1281 |
methodList size > 30 ifTrue:[ |
|
1282 |
"/ however, only if its worth building the set ... |
|
1283 |
prevSelection size > 5 ifTrue:[ |
|
1284 |
methodSet := methodSet asIdentitySet. |
|
1285 |
] |
|
1286 |
]. |
|
1287 |
newSelection := prevSelection select:[:item | methodSet includesIdentical:item]. |
|
1288 |
]. |
|
1289 |
newSelection size > 0 ifTrue:[ |
|
1290 |
newSelection size > 100 ifTrue:[ |
|
1291 |
"/ need selection indices - might be expensive if done straight forward... |
|
1292 |
reverseMap := IdentityDictionary new. |
|
1293 |
methodList keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. |
|
1294 |
newSelIdx := newSelection collect:[:mthd | reverseMap at:mthd]. |
|
1295 |
] ifFalse:[ |
|
1296 |
newSelIdx := newSelection collect:[:mthd | methodList identityIndexOf:mthd] |
|
1297 |
]. |
|
5591 | 1298 |
"/ self halt. |
7702 | 1299 |
"/ force change (for dependents) |
1300 |
newSelIdx ~= selectedMethodNameIndices value ifTrue:[ |
|
1301 |
selectedMethodNameIndices value:newSelIdx. |
|
1302 |
]. |
|
1303 |
] ifFalse:[ |
|
1304 |
lastSelectedMethods := selectedMethodsHolder value. |
|
1305 |
lastSelectedMethods notNil ifTrue:[ |
|
1306 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection |
|
1307 |
]. |
|
1308 |
selectedMethodNameIndices value size > 0 ifTrue:[ |
|
1309 |
selectedMethodNameIndices value:#(). |
|
1310 |
] |
|
1311 |
]. |
|
5591 | 1312 |
|
7702 | 1313 |
newSelection ~= prevSelection ifTrue:[ |
1314 |
self selectionChanged. |
|
1315 |
] |
|
1316 |
] ifTrue:[ |
|
1317 |
"/ same list - but classes might have changed |
|
1318 |
"/ that is the case, if the class selection has been changed, |
|
1319 |
"/ to another class which has the same categories. |
|
5591 | 1320 |
|
7702 | 1321 |
(prevClasses size ~= classes size |
1322 |
or:[prevClasses asOrderedCollection ~= (classes ? #()) asOrderedCollection ]) ifTrue:[ |
|
1323 |
(newListSize > 0 or:[oldListSize > 0]) ifTrue:[ |
|
1324 |
self selectionChanged. |
|
1325 |
] |
|
1326 |
] |
|
1327 |
] |
|
5591 | 1328 |
"/ ]. |
1329 |
||
7702 | 1330 |
"Modified: / 05-03-2007 / 16:07:24 / cg" |
5591 | 1331 |
! |
1332 |
||
1333 |
updateListEntryFor:aMethod |
|
1334 |
"update my list for a single method. |
|
1335 |
(used when a single methods package, code or whatever changes, and a full udpate |
|
1336 |
would be too slow)" |
|
1337 |
||
1338 |
|s idx| |
|
1339 |
||
1340 |
s := self |
|
6268 | 1341 |
listEntryForMethod:aMethod |
1342 |
selector:aMethod selector |
|
1343 |
class:aMethod mclass |
|
1344 |
showClass:lastShowClass |
|
1345 |
showCategory:lastShowCategory |
|
1346 |
classFirst:lastShowClassFirst. |
|
5591 | 1347 |
|
1348 |
idx := methodList identityIndexOf:aMethod. |
|
1349 |
idx == 0 ifTrue:[ |
|
6268 | 1350 |
aMethod isWrapped ifTrue:[ |
1351 |
idx := methodList identityIndexOf:aMethod originalMethod. |
|
1352 |
] |
|
5591 | 1353 |
]. |
1354 |
idx == 0 ifTrue:[ |
|
6268 | 1355 |
self invalidateList |
5591 | 1356 |
] ifFalse:[ |
6268 | 1357 |
self browserNameList at:idx put:s. |
5591 | 1358 |
] |
1359 |
! ! |
|
1360 |
||
6271 | 1361 |
!MethodList methodsFor:'private-presentation'! |
1362 |
||
9451
79d033f585b9
added: #colorForCoverageInformationOfMethod:
Claus Gittinger <cg@exept.de>
parents:
9448
diff
changeset
|
1363 |
colorForCoverageInformationOfMethod:aMethod |
9430 | 1364 |
aMethod isInstrumented ifFalse:[^ nil]. |
9448
f9258f99d465
changed: #emphasisForCoverageInformationOfMethod:
Claus Gittinger <cg@exept.de>
parents:
9438
diff
changeset
|
1365 |
aMethod category = 'documentation' ifTrue:[^ nil]. |
9430 | 1366 |
|
1367 |
aMethod hasBeenCalled ifTrue:[ |
|
1368 |
aMethod haveAllBlocksBeenExecuted ifTrue:[ |
|
9451
79d033f585b9
added: #colorForCoverageInformationOfMethod:
Claus Gittinger <cg@exept.de>
parents:
9448
diff
changeset
|
1369 |
^ UserPreferences current colorForInstrumentedFullyCoveredCode |
9430 | 1370 |
]. |
9451
79d033f585b9
added: #colorForCoverageInformationOfMethod:
Claus Gittinger <cg@exept.de>
parents:
9448
diff
changeset
|
1371 |
^ UserPreferences current colorForInstrumentedPartiallyCoveredCode |
9430 | 1372 |
]. |
9451
79d033f585b9
added: #colorForCoverageInformationOfMethod:
Claus Gittinger <cg@exept.de>
parents:
9448
diff
changeset
|
1373 |
^ UserPreferences current colorForInstrumentedNeverCalledCode |
9430 | 1374 |
|
9451
79d033f585b9
added: #colorForCoverageInformationOfMethod:
Claus Gittinger <cg@exept.de>
parents:
9448
diff
changeset
|
1375 |
"Created: / 30-04-2010 / 11:53:38 / cg" |
9430 | 1376 |
! |
1377 |
||
6271 | 1378 |
listEntryForMethod:aMethod selector:selector class:cls showClass:showClass showCategory:showCategory classFirst:showClassFirst |
1379 |
"answer a method list entry |
|
1380 |
gimmics: |
|
1381 |
adding a little image to breakPointed methods, |
|
1382 |
inheritance indicators, |
|
1383 |
highlight accessors of variable" |
|
1384 |
||
1385 |
|clsName s icn variablesToHighlight classVarsToHighLight |
|
9451
79d033f585b9
added: #colorForCoverageInformationOfMethod:
Claus Gittinger <cg@exept.de>
parents:
9448
diff
changeset
|
1386 |
doHighLight doHighLightRed clr emp cat l redefIcon |
7502 | 1387 |
metrics complexity complexityString complexityIcon mark| |
6271 | 1388 |
|
9038
9b56d0b8c38e
required missing protocol display
Claus Gittinger <cg@exept.de>
parents:
9004
diff
changeset
|
1389 |
aMethod isNil ifTrue:[ |
9b56d0b8c38e
required missing protocol display
Claus Gittinger <cg@exept.de>
parents:
9004
diff
changeset
|
1390 |
"/ a non-existing (pseudo) method (such as required protocol) |
9b56d0b8c38e
required missing protocol display
Claus Gittinger <cg@exept.de>
parents:
9004
diff
changeset
|
1391 |
^ selector colorizeAllWith:Color red. |
9b56d0b8c38e
required missing protocol display
Claus Gittinger <cg@exept.de>
parents:
9004
diff
changeset
|
1392 |
]. |
9b56d0b8c38e
required missing protocol display
Claus Gittinger <cg@exept.de>
parents:
9004
diff
changeset
|
1393 |
|
6271 | 1394 |
aMethod isAssociation ifTrue:[ |
1395 |
self halt:'should not happen'. |
|
1396 |
]. |
|
1397 |
||
8638 | 1398 |
selector isNil ifTrue:[ |
1399 |
s := '???' |
|
1400 |
] ifFalse:[ |
|
1401 |
s := aMethod printStringForBrowserWithSelector:selector inClass:cls. |
|
1402 |
]. |
|
6271 | 1403 |
showClassFirst ifTrue:[ |
1404 |
clsName := cls nameInBrowser. |
|
1405 |
s := clsName , ' ' , s allBold |
|
1406 |
]. |
|
1407 |
||
1408 |
"/ |
|
1409 |
"/ wrap icons (i.e. break- or trace points) |
|
1410 |
"/ have higher prio ... |
|
1411 |
"/ |
|
9038
9b56d0b8c38e
required missing protocol display
Claus Gittinger <cg@exept.de>
parents:
9004
diff
changeset
|
1412 |
(aMethod notNil and:[aMethod isWrapped]) ifTrue:[ |
6271 | 1413 |
(s endsWith:' !!') ifTrue:[ |
1414 |
s := s copyWithoutLast:2 |
|
1415 |
]. |
|
1416 |
aMethod isBreakpointed ifTrue:[ |
|
1417 |
icn := self stopIcon |
|
1418 |
] ifFalse:[ |
|
1419 |
aMethod isTimed ifTrue:[ |
|
1420 |
icn := self timeIcon |
|
1421 |
] ifFalse:[ |
|
1422 |
icn := self traceIcon |
|
1423 |
] |
|
1424 |
]. |
|
1425 |
]. |
|
1426 |
||
1427 |
icn isNil ifTrue:[ |
|
8198 | 1428 |
self showImageResourceMethodsImages value ~~ false ifTrue:[ |
9252
ee7770f155ca
changed: #listEntryForMethod:selector:class:showClass:showCategory:classFirst:
Claus Gittinger <cg@exept.de>
parents:
9038
diff
changeset
|
1429 |
(aMethod hasImageResource) ifTrue:[ |
8474 | 1430 |
aMethod mclass isMeta ifTrue:[ |
1431 |
icn := aMethod valueWithReceiver:nil arguments:nil . |
|
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1432 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1433 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1434 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1435 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1436 |
|
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1437 |
icn isNil ifTrue:[ |
6271 | 1438 |
showMethodTypeIcon value ~~ false ifTrue:[ |
1439 |
icn := self resourceIconForMethod:aMethod. |
|
1440 |
]. |
|
1441 |
icn isNil ifTrue:[ |
|
1442 |
aMethod isProtected ifTrue:[ |
|
1443 |
icn := self protectedMethodIcon |
|
1444 |
] ifFalse:[ |
|
1445 |
aMethod isPrivate ifTrue:[ |
|
1446 |
icn := self privateMethodIcon |
|
1447 |
] ifFalse:[ |
|
1448 |
(aMethod isIgnored) ifTrue:[ |
|
1449 |
icn := self ignoredMethodIcon |
|
1450 |
] ifFalse:[ |
|
1451 |
(aMethod isJavaMethod and:[aMethod isAbstract]) ifTrue:[ |
|
1452 |
icn := self abstractMethodIcon |
|
1453 |
] |
|
1454 |
] |
|
1455 |
] |
|
1456 |
]. |
|
1457 |
]. |
|
1458 |
]. |
|
1459 |
icn isNil ifTrue:[ |
|
1460 |
(selector startsWith:'test') ifTrue:[ |
|
10200
454d96e87e85
changed: #listEntryForMethod:selector:class:showClass:showCategory:classFirst:
Claus Gittinger <cg@exept.de>
parents:
9462
diff
changeset
|
1461 |
(cls isTestCaseLike and:[cls isAbstract not]) ifTrue:[ |
6271 | 1462 |
cls lastTestRunResultOrNil == false ifTrue:[ |
1463 |
(cls testSelectorFailed:selector) ifTrue:[ |
|
1464 |
icn := SystemBrowser testCaseFailedIcon |
|
1465 |
] ifFalse:[ |
|
1466 |
"/ icn := SystemBrowser testCasePassedIcon |
|
1467 |
]. |
|
1468 |
] |
|
1469 |
]. |
|
1470 |
] |
|
1471 |
]. |
|
1472 |
||
1473 |
showClass ifTrue:[ |
|
1474 |
showClassFirst ifFalse:[ |
|
1475 |
s := s , ' [' , cls name allBold , ']'. |
|
1476 |
] |
|
1477 |
]. |
|
1478 |
showCategory ifTrue:[ |
|
1479 |
cat := aMethod category. |
|
1480 |
cat notNil ifTrue:[ |
|
1481 |
s := s , ' {' , cat "asText allItalic" , '}' |
|
1482 |
] |
|
1483 |
]. |
|
7502 | 1484 |
|
10228 | 1485 |
showCoverageInformation value ifTrue:[ |
9451
79d033f585b9
added: #colorForCoverageInformationOfMethod:
Claus Gittinger <cg@exept.de>
parents:
9448
diff
changeset
|
1486 |
clr := self colorForCoverageInformationOfMethod:aMethod. |
79d033f585b9
added: #colorForCoverageInformationOfMethod:
Claus Gittinger <cg@exept.de>
parents:
9448
diff
changeset
|
1487 |
clr notNil ifTrue:[ |
79d033f585b9
added: #colorForCoverageInformationOfMethod:
Claus Gittinger <cg@exept.de>
parents:
9448
diff
changeset
|
1488 |
s := self colorize:s with:(#color->clr). |
9430 | 1489 |
"/ aMethod isInstrumented ifTrue:[ |
1490 |
"/ icn := self instrumentationIcon |
|
1491 |
"/ ]. |
|
1492 |
]. |
|
1493 |
] ifFalse:[ |
|
1494 |
(ChangeSet current includesChangeForClass:cls selector:selector) ifTrue:[ |
|
1495 |
mark := self class markForBeingInChangeList. |
|
1496 |
"/ mark := self colorizeForChangedCode:mark. |
|
1497 |
s := s , mark. |
|
1498 |
"/ cg: I dont know why this was disabled - it is req'd to |
|
1499 |
"/ see changed methods in a method list (implementors...) |
|
1500 |
s := self colorizeForChangedCode:s. |
|
1501 |
]. |
|
1502 |
||
1503 |
(SmallTeam notNil and:[SmallTeam includesChangeForClass:cls selector:selector]) ifTrue:[ |
|
1504 |
s := (self colorizeForChangedCodeInSmallTeam:'!! '),s |
|
1505 |
]. |
|
6841
6d72f92ed6cd
mark changed methods with a '*'
Claus Gittinger <cg@exept.de>
parents:
6789
diff
changeset
|
1506 |
]. |
6271 | 1507 |
|
1508 |
variablesToHighlight := variableFilter value. |
|
1509 |
variablesToHighlight size > 0 ifTrue:[ |
|
1510 |
classVarsToHighLight := filterClassVars value. |
|
1511 |
classVarsToHighLight ifTrue:[ |
|
1512 |
doHighLight := self method:aMethod includesRefsToClassVariable:variablesToHighlight. |
|
1513 |
doHighLight ifTrue:[ |
|
1514 |
doHighLightRed := self method:aMethod includesModsOfClassVariable:variablesToHighlight. |
|
1515 |
]. |
|
1516 |
] ifFalse:[ |
|
1517 |
doHighLight := self method:aMethod includesRefsToInstanceVariable:variablesToHighlight. |
|
1518 |
doHighLight ifTrue:[ |
|
1519 |
doHighLightRed := self method:aMethod includesModsOfInstanceVariable:variablesToHighlight |
|
1520 |
] |
|
1521 |
]. |
|
1522 |
doHighLight ifTrue:[ |
|
1523 |
s := s allBold. |
|
1524 |
doHighLightRed ifTrue:[ |
|
1525 |
emp := (UserPreferences current emphasisForWrittenVariable) |
|
1526 |
] ifFalse:[ |
|
1527 |
emp := (UserPreferences current emphasisForReadVariable) |
|
1528 |
]. |
|
1529 |
s := s emphasisAllAdd:emp |
|
1530 |
] |
|
1531 |
]. |
|
1532 |
||
6694 | 1533 |
(showMethodComplexity value == true |
6271 | 1534 |
and:[ OOM::MethodMetrics notNil ]) ifTrue:[ |
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1535 |
icn isNil ifTrue:[ |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1536 |
metrics := OOM::MethodMetrics forMethod:aMethod. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1537 |
complexity := metrics complexity ? 0. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1538 |
complexityIcon := OOM::MethodMetrics iconForComplexity:complexity. |
6271 | 1539 |
|
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1540 |
ShowComplexityValue == true ifTrue:[ |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1541 |
complexityString := '{' , complexity printString , '}'. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1542 |
s := complexityString , ' ' , s. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1543 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1544 |
"/ icn := icn ? complexityIcon. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1545 |
s := LabelAndIcon icon:complexityIcon string:s. |
6271 | 1546 |
]. |
1547 |
]. |
|
1548 |
||
1549 |
showMethodInheritance value ~~ false ifTrue:[ |
|
1550 |
redefIcon := self redefinedOrInheritedIconFor:aMethod. |
|
1551 |
]. |
|
1552 |
||
1553 |
(icn notNil or:[redefIcon notNil]) ifTrue:[ |
|
1554 |
l := LabelAndIcon icon:redefIcon string:s. |
|
1555 |
l image:icn. |
|
1556 |
l gap:2. |
|
1557 |
^ l |
|
1558 |
]. |
|
1559 |
^ s |
|
1560 |
||
6841
6d72f92ed6cd
mark changed methods with a '*'
Claus Gittinger <cg@exept.de>
parents:
6789
diff
changeset
|
1561 |
"Created: / 22-10-1996 / 19:51:00 / cg" |
10228 | 1562 |
"Modified: / 06-07-2011 / 20:11:21 / cg" |
6271 | 1563 |
! ! |
1564 |
||
5591 | 1565 |
!MethodList methodsFor:'private-watching'! |
1566 |
||
1567 |
startWatchProcess |
|
1568 |
updateProcess notNil ifTrue:[ |
|
1569 |
^ self |
|
1570 |
]. |
|
1571 |
updateProcess := [ |
|
1572 |
[true] whileTrue:[ |
|
1573 |
Delay waitForSeconds:1. |
|
1574 |
self enqueueDelayedUpdateList |
|
1575 |
] |
|
1576 |
] fork. |
|
1577 |
! |
|
1578 |
||
1579 |
stopWatchProcess |
|
1580 |
|p| |
|
1581 |
||
1582 |
(p := updateProcess) notNil ifTrue:[ |
|
1583 |
updateProcess := nil. |
|
1584 |
p terminate |
|
1585 |
]. |
|
1586 |
! ! |
|
1587 |
||
1588 |
!MethodList methodsFor:'setup'! |
|
1589 |
||
1590 |
postBuildWith:aBuilder |
|
1591 |
|methodListView| |
|
1592 |
||
1593 |
super postBuildWith:aBuilder. |
|
1594 |
||
1595 |
methodListView := aBuilder componentAt:'List'. |
|
1596 |
methodListView notNil ifTrue:[ |
|
6277 | 1597 |
methodListView allowDrag:true. |
1598 |
methodListView dragObjectConverter:[:obj | |
|
1599 |
|nm method idx| |
|
5591 | 1600 |
|
6277 | 1601 |
nm := obj theObject asString string string. |
1602 |
idx := browserNameList value findFirst:[:item | item string string = nm]. |
|
1603 |
method := methodList value at:idx. |
|
1604 |
DropObject newMethod:method. |
|
1605 |
]. |
|
5591 | 1606 |
] |
1607 |
! ! |
|
1608 |
||
1609 |
!MethodList class methodsFor:'documentation'! |
|
1610 |
||
9004
fbd6a4c325f6
changed: #methodIsRedefinedBelow:
Claus Gittinger <cg@exept.de>
parents:
8644
diff
changeset
|
1611 |
version_CVS |
10228 | 1612 |
^ '$Header: /cvs/stx/stx/libtool/Tools_MethodList.st,v 1.50 2011-07-06 18:13:33 cg Exp $' |
5591 | 1613 |
! ! |