author | Claus Gittinger <cg@exept.de> |
Wed, 09 Aug 2006 13:56:05 +0200 | |
changeset 6855 | 93bacd7fcf14 |
parent 6706 | 8a8ba991614c |
child 6877 | 59c8f9e00343 |
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 |
||
5592 | 13 |
"{ Package: 'stx:libtool' }" |
5591 | 14 |
|
15 |
"{ NameSpace: Tools }" |
|
16 |
||
17 |
BrowserList subclass:#MethodCategoryList |
|
18 |
instanceVariableNames:'variableFilter filterClassVars lastSelectedProtocols classes |
|
19 |
leafClasses protocolList rawProtocolList selectedProtocolIndices |
|
20 |
lastGeneratedProtocols noAllItem packageFilterOnInput |
|
21 |
methodVisibilityHolder' |
|
22 |
classVariableNames:'AdditionalEmptyCategoriesPerClassName' |
|
23 |
poolDictionaries:'' |
|
24 |
category:'Interface-Browsers-New' |
|
25 |
! |
|
26 |
||
27 |
!MethodCategoryList class methodsFor:'documentation'! |
|
28 |
||
29 |
copyright |
|
30 |
" |
|
31 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
32 |
All Rights Reserved |
|
33 |
||
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! ! |
|
42 |
||
43 |
!MethodCategoryList class methodsFor:'interface specs'! |
|
44 |
||
45 |
singleProtocolWindowSpec |
|
46 |
"This resource specification was automatically generated |
|
47 |
by the UIPainter of ST/X." |
|
48 |
||
49 |
"Do not manually edit this!! If it is corrupted, |
|
50 |
the UIPainter may not be able to read the specification." |
|
51 |
||
52 |
" |
|
53 |
UIPainter new openOnClass:MethodCategoryList andSelector:#singleProtocolWindowSpec |
|
54 |
MethodCategoryList new openInterface:#singleProtocolWindowSpec |
|
55 |
" |
|
56 |
||
57 |
<resource: #canvas> |
|
58 |
||
59 |
^ |
|
60 |
#(#FullSpec |
|
5592 | 61 |
#name: #singleProtocolWindowSpec |
62 |
#window: |
|
5591 | 63 |
#(#WindowSpec |
5592 | 64 |
#label: 'ProtocolList' |
65 |
#name: 'ProtocolList' |
|
66 |
#min: #(#Point 0 0) |
|
67 |
#max: #(#Point 1024 721) |
|
68 |
#bounds: #(#Rectangle 12 22 312 322) |
|
69 |
) |
|
70 |
#component: |
|
5591 | 71 |
#(#SpecCollection |
5592 | 72 |
#collection: #( |
73 |
#(#LabelSpec |
|
74 |
#label: 'ProtocolName' |
|
75 |
#name: 'ProtocolLabel' |
|
76 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 25 0) |
|
77 |
#translateLabel: true |
|
78 |
#labelChannel: #protocolLabelHolder |
|
79 |
#menu: #menuHolder |
|
80 |
) |
|
81 |
) |
|
5591 | 82 |
|
5592 | 83 |
) |
5591 | 84 |
) |
85 |
! |
|
86 |
||
87 |
windowSpec |
|
88 |
"This resource specification was automatically generated |
|
89 |
by the UIPainter of ST/X." |
|
90 |
||
91 |
"Do not manually edit this!! If it is corrupted, |
|
92 |
the UIPainter may not be able to read the specification." |
|
93 |
||
94 |
" |
|
95 |
UIPainter new openOnClass:MethodCategoryList andSelector:#windowSpec |
|
96 |
MethodCategoryList new openInterface:#windowSpec |
|
97 |
MethodCategoryList open |
|
98 |
" |
|
99 |
||
100 |
<resource: #canvas> |
|
101 |
||
102 |
^ |
|
103 |
#(#FullSpec |
|
6469 | 104 |
#name: #windowSpec |
105 |
#window: |
|
5591 | 106 |
#(#WindowSpec |
6469 | 107 |
#label: 'ProtocolList' |
108 |
#name: 'ProtocolList' |
|
109 |
#min: #(#Point 0 0) |
|
110 |
#max: #(#Point 1024 721) |
|
111 |
#bounds: #(#Rectangle 16 46 316 346) |
|
112 |
) |
|
113 |
#component: |
|
5591 | 114 |
#(#SpecCollection |
6469 | 115 |
#collection: #( |
116 |
#(#SequenceViewSpec |
|
117 |
#name: 'List' |
|
118 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
119 |
#tabable: true |
|
120 |
#model: #selectedProtocolIndices |
|
121 |
#menu: #menuHolder |
|
122 |
#hasHorizontalScrollBar: true |
|
123 |
#hasVerticalScrollBar: true |
|
124 |
#miniScrollerHorizontal: true |
|
125 |
#isMultiSelect: true |
|
126 |
#valueChangeSelector: #selectionChangedByClick |
|
127 |
#useIndex: true |
|
128 |
#sequenceList: #protocolList |
|
129 |
#doubleClickChannel: #doubleClickChannel |
|
130 |
#properties: |
|
131 |
#(#PropertyListDictionary |
|
132 |
#dragArgument: nil |
|
133 |
#dropArgument: nil |
|
134 |
#canDropSelector: #canDropContext: |
|
135 |
#dropSelector: #doDropContext: |
|
136 |
) |
|
137 |
) |
|
138 |
) |
|
5591 | 139 |
|
6469 | 140 |
) |
5591 | 141 |
) |
142 |
! ! |
|
143 |
||
144 |
!MethodCategoryList class methodsFor:'plugIn spec'! |
|
145 |
||
146 |
aspectSelectors |
|
147 |
"This resource specification was automatically generated |
|
148 |
by the UIPainter of ST/X." |
|
149 |
||
150 |
"Do not manually edit this. If it is corrupted, |
|
151 |
the UIPainter may not be able to read the specification." |
|
152 |
||
153 |
"Return a description of exported aspects; |
|
154 |
these can be connected to aspects of an embedding application |
|
155 |
(if this app is embedded in a subCanvas)." |
|
156 |
||
157 |
^ #( |
|
158 |
#(#doubleClickChannel #action ) |
|
159 |
#filterClassVars |
|
160 |
#forceGeneratorTrigger |
|
161 |
#immediateUpdate |
|
162 |
#inGeneratorHolder |
|
163 |
#menuHolder |
|
164 |
#noAllItem |
|
165 |
#outGeneratorHolder |
|
166 |
#packageFilter |
|
167 |
#packageFilterOnInput |
|
168 |
#selectedProtocols |
|
169 |
#selectionChangeCondition |
|
170 |
#updateTrigger |
|
171 |
#variableFilter |
|
172 |
#methodVisibilityHolder |
|
173 |
). |
|
174 |
! ! |
|
175 |
||
176 |
!MethodCategoryList methodsFor:'aspects'! |
|
177 |
||
178 |
browserNameList |
|
179 |
^ self protocolList |
|
180 |
! |
|
181 |
||
182 |
defaultSlaveModeValue |
|
183 |
^ false. |
|
184 |
! |
|
185 |
||
186 |
filterClassVars |
|
187 |
filterClassVars isNil ifTrue:[ |
|
188 |
filterClassVars := false asValue. |
|
189 |
filterClassVars addDependent:self |
|
190 |
]. |
|
191 |
^ filterClassVars |
|
192 |
||
193 |
"Modified: / 31.1.2000 / 00:56:31 / cg" |
|
194 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
195 |
! |
|
196 |
||
197 |
filterClassVars:aValueHolder |
|
198 |
filterClassVars notNil ifTrue:[ |
|
199 |
filterClassVars removeDependent:self |
|
200 |
]. |
|
201 |
filterClassVars := aValueHolder. |
|
202 |
filterClassVars notNil ifTrue:[ |
|
203 |
filterClassVars addDependent:self |
|
204 |
]. |
|
205 |
||
206 |
"Modified: / 31.1.2000 / 00:56:31 / cg" |
|
207 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
208 |
! |
|
209 |
||
210 |
methodVisibilityHolder |
|
211 |
methodVisibilityHolder isNil ifTrue:[ |
|
212 |
methodVisibilityHolder := false asValue. |
|
213 |
methodVisibilityHolder addDependent:self |
|
214 |
]. |
|
215 |
^ methodVisibilityHolder |
|
216 |
! |
|
217 |
||
218 |
methodVisibilityHolder:aValueHolder |
|
219 |
methodVisibilityHolder notNil ifTrue:[ |
|
220 |
methodVisibilityHolder removeDependent:self |
|
221 |
]. |
|
222 |
methodVisibilityHolder := aValueHolder. |
|
223 |
methodVisibilityHolder notNil ifTrue:[ |
|
224 |
methodVisibilityHolder addDependent:self |
|
225 |
]. |
|
226 |
||
227 |
"Modified: / 31.1.2000 / 00:56:31 / cg" |
|
228 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
229 |
! |
|
230 |
||
231 |
noAllItem |
|
232 |
noAllItem isNil ifTrue:[ |
|
233 |
noAllItem := false asValue. |
|
234 |
noAllItem addDependent:self |
|
235 |
]. |
|
236 |
^ noAllItem |
|
237 |
! |
|
238 |
||
239 |
noAllItem:aValueHolder |
|
240 |
noAllItem notNil ifTrue:[ |
|
241 |
noAllItem removeDependent:self |
|
242 |
]. |
|
243 |
noAllItem := aValueHolder. |
|
244 |
noAllItem notNil ifTrue:[ |
|
245 |
noAllItem addDependent:self |
|
246 |
]. |
|
247 |
! |
|
248 |
||
249 |
packageFilterOnInput |
|
250 |
packageFilterOnInput isNil ifTrue:[ |
|
251 |
packageFilterOnInput := nil asValue. |
|
252 |
packageFilterOnInput addDependent:self |
|
253 |
]. |
|
254 |
^ packageFilterOnInput |
|
255 |
! |
|
256 |
||
257 |
packageFilterOnInput:aValueHolder |
|
258 |
|prevFilter| |
|
259 |
||
260 |
prevFilter := packageFilterOnInput value. |
|
261 |
packageFilterOnInput notNil ifTrue:[ |
|
262 |
packageFilterOnInput removeDependent:self |
|
263 |
]. |
|
264 |
packageFilterOnInput := aValueHolder. |
|
265 |
packageFilterOnInput notNil ifTrue:[ |
|
266 |
packageFilterOnInput addDependent:self |
|
267 |
]. |
|
268 |
prevFilter ~= packageFilterOnInput value ifTrue:[ |
|
269 |
self enqueueDelayedUpdateList |
|
270 |
]. |
|
271 |
! |
|
272 |
||
273 |
protocolLabelHolder |
|
274 |
^ self pseudoListLabelHolder |
|
275 |
! |
|
276 |
||
277 |
protocolList |
|
278 |
protocolList isNil ifTrue:[ |
|
279 |
protocolList := List new. "/ ValueHolder new |
|
280 |
]. |
|
281 |
^ protocolList |
|
282 |
||
283 |
"Modified: / 31.1.2000 / 00:56:31 / cg" |
|
284 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
285 |
! |
|
286 |
||
287 |
rawProtocolList |
|
288 |
rawProtocolList isNil ifTrue:[ |
|
289 |
rawProtocolList := List new. |
|
290 |
]. |
|
291 |
^ rawProtocolList |
|
292 |
! |
|
293 |
||
294 |
selectedProtocolIndices |
|
295 |
selectedProtocolIndices isNil ifTrue:[ |
|
296 |
selectedProtocolIndices := ValueHolder new. |
|
297 |
selectedProtocolIndices addDependent:self |
|
298 |
]. |
|
299 |
^ selectedProtocolIndices. |
|
300 |
! |
|
301 |
||
302 |
selectedProtocols |
|
303 |
^ self selectionHolder |
|
304 |
! |
|
305 |
||
306 |
selectedProtocols:aValueHolder |
|
307 |
^ self selectionHolder:aValueHolder |
|
308 |
! |
|
309 |
||
310 |
variableFilter |
|
311 |
variableFilter isNil ifTrue:[ |
|
312 |
variableFilter := false asValue. |
|
313 |
variableFilter addDependent:self |
|
314 |
]. |
|
315 |
^ variableFilter |
|
316 |
||
317 |
"Modified: / 31.1.2000 / 00:56:31 / cg" |
|
318 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
319 |
! |
|
320 |
||
321 |
variableFilter:aValueHolder |
|
322 |
variableFilter notNil ifTrue:[ |
|
323 |
variableFilter removeDependent:self |
|
324 |
]. |
|
325 |
variableFilter := aValueHolder. |
|
326 |
variableFilter notNil ifTrue:[ |
|
327 |
variableFilter addDependent:self |
|
328 |
]. |
|
329 |
||
330 |
"Modified: / 31.1.2000 / 00:56:31 / cg" |
|
331 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
332 |
! ! |
|
333 |
||
334 |
!MethodCategoryList methodsFor:'change & update'! |
|
335 |
||
336 |
classDefinitionChanged:aClass |
|
337 |
|refetch anyChange| |
|
338 |
||
339 |
anyChange := false. |
|
340 |
refetch := [:oldClass | |
|
341 |
|nm cls newClass| |
|
342 |
||
343 |
nm := oldClass theNonMetaclass name. |
|
344 |
oldClass isMeta ifTrue:[ |
|
345 |
newClass := Smalltalk at:nm. |
|
346 |
newClass isNil ifTrue:[ |
|
347 |
Transcript showCR:'oops - browser lost class ' , nm. |
|
348 |
newClass := oldClass |
|
349 |
] ifFalse:[ |
|
350 |
newClass := newClass theMetaclass |
|
351 |
] |
|
352 |
] ifFalse:[ |
|
353 |
newClass := Smalltalk at:nm |
|
354 |
]. |
|
355 |
newClass ~~ oldClass ifTrue:[ |
|
356 |
anyChange := true. |
|
357 |
]. |
|
358 |
newClass |
|
359 |
]. |
|
360 |
||
361 |
classes := classes collect:refetch. |
|
362 |
leafClasses := leafClasses collect:refetch. |
|
363 |
anyChange ifTrue:[ |
|
364 |
self updateOutputGenerator |
|
365 |
]. |
|
366 |
! |
|
367 |
||
368 |
delayedUpdate:something with:aParameter from:changedObject |
|
369 |
|sel oldMethod newMethod mthd selectedCategories selectedProtocolsHolder oldProtocol newProtocol |
|
370 |
rawProtocolListHolder rawProtocolList oldSelectedProtocols newSelectedProtocols newIndices idx cls listView| |
|
371 |
||
372 |
selectedProtocolsHolder := self selectedProtocols. |
|
373 |
rawProtocolListHolder := self rawProtocolList. |
|
374 |
||
375 |
changedObject == Smalltalk ifTrue:[ |
|
6412 | 376 |
classes notNil ifTrue:[ |
377 |
something == #methodCategory ifTrue:[ |
|
378 |
cls := aParameter at:1. |
|
379 |
(cls notNil and:[classes includesIdentical:cls]) ifTrue:[ |
|
380 |
mthd := aParameter at:2. |
|
381 |
newProtocol := mthd category. |
|
382 |
oldProtocol := aParameter at:3. |
|
5591 | 383 |
|
6412 | 384 |
self invalidateList. |
5591 | 385 |
|
6412 | 386 |
selectedCategories := selectedProtocolsHolder value. |
387 |
selectedCategories size > 0 ifTrue:[ |
|
388 |
selectedCategories := selectedCategories collect:[:each | each ifNil:[self class nameListEntryForNILCategory]]. |
|
389 |
selectedCategories := selectedCategories collect:[:each | each string]. |
|
5591 | 390 |
|
6412 | 391 |
((selectedCategories includes:oldProtocol) |
392 |
or:[ (selectedCategories includes:newProtocol) |
|
393 |
or:[ selectedCategories includes:(self class nameListEntryForALL) ]]) |
|
394 |
ifTrue:[ |
|
395 |
self updateOutputGenerator. |
|
396 |
]. |
|
397 |
]. |
|
5591 | 398 |
|
6412 | 399 |
]. |
400 |
^ self |
|
401 |
]. |
|
5591 | 402 |
|
6412 | 403 |
something == #methodInClass ifTrue:[ |
404 |
"/ a method has been added/removed/changed |
|
405 |
cls := aParameter at:1. |
|
406 |
(classes includesIdentical:cls) ifTrue:[ |
|
407 |
sel := aParameter at:2. |
|
408 |
oldMethod := aParameter at:3. |
|
409 |
newMethod := cls compiledMethodAt:sel. |
|
410 |
oldMethod notNil ifTrue:[ |
|
411 |
variableFilter value size > 0 ifTrue:[ |
|
412 |
"/ sigh - must invalidate |
|
413 |
self invalidateList. |
|
414 |
]. |
|
415 |
^ self. |
|
416 |
]. |
|
417 |
"/ method was added - update the methodList |
|
418 |
"/ Q: is this needed (methodCategoryList should send me a new inGenerator) |
|
419 |
self invalidateList. |
|
5591 | 420 |
|
6412 | 421 |
"/ if its category is selected, updateOutputGenerator |
422 |
selectedCategories := selectedProtocolsHolder value. |
|
423 |
selectedCategories size > 0 ifTrue:[ |
|
424 |
selectedCategories := selectedCategories collect:[:each | each ifNil:[self class nameListEntryForNILCategory]]. |
|
425 |
selectedCategories := selectedCategories collect:[:each | each string]. |
|
5591 | 426 |
|
6412 | 427 |
((oldMethod notNil and:[selectedCategories includes:(oldMethod category)]) |
428 |
or:[ (newMethod notNil and:[selectedCategories includes:(newMethod category)])]) |
|
429 |
ifTrue:[ |
|
430 |
self updateOutputGenerator. |
|
431 |
]. |
|
432 |
]. |
|
433 |
]. |
|
434 |
^ self. |
|
435 |
]. |
|
5591 | 436 |
|
6412 | 437 |
something == #methodInClassRemoved ifTrue:[ |
438 |
cls := aParameter at:1. |
|
439 |
(classes includesIdentical:cls) ifTrue:[ |
|
440 |
sel := aParameter at:2. |
|
441 |
"/ method was removed - update the list and output generator |
|
442 |
self invalidateList. |
|
443 |
"/ self updateOutputGenerator. |
|
444 |
self slaveMode value == true ifFalse:[ |
|
445 |
self enqueueDelayedUpdateOutputGenerator. |
|
446 |
] |
|
447 |
]. |
|
448 |
^ self. |
|
449 |
]. |
|
5591 | 450 |
|
6664
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
451 |
(something == #classOrganization |
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
452 |
or:[ something == #methodCategoryAdded |
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
453 |
or:[ something == #methodCategoryRemoved |
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
454 |
or:[ something == #methodCategoriesRemoved |
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
455 |
or:[ something == #methodCategoryRenamed ]]]]) ifTrue:[ |
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
456 |
cls := (something == #classOrganization) ifTrue:aParameter ifFalse:[aParameter first]. |
6412 | 457 |
(classes includesIdentical:cls) ifTrue:[ |
458 |
self invalidateList. |
|
459 |
] ifFalse:[ |
|
460 |
(classes contains:[:aClass | aClass name = cls name]) ifTrue:[ |
|
461 |
self invalidateList. |
|
462 |
"/ self error:'obsolete class: should not happen'. |
|
463 |
] |
|
464 |
]. |
|
465 |
^ self. |
|
466 |
]. |
|
5591 | 467 |
|
6412 | 468 |
something == #projectOrganization ifTrue:[ |
469 |
aParameter notNil ifTrue:[ |
|
470 |
cls := aParameter at:1. |
|
471 |
cls notNil ifTrue:[ |
|
472 |
((classes includes:cls theMetaclass) |
|
473 |
or:[(classes includes:cls theNonMetaclass)]) ifTrue:[ |
|
474 |
self invalidateList. |
|
475 |
self slaveMode value == true ifFalse:[ |
|
476 |
self enqueueDelayedUpdateOutputGenerator. |
|
477 |
] |
|
478 |
]. |
|
479 |
]. |
|
480 |
] ifFalse:[ |
|
481 |
self invalidateList. |
|
482 |
]. |
|
483 |
^ self |
|
484 |
]. |
|
5591 | 485 |
|
6412 | 486 |
(something == #classDefinition or:[something == #classVariables]) |
487 |
ifTrue:[ |
|
488 |
self classDefinitionChanged:aParameter. |
|
489 |
^ self |
|
490 |
]. |
|
5591 | 491 |
|
6412 | 492 |
"/ everything else is ignored |
493 |
"/ self halt. |
|
494 |
]. |
|
495 |
^ self |
|
5591 | 496 |
]. |
497 |
||
498 |
changedObject == self selectedProtocolIndices ifTrue:[ |
|
6412 | 499 |
oldSelectedProtocols := selectedProtocolsHolder value ? #(). |
500 |
oldSelectedProtocols := oldSelectedProtocols collect:[:each | each ifNil:[self class nameListEntryForNILCategory]]. |
|
501 |
oldSelectedProtocols := oldSelectedProtocols collect:[:each | each string]. |
|
502 |
newSelectedProtocols := self getSelectedProtocolsFromIndices. |
|
503 |
oldSelectedProtocols ~= newSelectedProtocols ifTrue:[ |
|
504 |
selectedProtocolsHolder value:newSelectedProtocols. |
|
505 |
]. |
|
506 |
newSelectedProtocols size > 1 ifTrue:[ |
|
507 |
(newSelectedProtocols includes:(self class nameListEntryForALL)) ifTrue:[ |
|
508 |
rawProtocolList := rawProtocolListHolder value. |
|
509 |
idx := rawProtocolList indexOf: (newSelectedProtocols copy remove:(self class nameListEntryForALL); yourself) first. |
|
510 |
idx ~~ 0 ifTrue:[ |
|
511 |
(listView := self builder componentAt:#List) notNil ifTrue:[ |
|
512 |
listView makeLineVisible:idx. |
|
513 |
] |
|
514 |
] |
|
515 |
] |
|
516 |
]. |
|
5591 | 517 |
|
6412 | 518 |
^ self |
5591 | 519 |
]. |
520 |
||
521 |
changedObject == selectedProtocolsHolder ifTrue:[ |
|
6412 | 522 |
rawProtocolList := rawProtocolListHolder value. |
523 |
rawProtocolList size == 0 ifTrue:[ |
|
524 |
self updateList. |
|
525 |
rawProtocolList := rawProtocolListHolder value. |
|
526 |
]. |
|
527 |
rawProtocolList notNil ifTrue:[ |
|
528 |
selectedCategories := selectedProtocolsHolder value ? #(). |
|
529 |
selectedCategories := selectedCategories collect:[:each | each ifNil:[self class nameListEntryForNILCategory]]. |
|
530 |
newIndices := selectedCategories |
|
531 |
collect:[:each | rawProtocolList findFirst:[:p | p string = each string]]. |
|
532 |
newIndices := newIndices select:[:each | each ~~ 0]. |
|
533 |
newIndices ~= self selectedProtocolIndices value ifTrue:[ |
|
534 |
self selectedProtocolIndices setValue:nil. "/ to force update |
|
535 |
self selectedProtocolIndices value:newIndices |
|
536 |
]. |
|
537 |
(lastGeneratedProtocols notNil |
|
538 |
and:[(lastGeneratedProtocols includes:self class nameListEntryForALL) |
|
539 |
and:[(selectedProtocolsHolder value ? #()) includes:self class nameListEntryForALL]]) |
|
540 |
ifTrue:[ |
|
541 |
"/ no need to update generator |
|
542 |
] ifFalse:[ |
|
543 |
self updateOutputGenerator. |
|
544 |
] |
|
545 |
]. |
|
546 |
^ self |
|
5591 | 547 |
]. |
548 |
||
549 |
(changedObject == variableFilter |
|
550 |
or:[changedObject == filterClassVars |
|
551 |
or:[changedObject == packageFilterOnInput]]) ifTrue:[ |
|
6412 | 552 |
self invalidateList. |
553 |
^ self |
|
5591 | 554 |
]. |
555 |
||
556 |
changedObject == methodVisibilityHolder ifTrue:[ |
|
6412 | 557 |
self invalidateList. |
558 |
self updateOutputGenerator. |
|
559 |
^ self |
|
5591 | 560 |
]. |
561 |
||
562 |
lastGeneratedProtocols := nil. |
|
563 |
||
564 |
changedObject == inGeneratorHolder ifTrue:[ |
|
6412 | 565 |
selectedCategories := selectedProtocolsHolder value. |
5591 | 566 |
|
6412 | 567 |
selectedCategories size > 0 ifTrue:[ |
568 |
oldSelectedProtocols := selectedCategories ? #(). |
|
569 |
oldSelectedProtocols := oldSelectedProtocols collect:[:each | each ifNil:[self class nameListEntryForNILCategory]]. |
|
570 |
oldSelectedProtocols := oldSelectedProtocols collect:[:each | each string]. |
|
571 |
self updateList. |
|
572 |
rawProtocolList := rawProtocolListHolder value. |
|
573 |
newSelectedProtocols := oldSelectedProtocols select:[:each | rawProtocolList includes:each]. |
|
5591 | 574 |
"/ selectedProtocolsHolder setValue:nil. "/ to force update |
6412 | 575 |
selectedProtocolsHolder value:newSelectedProtocols. |
576 |
^ self |
|
577 |
]. |
|
5591 | 578 |
]. |
579 |
||
580 |
super delayedUpdate:something with:aParameter from:changedObject |
|
581 |
||
582 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
583 |
"Modified: / 29.2.2000 / 11:11:39 / cg" |
|
584 |
! |
|
585 |
||
586 |
getSelectedProtocolsFromIndices |
|
587 |
|l| |
|
588 |
||
589 |
l := self rawProtocolList value. |
|
590 |
^ self selectedProtocolIndices value collect:[:idx | l at:idx]. |
|
591 |
! |
|
592 |
||
593 |
selectionChanged |
|
594 |
|newSelectedCategories allEntry| |
|
595 |
||
596 |
newSelectedCategories := self selectedProtocols value. |
|
597 |
||
598 |
"/ the outputGenerator is only to be updated, if the output would really |
|
599 |
"/ change ... |
|
600 |
allEntry := self class nameListEntryForALL. |
|
601 |
||
602 |
(lastSelectedProtocols notNil |
|
603 |
and:[newSelectedCategories notNil |
|
604 |
and:[(lastSelectedProtocols includes:(allEntry)) |
|
605 |
and:[newSelectedCategories includes:(allEntry)]]]) ifTrue:[ |
|
606 |
"/ no change ... |
|
607 |
^ self |
|
608 |
]. |
|
609 |
||
610 |
super selectionChanged. |
|
611 |
||
612 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
613 |
"Modified: / 24.2.2000 / 14:12:12 / cg" |
|
614 |
! |
|
615 |
||
616 |
selectionChangedByClick |
|
617 |
"we are not interested in that - get another notification |
|
618 |
via the changed valueHolder" |
|
619 |
||
620 |
lastSelectedProtocols := self getSelectedProtocolsFromIndices |
|
621 |
! |
|
622 |
||
623 |
update:something with:aParameter from:changedObject |
|
6855
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
624 |
|cls sel oldMethod newMethod| |
5591 | 625 |
|
626 |
"/ some can be ignored immediately |
|
627 |
changedObject == Smalltalk ifTrue:[ |
|
6855
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
628 |
something isNil ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
629 |
"/ self halt "/ huh - Smalltalk changed - so what ? |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
630 |
^ self. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
631 |
]. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
632 |
something == #methodInClass ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
633 |
"/ a method has been added/removed/changed |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
634 |
cls := aParameter at:1. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
635 |
(classes notNil and:[classes includesIdentical:cls]) ifFalse:[^ self]. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
636 |
sel := aParameter at:2. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
637 |
oldMethod := aParameter at:3. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
638 |
newMethod := cls compiledMethodAt:sel. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
639 |
oldMethod notNil ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
640 |
variableFilter value size > 0 ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
641 |
"/ sigh - must invalidate |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
642 |
self invalidateList. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
643 |
^ self. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
644 |
]. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
645 |
oldMethod category ~= newMethod category ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
646 |
self invalidateList. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
647 |
^ self. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
648 |
]. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
649 |
"/ mhmh - its now changed (so coloring will change). |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
650 |
self invalidateList. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
651 |
^ self. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
652 |
]. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
653 |
]. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
654 |
|
5591 | 655 |
"/ something == #classDefinition ifTrue:[ |
656 |
"/ ^ self. |
|
657 |
"/ ]. |
|
6855
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
658 |
something == #newClass ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
659 |
^ self. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
660 |
]. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
661 |
something == #classRemove ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
662 |
^ self. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
663 |
]. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
664 |
something == #classRename ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
665 |
^ self. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
666 |
]. |
5591 | 667 |
"/ something == #classVariables ifTrue:[ |
668 |
"/ ^ self. |
|
669 |
"/ ]. |
|
6855
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
670 |
something == #classComment ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
671 |
^ self. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
672 |
]. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
673 |
something == #organization ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
674 |
^ self. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
675 |
]. |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
676 |
something == #methodTrap ifTrue:[ |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
677 |
^ self |
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
678 |
]. |
5591 | 679 |
]. |
680 |
||
681 |
super update:something with:aParameter from:changedObject. |
|
682 |
! ! |
|
683 |
||
684 |
!MethodCategoryList methodsFor:'drag & drop'! |
|
685 |
||
6469 | 686 |
canDropContext:aDropContext |
5591 | 687 |
|cat methods| |
688 |
||
689 |
methods := aDropContext dropObjects collect:[:obj | obj theObject]. |
|
690 |
||
691 |
(methods contains:[:aMethod | aMethod isMethod not]) ifTrue:[^ false]. |
|
692 |
||
693 |
cat := self categoryAtTargetPointOf:aDropContext. |
|
6492 | 694 |
cat isNil ifTrue:[^ false]. |
5591 | 695 |
|
696 |
(methods contains:[:aMethod | aMethod category ~= cat]) ifFalse:[^ false]. |
|
6492 | 697 |
^ true |
5591 | 698 |
! |
699 |
||
700 |
categoryAtTargetPointOf:aDropContext |
|
701 |
|p methodListView lineNr cat| |
|
702 |
||
703 |
p := aDropContext targetPoint. |
|
704 |
||
705 |
methodListView := aDropContext targetWidget. |
|
706 |
||
707 |
lineNr := methodListView lineAtY:p y. |
|
708 |
lineNr isNil ifTrue:[^ nil]. |
|
709 |
||
710 |
cat := rawProtocolList at:lineNr. |
|
711 |
cat := cat string. |
|
712 |
cat = self class nameListEntryForALL ifTrue:[^ nil]. |
|
713 |
||
714 |
^ cat |
|
715 |
! |
|
716 |
||
6469 | 717 |
doDropContext:aDropContext |
5591 | 718 |
|cat methods| |
719 |
||
720 |
methods := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject]. |
|
721 |
(methods contains:[:something | something isMethod not]) ifTrue:[^ self]. |
|
722 |
||
723 |
cat := self categoryAtTargetPointOf:aDropContext. |
|
724 |
cat notNil ifTrue:[ |
|
6469 | 725 |
self masterApplication moveMethods:methods toProtocol:cat. |
5591 | 726 |
]. |
727 |
! ! |
|
728 |
||
729 |
!MethodCategoryList methodsFor:'generators'! |
|
730 |
||
731 |
makeGenerator |
|
732 |
"return a generator which enumerates the methods from the selected protocol; |
|
733 |
that generator generates 4-element elements (includes the class and protocol), |
|
734 |
in order to make the consumers only depend on one input |
|
735 |
(i.e. to pass multiple-class and multiple-protocol info |
|
736 |
without a need for another classHolder/protocolHolder in the methodList)." |
|
737 |
||
738 |
^ Iterator on:[:whatToDo | |
|
739 |
|protocols allProtocols noCat static notStatic classSelectorPairsAlreadyDone |
|
740 |
packages remainingClasses remainingCategories classesAlreadyDone| |
|
741 |
||
742 |
noCat := (self class nameListEntryForNILCategory). |
|
743 |
static := (self class nameListEntryForStatic). |
|
744 |
notStatic := (self class nameListEntryForNonStatic). |
|
745 |
||
746 |
protocols := self selectedProtocols value ? #(). |
|
747 |
protocols := protocols collect:[:each | (each ifNil:[noCat]) string]. |
|
748 |
lastGeneratedProtocols := protocols. |
|
749 |
protocols := protocols asSet. |
|
750 |
||
751 |
(leafClasses size > 0 |
|
752 |
and:[protocols size > 0]) ifTrue:[ |
|
753 |
allProtocols := protocols includes:(self class nameListEntryForALL). |
|
754 |
||
755 |
packages := packageFilter value value. |
|
756 |
(packages notNil and:[packages includes:(self class nameListEntryForALL)]) ifTrue:[ |
|
757 |
packages := nil. |
|
758 |
]. |
|
759 |
||
760 |
remainingClasses := leafClasses copy asIdentitySet. |
|
761 |
remainingCategories := protocols copy asSet. |
|
762 |
||
763 |
classesAlreadyDone := IdentitySet new. |
|
764 |
classSelectorPairsAlreadyDone := Set new. |
|
765 |
||
766 |
leafClasses do:[:aLeafClass | |
|
767 |
(self classesToProcessForClasses:(Array with:aLeafClass)) do:[:aClass | |
|
768 |
|supportsMethodCategories isJavaClass anyInThisClass| |
|
769 |
||
770 |
(classesAlreadyDone includes:aClass) ifFalse:[ |
|
771 |
classesAlreadyDone add:aClass. |
|
772 |
||
773 |
supportsMethodCategories := aClass supportsMethodCategories. |
|
774 |
isJavaClass := aClass isJavaClass. |
|
775 |
anyInThisClass := false. |
|
776 |
||
777 |
aClass methodDictionary keysAndValuesDo:[:sel :mthd | |
|
778 |
|cat| |
|
779 |
||
780 |
supportsMethodCategories ifTrue:[ |
|
781 |
cat := mthd category. |
|
782 |
] ifFalse:[ |
|
783 |
isJavaClass ifTrue:[ |
|
784 |
cat := mthd isStatic ifTrue:[static] ifFalse:[notStatic] |
|
785 |
] ifFalse:[ |
|
786 |
cat := noCat. |
|
787 |
] |
|
788 |
]. |
|
789 |
(allProtocols or:[protocols includes:cat]) ifTrue:[ |
|
790 |
(packages isNil or:[packages includes:mthd package]) |
|
791 |
ifTrue:[ |
|
792 |
||
793 |
(methodVisibilityHolder value == #class) ifTrue:[ |
|
794 |
whatToDo value:aClass value:cat value:sel value:mthd. |
|
795 |
] ifFalse:[ |
|
796 |
(classSelectorPairsAlreadyDone includes:(aLeafClass->sel)) ifFalse:[ |
|
797 |
classSelectorPairsAlreadyDone add:(aLeafClass->sel). |
|
798 |
whatToDo value:aClass value:cat value:sel value:mthd. |
|
799 |
]. |
|
800 |
]. |
|
801 |
||
802 |
anyInThisClass := true. |
|
803 |
remainingCategories remove:cat ifAbsent:nil. |
|
804 |
] |
|
805 |
] |
|
806 |
]. |
|
807 |
anyInThisClass ifTrue:[ remainingClasses remove:aClass ifAbsent:nil. ]. |
|
808 |
]. |
|
809 |
]. |
|
810 |
]. |
|
811 |
remainingClasses do:[:aClass | |
|
812 |
whatToDo value:aClass value:nil value:nil value:nil. |
|
813 |
]. |
|
814 |
remainingCategories do:[:cat | |
|
815 |
whatToDo value:nil value:cat value:nil value:nil. |
|
816 |
] |
|
817 |
] |
|
818 |
] |
|
819 |
||
820 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
821 |
"Modified: / 25.2.2000 / 22:21:52 / cg" |
|
822 |
! ! |
|
823 |
||
824 |
!MethodCategoryList methodsFor:'private'! |
|
825 |
||
826 |
class:cls protocol:cat includesMethodsInAnyPackage:packageFilter |
|
827 |
cls methodDictionary keysAndValuesDo:[:sel :mthd | |
|
828 |
mthd category == cat ifTrue:[ |
|
829 |
(packageFilter includes:mthd package) ifTrue:[ |
|
830 |
^ true |
|
831 |
] |
|
832 |
] |
|
833 |
]. |
|
834 |
^ false |
|
835 |
! |
|
836 |
||
837 |
class:cls protocol:cat includesModsOfClassVariable:variablesToHighLight |
|
838 |
^ self class:cls protocol:cat includesRefsToVariable:variablesToHighLight askParserWith:#modifiedClassVars |
|
839 |
! |
|
840 |
||
841 |
class:cls protocol:cat includesModsOfInstanceVariable:variablesToHighLight |
|
842 |
^ self class:cls protocol:cat includesRefsToVariable:variablesToHighLight askParserWith:#modifiedInstVars |
|
843 |
! |
|
844 |
||
845 |
class:cls protocol:cat includesRefsToClassVariable:variablesToHighLight |
|
846 |
^ self class:cls protocol:cat includesRefsToVariable:variablesToHighLight askParserWith:#usedClassVars |
|
847 |
! |
|
848 |
||
849 |
class:cls protocol:cat includesRefsToInstanceVariable:variablesToHighLight |
|
850 |
^ self class:cls protocol:cat includesRefsToVariable:variablesToHighLight askParserWith:#usedInstVars |
|
851 |
! |
|
852 |
||
853 |
class:cls protocol:cat includesRefsToVariable:variablesToHighLight askParserWith:querySelector |
|
854 |
|anyVarNameAccessable| |
|
855 |
||
856 |
anyVarNameAccessable := cls allInstVarNames includesAny:variablesToHighLight. |
|
857 |
anyVarNameAccessable ifFalse:[ |
|
858 |
anyVarNameAccessable := cls theNonMetaclass allClassVarNames includesAny:variablesToHighLight. |
|
859 |
]. |
|
860 |
anyVarNameAccessable ifFalse:[ |
|
861 |
"/ no need to parse |
|
862 |
^ false |
|
863 |
]. |
|
864 |
||
865 |
cls selectorsAndMethodsDo:[:sel :mthd | |
|
866 |
|src parser usedVars| |
|
867 |
||
868 |
mthd category = cat ifTrue:[ |
|
869 |
src := mthd source. |
|
870 |
src notNil ifTrue:[ |
|
871 |
" |
|
872 |
before doing a slow parse, quickly scan the |
|
873 |
methods source for the variables name ... |
|
874 |
" |
|
875 |
(variablesToHighLight contains:[:varName | (src findString:varName) ~~ 0]) ifTrue:[ |
|
876 |
parser := Parser |
|
877 |
parseMethod:src |
|
878 |
in:cls |
|
879 |
ignoreErrors:true |
|
880 |
ignoreWarnings:true. |
|
881 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
|
882 |
usedVars := parser perform:querySelector. |
|
883 |
(usedVars includesAny:variablesToHighLight) |
|
884 |
ifTrue:[ |
|
885 |
^ true |
|
886 |
] |
|
887 |
] |
|
888 |
] |
|
889 |
] ifFalse:[ |
|
890 |
Transcript showCR:'Oops - cannot access methods source'. |
|
891 |
] |
|
892 |
] |
|
893 |
]. |
|
894 |
^ false |
|
895 |
! |
|
896 |
||
897 |
classesToProcessForClasses:classes |
|
898 |
^ self classesToProcessForClasses:classes withVisibility:methodVisibilityHolder value. |
|
899 |
! |
|
900 |
||
901 |
listOfMethodCategories |
|
902 |
|categoryList plainCategories classesProcessed leafClassesProcessed |
|
903 |
generator nm variablesToHighlight classVarsToHighLight |
|
904 |
itemsWithVarRefs itemsWithVarMods itemsWithExtensions itemsWithSuppressedExtensions |
|
905 |
itemsInChangeSet |
|
6706 | 906 |
packageFilterOnInput packageFilter nameListEntryForALL changeSet emphasizedPlus emphasisForRef emphasisForMod| |
5591 | 907 |
|
908 |
generator := inGeneratorHolder value. |
|
909 |
generator isNil ifTrue:[ ^ #() ]. |
|
910 |
||
911 |
nameListEntryForALL := self class nameListEntryForALL. |
|
912 |
||
913 |
packageFilterOnInput := self packageFilterOnInput value. |
|
914 |
(packageFilterOnInput notNil and:[packageFilterOnInput includes:nameListEntryForALL]) ifTrue:[ |
|
5814 | 915 |
packageFilterOnInput := nil |
5591 | 916 |
]. |
917 |
packageFilter := self packageFilter value. |
|
918 |
(packageFilter notNil and:[packageFilter includes:nameListEntryForALL]) ifTrue:[ |
|
5814 | 919 |
packageFilter := nil |
5591 | 920 |
]. |
921 |
||
922 |
categoryList := Set new. |
|
923 |
itemsWithVarRefs := Set new. |
|
924 |
itemsWithVarMods := Set new. |
|
925 |
itemsWithExtensions := Set new. |
|
926 |
itemsWithSuppressedExtensions := Set new. |
|
927 |
itemsInChangeSet := Set new. |
|
928 |
plainCategories := Set new. |
|
929 |
classesProcessed := IdentitySet new. |
|
930 |
leafClassesProcessed := IdentitySet new. |
|
931 |
variablesToHighlight := variableFilter value. |
|
932 |
classVarsToHighLight := filterClassVars value. |
|
933 |
||
934 |
generator do:[:clsIn :catIn | |
|
5814 | 935 |
|emptyProtocols clsName doHighLight doHighLightRed suppress| |
5591 | 936 |
|
5814 | 937 |
leafClassesProcessed add:clsIn. |
938 |
(self classesToProcessForClasses:(Array with:clsIn)) do:[:cls | |
|
939 |
|cats| |
|
5591 | 940 |
|
5814 | 941 |
classesProcessed add:cls. |
5591 | 942 |
|
5814 | 943 |
cls ~~ clsIn ifTrue:[ |
944 |
cats := cls categories |
|
945 |
] ifFalse:[ |
|
946 |
cats := Array with:catIn. |
|
947 |
]. |
|
948 |
cats do:[:cat | |
|
949 |
cat notNil ifTrue:[ |
|
950 |
suppress := packageFilterOnInput notNil |
|
951 |
and:[ (self class:cls protocol:cat includesMethodsInAnyPackage:packageFilterOnInput) not ]. |
|
5591 | 952 |
|
5814 | 953 |
suppress ifFalse:[ |
954 |
variablesToHighlight size > 0 ifTrue:[ |
|
955 |
(itemsWithVarRefs includes:cat) ifFalse:[ |
|
956 |
classVarsToHighLight ifTrue:[ |
|
957 |
doHighLight := self class:cls protocol:cat includesRefsToClassVariable:variablesToHighlight. |
|
958 |
doHighLight ifTrue:[ |
|
959 |
doHighLightRed := self class:cls protocol:cat includesModsOfClassVariable:variablesToHighlight. |
|
960 |
]. |
|
961 |
] ifFalse:[ |
|
962 |
doHighLight := self class:cls protocol:cat includesRefsToInstanceVariable:variablesToHighlight. |
|
963 |
doHighLight ifTrue:[ |
|
964 |
doHighLightRed := self class:cls protocol:cat includesModsOfInstanceVariable:variablesToHighlight. |
|
965 |
]. |
|
966 |
]. |
|
967 |
doHighLight ifTrue:[ |
|
968 |
itemsWithVarRefs add:cat. |
|
969 |
doHighLightRed ifTrue:[ |
|
970 |
itemsWithVarMods add:cat. |
|
971 |
]. |
|
972 |
] |
|
973 |
] |
|
974 |
]. |
|
975 |
categoryList add:cat. |
|
5591 | 976 |
|
5814 | 977 |
AdditionalEmptyCategoriesPerClassName size > 0 ifTrue:[ |
978 |
clsName := cls name. |
|
979 |
emptyProtocols := AdditionalEmptyCategoriesPerClassName at:clsName ifAbsent:nil. |
|
980 |
emptyProtocols size > 0 ifTrue:[ |
|
981 |
emptyProtocols remove:cat ifAbsent:nil. |
|
982 |
]. |
|
983 |
emptyProtocols size == 0 ifTrue:[ |
|
984 |
AdditionalEmptyCategoriesPerClassName removeKey:clsName ifAbsent:nil |
|
985 |
]. |
|
986 |
]. |
|
987 |
] |
|
988 |
] |
|
989 |
] |
|
990 |
] |
|
991 |
]. |
|
992 |
||
993 |
changeSet := ChangeSet current. |
|
5591 | 994 |
|
995 |
classesProcessed do:[:eachClass | |
|
5814 | 996 |
|classPackage| |
5591 | 997 |
|
5814 | 998 |
classPackage := eachClass package. |
6706 | 999 |
eachClass methodDictionary keysAndValuesDo:[:mSelector :mthd | |
5814 | 1000 |
|mPackage mCategory| |
5591 | 1001 |
|
5814 | 1002 |
mPackage := mthd package. |
1003 |
mCategory := mthd category. |
|
5591 | 1004 |
|
5814 | 1005 |
#fixme. |
1006 |
mPackage = classPackage ifTrue:[ |
|
1007 |
mPackage ~~ classPackage ifTrue:[ |
|
1008 |
mthd setPackage:(mPackage := mPackage string asSymbol). |
|
1009 |
] |
|
1010 |
]. |
|
1011 |
mPackage ~~ classPackage ifTrue:[ |
|
1012 |
itemsWithExtensions add:mCategory. |
|
5591 | 1013 |
|
5814 | 1014 |
(packageFilter notNil |
1015 |
and:[ (packageFilter includes:mPackage) not]) |
|
1016 |
ifTrue:[ |
|
1017 |
itemsWithSuppressedExtensions add:mCategory. |
|
1018 |
]. |
|
1019 |
]. |
|
6706 | 1020 |
(changeSet includesChangeForClass:eachClass selector:mSelector) ifTrue:[ |
1021 |
itemsInChangeSet add:mCategory. |
|
5814 | 1022 |
] |
1023 |
] |
|
5591 | 1024 |
]. |
1025 |
||
1026 |
categoryList := categoryList asOrderedCollection. |
|
1027 |
self rawProtocolList removeAll. |
|
1028 |
rawProtocolList addAll:categoryList. |
|
1029 |
||
6698 | 1030 |
emphasizedPlus := (self colorizeForDifferentPackage:' [ + ]'). |
1031 |
emphasisForRef := UserPreferences current emphasisForReadVariable. |
|
1032 |
emphasisForMod := UserPreferences current emphasisForWrittenVariable. |
|
1033 |
||
6704 | 1034 |
(itemsInChangeSet notEmpty |
1035 |
or:[itemsWithExtensions notEmpty |
|
1036 |
or:[itemsWithVarRefs notEmpty] ]) ifTrue:[ |
|
6698 | 1037 |
rawProtocolList keysAndValuesDo:[:idx :cat | |
6706 | 1038 |
|item inChangeSet hasExtensions hasVarRef hasVarMod| |
5591 | 1039 |
|
6698 | 1040 |
item := cat. |
6701 | 1041 |
inChangeSet := itemsInChangeSet includes:cat. |
1042 |
inChangeSet ifTrue:[ |
|
1043 |
item := self colorizeForChangedCode:cat. |
|
1044 |
]. |
|
1045 |
||
6698 | 1046 |
hasVarRef := itemsWithVarRefs includes:cat. |
1047 |
hasVarRef ifTrue:[ |
|
1048 |
hasVarMod := itemsWithVarMods includes:cat. |
|
6701 | 1049 |
item := item asText |
1050 |
emphasisAllAdd:(hasVarMod ifTrue:emphasisForMod ifFalse:emphasisForRef). |
|
1051 |
]. |
|
5591 | 1052 |
|
6701 | 1053 |
hasExtensions := itemsWithExtensions includes:cat. |
1054 |
hasExtensions ifTrue:[ |
|
1055 |
item := item , emphasizedPlus. |
|
6698 | 1056 |
]. |
1057 |
categoryList at:idx put:item. |
|
1058 |
] |
|
5591 | 1059 |
]. |
1060 |
||
1061 |
classesProcessed size > 0 ifTrue:[ |
|
5814 | 1062 |
"/ those are simulated - in ST/X, empty categories do not |
1063 |
"/ really exist; however, during browsing, it makes sense. |
|
1064 |
AdditionalEmptyCategoriesPerClassName size > 0 ifTrue:[ |
|
1065 |
AdditionalEmptyCategoriesPerClassName keysAndValuesDo:[:clsName :protocols | |
|
1066 |
(classesProcessed contains:[:cls | cls name = clsName]) ifTrue:[ |
|
1067 |
categoryList addAll:protocols. |
|
1068 |
rawProtocolList addAll:protocols. |
|
1069 |
] |
|
1070 |
] |
|
1071 |
]. |
|
5591 | 1072 |
]. |
1073 |
||
1074 |
self makeIndependent. |
|
1075 |
classes := classesProcessed. |
|
1076 |
leafClasses := leafClassesProcessed. |
|
1077 |
self makeDependent. |
|
1078 |
||
1079 |
rawProtocolList sortWith:categoryList. |
|
1080 |
categoryList size == 1 ifTrue:[ |
|
5814 | 1081 |
nm := categoryList first string. |
1082 |
classes size == 1 ifTrue:[ |
|
1083 |
nm := classes first name , '-' , nm |
|
1084 |
]. |
|
1085 |
self protocolLabelHolder value:nm |
|
5591 | 1086 |
]. |
1087 |
categoryList notEmpty ifTrue:[ |
|
5814 | 1088 |
noAllItem value ~~ true ifTrue:[ |
1089 |
categoryList addFirst:nameListEntryForALL. |
|
1090 |
rawProtocolList addFirst:nameListEntryForALL. |
|
1091 |
] |
|
5591 | 1092 |
]. |
1093 |
^ categoryList |
|
1094 |
||
1095 |
"Created: / 5.2.2000 / 13:42:11 / cg" |
|
1096 |
"Modified: / 5.11.2001 / 13:59:19 / cg" |
|
1097 |
! |
|
1098 |
||
1099 |
makeDependent |
|
1100 |
Smalltalk addDependent:self |
|
1101 |
! |
|
1102 |
||
1103 |
makeIndependent |
|
1104 |
Smalltalk removeDependent:self. |
|
1105 |
! |
|
1106 |
||
1107 |
release |
|
1108 |
super release. |
|
1109 |
||
1110 |
filterClassVars removeDependent:self. |
|
1111 |
methodVisibilityHolder removeDependent:self. |
|
1112 |
noAllItem removeDependent:self. |
|
1113 |
packageFilterOnInput removeDependent:self. |
|
1114 |
selectedProtocolIndices removeDependent:self. |
|
1115 |
variableFilter removeDependent:self. |
|
1116 |
! |
|
1117 |
||
1118 |
updateList |
|
1119 |
|prevClasses prevSelection newSelection newList oldList sameContents selectedProtocolsHolder rawList| |
|
1120 |
||
1121 |
selectedProtocolsHolder := self selectedProtocols. |
|
1122 |
||
1123 |
prevClasses := classes ifNil:[ #() ] ifNotNil:[ classes copy ]. |
|
1124 |
oldList := self protocolList value copy. |
|
1125 |
newList := self listOfMethodCategories. |
|
1126 |
||
1127 |
"/ oldListSize := self browserNameList size. |
|
1128 |
"/ newListSize := newList size. |
|
1129 |
self selectedProtocolIndices removeDependent:self. |
|
1130 |
sameContents := self updateListFor:newList. |
|
1131 |
self selectedProtocolIndices addDependent:self. |
|
1132 |
sameContents ifFalse:[ |
|
1133 |
prevSelection := lastSelectedProtocols ? (selectedProtocolsHolder value) ? #(). |
|
1134 |
"/ prevSelection := selectedProtocolsHolder value ? lastSelectedProtocols ? #(). |
|
1135 |
||
1136 |
rawList := self rawProtocolList value. |
|
1137 |
newSelection := prevSelection select:[:item | rawList includes:item string]. |
|
1138 |
||
1139 |
newSelection size > 0 ifTrue:[ |
|
1140 |
"/ force change (for dependents) |
|
1141 |
"/ selectedProtocolsHolder value:nil. |
|
1142 |
"/ selectedProtocolsHolder value:newSelection. |
|
1143 |
selectedProtocolsHolder setValue:newSelection. |
|
1144 |
selectedProtocolsHolder changed:#value. |
|
1145 |
] ifFalse:[ |
|
1146 |
prevSelection := selectedProtocolsHolder value. |
|
1147 |
selectedProtocolsHolder value:nil. |
|
1148 |
]. |
|
1149 |
(prevSelection size > 0 or:[newSelection size > 0]) ifTrue:[ |
|
1150 |
self enqueueDelayedUpdateOutputGenerator. |
|
1151 |
"/ self updateOutputGenerator. |
|
1152 |
]. |
|
1153 |
||
1154 |
"/ prevSelection notNil ifTrue:[ |
|
1155 |
"/ lastSelectedProtocols := prevSelection. |
|
1156 |
"/ ]. |
|
1157 |
] ifTrue:[ |
|
1158 |
"/ same list - but classes might have changed |
|
1159 |
"/ that is the case, if the class selection has been changed, |
|
1160 |
"/ to another class which has the same categories. |
|
1161 |
(prevClasses size ~= classes size |
|
1162 |
or:[prevClasses asOrderedCollection ~= (classes ? #()) asOrderedCollection ]) ifTrue:[ |
|
1163 |
(newList size > 0 or:[oldList size > 0]) ifTrue:[ |
|
1164 |
self updateOutputGenerator |
|
1165 |
] |
|
1166 |
] ifFalse:[ |
|
1167 |
"/ self protocolList value:newList. |
|
1168 |
] |
|
1169 |
]. |
|
1170 |
listValid := true. |
|
1171 |
||
1172 |
"Created: / 5.2.2000 / 13:42:11 / cg" |
|
1173 |
"Modified: / 29.2.2000 / 11:08:55 / cg" |
|
1174 |
! ! |
|
1175 |
||
1176 |
!MethodCategoryList methodsFor:'special'! |
|
1177 |
||
1178 |
addAdditionalProtocol:aProtocol forClass:aClass |
|
1179 |
|categories| |
|
1180 |
||
1181 |
"/ those are simulated - in ST/X, empty categories do not |
|
1182 |
"/ really exist; however, during browsing, it makes sense. |
|
1183 |
AdditionalEmptyCategoriesPerClassName isNil ifTrue:[ |
|
6664
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
1184 |
AdditionalEmptyCategoriesPerClassName := Dictionary new. |
5591 | 1185 |
]. |
1186 |
categories := AdditionalEmptyCategoriesPerClassName at:aClass name ifAbsent:nil. |
|
1187 |
categories isNil ifTrue:[ |
|
6664
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
1188 |
categories := Set new. |
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
1189 |
AdditionalEmptyCategoriesPerClassName at:aClass name put:categories. |
5591 | 1190 |
]. |
1191 |
categories add:aProtocol. |
|
6664
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
1192 |
aClass changed:#organization. "/ not really ... to force update |
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
1193 |
Smalltalk changed:#methodCategoryAdded with:(Array with:aClass with:aProtocol). "/ not really ... to force update |
5591 | 1194 |
! |
1195 |
||
1196 |
additionalProtocolForClass:aClass |
|
1197 |
"/ those are simulated - in ST/X, empty categories do not |
|
1198 |
"/ really exist; however, during browsing, it makes sense. |
|
1199 |
AdditionalEmptyCategoriesPerClassName isNil ifTrue:[ ^ #() ]. |
|
1200 |
^ AdditionalEmptyCategoriesPerClassName at:aClass name ifAbsent:[ #() ]. |
|
1201 |
! |
|
1202 |
||
1203 |
clearLastSelectedProtocol |
|
1204 |
lastSelectedProtocols := nil |
|
1205 |
! |
|
1206 |
||
6342
698b45d51014
new method-category initial offer
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1207 |
lastSelectedProtocols |
698b45d51014
new method-category initial offer
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1208 |
^ lastSelectedProtocols |
698b45d51014
new method-category initial offer
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1209 |
! |
698b45d51014
new method-category initial offer
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1210 |
|
5591 | 1211 |
removeAdditionalProtocol:aListOfProtocols forClass:aClass |
1212 |
|categories| |
|
1213 |
||
1214 |
"/ those are simulated - in ST/X, empty categories do not |
|
1215 |
"/ really exist; however, during browsing, it makes sense. |
|
1216 |
||
1217 |
AdditionalEmptyCategoriesPerClassName isNil ifTrue:[^ self]. |
|
1218 |
||
1219 |
categories := AdditionalEmptyCategoriesPerClassName at:aClass name ifAbsent:nil. |
|
1220 |
categories isNil ifTrue:[^ self]. |
|
1221 |
categories removeAllFoundIn:aListOfProtocols. |
|
1222 |
categories isEmpty ifTrue:[ |
|
6664
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
1223 |
AdditionalEmptyCategoriesPerClassName removeKey:aClass name. |
5591 | 1224 |
]. |
1225 |
||
1226 |
aClass changed:#organization. "/ not really ... to force update |
|
6664
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
1227 |
Smalltalk changed:#methodCategoriesRemoved with:(Array with:aClass with:aListOfProtocols). "/ not really ... to force update |
5591 | 1228 |
! |
1229 |
||
1230 |
removeAllAdditionalProtocol |
|
1231 |
"/ those are simulated - in ST/X, empty categories do not |
|
1232 |
"/ really exist; however, during browsing, it makes sense. |
|
1233 |
AdditionalEmptyCategoriesPerClassName := nil |
|
1234 |
||
1235 |
||
1236 |
! |
|
1237 |
||
1238 |
removeAllAdditionalProtocolForClass:aClass |
|
1239 |
"/ those are simulated - in ST/X, empty categories do not |
|
1240 |
"/ really exist; however, during browsing, it makes sense. |
|
1241 |
AdditionalEmptyCategoriesPerClassName notNil ifTrue:[ |
|
1242 |
AdditionalEmptyCategoriesPerClassName removeKey:aClass name ifAbsent:nil |
|
1243 |
]. |
|
1244 |
||
1245 |
||
1246 |
! |
|
1247 |
||
1248 |
renameAdditionalProtocol:oldName to:newName forClass:aClass |
|
1249 |
|categories| |
|
1250 |
||
1251 |
"/ those are simulated - in ST/X, empty categories do not |
|
1252 |
"/ really exist; however, during browsing, it makes sense. |
|
1253 |
||
1254 |
AdditionalEmptyCategoriesPerClassName isNil ifTrue:[^ self]. |
|
1255 |
categories := AdditionalEmptyCategoriesPerClassName at:aClass name ifAbsent:nil. |
|
1256 |
categories isNil ifTrue:[^ self]. |
|
1257 |
categories remove:oldName ifAbsent:nil. |
|
1258 |
categories add:newName. |
|
1259 |
||
1260 |
aClass changed:#organization. "/ not really ... to force update |
|
6664
50eb2e92aaed
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6492
diff
changeset
|
1261 |
Smalltalk changed:#methodCategoryRenamed with:(Array with:aClass with:oldName with:newName). "/ not really ... to force update |
5591 | 1262 |
! ! |
1263 |
||
1264 |
!MethodCategoryList class methodsFor:'documentation'! |
|
1265 |
||
1266 |
version |
|
6855
93bacd7fcf14
much faster update (only invalidate once, when multiple methods are compiled)
Claus Gittinger <cg@exept.de>
parents:
6706
diff
changeset
|
1267 |
^ '$Header: /cvs/stx/stx/libtool/Tools_MethodCategoryList.st,v 1.15 2006-08-09 11:56:05 cg Exp $' |
5591 | 1268 |
! ! |