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