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