14098
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2000 by eXept Software AG
|
14100
|
3 |
All Rights Reserved
|
14098
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libtool' }"
|
|
13 |
|
|
14 |
"{ NameSpace: Tools }"
|
|
15 |
|
|
16 |
BrowserList subclass:#MethodList
|
|
17 |
instanceVariableNames:'classes selectedMethodNameIndices methodList lastSelectedMethods
|
|
18 |
browserNameList variableFilter filterClassVars updateProcess
|
|
19 |
lastShowClass lastShowCategory lastShowClassFirst
|
|
20 |
showMethodInheritance lastMethodClass lastMethodClassesSubclasses
|
|
21 |
classAndSelectorsRedefinedBySubclassesOfClass showClass
|
|
22 |
showMethodComplexity showMethodTypeIcon
|
|
23 |
showImageResourceMethodsImages showSyntheticMethods'
|
|
24 |
classVariableNames:'ShowComplexityValue'
|
|
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
|
14100
|
34 |
All Rights Reserved
|
14098
|
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 |
documentation
|
|
46 |
"
|
|
47 |
I implement the method list in the new system browser
|
|
48 |
"
|
|
49 |
! !
|
|
50 |
|
|
51 |
!MethodList class methodsFor:'interface specs'!
|
|
52 |
|
|
53 |
singleMethodWindowSpec
|
|
54 |
"This resource specification was automatically generated
|
|
55 |
by the UIPainter of ST/X."
|
|
56 |
|
|
57 |
"Do not manually edit this!! If it is corrupted,
|
|
58 |
the UIPainter may not be able to read the specification."
|
|
59 |
|
|
60 |
"
|
|
61 |
UIPainter new openOnClass:MethodList andSelector:#singleMethodWindowSpec
|
|
62 |
MethodList new openInterface:#singleMethodWindowSpec
|
|
63 |
"
|
|
64 |
|
|
65 |
<resource: #canvas>
|
|
66 |
|
14100
|
67 |
^
|
14098
|
68 |
#(#FullSpec
|
14100
|
69 |
#name: #singleMethodWindowSpec
|
|
70 |
#window:
|
14098
|
71 |
#(#WindowSpec
|
14100
|
72 |
#label: 'SingleSelectorList'
|
|
73 |
#name: 'SingleSelectorList'
|
|
74 |
#min: #(#Point 0 0)
|
|
75 |
#max: #(#Point 1024 721)
|
|
76 |
#bounds: #(#Rectangle 12 22 312 322)
|
|
77 |
)
|
|
78 |
#component:
|
14098
|
79 |
#(#SpecCollection
|
14100
|
80 |
#collection: #(
|
|
81 |
#(#LabelSpec
|
|
82 |
#label: 'MethodName'
|
|
83 |
#name: 'MethodLabel'
|
|
84 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 25 0)
|
|
85 |
#translateLabel: true
|
|
86 |
#labelChannel: #methodLabelHolder
|
|
87 |
#menu: #menuHolder
|
|
88 |
)
|
|
89 |
)
|
|
90 |
|
|
91 |
)
|
14098
|
92 |
)
|
|
93 |
|
|
94 |
"Modified: / 1.3.2000 / 20:50:15 / cg"
|
|
95 |
!
|
|
96 |
|
|
97 |
windowSpec
|
|
98 |
"This resource specification was automatically generated
|
|
99 |
by the UIPainter of ST/X."
|
|
100 |
|
|
101 |
"Do not manually edit this!! If it is corrupted,
|
|
102 |
the UIPainter may not be able to read the specification."
|
|
103 |
|
|
104 |
"
|
|
105 |
UIPainter new openOnClass:Tools::MethodList andSelector:#windowSpec
|
|
106 |
Tools::MethodList new openInterface:#windowSpec
|
|
107 |
Tools::MethodList open
|
|
108 |
"
|
|
109 |
|
|
110 |
<resource: #canvas>
|
|
111 |
|
14100
|
112 |
^
|
14098
|
113 |
#(FullSpec
|
14100
|
114 |
name: windowSpec
|
|
115 |
window:
|
14098
|
116 |
(WindowSpec
|
14100
|
117 |
label: 'SelectorList'
|
|
118 |
name: 'SelectorList'
|
|
119 |
min: (Point 0 0)
|
|
120 |
bounds: (Rectangle 0 0 300 300)
|
|
121 |
)
|
|
122 |
component:
|
14098
|
123 |
(SpecCollection
|
14100
|
124 |
collection: (
|
|
125 |
(SequenceViewSpec
|
|
126 |
name: 'List'
|
|
127 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
128 |
tabable: true
|
|
129 |
model: selectedMethodNameIndices
|
|
130 |
menu: menuHolder
|
|
131 |
hasHorizontalScrollBar: true
|
|
132 |
hasVerticalScrollBar: true
|
|
133 |
miniScrollerHorizontal: true
|
|
134 |
isMultiSelect: true
|
|
135 |
valueChangeSelector: selectionChangedByClick
|
|
136 |
useIndex: true
|
|
137 |
sequenceList: browserNameList
|
|
138 |
doubleClickChannel: doubleClickChannel
|
|
139 |
properties:
|
|
140 |
(PropertyListDictionary
|
|
141 |
canDropSelector: canDropContext:
|
|
142 |
dragArgument: nil
|
|
143 |
dropArgument: nil
|
|
144 |
dropSelector: doDropContext:
|
|
145 |
)
|
|
146 |
)
|
|
147 |
)
|
|
148 |
|
|
149 |
)
|
14098
|
150 |
)
|
|
151 |
! !
|
|
152 |
|
|
153 |
!MethodList class methodsFor:'plugIn spec'!
|
|
154 |
|
|
155 |
aspectSelectors
|
|
156 |
"This resource specification was automatically generated
|
|
157 |
by the UIPainter of ST/X."
|
|
158 |
|
|
159 |
"Do not manually edit this. If it is corrupted,
|
|
160 |
the UIPainter may not be able to read the specification."
|
|
161 |
|
|
162 |
"Return a description of exported aspects;
|
|
163 |
these can be connected to aspects of an embedding application
|
|
164 |
(if this app is embedded in a subCanvas)."
|
|
165 |
|
|
166 |
^ #(
|
14100
|
167 |
environmentHolder
|
|
168 |
#(doubleClickChannel action)
|
|
169 |
#filterClassVars
|
|
170 |
#forceGeneratorTrigger
|
|
171 |
#immediateUpdate
|
|
172 |
#inGeneratorHolder
|
|
173 |
#menuHolder
|
|
174 |
#methodCategoryHolder
|
|
175 |
#packageFilter
|
|
176 |
#selectedMethods
|
|
177 |
#selectionChangeCondition
|
|
178 |
#showCoverageInformation
|
|
179 |
#showImageResourceMethodsImages
|
|
180 |
#showMethodComplexity
|
|
181 |
#showMethodInheritance
|
|
182 |
#showMethodTypeIcon
|
|
183 |
#sortBy
|
|
184 |
#updateTrigger
|
|
185 |
#variableFilter
|
|
186 |
#showSyntheticMethods
|
14098
|
187 |
).
|
|
188 |
|
|
189 |
"Modified: / 24-02-2014 / 10:37:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
190 |
! !
|
|
191 |
|
|
192 |
!MethodList methodsFor:'aspects'!
|
|
193 |
|
|
194 |
browserNameList
|
|
195 |
browserNameList isNil ifTrue:[
|
14100
|
196 |
browserNameList := List new.
|
14098
|
197 |
].
|
|
198 |
^ browserNameList.
|
|
199 |
|
|
200 |
"Modified: / 31.1.2000 / 00:42:44 / cg"
|
|
201 |
"Created: / 5.2.2000 / 22:38:32 / cg"
|
|
202 |
!
|
|
203 |
|
|
204 |
defaultSlaveModeValue
|
|
205 |
^ false.
|
|
206 |
!
|
|
207 |
|
|
208 |
filterClassVars
|
|
209 |
filterClassVars isNil ifTrue:[
|
14100
|
210 |
filterClassVars := false asValue.
|
|
211 |
filterClassVars addDependent:self
|
14098
|
212 |
].
|
|
213 |
^ filterClassVars
|
|
214 |
!
|
|
215 |
|
|
216 |
filterClassVars:aValueHolder
|
|
217 |
filterClassVars notNil ifTrue:[
|
14100
|
218 |
filterClassVars removeDependent:self
|
14098
|
219 |
].
|
|
220 |
filterClassVars := aValueHolder.
|
|
221 |
filterClassVars notNil ifTrue:[
|
14100
|
222 |
filterClassVars addDependent:self
|
14098
|
223 |
].
|
|
224 |
!
|
|
225 |
|
|
226 |
methodLabelHolder
|
|
227 |
^ self pseudoListLabelHolder
|
|
228 |
|
|
229 |
"Created: / 1.3.2000 / 20:50:07 / cg"
|
|
230 |
!
|
|
231 |
|
|
232 |
methodList
|
|
233 |
^ methodList
|
|
234 |
!
|
|
235 |
|
|
236 |
selectedMethodNameIndices
|
|
237 |
selectedMethodNameIndices isNil ifTrue:[
|
14100
|
238 |
selectedMethodNameIndices := ValueHolder new.
|
|
239 |
selectedMethodNameIndices addDependent:self
|
14098
|
240 |
].
|
|
241 |
^ selectedMethodNameIndices.
|
|
242 |
|
|
243 |
"Modified: / 5.2.2000 / 00:31:48 / cg"
|
|
244 |
"Created: / 5.2.2000 / 22:59:31 / cg"
|
|
245 |
!
|
|
246 |
|
|
247 |
selectedMethods
|
|
248 |
^ self selectionHolder
|
|
249 |
!
|
|
250 |
|
|
251 |
selectedMethods:aValueHolder
|
|
252 |
^ self selectionHolder:aValueHolder
|
|
253 |
!
|
|
254 |
|
|
255 |
showImageResourceMethodsImages
|
|
256 |
showImageResourceMethodsImages isNil ifTrue:[
|
14100
|
257 |
showImageResourceMethodsImages := false asValue.
|
|
258 |
showImageResourceMethodsImages addDependent:self
|
14098
|
259 |
].
|
|
260 |
^ showImageResourceMethodsImages
|
|
261 |
!
|
|
262 |
|
|
263 |
showImageResourceMethodsImages:aValueHolder
|
|
264 |
showImageResourceMethodsImages notNil ifTrue:[
|
14100
|
265 |
showImageResourceMethodsImages removeDependent:self
|
14098
|
266 |
].
|
|
267 |
showImageResourceMethodsImages := aValueHolder.
|
|
268 |
showImageResourceMethodsImages notNil ifTrue:[
|
14100
|
269 |
showImageResourceMethodsImages addDependent:self
|
14098
|
270 |
].
|
|
271 |
!
|
|
272 |
|
|
273 |
showMethodComplexity
|
|
274 |
showMethodComplexity isNil ifTrue:[
|
14100
|
275 |
showMethodComplexity := false asValue.
|
|
276 |
showMethodComplexity addDependent:self
|
14098
|
277 |
].
|
|
278 |
^ showMethodComplexity
|
|
279 |
!
|
|
280 |
|
|
281 |
showMethodComplexity:aValueHolder
|
|
282 |
showMethodComplexity notNil ifTrue:[
|
14100
|
283 |
showMethodComplexity removeDependent:self
|
14098
|
284 |
].
|
|
285 |
showMethodComplexity := aValueHolder.
|
|
286 |
showMethodComplexity notNil ifTrue:[
|
14100
|
287 |
showMethodComplexity addDependent:self
|
14098
|
288 |
].
|
|
289 |
!
|
|
290 |
|
|
291 |
showMethodInheritance
|
|
292 |
showMethodInheritance isNil ifTrue:[
|
14100
|
293 |
showMethodInheritance := false asValue.
|
|
294 |
showMethodInheritance addDependent:self
|
14098
|
295 |
].
|
|
296 |
^ showMethodInheritance
|
|
297 |
!
|
|
298 |
|
|
299 |
showMethodInheritance:aValueHolder
|
|
300 |
showMethodInheritance notNil ifTrue:[
|
14100
|
301 |
showMethodInheritance removeDependent:self
|
14098
|
302 |
].
|
|
303 |
showMethodInheritance := aValueHolder.
|
|
304 |
showMethodInheritance notNil ifTrue:[
|
14100
|
305 |
showMethodInheritance addDependent:self
|
14098
|
306 |
].
|
|
307 |
!
|
|
308 |
|
|
309 |
showMethodTypeIcon
|
|
310 |
showMethodTypeIcon isNil ifTrue:[
|
14100
|
311 |
showMethodTypeIcon := true asValue.
|
|
312 |
showMethodTypeIcon addDependent:self
|
14098
|
313 |
].
|
|
314 |
^ showMethodTypeIcon
|
|
315 |
!
|
|
316 |
|
|
317 |
showMethodTypeIcon:aValueHolder
|
|
318 |
showMethodTypeIcon notNil ifTrue:[
|
14100
|
319 |
showMethodTypeIcon removeDependent:self
|
14098
|
320 |
].
|
|
321 |
showMethodTypeIcon := aValueHolder.
|
|
322 |
showMethodTypeIcon notNil ifTrue:[
|
14100
|
323 |
showMethodTypeIcon addDependent:self
|
14098
|
324 |
].
|
|
325 |
!
|
|
326 |
|
|
327 |
showSyntheticMethods
|
|
328 |
showSyntheticMethods isNil ifTrue:[
|
14100
|
329 |
showSyntheticMethods := false asValue.
|
|
330 |
showSyntheticMethods addDependent:self
|
14098
|
331 |
].
|
|
332 |
^ showSyntheticMethods
|
|
333 |
|
|
334 |
"Created: / 13-04-2012 / 16:03:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
335 |
!
|
|
336 |
|
|
337 |
showSyntheticMethods:aValueHolder
|
|
338 |
showSyntheticMethods notNil ifTrue:[
|
14100
|
339 |
showSyntheticMethods removeDependent:self
|
14098
|
340 |
].
|
|
341 |
showSyntheticMethods := aValueHolder.
|
|
342 |
showSyntheticMethods notNil ifTrue:[
|
14100
|
343 |
showSyntheticMethods addDependent:self
|
14098
|
344 |
].
|
|
345 |
|
|
346 |
"Created: / 13-04-2012 / 16:03:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
347 |
!
|
|
348 |
|
|
349 |
variableFilter
|
|
350 |
variableFilter isNil ifTrue:[
|
14100
|
351 |
variableFilter := nil asValue.
|
|
352 |
variableFilter addDependent:self
|
14098
|
353 |
].
|
|
354 |
^ variableFilter
|
|
355 |
!
|
|
356 |
|
|
357 |
variableFilter:aValueHolder
|
|
358 |
variableFilter notNil ifTrue:[
|
14100
|
359 |
variableFilter removeDependent:self
|
14098
|
360 |
].
|
|
361 |
variableFilter := aValueHolder.
|
|
362 |
variableFilter notNil ifTrue:[
|
14100
|
363 |
variableFilter addDependent:self
|
14098
|
364 |
].
|
|
365 |
! !
|
|
366 |
|
|
367 |
!MethodList methodsFor:'change & update'!
|
|
368 |
|
|
369 |
delayedUpdate:something with:aParameter from:changedObject
|
|
370 |
|cls clsName sel oldMethod newMethod methods newSelection
|
|
371 |
selectionHolder selection needSelectionChange|
|
|
372 |
|
|
373 |
selectionHolder := self selectedMethods.
|
|
374 |
selection := selectionHolder value.
|
|
375 |
|
|
376 |
changedObject == environment ifTrue:[
|
14100
|
377 |
classes notNil ifTrue:[
|
|
378 |
something == #classDefinition ifTrue:[
|
|
379 |
cls := aParameter.
|
|
380 |
clsName := cls name.
|
|
381 |
(classes contains:[:aClass | aClass name = clsName]) ifFalse:[
|
|
382 |
^ self "/ I don't care for that class
|
|
383 |
].
|
|
384 |
classes := classes collect:[:eachClass | (environment classNamed:eachClass name) ].
|
|
385 |
self invalidateList.
|
14098
|
386 |
"/ self updateList.
|
14100
|
387 |
^ self.
|
|
388 |
].
|
14098
|
389 |
|
14100
|
390 |
something == #methodCategory ifTrue:[
|
|
391 |
"/ ignore here - methodCategoryList will tell me if required
|
|
392 |
^ self
|
|
393 |
].
|
|
394 |
(something == #classOrganization
|
|
395 |
or:[ something == #methodCategoryAdded
|
|
396 |
or:[ something == #methodCategoryRemoved
|
|
397 |
or:[ something == #methodCategoriesRemoved
|
|
398 |
or:[ something == #methodCategoryRenamed ]]]]) ifTrue:[
|
|
399 |
"/ ignore here - methodCategoryList will tell me if required
|
|
400 |
^ self
|
|
401 |
].
|
14098
|
402 |
|
14100
|
403 |
(something == #methodInClass
|
|
404 |
or:[something == #methodCoverageInfo]) ifTrue:[
|
|
405 |
"/ a method has been added/changed
|
|
406 |
cls := aParameter at:1.
|
|
407 |
(classes includesIdentical:cls) ifTrue:[
|
|
408 |
sel := aParameter at:2.
|
|
409 |
oldMethod := aParameter at:3.
|
|
410 |
newMethod := cls compiledMethodAt:sel.
|
|
411 |
(oldMethod notNil and:[newMethod notNil]) ifTrue:[
|
|
412 |
"a method was changed & acccepted;
|
|
413 |
No need for a rescan of the methodDictionary;
|
|
414 |
however, ensure that the refs to the old method are updated
|
|
415 |
"
|
|
416 |
methods := selection.
|
|
417 |
methods size > 0 ifTrue:[
|
|
418 |
(methods includesIdentical:oldMethod) ifTrue:[
|
|
419 |
needSelectionChange := true.
|
|
420 |
]
|
|
421 |
].
|
|
422 |
methodList replaceAllIdentical:oldMethod with:newMethod.
|
|
423 |
lastSelectedMethods notNil ifTrue:[
|
|
424 |
lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod
|
|
425 |
].
|
|
426 |
methods size > 0 ifTrue:[
|
|
427 |
methods := methods asOrderedCollection.
|
|
428 |
methods replaceAllIdentical:oldMethod with:newMethod.
|
|
429 |
].
|
14098
|
430 |
|
14100
|
431 |
needSelectionChange == true ifTrue:[
|
|
432 |
selectionHolder setValue:methods.
|
|
433 |
"/ self enqueueDelayedMethodsSelectionChanged.
|
|
434 |
"/ need this to inform my browser that method was changed
|
|
435 |
"/ by someone else.
|
|
436 |
selectionHolder changed.
|
|
437 |
].
|
|
438 |
"/JV@2011-07-22: Update always - I need to see immediately that
|
|
439 |
"/the method has changed. Also, add/remove breakpoint etc.
|
14098
|
440 |
|
|
441 |
"/ (variableFilter value size > 0
|
|
442 |
"/ or:[oldMethod package ~= newMethod package
|
|
443 |
"/ or:[oldMethod resources ~= newMethod resources
|
|
444 |
"/ or:[showMethodComplexity value == true]]])
|
14100
|
445 |
self autoUpdateOnChange ifTrue:[
|
|
446 |
"/ only update that method's entry
|
|
447 |
self updateListEntryFor:newMethod.
|
|
448 |
"/ sigh - must invalidate
|
|
449 |
"/ self invalidateList.
|
|
450 |
].
|
|
451 |
^ self.
|
|
452 |
].
|
|
453 |
"/ method was added - update the methodList
|
|
454 |
"/ Q: is this needed (methodCategoryList should send me a new inGenerator)
|
|
455 |
self invalidateList.
|
|
456 |
].
|
|
457 |
^ self.
|
|
458 |
].
|
14098
|
459 |
|
14100
|
460 |
something == #methodInClassRemoved ifTrue:[
|
|
461 |
cls := aParameter at:1.
|
|
462 |
(classes includesIdentical:cls) ifTrue:[
|
|
463 |
sel := aParameter at:2.
|
|
464 |
"/ method was removed - update the methodList
|
|
465 |
"/ Q: is this needed (methodCategoryList should send me a new inGenerator)
|
|
466 |
self invalidateList.
|
|
467 |
].
|
|
468 |
^ self.
|
|
469 |
].
|
14098
|
470 |
|
14100
|
471 |
something == #methodCoverageInfo ifTrue:[
|
|
472 |
"/ already checked if it is one of my classes
|
|
473 |
self updateListEntryFor:aParameter.
|
14098
|
474 |
"/ self enqueueDelayedUpdateList.
|
|
475 |
"/ listValid == true ifTrue:[
|
|
476 |
"/ self invalidateList.
|
|
477 |
"/ ].
|
14100
|
478 |
^ self.
|
|
479 |
].
|
14098
|
480 |
|
14100
|
481 |
(something == #methodTrap
|
|
482 |
or:[ something == #lastTestRunResult
|
|
483 |
or:[ something == #privacyOfMethod ]]) ifTrue:[
|
|
484 |
cls := aParameter at:1.
|
|
485 |
sel := aParameter at:2.
|
|
486 |
(classes includesIdentical:cls) ifFalse:[ ^ self].
|
14098
|
487 |
|
14100
|
488 |
newMethod := cls compiledMethodAt:sel.
|
|
489 |
newMethod isNil ifTrue:[
|
|
490 |
self invalidateList.
|
|
491 |
^ self
|
|
492 |
].
|
14098
|
493 |
|
14100
|
494 |
((something == #privacyOfMethod) or:[something == #lastTestRunResult]) ifTrue:[
|
|
495 |
self updateListEntryFor:newMethod.
|
|
496 |
].
|
14098
|
497 |
|
14100
|
498 |
(something == #methodTrap) ifTrue:[
|
|
499 |
newMethod isWrapped ifTrue:[
|
|
500 |
oldMethod := newMethod originalMethod
|
|
501 |
] ifFalse:[
|
|
502 |
selection size > 0 ifTrue:[
|
|
503 |
oldMethod := selection detect:[:each | each isWrapped and:[each originalMethod == newMethod]] ifNone:nil.
|
|
504 |
]
|
|
505 |
].
|
14098
|
506 |
|
14100
|
507 |
selection size > 0 ifTrue:[
|
|
508 |
(selection 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 |
selection size > 0 ifTrue:[
|
|
517 |
selection := selection asOrderedCollection.
|
|
518 |
selection replaceAllIdentical:oldMethod with:newMethod.
|
|
519 |
].
|
|
520 |
needSelectionChange == true ifTrue:[
|
|
521 |
selectionHolder changed.
|
|
522 |
].
|
14098
|
523 |
|
14100
|
524 |
"/ actually, could just change that single item ...
|
|
525 |
"/ ... might be cheaper, if list is huge.
|
|
526 |
"/ only update that methods entry
|
|
527 |
self updateListEntryFor:newMethod.
|
|
528 |
"/ self invalidateList.
|
|
529 |
].
|
|
530 |
^ self
|
|
531 |
].
|
14098
|
532 |
|
14100
|
533 |
(something == #projectOrganization
|
|
534 |
or:[something == #lastTestRunResult]) ifTrue:[
|
|
535 |
aParameter notNil ifTrue:[
|
|
536 |
cls := aParameter at:1.
|
|
537 |
cls notNil ifTrue:[
|
|
538 |
((classes includesIdentical:cls theNonMetaclass)
|
|
539 |
or:[(classes includesIdentical:cls theMetaclass)]) ifTrue:[
|
|
540 |
self invalidateList.
|
|
541 |
].
|
|
542 |
].
|
|
543 |
] ifFalse:[
|
|
544 |
self invalidateList.
|
|
545 |
].
|
|
546 |
^ self
|
|
547 |
].
|
14098
|
548 |
|
14100
|
549 |
"/ everything else is ignored
|
|
550 |
"/ self halt.
|
|
551 |
].
|
|
552 |
^ self
|
14098
|
553 |
].
|
|
554 |
|
|
555 |
"/ something == #organization ifTrue:[
|
|
556 |
"/self halt:'no longer'.
|
|
557 |
"/^ self.
|
|
558 |
"/ "/ a methods cateory has changed
|
|
559 |
"/ (classes includesIdentical:changedObject) ifTrue:[
|
|
560 |
"/ aParameter isSymbol ifTrue:[
|
|
561 |
"/ "/ a method with a new category
|
|
562 |
"/ (self methodList includesIdentical:(changedObject compiledMethodAt:aParameter)) ifTrue:[
|
|
563 |
"/ self invalidateList.
|
|
564 |
"/ ].
|
|
565 |
"/ ^ self.
|
|
566 |
"/ ].
|
|
567 |
"/ "/ a new category (no method yet)
|
|
568 |
"/ self invalidateList
|
|
569 |
"/ ].
|
|
570 |
"/ ^ self
|
|
571 |
"/ ].
|
|
572 |
|
|
573 |
"/ something == #methodDictionary ifTrue:[
|
|
574 |
"/self halt:'no longer'.
|
|
575 |
"/^ self.
|
|
576 |
"/ "/ a method has been added/removed
|
|
577 |
"/ (classes includesIdentical:changedObject) ifTrue:[
|
|
578 |
"/ aParameter isArray ifTrue:[
|
|
579 |
"/ sel := aParameter at:1.
|
|
580 |
"/ oldMethod := aParameter at:2.
|
|
581 |
"/ newMethod := changedObject compiledMethodAt:sel.
|
|
582 |
"/ oldMethod notNil ifTrue:[
|
|
583 |
"/ "a method was changed & acccepted;
|
|
584 |
"/ No need for a rescan of the methodDictionary;
|
|
585 |
"/ however, ensure that the refs to the old method are updated
|
|
586 |
"/ "
|
|
587 |
"/ methods := selection.
|
|
588 |
"/ methods size > 0 ifTrue:[
|
|
589 |
"/ (methods includesIdentical:oldMethod) ifTrue:[
|
|
590 |
"/ needSelectionChange := true.
|
|
591 |
"/ ]
|
|
592 |
"/ ].
|
|
593 |
"/ methodList replaceAllIdentical:oldMethod with:newMethod.
|
|
594 |
"/ lastSelectedMethods notNil ifTrue:[
|
|
595 |
"/ lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod
|
|
596 |
"/ ].
|
|
597 |
"/ methods size > 0 ifTrue:[
|
|
598 |
"/ methods := methods asOrderedCollection.
|
|
599 |
"/ methods replaceAllIdentical:oldMethod with:newMethod.
|
|
600 |
"/ ].
|
|
601 |
"/ needSelectionChange == true ifTrue:[
|
|
602 |
"/ selectionHolder setValue:methods.
|
|
603 |
"/ selectionHolder changed.
|
|
604 |
"/ ].
|
|
605 |
"/ ^ self.
|
|
606 |
"/ ]
|
|
607 |
"/ ].
|
|
608 |
"/ "/ class has changed must update the methodList
|
|
609 |
"/ self invalidateList.
|
|
610 |
"/ ].
|
|
611 |
"/ ^ self.
|
|
612 |
"/ ].
|
|
613 |
|
|
614 |
"/ something == #projectOrganization ifTrue:[
|
|
615 |
"/ ((classes includesIdentical:changedObject theNonMetaclass)
|
|
616 |
"/ or:[(classes includesIdentical:changedObject theMetaclass)]) ifTrue:[
|
|
617 |
"/ self invalidateList.
|
|
618 |
"/ ].
|
|
619 |
"/ ^ self
|
|
620 |
"/ ].
|
|
621 |
|
|
622 |
changedObject == sortBy ifTrue:[
|
14100
|
623 |
listValid ~~ true ifTrue:[ "/ could be nil
|
|
624 |
inGeneratorHolder value isNil ifTrue:[
|
|
625 |
"/ ok, no need to react on that one
|
|
626 |
"/ (will invalidate anyway, once I have more info at hand)
|
|
627 |
^ self
|
|
628 |
].
|
|
629 |
].
|
|
630 |
self invalidateList.
|
|
631 |
^ self
|
14098
|
632 |
].
|
|
633 |
|
|
634 |
(changedObject == variableFilter
|
|
635 |
or:[changedObject == filterClassVars
|
|
636 |
or:[changedObject == showMethodInheritance
|
|
637 |
or:[changedObject == showMethodComplexity
|
|
638 |
or:[changedObject == showSyntheticMethods
|
|
639 |
]]]]) ifTrue:[
|
14100
|
640 |
self invalidateList.
|
|
641 |
^ self
|
14098
|
642 |
].
|
|
643 |
|
|
644 |
changedObject == selectedMethodNameIndices ifTrue:[
|
14100
|
645 |
newSelection := self selectedMethodNameIndices value collect:[:idx | methodList at:idx].
|
|
646 |
newSelection ~= selection ifTrue:[
|
|
647 |
selectionHolder value:newSelection.
|
|
648 |
lastSelectedMethods := newSelection.
|
|
649 |
lastSelectedMethods notNil ifTrue:[
|
|
650 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection
|
|
651 |
].
|
|
652 |
] ifFalse:[
|
|
653 |
"/ a reselect - force update
|
14098
|
654 |
"/ selection size == 1 ifTrue:[
|
14100
|
655 |
selectionHolder setValue:newSelection.
|
|
656 |
selectionHolder changed:#value.
|
14098
|
657 |
"/ ].
|
14100
|
658 |
].
|
|
659 |
^ self
|
14098
|
660 |
].
|
|
661 |
changedObject == selectionHolder ifTrue:[
|
14100
|
662 |
self selectedMethodsChanged.
|
|
663 |
lastSelectedMethods := selectionHolder value.
|
|
664 |
lastSelectedMethods notNil ifTrue:[
|
|
665 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection
|
|
666 |
].
|
|
667 |
^ self
|
14098
|
668 |
].
|
|
669 |
"/ something == #methodTrap ifTrue:[
|
|
670 |
"/self halt:'no longer'.
|
|
671 |
"/^ self.
|
|
672 |
"/ (classes includesIdentical:changedObject) ifTrue:[
|
|
673 |
"/ newMethod := changedObject compiledMethodAt:aParameter.
|
|
674 |
"/ newMethod isNil ifTrue:[
|
|
675 |
"/ self invalidateList.
|
|
676 |
"/ ^ self
|
|
677 |
"/ ].
|
|
678 |
"/ newMethod isWrapped ifTrue:[
|
|
679 |
"/ oldMethod := newMethod originalMethod
|
|
680 |
"/ ] ifFalse:[
|
|
681 |
"/ selection size > 0 ifTrue:[
|
|
682 |
"/ oldMethod := selection detect:[:each | each isWrapped and:[each originalMethod == newMethod]] ifNone:nil.
|
|
683 |
"/ ]
|
|
684 |
"/ ].
|
|
685 |
"/
|
|
686 |
"/ selection size > 0 ifTrue:[
|
|
687 |
"/ (selection includesIdentical:oldMethod) ifTrue:[
|
|
688 |
"/ needSelectionChange := true.
|
|
689 |
"/ ]
|
|
690 |
"/ ].
|
|
691 |
"/"/ methodList replaceAllIdentical:oldMethod with:newMethod.
|
|
692 |
"/ lastSelectedMethods notNil ifTrue:[
|
|
693 |
"/ lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod
|
|
694 |
"/ ].
|
|
695 |
"/ selection size > 0 ifTrue:[
|
|
696 |
"/ selection := selection asOrderedCollection.
|
|
697 |
"/ selection replaceAllIdentical:oldMethod with:newMethod.
|
|
698 |
"/ ].
|
|
699 |
"/ needSelectionChange == true ifTrue:[
|
|
700 |
"/ selectionHolder changed.
|
|
701 |
"/ ].
|
|
702 |
"/ self invalidateList.
|
|
703 |
"/ ^ self
|
|
704 |
"/ ].
|
|
705 |
"/ ^ self
|
|
706 |
"/ ].
|
|
707 |
super delayedUpdate:something with:aParameter from:changedObject
|
|
708 |
|
|
709 |
"Created: / 05-02-2000 / 13:42:14 / cg"
|
|
710 |
"Modified: / 05-06-2012 / 23:47:15 / cg"
|
|
711 |
"Modified: / 24-08-2013 / 00:41:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
712 |
!
|
|
713 |
|
|
714 |
selectedMethodsChanged
|
|
715 |
"the set of selected methods has changed;
|
|
716 |
update the selection-index collection (for the selectionInListView)"
|
|
717 |
|
14100
|
718 |
|indices methods reverseMap
|
14098
|
719 |
selectedMethodsHolder selectedMethods selectedMethodNameIndicesHolder|
|
|
720 |
|
|
721 |
methods := methodList ? #().
|
|
722 |
methods size == 0 ifTrue:[
|
14100
|
723 |
"/ this may happen during early startup,
|
|
724 |
"/ when invoked with a preset methodSelection,
|
|
725 |
"/ and the methodGenerator has not yet been setup
|
|
726 |
"/ to not clobber the selection, defer the update
|
|
727 |
"/ until the methodList arrives ...
|
|
728 |
^ self
|
14098
|
729 |
].
|
|
730 |
|
|
731 |
selectedMethodsHolder := self selectedMethods.
|
|
732 |
selectedMethods := selectedMethodsHolder value.
|
|
733 |
|
|
734 |
"/ check if all is selected (likely)
|
|
735 |
((selectedMethods size == methodList size)
|
|
736 |
and:[selectedMethods = methodList]) ifTrue:[
|
14100
|
737 |
indices := (1 to:selectedMethods size)
|
14098
|
738 |
] ifFalse:[
|
14100
|
739 |
selectedMethods size > 100 ifTrue:[
|
|
740 |
"/ check if all is selected (likely)
|
|
741 |
((selectedMethods size == methodList size)
|
|
742 |
and:[selectedMethods = methodList]) ifTrue:[
|
|
743 |
indices := (1 to:selectedMethods size)
|
|
744 |
] ifFalse:[
|
|
745 |
"/ for big collections, generate a reverse map
|
|
746 |
reverseMap := IdentityDictionary new.
|
|
747 |
methods keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx].
|
|
748 |
indices := selectedMethods collect:[:eachSelectedMethod |
|
|
749 |
reverseMap at:eachSelectedMethod ifAbsent:0
|
|
750 |
]
|
|
751 |
]
|
|
752 |
] ifFalse:[
|
|
753 |
indices := (selectedMethods ? #()) collect:[:eachSelectedMethod |
|
|
754 |
methods identityIndexOf:eachSelectedMethod.
|
|
755 |
]
|
|
756 |
].
|
|
757 |
indices := indices select:[:idx | idx ~= 0].
|
14098
|
758 |
].
|
|
759 |
|
|
760 |
selectedMethodNameIndicesHolder := self selectedMethodNameIndices.
|
|
761 |
selectedMethodNameIndicesHolder value ~= indices ifTrue:[
|
14100
|
762 |
selectedMethodNameIndicesHolder value:indices.
|
14098
|
763 |
]
|
|
764 |
!
|
|
765 |
|
|
766 |
selectionChanged
|
|
767 |
|methods|
|
|
768 |
|
|
769 |
methods := ((self selectedMethodNameIndices value) ? #()) collect:[:idx | methodList at:idx].
|
|
770 |
methods notEmpty ifTrue:[
|
14100
|
771 |
lastSelectedMethods := methods asOrderedCollection.
|
14098
|
772 |
].
|
|
773 |
"/ to allow reselect, change my valueHolder, even if the same collection
|
|
774 |
"/ self selectedMethods value ~= methods ifTrue:[
|
14100
|
775 |
self selectedMethods value:methods asOrderedCollection
|
14098
|
776 |
"/ ]
|
|
777 |
|
|
778 |
"Created: / 05-02-2000 / 13:42:14 / cg"
|
|
779 |
"Modified: / 05-02-2000 / 23:32:20 / cg"
|
|
780 |
"Modified: / 13-06-2013 / 12:19:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
781 |
!
|
|
782 |
|
|
783 |
selectionChangedByClick
|
|
784 |
"we are not interested in that - get another notification
|
|
785 |
via the changed valueHolder "
|
|
786 |
!
|
|
787 |
|
|
788 |
update:something with:aParameter from:changedObject
|
|
789 |
|cls clsName sel mthd mustFlushInheritanceInfo|
|
|
790 |
|
|
791 |
mustFlushInheritanceInfo := true.
|
|
792 |
|
|
793 |
"/ some can be ignored immediately
|
|
794 |
changedObject == environment ifTrue:[
|
14100
|
795 |
classes isNil ifTrue:[
|
|
796 |
^ self.
|
|
797 |
].
|
|
798 |
something isNil ifTrue:[
|
|
799 |
"/ self halt "/ huh - environment changed - so what ?
|
|
800 |
^ self.
|
|
801 |
].
|
|
802 |
something == #classComment ifTrue:[
|
|
803 |
^ self.
|
|
804 |
].
|
|
805 |
something == #classVariables ifTrue:[
|
|
806 |
^ self.
|
|
807 |
].
|
|
808 |
something == #organization ifTrue:[
|
|
809 |
^ self.
|
|
810 |
].
|
|
811 |
something == #methodCategory ifTrue:[
|
|
812 |
"/ ignore here - methodCategoryList will tell me if required
|
|
813 |
^ self
|
|
814 |
].
|
|
815 |
(something == #classOrganization
|
|
816 |
or:[ something == #methodCategoryAdded
|
|
817 |
or:[ something == #methodCategoryRemoved
|
|
818 |
or:[ something == #methodCategoriesRemoved
|
|
819 |
or:[ something == #methodCategoryRenamed ]]]]) ifTrue:[
|
|
820 |
"/ ignore here - methodCategoryList will tell me if required
|
|
821 |
^ self
|
|
822 |
].
|
14098
|
823 |
|
14100
|
824 |
something == #methodCoverageInfo ifTrue:[
|
|
825 |
self showCoverageInformation value ifFalse:[^ self].
|
|
826 |
mthd := aParameter.
|
|
827 |
(classes notNil and:[classes includesIdentical:mthd mclass]) ifFalse:[
|
|
828 |
^ self "/ I don't care for that class
|
|
829 |
].
|
|
830 |
mustFlushInheritanceInfo := false.
|
|
831 |
].
|
14098
|
832 |
|
14100
|
833 |
(something == #methodTrap
|
|
834 |
or:[ something == #methodPrivacy
|
|
835 |
or:[ something == #lastTestRunResult] ]) ifTrue:[
|
|
836 |
self window shown ifFalse:[
|
|
837 |
"JV@2011-11-17: Do not break the dependency here,
|
|
838 |
because then the window won't get updates once
|
|
839 |
deiconified -> leads to confusing behavior
|
|
840 |
(browser shows obsolete info)"
|
|
841 |
"/changedObject removeDependent:self. "/ ?????
|
|
842 |
self invalidateList.
|
|
843 |
^ self
|
|
844 |
].
|
|
845 |
cls := aParameter at:1.
|
|
846 |
sel := aParameter at:2.
|
|
847 |
mthd := cls compiledMethodAt:sel.
|
|
848 |
(mthd notNil and:[mthd isWrapped or:[mthd isMethodWithBreakpoints]]) ifTrue:[
|
|
849 |
(methodList includes:mthd originalMethod) ifTrue:[
|
|
850 |
methodList replaceAll:mthd originalMethod with:mthd.
|
|
851 |
lastSelectedMethods notNil ifTrue:[
|
|
852 |
lastSelectedMethods replaceAll:mthd originalMethod with:mthd.
|
|
853 |
].
|
|
854 |
]
|
|
855 |
].
|
|
856 |
mustFlushInheritanceInfo := false.
|
|
857 |
].
|
|
858 |
something == #newClass ifTrue:[
|
|
859 |
^ self.
|
|
860 |
].
|
14098
|
861 |
|
14100
|
862 |
(something == #methodInClass
|
|
863 |
or:[ something == #methodInClassRemoved ]) ifTrue:[
|
|
864 |
cls := aParameter first.
|
|
865 |
clsName := cls name.
|
|
866 |
(classes contains:[:aClass | aClass name = clsName]) ifFalse:[
|
|
867 |
^ self "/ I dont care for that class
|
|
868 |
].
|
|
869 |
sel := aParameter second.
|
|
870 |
(methodList contains:[:mthd | mthd getMclass notNil and:[mthd selector = sel]]) ifFalse:[
|
|
871 |
mustFlushInheritanceInfo := false.
|
|
872 |
self window topView hasFocus ifFalse:[
|
|
873 |
self enqueueDelayedUpdate:something with:aParameter from:changedObject.
|
|
874 |
^ self.
|
|
875 |
].
|
|
876 |
].
|
|
877 |
].
|
14098
|
878 |
|
14100
|
879 |
mustFlushInheritanceInfo ifTrue:[
|
|
880 |
"/ as the organisation changes, flush my remembered redefinition-cache-info
|
|
881 |
classAndSelectorsRedefinedBySubclassesOfClass := nil.
|
|
882 |
].
|
14098
|
883 |
|
14100
|
884 |
something == #classDefinition ifTrue:[
|
|
885 |
cls := aParameter.
|
|
886 |
clsName := cls name.
|
|
887 |
(classes contains:[:aClass | aClass name = clsName]) ifFalse:[
|
|
888 |
^ self "/ I don't care for that class
|
|
889 |
].
|
|
890 |
self enqueueDelayedUpdate:something with:aParameter from:changedObject.
|
|
891 |
^ self.
|
|
892 |
].
|
|
893 |
something == #classRemove ifTrue:[
|
|
894 |
^ self.
|
|
895 |
].
|
|
896 |
something == #classRename ifTrue:[
|
|
897 |
^ self.
|
|
898 |
].
|
14098
|
899 |
].
|
|
900 |
|
|
901 |
"/ these must lead to immediate update of the selectedMethods collection
|
|
902 |
"/ (otherwise, that collection might be updated too late, leading to
|
|
903 |
"/ an obsolete methods code being shown by the codeView.
|
14100
|
904 |
(something == #methodInClass
|
14098
|
905 |
or:[ something == #methodCoverageInfo ]) ifTrue:[
|
14100
|
906 |
"/ as the organisation changes, flush my remembered redefinition-cache-info
|
|
907 |
classAndSelectorsRedefinedBySubclassesOfClass := nil.
|
|
908 |
cls := aParameter at:1.
|
|
909 |
(classes includesIdentical:cls) ifFalse:[
|
|
910 |
^ self "/ I dont care for that class
|
|
911 |
].
|
|
912 |
self enqueueDelayedUpdate:something with:aParameter from:changedObject.
|
|
913 |
^ self
|
14098
|
914 |
].
|
|
915 |
|
|
916 |
something == #coverageInfo ifTrue:[
|
14100
|
917 |
listValid == true ifTrue:[
|
|
918 |
self enqueueDelayedUpdateList
|
|
919 |
].
|
|
920 |
^ self.
|
14098
|
921 |
].
|
|
922 |
|
|
923 |
something == #methodInClassRemoved ifTrue:[
|
14100
|
924 |
cls := aParameter at:1.
|
|
925 |
(classes includesIdentical:cls) ifFalse:[
|
|
926 |
^ self "/ I dont care for that class
|
|
927 |
].
|
14098
|
928 |
].
|
|
929 |
|
|
930 |
super update:something with:aParameter from:changedObject
|
|
931 |
|
|
932 |
"Modified: / 17-11-2011 / 19:22:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
933 |
"Modified: / 05-06-2012 / 23:41:50 / cg"
|
|
934 |
! !
|
|
935 |
|
|
936 |
!MethodList methodsFor:'drag & drop'!
|
|
937 |
|
|
938 |
canDropContext:aDropContext
|
|
939 |
"I can receive methods (from another browser) and image filenames"
|
|
940 |
|objects|
|
|
941 |
|
|
942 |
"/ ignore drop from myself
|
|
943 |
aDropContext sourceWidget == aDropContext targetWidget ifTrue:[^ false].
|
|
944 |
|
|
945 |
objects := aDropContext dropObjects collect:[:obj | obj theObject].
|
14100
|
946 |
(objects
|
|
947 |
conform:[:anObject |
|
|
948 |
|mime|
|
14098
|
949 |
|
14100
|
950 |
anObject isMethod
|
|
951 |
or:[ anObject isFilename
|
|
952 |
and:[ (mime := anObject mimeTypeFromName) notNil
|
|
953 |
and:[ mime isImageType ]]]
|
|
954 |
]) ifFalse:[^ false].
|
14098
|
955 |
|
|
956 |
self masterApplication theSingleSelectedClass isNil ifTrue:[^ false].
|
|
957 |
^ true
|
|
958 |
|
|
959 |
"Modified: / 13-09-2006 / 11:43:54 / cg"
|
|
960 |
!
|
|
961 |
|
|
962 |
doDropContext:aDropContext
|
|
963 |
|objects methods files browser cls|
|
|
964 |
|
|
965 |
browser := self masterApplication.
|
|
966 |
cls := browser theSingleSelectedClass.
|
|
967 |
|
|
968 |
objects := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject].
|
|
969 |
methods := objects select:[:something | something isMethod].
|
|
970 |
|
|
971 |
aDropContext dragType == DropContext dragTypeCopy ifTrue:[
|
14100
|
972 |
browser
|
|
973 |
copyMethods:methods
|
|
974 |
toClass:cls.
|
14098
|
975 |
] ifFalse:[
|
14100
|
976 |
browser
|
|
977 |
moveMethods:methods
|
|
978 |
toClass:cls.
|
14098
|
979 |
].
|
|
980 |
|
14100
|
981 |
files := objects select:[:something | something isFilename].
|
14098
|
982 |
files do:[:eachFilename |
|
14100
|
983 |
|img sel mime|
|
14098
|
984 |
|
14100
|
985 |
((mime := eachFilename mimeTypeFromName) notNil
|
|
986 |
and:[mime isImageType]) ifTrue:[
|
|
987 |
img := Image fromFile:eachFilename.
|
|
988 |
sel := Dialog request:'Name of Image Method' initialAnswer:'img_',eachFilename withoutSuffix baseName.
|
|
989 |
sel isEmptyOrNil ifTrue:[^ self].
|
|
990 |
browser theSingleSelectedClass programmingLanguage codeGeneratorClass
|
|
991 |
createImageSpecMethodFor:img comment:'"Imported from ',eachFilename pathName,'"' in:cls selector:sel
|
|
992 |
]
|
14098
|
993 |
].
|
|
994 |
|
|
995 |
"Modified: / 13-09-2006 / 11:43:44 / cg"
|
|
996 |
! !
|
|
997 |
|
|
998 |
!MethodList methodsFor:'private'!
|
|
999 |
|
14100
|
1000 |
isMethodToBeShown:aMethod
|
14098
|
1001 |
"invoked, when we get a change for aMethod which was previously not
|
|
1002 |
in the list (for example, if I show a filtered list).
|
|
1003 |
Check if that single method is to be shown now.
|
|
1004 |
Used to speed up update for senders/string/implementors lists"
|
|
1005 |
|
|
1006 |
|generator|
|
|
1007 |
|
|
1008 |
generator := inGeneratorHolder value.
|
|
1009 |
generator isNil ifTrue:[
|
14100
|
1010 |
^ false
|
14098
|
1011 |
].
|
14100
|
1012 |
|
14098
|
1013 |
"/ generator generates nil-selector entries
|
|
1014 |
"/ to pass multiple-class and multiple-protocol info
|
14100
|
1015 |
|
|
1016 |
generator do:[:cls :cat :sel :mthd |
|
|
1017 |
mthd == aMethod ifTrue:[
|
|
1018 |
mthd isSynthetic ifFalse:[
|
|
1019 |
sel notNil ifTrue:[
|
14098
|
1020 |
"/ cg: no longer filter those...
|
14100
|
1021 |
"/ (packageFilter value isNil
|
14098
|
1022 |
"/ or:[ packageFilter value includes:mthd package ]) ifTrue:[
|
14100
|
1023 |
^ true
|
14098
|
1024 |
"/ ]
|
14100
|
1025 |
]
|
|
1026 |
].
|
|
1027 |
^ false
|
|
1028 |
]
|
14098
|
1029 |
].
|
|
1030 |
^ false
|
|
1031 |
|
|
1032 |
"Created: / 17-08-2011 / 15:03:34 / cg"
|
|
1033 |
!
|
|
1034 |
|
|
1035 |
listOfMethodNames
|
14100
|
1036 |
|methods entries selectorBag newNameList allClasses newClasses
|
14098
|
1037 |
allCategories "allSelectors"
|
14100
|
1038 |
generator doShowClass doShowClassFirst doShowCategory enforceClassAndProtocolInList
|
14098
|
1039 |
theMethod sortByClass anyMethodToWatch mclass
|
14100
|
1040 |
packageFilterValue nameListEntryForExtensions
|
14098
|
1041 |
suppressInheritanceInfoNow startTime|
|
|
1042 |
|
|
1043 |
suppressInheritanceInfoNow := (showMethodInheritance value ? true) not.
|
|
1044 |
startTime := Timestamp now.
|
|
1045 |
|
|
1046 |
generator := inGeneratorHolder value.
|
|
1047 |
generator isNil ifTrue:[
|
14100
|
1048 |
^ #()
|
14098
|
1049 |
].
|
|
1050 |
allClasses := IdentitySet new.
|
|
1051 |
allCategories := IdentitySet new.
|
14100
|
1052 |
|
14098
|
1053 |
"/ allSelectors := Set new.
|
14100
|
1054 |
|
14098
|
1055 |
newClasses := IdentitySet new.
|
|
1056 |
selectorBag := Bag new.
|
|
1057 |
entries := OrderedCollection new.
|
|
1058 |
enforceClassAndProtocolInList := false.
|
|
1059 |
anyMethodToWatch := false.
|
|
1060 |
|
|
1061 |
"/ no longer filter those
|
|
1062 |
"/ JV@2013-09-17: Why on hell not? A little explanation please!!
|
|
1063 |
"/ Enabled again, because when i select package in a browser I expect
|
|
1064 |
"/ to see only methods belonging to that package!!
|
|
1065 |
packageFilterValue := packageFilter value.
|
|
1066 |
|
|
1067 |
"/ generator generates nil-selector entries
|
|
1068 |
"/ to pass multiple-class and multiple-protocol info
|
|
1069 |
nameListEntryForExtensions := self class nameListEntryForExtensions.
|
|
1070 |
|
|
1071 |
generator do:[:cls :cat :sel :mthd |
|
14100
|
1072 |
|categoryIsExtensionsPseudoCategory|
|
14098
|
1073 |
|
14100
|
1074 |
categoryIsExtensionsPseudoCategory := (cat = nameListEntryForExtensions).
|
14098
|
1075 |
|
14100
|
1076 |
(cls isNil and:[ cat isNil and:[ sel isNil ] ]) ifTrue:[
|
|
1077 |
enforceClassAndProtocolInList := true
|
|
1078 |
] ifFalse:[
|
|
1079 |
cls notNil ifTrue:[
|
|
1080 |
allClasses add:cls.
|
|
1081 |
].
|
14098
|
1082 |
"/ cat notNil ifTrue:[
|
|
1083 |
"/ allCategories add:cat.
|
|
1084 |
"/ ].
|
14100
|
1085 |
"/ JV: Filter method through package filter
|
|
1086 |
"/ but not, if it is an extension method and we are showing extensions
|
|
1087 |
(mthd notNil
|
|
1088 |
and:[ (mthd isSynthetic not or:[showSyntheticMethods value == true])
|
|
1089 |
and:[ sel notNil ]]
|
|
1090 |
) ifTrue:[
|
|
1091 |
(packageFilterValue isNil
|
|
1092 |
or:[ (packageFilterValue includes:mthd package)
|
|
1093 |
or:[ categoryIsExtensionsPseudoCategory and:[ mthd isExtension] ]]
|
|
1094 |
) ifTrue:[
|
|
1095 |
entries add:(Array with:cls with:sel with:mthd).
|
|
1096 |
selectorBag add:sel.
|
|
1097 |
newClasses add:cls.
|
|
1098 |
|
|
1099 |
allCategories add:mthd category.
|
|
1100 |
"/ allSelectors add:sel.
|
|
1101 |
]
|
|
1102 |
]
|
|
1103 |
].
|
|
1104 |
(mthd notNil and:[ mthd isWrapped ]) ifTrue:[
|
|
1105 |
(mthd isTiming or:[ mthd isCounting or:[ mthd isCountingMemoryUsage ] ]) ifTrue:[
|
|
1106 |
anyMethodToWatch := true
|
|
1107 |
]
|
|
1108 |
].
|
14098
|
1109 |
].
|
|
1110 |
showMethodInheritance value ~~ false ifTrue:[
|
14100
|
1111 |
"/ collect redefinition information once (big speedup for #methodIsRedefinedbelow)
|
|
1112 |
classAndSelectorsRedefinedBySubclassesOfClass isNil ifTrue:[
|
|
1113 |
classAndSelectorsRedefinedBySubclassesOfClass := IdentityDictionary new.
|
|
1114 |
].
|
|
1115 |
allClasses do:[:cls |
|
|
1116 |
|d|
|
14098
|
1117 |
|
14100
|
1118 |
d := classAndSelectorsRedefinedBySubclassesOfClass.
|
|
1119 |
(d notNil and:[ (d includesKey:cls) not ]) ifTrue:[
|
|
1120 |
cls isLoaded ifTrue:[
|
|
1121 |
d at:cls put:(self setOfAllSelectorsImplementedBelow:cls)
|
|
1122 |
]
|
|
1123 |
]
|
|
1124 |
].
|
14098
|
1125 |
].
|
14100
|
1126 |
|
14098
|
1127 |
"/ multiple classes must: add the className for some
|
14100
|
1128 |
|
14098
|
1129 |
doShowClass := enforceClassAndProtocolInList or:[ allClasses size > 1 ].
|
14100
|
1130 |
|
14098
|
1131 |
"/ multiple categories: must add the categorie for some
|
14100
|
1132 |
|
14098
|
1133 |
doShowCategory := enforceClassAndProtocolInList or:[ allCategories size > 1 ].
|
|
1134 |
|
|
1135 |
doShowClassFirst := doShowClass.
|
|
1136 |
doShowClassFirst := doShowClass and:[ sortBy value == #class ].
|
|
1137 |
sortBy value == false ifTrue:[
|
14100
|
1138 |
"/ do not sort
|
14098
|
1139 |
] ifFalse:[
|
14100
|
1140 |
(doShowClass not and:[ sortBy value == #class ]) ifTrue:[
|
|
1141 |
"/ multiple classes must add the className for some
|
|
1142 |
"/ check, if doShowClass must be enforced
|
|
1143 |
entries do:[:entry |
|
|
1144 |
|cls sel mthd s needClass|
|
14098
|
1145 |
|
14100
|
1146 |
cls := entry at:1.
|
|
1147 |
sel := entry at:2.
|
|
1148 |
mthd := entry at:3.
|
|
1149 |
doShowClass ifFalse:[
|
|
1150 |
doShowClass := (selectorBag occurrencesOf:sel) > 1
|
|
1151 |
].
|
|
1152 |
].
|
|
1153 |
].
|
|
1154 |
sortByClass := doShowClass and:[ sortBy value == #class ].
|
|
1155 |
sortByClass ifTrue:[
|
|
1156 |
entries
|
|
1157 |
sort:[:a :b |
|
|
1158 |
|nmA nmB clsNmA clsNmB nsNmA nsNmB|
|
14098
|
1159 |
|
14100
|
1160 |
clsNmA := (a at:1) name.
|
|
1161 |
clsNmB := (b at:1) name.
|
|
1162 |
clsNmA = clsNmB ifTrue:[
|
|
1163 |
nmA := (a at:2) asSymbol selector.
|
|
1164 |
nmB := (b at:2) asSymbol selector.
|
|
1165 |
nmA = nmB ifTrue:[
|
|
1166 |
nsNmA := (a at:3) nameSpaceName.
|
|
1167 |
nsNmB := (b at:3) nameSpaceName.
|
|
1168 |
nsNmA < nsNmB
|
|
1169 |
] ifFalse:[ nmA < nmB ]
|
|
1170 |
] ifFalse:[
|
|
1171 |
clsNmA < clsNmB
|
|
1172 |
]
|
|
1173 |
].
|
|
1174 |
] ifFalse:[
|
|
1175 |
sortBy value == #category ifTrue:[
|
|
1176 |
entries
|
|
1177 |
sort:[:a :b |
|
|
1178 |
|nmA nmB catA catB clsNmA clsNmB nsNmA nsNmB|
|
14098
|
1179 |
|
14100
|
1180 |
catA := (a at:3) category.
|
|
1181 |
catB := (b at:3) category.
|
|
1182 |
catA = catB ifTrue:[
|
|
1183 |
nmA := (a at:2) asSymbol selector.
|
|
1184 |
nmB := (b at:2) asSymbol selector.
|
|
1185 |
nmA = nmB ifTrue:[
|
|
1186 |
clsNmA := (a at:1) name.
|
|
1187 |
clsNmB := (b at:1) name.
|
|
1188 |
clsNmA = clsNmB ifTrue:[
|
|
1189 |
nsNmA := (a at:3) nameSpaceName.
|
|
1190 |
nsNmB := (b at:3) nameSpaceName.
|
|
1191 |
nsNmA < nsNmB
|
|
1192 |
] ifFalse:[
|
|
1193 |
clsNmA < clsNmB
|
|
1194 |
]
|
|
1195 |
] ifFalse:[ nmA < nmB ]
|
|
1196 |
] ifFalse:[
|
|
1197 |
catA < catB
|
|
1198 |
]
|
|
1199 |
].
|
|
1200 |
] ifFalse:[
|
|
1201 |
entries
|
|
1202 |
sort:[:a :b |
|
|
1203 |
|nmA nmB clsNmA clsNmB nsNmA nsNmB|
|
14098
|
1204 |
|
14100
|
1205 |
nmA := (a at:2) asSymbol selector.
|
|
1206 |
nmB := (b at:2) asSymbol selector.
|
|
1207 |
nmA = nmB ifTrue:[
|
|
1208 |
clsNmA := (a at:1) name.
|
|
1209 |
clsNmB := (b at:1) name.
|
|
1210 |
clsNmA = clsNmB ifTrue:[
|
|
1211 |
nsNmA := (a at:3) nameSpaceName.
|
|
1212 |
nsNmB := (b at:3) nameSpaceName.
|
|
1213 |
nsNmA < nsNmB
|
|
1214 |
] ifFalse:[
|
|
1215 |
clsNmA < clsNmB
|
|
1216 |
]
|
|
1217 |
] ifFalse:[ nmA < nmB ]
|
|
1218 |
].
|
|
1219 |
].
|
|
1220 |
].
|
14098
|
1221 |
].
|
|
1222 |
methods := OrderedCollection new:(entries size).
|
14100
|
1223 |
|
14098
|
1224 |
"/ first generate the new methodList, and see if it is different ...
|
|
1225 |
|
14100
|
1226 |
entries do:[:entry |
|
|
1227 |
|sel mthd|
|
|
1228 |
|
|
1229 |
mthd := entry at:3.
|
|
1230 |
methods add:mthd.
|
14098
|
1231 |
].
|
|
1232 |
false "methodList = methods" "does not care for changed icons" ifTrue:[
|
14100
|
1233 |
"/ same list
|
|
1234 |
newNameList := self browserNameList.
|
14098
|
1235 |
] ifFalse:[
|
14100
|
1236 |
newNameList := OrderedCollection new:(entries size).
|
|
1237 |
|
|
1238 |
"/ multiple classes must add the className for some
|
14098
|
1239 |
|
14100
|
1240 |
entries do:[:entry |
|
|
1241 |
|cls sel mthd s needClass|
|
|
1242 |
|
|
1243 |
cls := entry at:1.
|
|
1244 |
sel := entry at:2.
|
|
1245 |
mthd := entry at:3.
|
|
1246 |
needClass := doShowClass.
|
|
1247 |
|
14098
|
1248 |
"/ needClass ifFalse:[
|
|
1249 |
"/ needClass := (selectorBag occurrencesOf:sel) > 1
|
|
1250 |
"/ ].
|
14100
|
1251 |
(suppressInheritanceInfoNow not
|
|
1252 |
and:[ (Timestamp now deltaFrom:startTime) > 3 seconds ]) ifTrue:[
|
|
1253 |
suppressInheritanceInfoNow := true.
|
|
1254 |
].
|
14098
|
1255 |
|
14100
|
1256 |
s := self
|
|
1257 |
listEntryForMethod:mthd
|
|
1258 |
selector:sel
|
|
1259 |
class:cls
|
|
1260 |
showClass:needClass
|
|
1261 |
showCategory:doShowCategory
|
|
1262 |
classFirst:doShowClassFirst
|
|
1263 |
suppressInheritanceInfo:suppressInheritanceInfoNow.
|
|
1264 |
|
|
1265 |
newNameList add:s.
|
|
1266 |
].
|
14098
|
1267 |
].
|
|
1268 |
self makeIndependent.
|
|
1269 |
classes := newClasses.
|
|
1270 |
self makeDependent.
|
|
1271 |
methodList := methods.
|
|
1272 |
methods size == 1 ifTrue:[
|
14100
|
1273 |
theMethod := methods first.
|
|
1274 |
mclass := theMethod mclass.
|
|
1275 |
mclass isNil ifTrue:[
|
|
1276 |
theMethod isWrapped ifTrue:[
|
|
1277 |
theMethod := theMethod originalMethod.
|
|
1278 |
mclass := theMethod mclass.
|
|
1279 |
].
|
|
1280 |
].
|
|
1281 |
self methodLabelHolder value:(mclass isNil
|
|
1282 |
ifTrue:[ ('???' , ' ' , '???') ]
|
|
1283 |
ifFalse:[ (mclass name , ' ' , theMethod selector) ])
|
14098
|
1284 |
].
|
|
1285 |
"/ anyMethodToWatch ifTrue:[
|
|
1286 |
"/ self startWatchProcess.
|
|
1287 |
"/ ] ifFalse:[
|
|
1288 |
"/ self stopWatchProcess.
|
|
1289 |
"/ ].
|
14100
|
1290 |
|
14098
|
1291 |
"/ remember these, in case of an incremental (single method only)
|
|
1292 |
"/ update in the future.
|
14100
|
1293 |
|
14098
|
1294 |
lastShowClass := doShowClass.
|
|
1295 |
lastShowClassFirst := doShowClassFirst.
|
|
1296 |
lastShowCategory := doShowCategory.
|
|
1297 |
^ newNameList.
|
|
1298 |
|
|
1299 |
"Created: / 05-02-2000 / 22:43:40 / cg"
|
|
1300 |
"Modified: / 24-08-2010 / 20:34:09 / Jan Vrany <enter your email here>"
|
|
1301 |
"Modified: / 20-07-2012 / 20:00:58 / cg"
|
|
1302 |
"Modified (comment): / 17-09-2013 / 10:31:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
1303 |
!
|
|
1304 |
|
|
1305 |
makeDependent
|
|
1306 |
environment addDependent:self.
|
|
1307 |
"/ ChangeSet addDependent:self.
|
|
1308 |
|
|
1309 |
"Modified: / 10-11-2006 / 17:57:01 / cg"
|
|
1310 |
!
|
|
1311 |
|
|
1312 |
makeIndependent
|
|
1313 |
environment removeDependent:self.
|
|
1314 |
"/ ChangeSet removeDependent:self.
|
|
1315 |
!
|
|
1316 |
|
|
1317 |
method:mthd includesModsOfClassVariable:variablesToHighLight
|
|
1318 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#modifiedClassVars
|
|
1319 |
!
|
|
1320 |
|
|
1321 |
method:mthd includesModsOfInstanceVariable:variablesToHighLight
|
|
1322 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#modifiedInstVars
|
|
1323 |
!
|
|
1324 |
|
|
1325 |
method:mthd includesRefsToClassVariable:variablesToHighLight
|
|
1326 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#usedClassVars
|
|
1327 |
!
|
|
1328 |
|
|
1329 |
method:mthd includesRefsToInstanceVariable:variablesToHighLight
|
|
1330 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#usedInstVars
|
|
1331 |
!
|
|
1332 |
|
|
1333 |
method:mthd includesRefsToVariable:variablesToHighLight askParserWith:querySelector
|
|
1334 |
|cls src parser usedVars anyVarNameAccessable|
|
|
1335 |
|
|
1336 |
cls := mthd mclass.
|
|
1337 |
cls isNil ifTrue:[^ false].
|
|
1338 |
|
|
1339 |
anyVarNameAccessable := cls allInstVarNames includesAny:variablesToHighLight.
|
|
1340 |
anyVarNameAccessable ifFalse:[
|
14100
|
1341 |
anyVarNameAccessable := cls theNonMetaclass allClassVarNames includesAny:variablesToHighLight.
|
14098
|
1342 |
].
|
|
1343 |
anyVarNameAccessable ifFalse:[
|
14100
|
1344 |
"/ no need to parse
|
|
1345 |
^ false
|
14098
|
1346 |
].
|
|
1347 |
|
|
1348 |
"/ JV Following code is just very bad. It assumes that method is a Smalltalk method.
|
14100
|
1349 |
"/ But it may not, it could be JavaScript method, Java method or whatever fancy language
|
14098
|
1350 |
"/ method. Should be actually delegated to the method itself, just as #messagesSend & co.
|
|
1351 |
|
14100
|
1352 |
"/ I'm not going to refactor now to keep the differences between jv-branch and CVS
|
14098
|
1353 |
"/ ss small as possible. This interface is bad anyway as method is parsed several times
|
|
1354 |
"/ to check different things. Once should be enough.
|
|
1355 |
|
|
1356 |
"/ Hack:
|
|
1357 |
|
|
1358 |
mthd programmingLanguage isSmalltalk ifFalse:[
|
14100
|
1359 |
^ [
|
|
1360 |
usedVars := mthd perform:querySelector.
|
|
1361 |
usedVars includesAny:variablesToHighLight
|
|
1362 |
] on: Error do:[
|
|
1363 |
false
|
|
1364 |
]
|
14098
|
1365 |
].
|
|
1366 |
|
|
1367 |
src := mthd source.
|
|
1368 |
src notNil ifTrue:[
|
14100
|
1369 |
"
|
|
1370 |
before doing a slow parse, quickly scan the
|
|
1371 |
methods source for the variables name ...
|
|
1372 |
"
|
|
1373 |
(variablesToHighLight contains:[:varName | (src findString:varName) ~~ 0]) ifTrue:[
|
|
1374 |
parser := Parser
|
|
1375 |
parseMethod:src
|
|
1376 |
in:cls
|
|
1377 |
ignoreErrors:true
|
|
1378 |
ignoreWarnings:true.
|
|
1379 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[
|
|
1380 |
usedVars := parser perform:querySelector.
|
|
1381 |
(usedVars includesAny:variablesToHighLight)
|
|
1382 |
ifTrue:[
|
|
1383 |
^ true
|
|
1384 |
]
|
|
1385 |
]
|
|
1386 |
]
|
14098
|
1387 |
].
|
|
1388 |
^ false
|
|
1389 |
|
|
1390 |
"Modified: / 30-08-2013 / 13:46:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
1391 |
!
|
|
1392 |
|
|
1393 |
methodIsInheritedFromAbove:aMethod
|
|
1394 |
|mClass|
|
|
1395 |
|
|
1396 |
mClass := aMethod mclass.
|
|
1397 |
(mClass notNil and:[mClass superclass notNil]) ifTrue:[
|
14100
|
1398 |
^ (mClass superclass whichClassIncludesSelector:aMethod selector) notNil.
|
14098
|
1399 |
].
|
|
1400 |
^ false
|
|
1401 |
!
|
|
1402 |
|
|
1403 |
methodIsRedefinedBelow:aMethod
|
|
1404 |
|mclass subClasses setOfRedefinedSelectors|
|
|
1405 |
|
|
1406 |
mclass := aMethod mclass.
|
|
1407 |
mclass isNil ifTrue:[^ false].
|
|
1408 |
|
|
1409 |
"/ if possible, make use of info prepared by listOfMethodNames
|
|
1410 |
classAndSelectorsRedefinedBySubclassesOfClass notNil
|
|
1411 |
ifTrue:[
|
14100
|
1412 |
setOfRedefinedSelectors := classAndSelectorsRedefinedBySubclassesOfClass at:mclass ifAbsent:nil.
|
|
1413 |
setOfRedefinedSelectors notNil ifTrue:[
|
|
1414 |
^ setOfRedefinedSelectors includes:aMethod selector
|
|
1415 |
]
|
14098
|
1416 |
].
|
|
1417 |
|
|
1418 |
lastMethodClass == mclass ifTrue:[
|
14100
|
1419 |
subClasses := lastMethodClassesSubclasses
|
14098
|
1420 |
] ifFalse:[
|
14100
|
1421 |
subClasses := aMethod mclass allSubclasses.
|
|
1422 |
lastMethodClassesSubclasses := subClasses.
|
|
1423 |
lastMethodClass := mclass.
|
14098
|
1424 |
].
|
|
1425 |
^ subClasses contains:[:cls | cls includesSelector:aMethod selector].
|
|
1426 |
!
|
|
1427 |
|
|
1428 |
redefinedOrInheritedIconFor:aMethod
|
|
1429 |
|inherited redefined subclassResponsibility|
|
|
1430 |
|
|
1431 |
inherited := self methodIsInheritedFromAbove:aMethod.
|
|
1432 |
redefined := self methodIsRedefinedBelow:aMethod.
|
|
1433 |
|
|
1434 |
inherited ifTrue:[
|
14100
|
1435 |
redefined ifTrue:[
|
|
1436 |
^ self methodInheritedFromAboveAndRedefinedBelowIcon.
|
|
1437 |
].
|
|
1438 |
^ self methodInheritedFromAboveIcon.
|
14098
|
1439 |
].
|
|
1440 |
|
|
1441 |
subclassResponsibility := aMethod sends:#subclassResponsibility.
|
|
1442 |
redefined ifTrue:[
|
14100
|
1443 |
subclassResponsibility ifTrue:[
|
|
1444 |
^ self methodIsSubclassResponsibilityAndRedefinedBelowIcon.
|
|
1445 |
].
|
|
1446 |
^ self methodRedefinedBelowIcon.
|
14098
|
1447 |
].
|
|
1448 |
subclassResponsibility ifTrue:[
|
14100
|
1449 |
^ self methodIsSubclassResponsibilityIcon.
|
14098
|
1450 |
].
|
|
1451 |
|
|
1452 |
^ self methodEmptyInheritedIcon
|
|
1453 |
!
|
|
1454 |
|
|
1455 |
release
|
|
1456 |
super release.
|
|
1457 |
|
|
1458 |
filterClassVars removeDependent:self.
|
|
1459 |
selectedMethodNameIndices removeDependent:self.
|
|
1460 |
showMethodInheritance removeDependent:self.
|
|
1461 |
variableFilter removeDependent:self.
|
|
1462 |
!
|
|
1463 |
|
|
1464 |
resourceIconForMethod:aMethod
|
|
1465 |
^ SystemBrowser resourceIconForMethod:aMethod
|
|
1466 |
|
|
1467 |
"Modified: / 17-08-2006 / 09:09:01 / cg"
|
|
1468 |
!
|
|
1469 |
|
|
1470 |
setOfAllSelectorsImplementedBelow:aClass
|
|
1471 |
|set|
|
|
1472 |
|
|
1473 |
set := IdentitySet new.
|
|
1474 |
aClass allSubclassesDo:[:eachSubclass |
|
14100
|
1475 |
set addAll:(eachSubclass methodDictionary keys).
|
14098
|
1476 |
].
|
|
1477 |
^ set
|
|
1478 |
!
|
|
1479 |
|
|
1480 |
updateList
|
|
1481 |
|prevSelection newList newSelection newSelIdx reverseMap sameContents newListSize oldListSize
|
|
1482 |
prevClasses methodSet selectedMethodsHolder|
|
|
1483 |
|
|
1484 |
selectedMethodsHolder := self selectedMethods.
|
|
1485 |
prevSelection := selectedMethodsHolder value ? #().
|
|
1486 |
|
|
1487 |
prevClasses := classes isNil ifTrue:[ #() ] ifFalse:[ classes copy ].
|
|
1488 |
|
|
1489 |
oldListSize := self browserNameList size.
|
|
1490 |
|
|
1491 |
self topApplication withWaitCursorDo:[
|
14100
|
1492 |
newList := self listOfMethodNames.
|
14098
|
1493 |
].
|
|
1494 |
newListSize := newList size.
|
|
1495 |
sameContents := self updateListFor:newList.
|
|
1496 |
|
|
1497 |
sameContents ifFalse:[
|
|
1498 |
"/ self browserNameList value:newList.
|
|
1499 |
|
14100
|
1500 |
(prevSelection size == 0
|
|
1501 |
and:[selectedMethodsHolder value size ~~ 0]) ifTrue:[
|
|
1502 |
"/ this happens during early startup time,
|
|
1503 |
"/ when the selection is already (pre-)set,
|
|
1504 |
"/ and the methodList is generated the first time
|
|
1505 |
"/ (i.e. when opened with preset selection
|
14098
|
1506 |
|
14100
|
1507 |
"/ do not clobber the selection in this case.
|
|
1508 |
prevSelection := selectedMethodsHolder value.
|
|
1509 |
].
|
14098
|
1510 |
|
14100
|
1511 |
(methodList size == 0 or:[prevSelection size == 0]) ifTrue:[
|
|
1512 |
newSelection := #()
|
|
1513 |
] ifFalse:[
|
|
1514 |
methodSet := methodList.
|
14098
|
1515 |
|
14100
|
1516 |
"/ intersect is much faster with sets, if the number of items is large
|
|
1517 |
"/ however, only if its worth building the set ...
|
|
1518 |
(methodSet size + prevSelection size) > 35 ifTrue:[
|
|
1519 |
methodSet := methodSet asIdentitySet.
|
|
1520 |
].
|
|
1521 |
newSelection := methodSet intersect:prevSelection.
|
|
1522 |
].
|
|
1523 |
newSelection size > 0 ifTrue:[
|
|
1524 |
newSelection size > 100 ifTrue:[
|
|
1525 |
"/ need selection indices - might be expensive if done straight forward...
|
|
1526 |
reverseMap := IdentityDictionary new.
|
|
1527 |
methodList keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx].
|
|
1528 |
newSelIdx := newSelection collect:[:mthd | reverseMap at:mthd].
|
|
1529 |
] ifFalse:[
|
|
1530 |
newSelIdx := newSelection collect:[:mthd | methodList identityIndexOf:mthd]
|
|
1531 |
].
|
14098
|
1532 |
"/ self halt.
|
14100
|
1533 |
"/ force change (for dependents)
|
|
1534 |
newSelIdx ~= selectedMethodNameIndices value ifTrue:[
|
|
1535 |
self selectedMethodNameIndices value:newSelIdx.
|
|
1536 |
].
|
|
1537 |
] ifFalse:[
|
|
1538 |
lastSelectedMethods := selectedMethodsHolder value.
|
|
1539 |
lastSelectedMethods notNil ifTrue:[
|
|
1540 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection
|
|
1541 |
].
|
|
1542 |
selectedMethodNameIndices value size > 0 ifTrue:[
|
|
1543 |
selectedMethodNameIndices value:#().
|
|
1544 |
]
|
|
1545 |
].
|
14098
|
1546 |
|
14100
|
1547 |
newSelection ~= prevSelection ifTrue:[
|
|
1548 |
self selectionChanged.
|
|
1549 |
]
|
14098
|
1550 |
] ifTrue:[
|
14100
|
1551 |
"/ same list - but classes might have changed
|
|
1552 |
"/ that is the case, if the class selection has been changed,
|
|
1553 |
"/ to another class which has the same categories.
|
14098
|
1554 |
|
14100
|
1555 |
(prevClasses ~= (classes ? IdentitySet new)) ifTrue:[
|
|
1556 |
(newListSize > 0 or:[oldListSize > 0]) ifTrue:[
|
|
1557 |
self selectionChanged.
|
|
1558 |
]
|
|
1559 |
]
|
14098
|
1560 |
]
|
|
1561 |
|
|
1562 |
"Modified: / 05-03-2007 / 16:07:24 / cg"
|
|
1563 |
"Modified: / 24-02-2014 / 11:08:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
1564 |
!
|
|
1565 |
|
|
1566 |
updateListEntryFor:aMethod
|
|
1567 |
"update my list for a single method.
|
|
1568 |
(used when a single methods package, code or whatever changes, and a full udpate
|
|
1569 |
would be too slow)"
|
|
1570 |
|
|
1571 |
|s idx|
|
|
1572 |
|
14100
|
1573 |
s := self
|
|
1574 |
listEntryForMethod:aMethod
|
|
1575 |
selector:aMethod selector
|
|
1576 |
class:aMethod mclass
|
|
1577 |
showClass:lastShowClass
|
|
1578 |
showCategory:lastShowCategory
|
|
1579 |
classFirst:lastShowClassFirst
|
|
1580 |
suppressInheritanceInfo:false.
|
14098
|
1581 |
|
|
1582 |
idx := methodList identityIndexOf:aMethod.
|
|
1583 |
idx == 0 ifTrue:[
|
14100
|
1584 |
aMethod isWrapped ifTrue:[
|
|
1585 |
idx := methodList identityIndexOf:aMethod originalMethod.
|
|
1586 |
idx == 0 ifTrue:[
|
|
1587 |
"/ aMethod (wrapped) has changed its status, but is not in the list.
|
|
1588 |
^ self.
|
|
1589 |
].
|
|
1590 |
]
|
14098
|
1591 |
].
|
|
1592 |
idx == 0 ifTrue:[
|
14100
|
1593 |
"/ method was not previously shown; try to avoid a full update
|
|
1594 |
(self isMethodToBeShown:aMethod) ifTrue:[
|
|
1595 |
self invalidateList
|
|
1596 |
].
|
14098
|
1597 |
] ifFalse:[
|
14100
|
1598 |
self browserNameList at:idx put:s.
|
14098
|
1599 |
]
|
|
1600 |
|
|
1601 |
"Modified: / 17-08-2011 / 15:05:02 / cg"
|
|
1602 |
! !
|
|
1603 |
|
|
1604 |
!MethodList methodsFor:'private-presentation'!
|
|
1605 |
|
|
1606 |
colorForCoverageInformationOfMethod:aMethod
|
|
1607 |
aMethod isInstrumented ifFalse:[^ nil].
|
|
1608 |
aMethod category = 'documentation' ifTrue:[^ nil].
|
|
1609 |
|
|
1610 |
aMethod hasBeenCalled ifTrue:[
|
14100
|
1611 |
aMethod haveAllBlocksBeenExecuted ifTrue:[
|
|
1612 |
^ UserPreferences current colorForInstrumentedFullyCoveredCode
|
|
1613 |
].
|
|
1614 |
^ UserPreferences current colorForInstrumentedPartiallyCoveredCode
|
14098
|
1615 |
].
|
|
1616 |
^ UserPreferences current colorForInstrumentedNeverCalledCode
|
|
1617 |
|
|
1618 |
"Created: / 30-04-2010 / 11:53:38 / cg"
|
|
1619 |
!
|
|
1620 |
|
|
1621 |
listEntryForMethod:aMethod selector:selector class:cls showClass:showClass showCategory:showCategory classFirst:showClassFirst
|
14100
|
1622 |
"answer a method list entry
|
|
1623 |
gimmics:
|
|
1624 |
adding a little image to breakPointed methods,
|
|
1625 |
inheritance indicators,
|
|
1626 |
highlight accessors of variable"
|
14098
|
1627 |
|
|
1628 |
^ self
|
14100
|
1629 |
listEntryForMethod:aMethod
|
|
1630 |
selector:selector
|
|
1631 |
class:cls
|
|
1632 |
showClass:showClass showCategory:showCategory
|
|
1633 |
classFirst:showClassFirst
|
|
1634 |
suppressInheritanceInfo:false
|
14098
|
1635 |
!
|
|
1636 |
|
|
1637 |
listEntryForMethod:aMethod selector:selector class:cls showClass:showClass showCategory:showCategory classFirst:showClassFirst suppressInheritanceInfo:suppressInheritanceInfo
|
14100
|
1638 |
"answer a method list entry
|
|
1639 |
gimmics:
|
|
1640 |
adding a little image to breakPointed methods,
|
|
1641 |
inheritance indicators,
|
|
1642 |
highlight accessors of variable"
|
14098
|
1643 |
|
14100
|
1644 |
|s icn variablesToHighlight classVarsToHighLight
|
|
1645 |
doHighLight doHighLightRed clr emp cat l redefIcon
|
14098
|
1646 |
metrics complexity complexityString complexityIcon mark lastResultOrNil|
|
|
1647 |
|
|
1648 |
aMethod isNil ifTrue:[
|
14100
|
1649 |
"/ a non-existing (pseudo) method (such as required protocol)
|
|
1650 |
^ selector colorizeAllWith:Color red.
|
14098
|
1651 |
].
|
|
1652 |
|
|
1653 |
showClassFirst ifTrue:[
|
14100
|
1654 |
s := aMethod printStringForBrowserWithSelector:selector allBold inClass:cls.
|
|
1655 |
s := cls nameInBrowser , ' ' , s
|
14098
|
1656 |
] ifFalse:[
|
14100
|
1657 |
s := aMethod printStringForBrowserWithSelector:selector inClass:cls.
|
14098
|
1658 |
].
|
|
1659 |
|
|
1660 |
"/
|
|
1661 |
"/ wrap icons (i.e. break- or trace points on the method)
|
|
1662 |
"/ have higher prio ...
|
|
1663 |
"/
|
|
1664 |
(aMethod notNil and:[aMethod isWrapped]) ifTrue:[
|
14100
|
1665 |
(s endsWith:' !!') ifTrue:[
|
|
1666 |
s := s copyButLast:2
|
|
1667 |
].
|
|
1668 |
aMethod isBreakpointed ifTrue:[
|
|
1669 |
icn := self stopIcon
|
|
1670 |
] ifFalse:[
|
|
1671 |
aMethod isTimed ifTrue:[
|
|
1672 |
icn := self timeIcon
|
|
1673 |
] ifFalse:[
|
|
1674 |
icn := self traceIcon
|
|
1675 |
]
|
|
1676 |
].
|
14098
|
1677 |
].
|
|
1678 |
|
|
1679 |
"/
|
|
1680 |
"/ breakpoint icons (i.e. break- or trace points inside)
|
|
1681 |
"/
|
|
1682 |
icn isNil ifTrue:[
|
14100
|
1683 |
(aMethod notNil and:[aMethod isMethodWithBreakpoints]) ifTrue:[
|
|
1684 |
icn := self breakPointedIcon
|
|
1685 |
].
|
14098
|
1686 |
].
|
|
1687 |
|
|
1688 |
icn isNil ifTrue:[
|
14100
|
1689 |
self showImageResourceMethodsImages value ~~ false ifTrue:[
|
|
1690 |
(aMethod hasImageResource) ifTrue:[
|
|
1691 |
aMethod mclass isMeta ifTrue:[
|
|
1692 |
icn := aMethod valueWithReceiver:nil arguments:nil .
|
|
1693 |
].
|
|
1694 |
].
|
|
1695 |
].
|
14098
|
1696 |
].
|
|
1697 |
|
|
1698 |
icn isNil ifTrue:[
|
14100
|
1699 |
showMethodTypeIcon value ~~ false ifTrue:[
|
|
1700 |
icn := self resourceIconForMethod:aMethod.
|
|
1701 |
].
|
|
1702 |
icn isNil ifTrue:[
|
|
1703 |
aMethod isProtected ifTrue:[
|
|
1704 |
icn := self protectedMethodIcon
|
|
1705 |
] ifFalse:[
|
|
1706 |
aMethod isPrivate ifTrue:[
|
|
1707 |
icn := self privateMethodIcon
|
|
1708 |
] ifFalse:[
|
|
1709 |
(aMethod isIgnored) ifTrue:[
|
|
1710 |
icn := self ignoredMethodIcon
|
|
1711 |
] ifFalse:[
|
|
1712 |
(aMethod isJavaMethod and:[aMethod isAbstract]) ifTrue:[
|
|
1713 |
icn := self abstractMethodIcon
|
|
1714 |
]
|
|
1715 |
]
|
|
1716 |
]
|
|
1717 |
].
|
|
1718 |
].
|
14098
|
1719 |
].
|
|
1720 |
icn isNil ifTrue:[
|
14100
|
1721 |
(selector startsWith:'test') ifTrue:[
|
|
1722 |
((cls isSubclassOf:TestCase)
|
|
1723 |
and:[cls isAbstract not]) ifTrue:[
|
|
1724 |
"JV@2011-11-17: Show thumbs even if not all test were run"
|
14098
|
1725 |
|
14100
|
1726 |
lastResultOrNil := cls rememberedOutcomeFor:selector.
|
|
1727 |
lastResultOrNil notNil ifTrue:[
|
|
1728 |
|state|
|
14098
|
1729 |
|
14100
|
1730 |
state := lastResultOrNil result.
|
|
1731 |
(state == TestResult statePass) ifTrue:[
|
|
1732 |
icn := ToolbarIconLibrary testCasePassedIcon
|
|
1733 |
] ifFalse:[
|
|
1734 |
(state == TestResult stateError) ifTrue:[
|
|
1735 |
icn := ToolbarIconLibrary testCaseErrorIcon
|
|
1736 |
] ifFalse:[
|
|
1737 |
(state == TestResult stateFail) ifTrue:[
|
|
1738 |
icn := ToolbarIconLibrary testCaseFailedIcon
|
|
1739 |
] ifFalse:[
|
|
1740 |
icn := ToolbarIconLibrary testCaseSkippedIcon
|
|
1741 |
]
|
|
1742 |
]
|
|
1743 |
]
|
|
1744 |
].
|
|
1745 |
].
|
|
1746 |
]
|
14098
|
1747 |
].
|
|
1748 |
|
|
1749 |
showClass ifTrue:[
|
14100
|
1750 |
showClassFirst ifFalse:[
|
|
1751 |
s := s , ' [' , cls name allBold , ']'.
|
|
1752 |
]
|
14098
|
1753 |
].
|
|
1754 |
(showCategory and:[aMethod mclass supportsMethodCategories]) ifTrue:[
|
14100
|
1755 |
cat := aMethod category.
|
|
1756 |
cat notNil ifTrue:[
|
|
1757 |
s := s , ' {' , (cat "asText allItalic" colorizeAllWith:Color grey), '}'
|
|
1758 |
]
|
14098
|
1759 |
].
|
|
1760 |
|
|
1761 |
self showCoverageInformation value ifTrue:[
|
14100
|
1762 |
clr := self colorForCoverageInformationOfMethod:aMethod.
|
|
1763 |
clr notNil ifTrue:[
|
|
1764 |
s := self colorize:s with:(#color->clr).
|
|
1765 |
"/ aMethod isInstrumented ifTrue:[
|
|
1766 |
"/ icn := self instrumentationIcon
|
|
1767 |
"/ ].
|
|
1768 |
].
|
14098
|
1769 |
] ifFalse:[
|
14100
|
1770 |
(ChangeSet current includesChangeForClass:cls selector:selector) ifTrue:[
|
|
1771 |
mark := self class markForBeingInChangeList.
|
|
1772 |
"/ mark := self colorizeForChangedCode:mark.
|
|
1773 |
s := s , mark.
|
|
1774 |
"/ cg: I dont know why this was disabled - it is req'd to
|
|
1775 |
"/ see changed methods in a method list (implementors...)
|
|
1776 |
s := self colorizeForChangedCode:s.
|
|
1777 |
].
|
14098
|
1778 |
|
14100
|
1779 |
(SmallTeam notNil and:[SmallTeam includesChangeForClass:cls selector:selector]) ifTrue:[
|
|
1780 |
s := (self colorizeForChangedCodeInSmallTeam:'!! '),s
|
|
1781 |
].
|
14098
|
1782 |
].
|
|
1783 |
|
|
1784 |
variablesToHighlight := variableFilter value.
|
|
1785 |
variablesToHighlight size > 0 ifTrue:[
|
14100
|
1786 |
classVarsToHighLight := filterClassVars value.
|
|
1787 |
classVarsToHighLight ifTrue:[
|
|
1788 |
doHighLight := self method:aMethod includesRefsToClassVariable:variablesToHighlight.
|
|
1789 |
doHighLight ifTrue:[
|
|
1790 |
doHighLightRed := self method:aMethod includesModsOfClassVariable:variablesToHighlight.
|
|
1791 |
].
|
|
1792 |
] ifFalse:[
|
|
1793 |
doHighLight := self method:aMethod includesRefsToInstanceVariable:variablesToHighlight.
|
|
1794 |
doHighLight ifTrue:[
|
|
1795 |
doHighLightRed := self method:aMethod includesModsOfInstanceVariable:variablesToHighlight
|
|
1796 |
]
|
|
1797 |
].
|
|
1798 |
doHighLight ifTrue:[
|
|
1799 |
s := s allBold.
|
|
1800 |
doHighLightRed ifTrue:[
|
|
1801 |
emp := (UserPreferences current emphasisForWrittenVariable)
|
|
1802 |
] ifFalse:[
|
|
1803 |
emp := (UserPreferences current emphasisForReadVariable)
|
|
1804 |
].
|
|
1805 |
s := s emphasisAllAdd:emp
|
|
1806 |
]
|
14098
|
1807 |
].
|
|
1808 |
|
14100
|
1809 |
(showMethodComplexity value == true
|
14098
|
1810 |
and:[ OOM::MethodMetrics notNil ]) ifTrue:[
|
14100
|
1811 |
icn isNil ifTrue:[
|
|
1812 |
metrics := OOM::MethodMetrics forMethod:aMethod.
|
|
1813 |
complexity := metrics complexity ? 0.
|
|
1814 |
complexityIcon := OOM::MethodMetrics iconForComplexity:complexity.
|
14098
|
1815 |
|
14100
|
1816 |
ShowComplexityValue == true ifTrue:[
|
|
1817 |
complexityString := '{' , complexity printString , '}'.
|
|
1818 |
s := complexityString , ' ' , s.
|
|
1819 |
].
|
|
1820 |
"/ icn := icn ? complexityIcon.
|
|
1821 |
s := LabelAndIcon icon:complexityIcon string:s.
|
|
1822 |
].
|
14098
|
1823 |
].
|
|
1824 |
|
|
1825 |
(showMethodInheritance value ? true) ifTrue:[
|
14100
|
1826 |
suppressInheritanceInfo ifTrue:[
|
|
1827 |
redefIcon := self methodEmptyInheritedIcon.
|
|
1828 |
] ifFalse:[
|
|
1829 |
redefIcon := self redefinedOrInheritedIconFor:aMethod.
|
|
1830 |
].
|
14098
|
1831 |
].
|
|
1832 |
|
|
1833 |
(icn notNil or:[redefIcon notNil]) ifTrue:[
|
14100
|
1834 |
"/eXept version
|
|
1835 |
"/l := LabelAndIcon icon:redefIcon string:s.
|
|
1836 |
"/l image:icn.
|
|
1837 |
"/JV:
|
|
1838 |
l := LabelAndIcon icon:icn string:s.
|
|
1839 |
l image:redefIcon.
|
|
1840 |
icn isNil ifTrue:[l offset: 13].
|
|
1841 |
l gap:1.
|
|
1842 |
^ l
|
14098
|
1843 |
].
|
|
1844 |
^ s
|
|
1845 |
|
|
1846 |
"Created: / 22-10-1996 / 19:51:00 / cg"
|
|
1847 |
"Modified: / 15-08-2009 / 13:13:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
1848 |
"Modified: / 07-03-2012 / 19:06:09 / cg"
|
|
1849 |
"Modified: / 16-10-2013 / 01:10:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
1850 |
! !
|
|
1851 |
|
|
1852 |
!MethodList methodsFor:'private-watching'!
|
|
1853 |
|
|
1854 |
startWatchProcess
|
|
1855 |
updateProcess notNil ifTrue:[
|
14100
|
1856 |
^ self
|
14098
|
1857 |
].
|
|
1858 |
updateProcess := [
|
14100
|
1859 |
[true] whileTrue:[
|
|
1860 |
Delay waitForSeconds:1.
|
|
1861 |
self enqueueDelayedUpdateList
|
|
1862 |
]
|
|
1863 |
] fork.
|
14098
|
1864 |
!
|
|
1865 |
|
|
1866 |
stopWatchProcess
|
|
1867 |
|p|
|
|
1868 |
|
|
1869 |
(p := updateProcess) notNil ifTrue:[
|
14100
|
1870 |
updateProcess := nil.
|
|
1871 |
p terminate
|
14098
|
1872 |
].
|
|
1873 |
! !
|
|
1874 |
|
|
1875 |
!MethodList methodsFor:'setup'!
|
|
1876 |
|
|
1877 |
postBuildWith:aBuilder
|
|
1878 |
|methodListView|
|
|
1879 |
|
|
1880 |
super postBuildWith:aBuilder.
|
|
1881 |
|
|
1882 |
methodListView := aBuilder componentAt:'List'.
|
|
1883 |
methodListView notNil ifTrue:[
|
14100
|
1884 |
methodListView allowDrag:true.
|
|
1885 |
methodListView dragObjectConverter:[:obj |
|
|
1886 |
|nm method idx|
|
14098
|
1887 |
|
14100
|
1888 |
nm := obj theObject asString string string.
|
|
1889 |
idx := browserNameList value findFirst:[:item | item string string = nm].
|
|
1890 |
method := methodList value at:idx.
|
|
1891 |
DropObject newMethod:method.
|
|
1892 |
].
|
14098
|
1893 |
]
|
|
1894 |
! !
|
|
1895 |
|
|
1896 |
!MethodList class methodsFor:'documentation'!
|
|
1897 |
|
|
1898 |
version
|
14100
|
1899 |
^ '$Header: /cvs/stx/stx/libtool/Tools__MethodList.st,v 1.98 2014-03-04 09:11:59 cg Exp $'
|
14098
|
1900 |
!
|
|
1901 |
|
|
1902 |
version_CVS
|
14100
|
1903 |
^ '$Header: /cvs/stx/stx/libtool/Tools__MethodList.st,v 1.98 2014-03-04 09:11:59 cg Exp $'
|
14098
|
1904 |
! !
|