author | Claus Gittinger <cg@exept.de> |
Mon, 07 Aug 2006 12:16:56 +0200 | |
changeset 6846 | b7d2d17e4ae5 |
parent 6841 | 6d72f92ed6cd |
child 6903 | 1fb966ff068c |
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 |
|
6846 | 454 |
(something == #projectOrganization |
455 |
or:[something == #lastTestRunResult]) ifTrue:[ |
|
5998 | 456 |
aParameter notNil ifTrue:[ |
457 |
cls := aParameter at:1. |
|
458 |
cls notNil ifTrue:[ |
|
459 |
((classes includesIdentical:cls theNonMetaclass) |
|
460 |
or:[(classes includesIdentical:cls theMetaclass)]) ifTrue:[ |
|
461 |
self invalidateList. |
|
462 |
]. |
|
463 |
]. |
|
464 |
] ifFalse:[ |
|
465 |
self invalidateList. |
|
466 |
]. |
|
467 |
^ self |
|
468 |
]. |
|
6846 | 469 |
|
5998 | 470 |
"/ everything else is ignored |
471 |
"/ self halt. |
|
472 |
]. |
|
473 |
^ self |
|
5591 | 474 |
]. |
475 |
||
476 |
"/ something == #organization ifTrue:[ |
|
477 |
"/self halt:'no longer'. |
|
478 |
"/^ self. |
|
479 |
"/ "/ a methods cateory has changed |
|
480 |
"/ (classes includesIdentical:changedObject) ifTrue:[ |
|
481 |
"/ aParameter isSymbol ifTrue:[ |
|
482 |
"/ "/ a method with a new category |
|
483 |
"/ (self methodList includesIdentical:(changedObject compiledMethodAt:aParameter)) ifTrue:[ |
|
484 |
"/ self invalidateList. |
|
485 |
"/ ]. |
|
486 |
"/ ^ self. |
|
487 |
"/ ]. |
|
488 |
"/ "/ a new category (no method yet) |
|
489 |
"/ self invalidateList |
|
490 |
"/ ]. |
|
491 |
"/ ^ self |
|
492 |
"/ ]. |
|
493 |
||
494 |
"/ something == #methodDictionary ifTrue:[ |
|
495 |
"/self halt:'no longer'. |
|
496 |
"/^ self. |
|
497 |
"/ "/ a method has been added/removed |
|
498 |
"/ (classes includesIdentical:changedObject) ifTrue:[ |
|
499 |
"/ aParameter isArray ifTrue:[ |
|
500 |
"/ sel := aParameter at:1. |
|
501 |
"/ oldMethod := aParameter at:2. |
|
502 |
"/ newMethod := changedObject compiledMethodAt:sel. |
|
503 |
"/ oldMethod notNil ifTrue:[ |
|
504 |
"/ "a method was changed & acccepted; |
|
505 |
"/ No need for a rescan of the methodDictionary; |
|
506 |
"/ however, ensure that the refs to the old method are updated |
|
507 |
"/ " |
|
508 |
"/ methods := selection. |
|
509 |
"/ methods size > 0 ifTrue:[ |
|
510 |
"/ (methods includesIdentical:oldMethod) ifTrue:[ |
|
511 |
"/ needSelectionChange := true. |
|
512 |
"/ ] |
|
513 |
"/ ]. |
|
514 |
"/ methodList replaceAllIdentical:oldMethod with:newMethod. |
|
515 |
"/ lastSelectedMethods notNil ifTrue:[ |
|
516 |
"/ lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod |
|
517 |
"/ ]. |
|
518 |
"/ methods size > 0 ifTrue:[ |
|
519 |
"/ methods := methods asOrderedCollection. |
|
520 |
"/ methods replaceAllIdentical:oldMethod with:newMethod. |
|
521 |
"/ ]. |
|
522 |
"/ needSelectionChange == true ifTrue:[ |
|
523 |
"/ selectionHolder setValue:methods. |
|
524 |
"/ selectionHolder changed. |
|
525 |
"/ ]. |
|
526 |
"/ ^ self. |
|
527 |
"/ ] |
|
528 |
"/ ]. |
|
529 |
"/ "/ class has changed must update the methodList |
|
530 |
"/ self invalidateList. |
|
531 |
"/ ]. |
|
532 |
"/ ^ self. |
|
533 |
"/ ]. |
|
534 |
||
535 |
"/ something == #projectOrganization ifTrue:[ |
|
536 |
"/ ((classes includesIdentical:changedObject theNonMetaclass) |
|
537 |
"/ or:[(classes includesIdentical:changedObject theMetaclass)]) ifTrue:[ |
|
538 |
"/ self invalidateList. |
|
539 |
"/ ]. |
|
540 |
"/ ^ self |
|
541 |
"/ ]. |
|
542 |
||
543 |
changedObject == sortBy ifTrue:[ |
|
5998 | 544 |
listValid ~~ true ifTrue:[ "/ could be nil |
545 |
inGeneratorHolder value isNil ifTrue:[ |
|
546 |
"/ ok, no need to react on that one |
|
547 |
"/ (will invalidate anyway, once I have more info at hand) |
|
548 |
^ self |
|
549 |
]. |
|
550 |
]. |
|
551 |
self invalidateList. |
|
552 |
^ self |
|
5591 | 553 |
]. |
554 |
||
555 |
(changedObject == variableFilter |
|
556 |
or:[changedObject == filterClassVars |
|
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
557 |
or:[changedObject == showMethodInheritance |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
558 |
or:[changedObject == showMethodComplexity]]]) ifTrue:[ |
5998 | 559 |
self invalidateList. |
560 |
^ self |
|
5591 | 561 |
]. |
562 |
||
563 |
changedObject == selectedMethodNameIndices ifTrue:[ |
|
5998 | 564 |
newSelection := self selectedMethodNameIndices value collect:[:idx | methodList at:idx]. |
565 |
newSelection ~= selection ifTrue:[ |
|
566 |
selectionHolder value:newSelection. |
|
567 |
lastSelectedMethods := newSelection. |
|
568 |
lastSelectedMethods notNil ifTrue:[ |
|
569 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection |
|
570 |
]. |
|
571 |
] ifFalse:[ |
|
572 |
"/ a reselect - force update |
|
5591 | 573 |
"/ selection size == 1 ifTrue:[ |
5998 | 574 |
selectionHolder setValue:newSelection. |
575 |
selectionHolder changed:#value. |
|
5591 | 576 |
"/ ]. |
5998 | 577 |
]. |
578 |
^ self |
|
5591 | 579 |
]. |
580 |
changedObject == selectionHolder ifTrue:[ |
|
5998 | 581 |
self selectedMethodsChanged. |
582 |
lastSelectedMethods := selectionHolder value. |
|
583 |
lastSelectedMethods notNil ifTrue:[ |
|
584 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection |
|
585 |
]. |
|
586 |
^ self |
|
5591 | 587 |
]. |
588 |
"/ something == #methodTrap ifTrue:[ |
|
589 |
"/self halt:'no longer'. |
|
590 |
"/^ self. |
|
591 |
"/ (classes includesIdentical:changedObject) ifTrue:[ |
|
592 |
"/ newMethod := changedObject compiledMethodAt:aParameter. |
|
593 |
"/ newMethod isNil ifTrue:[ |
|
594 |
"/ self invalidateList. |
|
595 |
"/ ^ self |
|
596 |
"/ ]. |
|
597 |
"/ newMethod isWrapped ifTrue:[ |
|
598 |
"/ oldMethod := newMethod originalMethod |
|
599 |
"/ ] ifFalse:[ |
|
600 |
"/ selection size > 0 ifTrue:[ |
|
601 |
"/ oldMethod := selection detect:[:each | each isWrapped and:[each originalMethod == newMethod]] ifNone:nil. |
|
602 |
"/ ] |
|
603 |
"/ ]. |
|
604 |
"/ |
|
605 |
"/ selection size > 0 ifTrue:[ |
|
606 |
"/ (selection includesIdentical:oldMethod) ifTrue:[ |
|
607 |
"/ needSelectionChange := true. |
|
608 |
"/ ] |
|
609 |
"/ ]. |
|
610 |
"/"/ methodList replaceAllIdentical:oldMethod with:newMethod. |
|
611 |
"/ lastSelectedMethods notNil ifTrue:[ |
|
612 |
"/ lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod |
|
613 |
"/ ]. |
|
614 |
"/ selection size > 0 ifTrue:[ |
|
615 |
"/ selection := selection asOrderedCollection. |
|
616 |
"/ selection replaceAllIdentical:oldMethod with:newMethod. |
|
617 |
"/ ]. |
|
618 |
"/ needSelectionChange == true ifTrue:[ |
|
619 |
"/ selectionHolder changed. |
|
620 |
"/ ]. |
|
621 |
"/ self invalidateList. |
|
622 |
"/ ^ self |
|
623 |
"/ ]. |
|
624 |
"/ ^ self |
|
625 |
"/ ]. |
|
626 |
super delayedUpdate:something with:aParameter from:changedObject |
|
627 |
||
6846 | 628 |
"Created: / 05-02-2000 / 13:42:14 / cg" |
629 |
"Modified: / 06-08-2006 / 10:36:49 / cg" |
|
5591 | 630 |
! |
631 |
||
632 |
selectedMethodsChanged |
|
633 |
"the set of selected methods has changed; |
|
634 |
update the selection-index collection (for the selectionInListView)" |
|
635 |
||
636 |
|indices methods reverseMap |
|
637 |
selectedMethodsHolder selectedMethods selectedMethodNameIndicesHolder| |
|
638 |
||
639 |
methods := methodList ? #(). |
|
640 |
methods size == 0 ifTrue:[ |
|
641 |
"/ this may happen during early startup, |
|
642 |
"/ when invoked with a preset methodSelection, |
|
643 |
"/ and the methodGenerator has not yet been setup |
|
644 |
"/ to not clobber the selection, defer the update |
|
645 |
"/ until the methodList arrives ... |
|
646 |
^ self |
|
647 |
]. |
|
648 |
||
649 |
selectedMethodsHolder := self selectedMethods. |
|
650 |
selectedMethods := selectedMethodsHolder value. |
|
651 |
||
652 |
"/ check if all is selected (likely) |
|
653 |
((selectedMethods size == methodList size) |
|
654 |
and:[selectedMethods = methodList]) ifTrue:[ |
|
655 |
indices := (1 to:selectedMethods size) |
|
656 |
] ifFalse:[ |
|
657 |
selectedMethods size > 100 ifTrue:[ |
|
658 |
"/ check if all is selected (likely) |
|
659 |
((selectedMethods size == methodList size) |
|
660 |
and:[selectedMethods = methodList]) ifTrue:[ |
|
661 |
indices := (1 to:selectedMethods size) |
|
662 |
] ifFalse:[ |
|
663 |
"/ for big collections, generate a reverse map |
|
664 |
reverseMap := IdentityDictionary new. |
|
665 |
methods keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. |
|
666 |
indices := selectedMethods collect:[:eachSelectedMethod | |
|
667 |
reverseMap at:eachSelectedMethod ifAbsent:0 |
|
668 |
] |
|
669 |
] |
|
670 |
] ifFalse:[ |
|
671 |
indices := (selectedMethods ? #()) collect:[:eachSelectedMethod | |
|
672 |
methods identityIndexOf:eachSelectedMethod. |
|
673 |
] |
|
674 |
]. |
|
675 |
indices := indices select:[:idx | idx ~= 0]. |
|
676 |
]. |
|
677 |
||
678 |
selectedMethodNameIndicesHolder := self selectedMethodNameIndices. |
|
679 |
selectedMethodNameIndicesHolder value ~= indices ifTrue:[ |
|
680 |
selectedMethodNameIndicesHolder value:indices. |
|
681 |
] |
|
682 |
! |
|
683 |
||
684 |
selectionChanged |
|
685 |
|methods| |
|
686 |
||
687 |
methods := ((self selectedMethodNameIndices value) ? #()) collect:[:idx | methodList at:idx]. |
|
688 |
methods notEmpty ifTrue:[ |
|
689 |
lastSelectedMethods := methods asOrderedCollection. |
|
690 |
]. |
|
691 |
"/ to allow reselect, change my valueHolder, even if the same collection |
|
692 |
"/ self selectedMethods value ~= methods ifTrue:[ |
|
693 |
self selectedMethods value:methods |
|
694 |
"/ ] |
|
695 |
||
696 |
"Created: / 5.2.2000 / 13:42:14 / cg" |
|
697 |
"Modified: / 5.2.2000 / 23:32:20 / cg" |
|
698 |
! |
|
699 |
||
700 |
selectionChangedByClick |
|
701 |
"we are not interested in that - get another notification |
|
702 |
via the changed valueHolder" |
|
703 |
||
704 |
! |
|
705 |
||
706 |
update:something with:aParameter from:changedObject |
|
707 |
|cls| |
|
708 |
||
709 |
"/ some can be ignored immediately |
|
710 |
changedObject == Smalltalk ifTrue:[ |
|
711 |
classes isNil ifTrue:[ |
|
712 |
^ self. |
|
713 |
]. |
|
714 |
something isNil ifTrue:[ |
|
715 |
"/ self halt "/ huh - Smalltalk changed - so what ? |
|
716 |
^ self. |
|
717 |
]. |
|
5998 | 718 |
|
5591 | 719 |
something == #classComment ifTrue:[ |
720 |
^ self. |
|
721 |
]. |
|
722 |
something == #classVariables ifTrue:[ |
|
723 |
^ self. |
|
724 |
]. |
|
725 |
something == #organization ifTrue:[ |
|
726 |
^ self. |
|
727 |
]. |
|
728 |
something == #methodCategory ifTrue:[ |
|
729 |
"/ ignore here - methodCategoryList will tell me if required |
|
730 |
^ self |
|
731 |
]. |
|
6663
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
732 |
(something == #classOrganization |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
733 |
or:[ something == #methodCategoryAdded |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
734 |
or:[ something == #methodCategoryRemoved |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
735 |
or:[ something == #methodCategoriesRemoved |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
736 |
or:[ something == #methodCategoryRenamed ]]]]) ifTrue:[ |
5591 | 737 |
"/ ignore here - methodCategoryList will tell me if required |
738 |
^ self |
|
739 |
]. |
|
5998 | 740 |
(something == #methodTrap |
6846 | 741 |
or:[ something == #methodPrivacy |
742 |
or:[ something == #lastTestRunResult] ]) ifTrue:[ |
|
5998 | 743 |
self window shown ifFalse:[ |
744 |
changedObject removeDependent:self. "/ ????? |
|
745 |
^ self |
|
746 |
]. |
|
5591 | 747 |
cls := aParameter at:1. |
748 |
(classes includesIdentical:cls) ifFalse:[ |
|
5998 | 749 |
^ self "/ I dont care for that class |
5591 | 750 |
]. |
751 |
]. |
|
752 |
||
6846 | 753 |
"/ as the organisation changes, flush my remembered redefinition-cache-info |
5591 | 754 |
classAndSelectorsRedefinedBySubclassesOfClass := nil. |
755 |
||
756 |
something == #classDefinition ifTrue:[ |
|
757 |
cls := aParameter. |
|
758 |
(classes contains:[:aClass | aClass name == cls name]) ifFalse:[ |
|
759 |
^ self "/ I dont care for that class |
|
760 |
]. |
|
761 |
classes := classes collect:[:eachClass | eachClass isMeta ifTrue:[ |
|
762 |
(Smalltalk at:eachClass theNonMetaclass name) class |
|
763 |
] ifFalse:[ |
|
764 |
Smalltalk at:eachClass name |
|
765 |
] |
|
766 |
]. |
|
767 |
self updateList. |
|
768 |
^ self. |
|
769 |
]. |
|
770 |
something == #newClass ifTrue:[ |
|
771 |
^ self. |
|
772 |
]. |
|
773 |
something == #classRemove ifTrue:[ |
|
774 |
^ self. |
|
775 |
]. |
|
776 |
something == #classRename ifTrue:[ |
|
777 |
^ self. |
|
778 |
]. |
|
779 |
]. |
|
780 |
||
781 |
"/ these must lead to immediate update of the selectedMethods collection |
|
782 |
"/ (otherwise, that collection might be updated too late, leading to |
|
783 |
"/ an obsolete methods code being shown by the codeView. |
|
784 |
something == #methodInClass ifTrue:[ |
|
6846 | 785 |
"/ as the organisation changes, flush my remembered redefinition-cache-info |
5591 | 786 |
classAndSelectorsRedefinedBySubclassesOfClass := nil. |
787 |
cls := aParameter at:1. |
|
788 |
(classes includesIdentical:cls) ifFalse:[ |
|
789 |
^ self "/ I dont care for that class |
|
790 |
]. |
|
791 |
self enqueueDelayedUpdate:something with:aParameter from:changedObject. |
|
792 |
^ self |
|
793 |
]. |
|
794 |
||
795 |
something == #methodInClassRemoved ifTrue:[ |
|
796 |
cls := aParameter at:1. |
|
797 |
(classes includesIdentical:cls) ifFalse:[ |
|
798 |
^ self "/ I dont care for that class |
|
799 |
]. |
|
800 |
]. |
|
801 |
||
802 |
super update:something with:aParameter from:changedObject |
|
6846 | 803 |
|
804 |
"Modified: / 06-08-2006 / 11:03:31 / cg" |
|
5591 | 805 |
! ! |
806 |
||
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
807 |
!MethodList methodsFor:'drag & drop'! |
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 |
canDropContext:aDropContext |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
810 |
|methods| |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
811 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
812 |
aDropContext sourceWidget == aDropContext targetWidget ifTrue:[^ false]. |
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 |
methods := aDropContext dropObjects collect:[:obj | obj theObject]. |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
815 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
816 |
(methods contains:[:aMethod | aMethod isMethod not]) ifTrue:[^ false]. |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
817 |
self masterApplication theSingleSelectedClass isNil ifTrue:[^ false]. |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
818 |
^ true |
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 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
821 |
doDropContext:aDropContext |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
822 |
|cat methods| |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
823 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
824 |
methods := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject]. |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
825 |
(methods contains:[:something | something isMethod not]) ifTrue:[^ self]. |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
826 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
827 |
self masterApplication moveMethods:methods toClass:(self masterApplication theSingleSelectedClass). |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
828 |
! ! |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
829 |
|
5591 | 830 |
!MethodList methodsFor:'private'! |
831 |
||
832 |
listOfMethodNames |
|
833 |
|methods entries selectorBag newNameList |
|
834 |
allClasses newClasses allCategories "allSelectors" generator |
|
835 |
doShowClass doShowClassFirst doShowCategory |
|
836 |
enforceClassAndProtocolInList theMethod sortByClass anyMethodToWatch mclass| |
|
837 |
||
838 |
generator := inGeneratorHolder value. |
|
839 |
generator isNil ifTrue:[^ #() ]. |
|
840 |
||
841 |
allClasses := IdentitySet new. |
|
842 |
allCategories := IdentitySet new. "/ not needed - all I need to know is if there is more than 1 category |
|
843 |
"/ allSelectors := Set new. |
|
844 |
newClasses := IdentitySet new. |
|
845 |
selectorBag := Bag new. |
|
846 |
entries := OrderedCollection new. |
|
847 |
enforceClassAndProtocolInList := false. |
|
848 |
anyMethodToWatch := false. |
|
849 |
||
850 |
"/ generator generates nil-selector entries |
|
851 |
"/ to pass multiple-class and multiple-protocol info |
|
852 |
generator do:[:cls :cat :sel :mthd | |
|
853 |
(cls isNil and:[cat isNil and:[sel isNil]]) |
|
854 |
ifTrue:[ |
|
855 |
enforceClassAndProtocolInList := true |
|
856 |
] ifFalse:[ |
|
857 |
cls notNil ifTrue:[ |
|
858 |
allClasses add:cls. |
|
859 |
]. |
|
860 |
cat notNil ifTrue:[ |
|
861 |
allCategories add:cat. |
|
862 |
]. |
|
863 |
sel notNil ifTrue:[ |
|
864 |
entries add:(Array with:cls with:sel with:mthd). |
|
865 |
selectorBag add:sel. |
|
866 |
newClasses add:cls. |
|
867 |
"/ allSelectors add:sel. |
|
868 |
] |
|
869 |
]. |
|
870 |
(mthd notNil and:[mthd isWrapped]) ifTrue:[ |
|
871 |
(mthd isTiming |
|
872 |
or:[mthd isCounting |
|
873 |
or:[mthd isCountingMemoryUsage]]) |
|
874 |
ifTrue:[ |
|
875 |
anyMethodToWatch := true |
|
876 |
] |
|
877 |
]. |
|
878 |
]. |
|
879 |
||
880 |
showMethodInheritance value ~~ false ifTrue:[ |
|
881 |
"/ collect redefinition information once (big speedup for #methodIsRedefinedbelow) |
|
882 |
classAndSelectorsRedefinedBySubclassesOfClass isNil ifTrue:[ |
|
883 |
classAndSelectorsRedefinedBySubclassesOfClass := IdentityDictionary new. |
|
884 |
]. |
|
885 |
allClasses do:[:cls | |d| |
|
886 |
d := classAndSelectorsRedefinedBySubclassesOfClass. |
|
887 |
(d notNil and:[ (d includesKey:cls) not ]) ifTrue:[ |
|
888 |
d at:cls put:(self setOfAllSelectorsImplementedBelow:cls) |
|
889 |
] |
|
890 |
]. |
|
891 |
]. |
|
892 |
||
893 |
"/ multiple classes must: add the className for some |
|
894 |
doShowClass := enforceClassAndProtocolInList or:[allClasses size > 1]. |
|
895 |
"/ multiple categories: must add the categorie for some |
|
896 |
doShowCategory := enforceClassAndProtocolInList or:[allCategories size > 1]. |
|
897 |
||
898 |
doShowClassFirst := doShowClass. "/ (doShowClass and:[allSelectors size == 1]). |
|
899 |
doShowClassFirst := doShowClass and:[ sortBy value == #class ]. |
|
900 |
||
901 |
sortBy value == false ifTrue:[ |
|
902 |
"/ do not sort |
|
903 |
] ifFalse:[ |
|
904 |
(doShowClass not and:[ sortBy value == #class ]) ifTrue:[ |
|
905 |
"/ multiple classes must add the className for some |
|
906 |
"/ check, if doShowClass must be enforced |
|
907 |
entries do:[:entry | |
|
908 |
|cls sel mthd s needClass| |
|
909 |
||
910 |
cls := entry at:1. |
|
911 |
sel := entry at:2. |
|
912 |
mthd := entry at:3. |
|
913 |
doShowClass ifFalse:[ |
|
914 |
doShowClass := (selectorBag occurrencesOf:sel) > 1 |
|
915 |
]. |
|
916 |
]. |
|
917 |
]. |
|
918 |
||
919 |
sortByClass := doShowClass and:[ sortBy value == #class ]. |
|
920 |
||
921 |
sortByClass ifTrue:[ |
|
922 |
entries sort:[:a :b | |nmA nmB clsNmA clsNmB| |
|
923 |
clsNmA := (a at:1) name. |
|
924 |
clsNmB := (b at:1) name. |
|
925 |
clsNmA = clsNmB ifTrue:[ |
|
926 |
nmA := (a at:2). |
|
927 |
nmB := (b at:2). |
|
928 |
nmA < nmB |
|
929 |
] ifFalse:[ |
|
930 |
clsNmA < clsNmB |
|
931 |
] |
|
932 |
]. |
|
933 |
] ifFalse:[ |
|
934 |
entries sort:[:a :b | |nmA nmB clsNmA clsNmB| |
|
935 |
nmA := (a at:2). |
|
936 |
nmB := (b at:2). |
|
937 |
nmA = nmB ifTrue:[ |
|
938 |
clsNmA := (a at:1) name. |
|
939 |
clsNmB := (b at:1) name. |
|
940 |
clsNmA < clsNmB |
|
941 |
] ifFalse:[ |
|
942 |
nmA < nmB |
|
943 |
] |
|
944 |
]. |
|
945 |
]. |
|
946 |
]. |
|
947 |
||
948 |
methods := OrderedCollection new:(entries size). |
|
949 |
||
950 |
"/ first generate the new methodList, and see if it is different ... |
|
951 |
entries do:[:entry | |
|
952 |
|sel mthd| |
|
953 |
||
954 |
mthd := entry at:3. |
|
955 |
methods add:mthd. |
|
956 |
]. |
|
957 |
||
958 |
false "methodList = methods" "does not care for changed icons" ifTrue:[ |
|
959 |
"/ same list |
|
960 |
newNameList := self browserNameList. |
|
961 |
] ifFalse:[ |
|
962 |
newNameList := OrderedCollection new:(entries size). |
|
963 |
||
964 |
"/ multiple classes must add the className for some |
|
965 |
entries do:[:entry | |
|
966 |
|cls sel mthd s needClass| |
|
967 |
||
968 |
cls := entry at:1. |
|
969 |
sel := entry at:2. |
|
970 |
mthd := entry at:3. |
|
971 |
needClass := doShowClass. |
|
972 |
"/ needClass ifFalse:[ |
|
973 |
"/ needClass := (selectorBag occurrencesOf:sel) > 1 |
|
974 |
"/ ]. |
|
975 |
s := self |
|
976 |
listEntryForMethod:mthd |
|
977 |
selector:sel |
|
978 |
class:cls |
|
979 |
showClass:needClass |
|
980 |
showCategory:doShowCategory |
|
981 |
classFirst:doShowClassFirst. |
|
982 |
||
983 |
"/ s := mthd printStringForBrowserWithSelector:sel inClass:cls. |
|
984 |
"/ needClass ifTrue:[ |
|
985 |
"/ s := s , ' [' , cls name , ']'. |
|
986 |
"/ ]. |
|
987 |
"/ doShowCategory ifTrue:[ |
|
988 |
"/ s := s , ' {' , mthd category "asText allItalic" , '}' |
|
989 |
"/ ]. |
|
990 |
newNameList add:s. |
|
991 |
]. |
|
992 |
]. |
|
993 |
||
994 |
self makeIndependent. |
|
995 |
classes := newClasses. |
|
996 |
self makeDependent. |
|
997 |
||
998 |
methodList := methods. |
|
999 |
methods size == 1 ifTrue:[ |
|
1000 |
theMethod := methods first. |
|
1001 |
mclass := theMethod mclass. |
|
1002 |
mclass isNil ifTrue:[ |
|
1003 |
theMethod isWrapped ifTrue:[ |
|
1004 |
theMethod := theMethod originalMethod. |
|
1005 |
mclass := theMethod mclass. |
|
1006 |
]. |
|
1007 |
]. |
|
6697 | 1008 |
self methodLabelHolder value:( |
1009 |
mclass isNil |
|
1010 |
ifTrue:[('???' , ' ' , '???')] |
|
1011 |
ifFalse:[(mclass name , ' ' , theMethod selector)]) |
|
5591 | 1012 |
]. |
1013 |
||
1014 |
anyMethodToWatch ifTrue:[ |
|
1015 |
self startWatchProcess. |
|
1016 |
] ifFalse:[ |
|
1017 |
self stopWatchProcess. |
|
1018 |
]. |
|
1019 |
||
1020 |
"/ remember these, in case of an incremental (single method only) |
|
1021 |
"/ update in the future. |
|
1022 |
lastShowClass := doShowClass. |
|
1023 |
lastShowClassFirst := doShowClassFirst. |
|
1024 |
lastShowCategory := doShowCategory. |
|
1025 |
||
1026 |
^ newNameList. |
|
1027 |
||
1028 |
"Created: / 5.2.2000 / 22:43:40 / cg" |
|
1029 |
"Modified: / 1.3.2000 / 21:00:26 / cg" |
|
1030 |
! |
|
1031 |
||
1032 |
makeDependent |
|
1033 |
Smalltalk addDependent:self. |
|
1034 |
! |
|
1035 |
||
1036 |
makeIndependent |
|
1037 |
Smalltalk removeDependent:self. |
|
1038 |
! |
|
1039 |
||
1040 |
method:mthd includesModsOfClassVariable:variablesToHighLight |
|
1041 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#modifiedClassVars |
|
1042 |
! |
|
1043 |
||
1044 |
method:mthd includesModsOfInstanceVariable:variablesToHighLight |
|
1045 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#modifiedInstVars |
|
1046 |
! |
|
1047 |
||
1048 |
method:mthd includesRefsToClassVariable:variablesToHighLight |
|
1049 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#usedClassVars |
|
1050 |
! |
|
1051 |
||
1052 |
method:mthd includesRefsToInstanceVariable:variablesToHighLight |
|
1053 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#usedInstVars |
|
1054 |
! |
|
1055 |
||
1056 |
method:mthd includesRefsToVariable:variablesToHighLight askParserWith:querySelector |
|
1057 |
|cls src parser usedVars anyVarNameAccessable| |
|
1058 |
||
1059 |
cls := mthd mclass. |
|
5885 | 1060 |
cls isNil ifTrue:[^ false]. |
1061 |
||
5591 | 1062 |
anyVarNameAccessable := cls allInstVarNames includesAny:variablesToHighLight. |
1063 |
anyVarNameAccessable ifFalse:[ |
|
5885 | 1064 |
anyVarNameAccessable := cls theNonMetaclass allClassVarNames includesAny:variablesToHighLight. |
5591 | 1065 |
]. |
1066 |
anyVarNameAccessable ifFalse:[ |
|
5885 | 1067 |
"/ no need to parse |
1068 |
^ false |
|
5591 | 1069 |
]. |
1070 |
||
1071 |
src := mthd source. |
|
1072 |
src notNil ifTrue:[ |
|
5885 | 1073 |
" |
1074 |
before doing a slow parse, quickly scan the |
|
1075 |
methods source for the variables name ... |
|
1076 |
" |
|
1077 |
(variablesToHighLight contains:[:varName | (src findString:varName) ~~ 0]) ifTrue:[ |
|
1078 |
parser := Parser |
|
1079 |
parseMethod:src |
|
1080 |
in:cls |
|
1081 |
ignoreErrors:true |
|
1082 |
ignoreWarnings:true. |
|
1083 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
|
1084 |
usedVars := parser perform:querySelector. |
|
1085 |
(usedVars includesAny:variablesToHighLight) |
|
1086 |
ifTrue:[ |
|
1087 |
^ true |
|
1088 |
] |
|
1089 |
] |
|
1090 |
] |
|
5591 | 1091 |
]. |
1092 |
^ false |
|
1093 |
! |
|
1094 |
||
1095 |
methodIsInheritedFromAbove:aMethod |
|
1096 |
|mClass| |
|
1097 |
||
1098 |
mClass := aMethod mclass. |
|
1099 |
(mClass notNil and:[mClass superclass notNil]) ifTrue:[ |
|
6789 | 1100 |
^ (mClass superclass whichClassIncludesSelector:aMethod selector) notNil. |
5591 | 1101 |
]. |
1102 |
^ false |
|
1103 |
! |
|
1104 |
||
1105 |
methodIsRedefinedBelow:aMethod |
|
1106 |
|mclass subClasses setOfRedefinedSelectors| |
|
1107 |
||
1108 |
mclass := aMethod mclass. |
|
1109 |
mclass isNil ifTrue:[^ false]. |
|
1110 |
||
1111 |
"/ if possible, make use of info prepared by listOfMethodNames |
|
1112 |
classAndSelectorsRedefinedBySubclassesOfClass notNil |
|
1113 |
ifTrue:[ |
|
1114 |
setOfRedefinedSelectors := classAndSelectorsRedefinedBySubclassesOfClass at:mclass ifAbsent:nil. |
|
1115 |
setOfRedefinedSelectors notNil ifTrue:[ |
|
1116 |
^ setOfRedefinedSelectors includes:aMethod selector |
|
1117 |
] |
|
1118 |
]. |
|
1119 |
||
1120 |
lastMethodClass == mclass ifTrue:[ |
|
1121 |
subClasses := lastMethodClassesSubclasses |
|
1122 |
] ifFalse:[ |
|
1123 |
subClasses := aMethod mclass allSubclasses. |
|
1124 |
lastMethodClassesSubclasses := subClasses. |
|
1125 |
lastMethodClass := mclass. |
|
1126 |
]. |
|
1127 |
^ subClasses contains:[:cls | cls implements:aMethod selector]. |
|
1128 |
! |
|
1129 |
||
1130 |
redefinedOrInheritedIconFor:aMethod |
|
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1131 |
|inherited redefined subclassResponsibility| |
5591 | 1132 |
|
1133 |
inherited := self methodIsInheritedFromAbove:aMethod. |
|
1134 |
redefined := self methodIsRedefinedBelow:aMethod. |
|
1135 |
||
1136 |
inherited ifTrue:[ |
|
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1137 |
redefined ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1138 |
^ self methodInheritedFromAboveAndRedefinedBelowIcon. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1139 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1140 |
^ self methodInheritedFromAboveIcon. |
5591 | 1141 |
]. |
5761
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 := aMethod sends:#subclassResponsibility. |
5591 | 1144 |
redefined ifTrue:[ |
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1145 |
subclassResponsibility ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1146 |
^ self methodIsSubclassResponsibilityAndRedefinedBelowIcon. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1147 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1148 |
^ self methodRedefinedBelowIcon. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1149 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1150 |
subclassResponsibility ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1151 |
^ self methodIsSubclassResponsibilityIcon. |
5591 | 1152 |
]. |
1153 |
||
1154 |
^ self methodEmptyInheritedIcon |
|
1155 |
! |
|
1156 |
||
1157 |
release |
|
1158 |
super release. |
|
1159 |
||
1160 |
filterClassVars removeDependent:self. |
|
1161 |
selectedMethodNameIndices removeDependent:self. |
|
1162 |
showMethodInheritance removeDependent:self. |
|
1163 |
variableFilter removeDependent:self. |
|
1164 |
! |
|
1165 |
||
1166 |
resourceIconForMethod:aMethod |
|
1167 |
|resources| |
|
1168 |
||
1169 |
(resources := aMethod resources) notNil ifTrue:[ |
|
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1170 |
(resources includesKey:#obsolete) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1171 |
^ self deprecatedMethodIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1172 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1173 |
(resources includesKey:#canvas) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1174 |
^ self canvasIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1175 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1176 |
(resources includesKey:#menu) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1177 |
^ self menuIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1178 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1179 |
(resources includesKey:#image) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1180 |
^ self imageIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1181 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1182 |
(resources includesKey:#fileImage) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1183 |
^ self fileImageIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1184 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1185 |
(resources includesKey:#programImage) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1186 |
^ self programImageIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1187 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1188 |
(resources includesKey:#help) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1189 |
^ self helpIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1190 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1191 |
(resources includesKey:#programMenu) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1192 |
^ self programMenuIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1193 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1194 |
(resources includesKey:#tableColumns) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1195 |
^ self tableColumnsIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1196 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1197 |
(resources includesKey:#tabList) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1198 |
^ self tabListIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1199 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1200 |
(resources includesKey:#hierarchicalList) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1201 |
^ self hierarchicalListIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1202 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1203 |
(resources includesKey:#programImage) ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1204 |
^ self programImageIcon |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1205 |
] |
5591 | 1206 |
]. |
1207 |
^ nil |
|
1208 |
! |
|
1209 |
||
1210 |
setOfAllSelectorsImplementedBelow:aClass |
|
1211 |
|set| |
|
1212 |
||
1213 |
set := IdentitySet new. |
|
1214 |
aClass allSubclassesDo:[:eachSubclass | |
|
1215 |
set addAll:(eachSubclass methodDictionary keys). |
|
1216 |
]. |
|
1217 |
^ set |
|
1218 |
! |
|
1219 |
||
1220 |
updateList |
|
1221 |
|prevSelection newList newSelection newSelIdx reverseMap sameContents newListSize oldListSize |
|
1222 |
prevClasses methodSet selectedMethodsHolder| |
|
1223 |
||
1224 |
selectedMethodsHolder := self selectedMethods. |
|
1225 |
prevSelection := selectedMethodsHolder value ? #(). |
|
1226 |
||
1227 |
prevClasses := classes ifNil:[ #() ] ifNotNil:[ classes copy ]. |
|
1228 |
||
1229 |
oldListSize := self browserNameList size. |
|
1230 |
||
1231 |
"/ self topApplication withWaitCursorDo:[ |
|
1232 |
newList := self listOfMethodNames. |
|
1233 |
newListSize := newList size. |
|
1234 |
sameContents := self updateListFor:newList. |
|
1235 |
||
1236 |
sameContents ifFalse:[ |
|
1237 |
"/ self browserNameList value:newList. |
|
1238 |
||
1239 |
(prevSelection size == 0 |
|
1240 |
and:[selectedMethodsHolder value size ~~ 0]) ifTrue:[ |
|
1241 |
"/ this happens during early startup time, |
|
1242 |
"/ when the selection is already (pre-)set, |
|
1243 |
"/ and the methodList is generated the first time |
|
1244 |
"/ (i.e. when opened with preset selection |
|
1245 |
||
1246 |
"/ do not clobber the selection in this case. |
|
1247 |
prevSelection := selectedMethodsHolder value. |
|
1248 |
]. |
|
1249 |
||
1250 |
(methodList size == 0 or:[prevSelection size == 0]) ifTrue:[ |
|
1251 |
newSelection := #() |
|
1252 |
] ifFalse:[ |
|
1253 |
methodSet := methodList. |
|
1254 |
||
1255 |
"/ inclusion test is much faster with sets, if the number of items is large |
|
1256 |
methodList size > 30 ifTrue:[ |
|
1257 |
"/ however, only if its worth building the set ... |
|
1258 |
prevSelection size > 5 ifTrue:[ |
|
1259 |
methodSet := methodSet asIdentitySet. |
|
1260 |
] |
|
1261 |
]. |
|
1262 |
newSelection := prevSelection select:[:item | methodSet includesIdentical:item]. |
|
1263 |
]. |
|
1264 |
newSelection size > 0 ifTrue:[ |
|
1265 |
newSelection size > 100 ifTrue:[ |
|
1266 |
"/ need selection indices - might be expensive if done straight forward... |
|
1267 |
reverseMap := IdentityDictionary new. |
|
1268 |
methodList keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. |
|
1269 |
newSelIdx := newSelection collect:[:mthd | reverseMap at:mthd]. |
|
1270 |
] ifFalse:[ |
|
1271 |
newSelIdx := newSelection collect:[:mthd | methodList identityIndexOf:mthd] |
|
1272 |
]. |
|
1273 |
"/ self halt. |
|
1274 |
"/ force change (for dependents) |
|
1275 |
selectedMethodNameIndices value:newSelIdx. |
|
1276 |
] ifFalse:[ |
|
1277 |
lastSelectedMethods := selectedMethodsHolder value. |
|
1278 |
lastSelectedMethods notNil ifTrue:[ |
|
1279 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection |
|
1280 |
]. |
|
1281 |
selectedMethodNameIndices value size > 0 ifTrue:[ |
|
1282 |
selectedMethodNameIndices value:#(). |
|
1283 |
] |
|
1284 |
]. |
|
1285 |
||
1286 |
newSelection ~= prevSelection ifTrue:[ |
|
1287 |
self selectionChanged. |
|
1288 |
] |
|
1289 |
] ifTrue:[ |
|
1290 |
"/ same list - but classes might have changed |
|
1291 |
"/ that is the case, if the class selection has been changed, |
|
1292 |
"/ to another class which has the same categories. |
|
1293 |
||
1294 |
(prevClasses size ~= classes size |
|
1295 |
or:[prevClasses asOrderedCollection ~= (classes ? #()) asOrderedCollection ]) ifTrue:[ |
|
1296 |
(newListSize > 0 or:[oldListSize > 0]) ifTrue:[ |
|
1297 |
self selectionChanged. |
|
1298 |
] |
|
1299 |
] |
|
1300 |
] |
|
1301 |
"/ ]. |
|
1302 |
||
1303 |
"Modified: / 18.8.2000 / 19:47:22 / cg" |
|
1304 |
! |
|
1305 |
||
1306 |
updateListEntryFor:aMethod |
|
1307 |
"update my list for a single method. |
|
1308 |
(used when a single methods package, code or whatever changes, and a full udpate |
|
1309 |
would be too slow)" |
|
1310 |
||
1311 |
|s idx| |
|
1312 |
||
1313 |
s := self |
|
6268 | 1314 |
listEntryForMethod:aMethod |
1315 |
selector:aMethod selector |
|
1316 |
class:aMethod mclass |
|
1317 |
showClass:lastShowClass |
|
1318 |
showCategory:lastShowCategory |
|
1319 |
classFirst:lastShowClassFirst. |
|
5591 | 1320 |
|
1321 |
idx := methodList identityIndexOf:aMethod. |
|
1322 |
idx == 0 ifTrue:[ |
|
6268 | 1323 |
aMethod isWrapped ifTrue:[ |
1324 |
idx := methodList identityIndexOf:aMethod originalMethod. |
|
1325 |
] |
|
5591 | 1326 |
]. |
1327 |
idx == 0 ifTrue:[ |
|
6268 | 1328 |
self invalidateList |
5591 | 1329 |
] ifFalse:[ |
6268 | 1330 |
self browserNameList at:idx put:s. |
5591 | 1331 |
] |
1332 |
! ! |
|
1333 |
||
6271 | 1334 |
!MethodList methodsFor:'private-presentation'! |
1335 |
||
1336 |
listEntryForMethod:aMethod selector:selector class:cls showClass:showClass showCategory:showCategory classFirst:showClassFirst |
|
1337 |
"answer a method list entry |
|
1338 |
gimmics: |
|
1339 |
adding a little image to breakPointed methods, |
|
1340 |
inheritance indicators, |
|
1341 |
highlight accessors of variable" |
|
1342 |
||
1343 |
|clsName s icn variablesToHighlight classVarsToHighLight |
|
6278 | 1344 |
doHighLight doHighLightRed emp cat l redefIcon |
1345 |
metrics complexity complexityString complexityIcon| |
|
6271 | 1346 |
|
1347 |
aMethod isAssociation ifTrue:[ |
|
1348 |
self halt:'should not happen'. |
|
1349 |
]. |
|
1350 |
||
1351 |
s := aMethod printStringForBrowserWithSelector:selector inClass:cls. |
|
1352 |
showClassFirst ifTrue:[ |
|
1353 |
clsName := cls nameInBrowser. |
|
1354 |
s := clsName , ' ' , s allBold |
|
1355 |
]. |
|
1356 |
||
1357 |
"/ |
|
1358 |
"/ wrap icons (i.e. break- or trace points) |
|
1359 |
"/ have higher prio ... |
|
1360 |
"/ |
|
1361 |
aMethod isWrapped ifTrue:[ |
|
1362 |
(s endsWith:' !!') ifTrue:[ |
|
1363 |
s := s copyWithoutLast:2 |
|
1364 |
]. |
|
1365 |
aMethod isBreakpointed ifTrue:[ |
|
1366 |
icn := self stopIcon |
|
1367 |
] ifFalse:[ |
|
1368 |
aMethod isTimed ifTrue:[ |
|
1369 |
icn := self timeIcon |
|
1370 |
] ifFalse:[ |
|
1371 |
icn := self traceIcon |
|
1372 |
] |
|
1373 |
]. |
|
1374 |
]. |
|
1375 |
||
1376 |
icn isNil ifTrue:[ |
|
1377 |
showMethodTypeIcon value ~~ false ifTrue:[ |
|
1378 |
icn := self resourceIconForMethod:aMethod. |
|
1379 |
]. |
|
1380 |
icn isNil ifTrue:[ |
|
1381 |
aMethod isProtected ifTrue:[ |
|
1382 |
icn := self protectedMethodIcon |
|
1383 |
] ifFalse:[ |
|
1384 |
aMethod isPrivate ifTrue:[ |
|
1385 |
icn := self privateMethodIcon |
|
1386 |
] ifFalse:[ |
|
1387 |
(aMethod isIgnored) ifTrue:[ |
|
1388 |
icn := self ignoredMethodIcon |
|
1389 |
] ifFalse:[ |
|
1390 |
(aMethod isJavaMethod and:[aMethod isAbstract]) ifTrue:[ |
|
1391 |
icn := self abstractMethodIcon |
|
1392 |
] |
|
1393 |
] |
|
1394 |
] |
|
1395 |
]. |
|
1396 |
]. |
|
1397 |
]. |
|
1398 |
icn isNil ifTrue:[ |
|
1399 |
(selector startsWith:'test') ifTrue:[ |
|
1400 |
((cls isSubclassOf:TestCase) |
|
1401 |
and:[cls isAbstract not]) ifTrue:[ |
|
1402 |
cls lastTestRunResultOrNil == false ifTrue:[ |
|
1403 |
(cls testSelectorFailed:selector) ifTrue:[ |
|
1404 |
icn := SystemBrowser testCaseFailedIcon |
|
1405 |
] ifFalse:[ |
|
1406 |
"/ icn := SystemBrowser testCasePassedIcon |
|
1407 |
]. |
|
1408 |
] |
|
1409 |
]. |
|
1410 |
] |
|
1411 |
]. |
|
1412 |
||
1413 |
showClass ifTrue:[ |
|
1414 |
showClassFirst ifFalse:[ |
|
1415 |
s := s , ' [' , cls name allBold , ']'. |
|
1416 |
] |
|
1417 |
]. |
|
1418 |
showCategory ifTrue:[ |
|
1419 |
cat := aMethod category. |
|
1420 |
cat notNil ifTrue:[ |
|
1421 |
s := s , ' {' , cat "asText allItalic" , '}' |
|
1422 |
] |
|
1423 |
]. |
|
6841
6d72f92ed6cd
mark changed methods with a '*'
Claus Gittinger <cg@exept.de>
parents:
6789
diff
changeset
|
1424 |
(ChangeSet current includesChangeForClass:cls selector:selector) ifTrue:[ |
6d72f92ed6cd
mark changed methods with a '*'
Claus Gittinger <cg@exept.de>
parents:
6789
diff
changeset
|
1425 |
s := s , ' *' |
6d72f92ed6cd
mark changed methods with a '*'
Claus Gittinger <cg@exept.de>
parents:
6789
diff
changeset
|
1426 |
]. |
6271 | 1427 |
|
1428 |
variablesToHighlight := variableFilter value. |
|
1429 |
variablesToHighlight size > 0 ifTrue:[ |
|
1430 |
classVarsToHighLight := filterClassVars value. |
|
1431 |
classVarsToHighLight ifTrue:[ |
|
1432 |
doHighLight := self method:aMethod includesRefsToClassVariable:variablesToHighlight. |
|
1433 |
doHighLight ifTrue:[ |
|
1434 |
doHighLightRed := self method:aMethod includesModsOfClassVariable:variablesToHighlight. |
|
1435 |
]. |
|
1436 |
] ifFalse:[ |
|
1437 |
doHighLight := self method:aMethod includesRefsToInstanceVariable:variablesToHighlight. |
|
1438 |
doHighLight ifTrue:[ |
|
1439 |
doHighLightRed := self method:aMethod includesModsOfInstanceVariable:variablesToHighlight |
|
1440 |
] |
|
1441 |
]. |
|
1442 |
doHighLight ifTrue:[ |
|
1443 |
s := s allBold. |
|
1444 |
doHighLightRed ifTrue:[ |
|
1445 |
emp := (UserPreferences current emphasisForWrittenVariable) |
|
1446 |
] ifFalse:[ |
|
1447 |
emp := (UserPreferences current emphasisForReadVariable) |
|
1448 |
]. |
|
1449 |
s := s emphasisAllAdd:emp |
|
1450 |
] |
|
1451 |
]. |
|
1452 |
||
6694 | 1453 |
(showMethodComplexity value == true |
6271 | 1454 |
and:[ OOM::MethodMetrics notNil ]) ifTrue:[ |
6278 | 1455 |
icn isNil ifTrue:[ |
6271 | 1456 |
metrics := OOM::MethodMetrics forMethod:aMethod. |
1457 |
complexity := metrics complexity ? 0. |
|
1458 |
complexityIcon := OOM::MethodMetrics iconForComplexity:complexity. |
|
1459 |
||
1460 |
ShowComplexityValue == true ifTrue:[ |
|
6272 | 1461 |
complexityString := '{' , complexity printString , '}'. |
1462 |
s := complexityString , ' ' , s. |
|
6271 | 1463 |
]. |
1464 |
"/ icn := icn ? complexityIcon. |
|
1465 |
s := LabelAndIcon icon:complexityIcon string:s. |
|
6278 | 1466 |
]. |
6271 | 1467 |
]. |
1468 |
||
1469 |
showMethodInheritance value ~~ false ifTrue:[ |
|
1470 |
redefIcon := self redefinedOrInheritedIconFor:aMethod. |
|
1471 |
]. |
|
1472 |
||
1473 |
(icn notNil or:[redefIcon notNil]) ifTrue:[ |
|
1474 |
l := LabelAndIcon icon:redefIcon string:s. |
|
1475 |
l image:icn. |
|
1476 |
l gap:2. |
|
1477 |
^ l |
|
1478 |
]. |
|
1479 |
^ s |
|
1480 |
||
6841
6d72f92ed6cd
mark changed methods with a '*'
Claus Gittinger <cg@exept.de>
parents:
6789
diff
changeset
|
1481 |
"Created: / 22-10-1996 / 19:51:00 / cg" |
6d72f92ed6cd
mark changed methods with a '*'
Claus Gittinger <cg@exept.de>
parents:
6789
diff
changeset
|
1482 |
"Modified: / 05-08-2006 / 17:32:58 / cg" |
6271 | 1483 |
! ! |
1484 |
||
5591 | 1485 |
!MethodList methodsFor:'private-watching'! |
1486 |
||
1487 |
startWatchProcess |
|
1488 |
updateProcess notNil ifTrue:[ |
|
1489 |
^ self |
|
1490 |
]. |
|
1491 |
updateProcess := [ |
|
1492 |
[true] whileTrue:[ |
|
1493 |
Delay waitForSeconds:1. |
|
1494 |
self enqueueDelayedUpdateList |
|
1495 |
] |
|
1496 |
] fork. |
|
1497 |
! |
|
1498 |
||
1499 |
stopWatchProcess |
|
1500 |
|p| |
|
1501 |
||
1502 |
(p := updateProcess) notNil ifTrue:[ |
|
1503 |
updateProcess := nil. |
|
1504 |
p terminate |
|
1505 |
]. |
|
1506 |
! ! |
|
1507 |
||
1508 |
!MethodList methodsFor:'setup'! |
|
1509 |
||
1510 |
postBuildWith:aBuilder |
|
1511 |
|methodListView| |
|
1512 |
||
1513 |
super postBuildWith:aBuilder. |
|
1514 |
||
1515 |
methodListView := aBuilder componentAt:'List'. |
|
1516 |
methodListView notNil ifTrue:[ |
|
6277 | 1517 |
methodListView allowDrag:true. |
1518 |
methodListView dragObjectConverter:[:obj | |
|
1519 |
|nm method idx| |
|
5591 | 1520 |
|
6277 | 1521 |
nm := obj theObject asString string string. |
1522 |
idx := browserNameList value findFirst:[:item | item string string = nm]. |
|
1523 |
method := methodList value at:idx. |
|
1524 |
DropObject newMethod:method. |
|
1525 |
]. |
|
5591 | 1526 |
] |
1527 |
! ! |
|
1528 |
||
1529 |
!MethodList class methodsFor:'documentation'! |
|
1530 |
||
1531 |
version |
|
6846 | 1532 |
^ '$Header: /cvs/stx/stx/libtool/Tools_MethodList.st,v 1.21 2006-08-07 10:16:56 cg Exp $' |
5591 | 1533 |
! ! |