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