author | Claus Gittinger <cg@exept.de> |
Tue, 24 Jan 2006 17:55:41 +0100 | |
changeset 6492 | 9c446e709216 |
parent 6469 | 10eea2ce0ca7 |
child 6664 | 50eb2e92aaed |
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 |
|
6412 | 451 |
something == #classOrganization ifTrue:[ |
452 |
cls := aParameter. |
|
453 |
(classes includesIdentical:cls) ifTrue:[ |
|
454 |
self invalidateList. |
|
455 |
] ifFalse:[ |
|
456 |
(classes contains:[:aClass | aClass name = cls name]) ifTrue:[ |
|
457 |
self invalidateList. |
|
458 |
"/ self error:'obsolete class: should not happen'. |
|
459 |
] |
|
460 |
]. |
|
461 |
^ self. |
|
462 |
]. |
|
5591 | 463 |
|
6412 | 464 |
something == #projectOrganization ifTrue:[ |
465 |
aParameter notNil ifTrue:[ |
|
466 |
cls := aParameter at:1. |
|
467 |
cls notNil ifTrue:[ |
|
468 |
((classes includes:cls theMetaclass) |
|
469 |
or:[(classes includes:cls theNonMetaclass)]) ifTrue:[ |
|
470 |
self invalidateList. |
|
471 |
self slaveMode value == true ifFalse:[ |
|
472 |
self enqueueDelayedUpdateOutputGenerator. |
|
473 |
] |
|
474 |
]. |
|
475 |
]. |
|
476 |
] ifFalse:[ |
|
477 |
self invalidateList. |
|
478 |
]. |
|
479 |
^ self |
|
480 |
]. |
|
5591 | 481 |
|
6412 | 482 |
(something == #classDefinition or:[something == #classVariables]) |
483 |
ifTrue:[ |
|
484 |
self classDefinitionChanged:aParameter. |
|
485 |
^ self |
|
486 |
]. |
|
5591 | 487 |
|
6412 | 488 |
"/ everything else is ignored |
489 |
"/ self halt. |
|
490 |
]. |
|
491 |
^ self |
|
5591 | 492 |
]. |
493 |
||
494 |
changedObject == self selectedProtocolIndices ifTrue:[ |
|
6412 | 495 |
oldSelectedProtocols := selectedProtocolsHolder value ? #(). |
496 |
oldSelectedProtocols := oldSelectedProtocols collect:[:each | each ifNil:[self class nameListEntryForNILCategory]]. |
|
497 |
oldSelectedProtocols := oldSelectedProtocols collect:[:each | each string]. |
|
498 |
newSelectedProtocols := self getSelectedProtocolsFromIndices. |
|
499 |
oldSelectedProtocols ~= newSelectedProtocols ifTrue:[ |
|
500 |
selectedProtocolsHolder value:newSelectedProtocols. |
|
501 |
]. |
|
502 |
newSelectedProtocols size > 1 ifTrue:[ |
|
503 |
(newSelectedProtocols includes:(self class nameListEntryForALL)) ifTrue:[ |
|
504 |
rawProtocolList := rawProtocolListHolder value. |
|
505 |
idx := rawProtocolList indexOf: (newSelectedProtocols copy remove:(self class nameListEntryForALL); yourself) first. |
|
506 |
idx ~~ 0 ifTrue:[ |
|
507 |
(listView := self builder componentAt:#List) notNil ifTrue:[ |
|
508 |
listView makeLineVisible:idx. |
|
509 |
] |
|
510 |
] |
|
511 |
] |
|
512 |
]. |
|
5591 | 513 |
|
6412 | 514 |
^ self |
5591 | 515 |
]. |
516 |
||
517 |
changedObject == selectedProtocolsHolder ifTrue:[ |
|
6412 | 518 |
rawProtocolList := rawProtocolListHolder value. |
519 |
rawProtocolList size == 0 ifTrue:[ |
|
520 |
self updateList. |
|
521 |
rawProtocolList := rawProtocolListHolder value. |
|
522 |
]. |
|
523 |
rawProtocolList notNil ifTrue:[ |
|
524 |
selectedCategories := selectedProtocolsHolder value ? #(). |
|
525 |
selectedCategories := selectedCategories collect:[:each | each ifNil:[self class nameListEntryForNILCategory]]. |
|
526 |
newIndices := selectedCategories |
|
527 |
collect:[:each | rawProtocolList findFirst:[:p | p string = each string]]. |
|
528 |
newIndices := newIndices select:[:each | each ~~ 0]. |
|
529 |
newIndices ~= self selectedProtocolIndices value ifTrue:[ |
|
530 |
self selectedProtocolIndices setValue:nil. "/ to force update |
|
531 |
self selectedProtocolIndices value:newIndices |
|
532 |
]. |
|
533 |
(lastGeneratedProtocols notNil |
|
534 |
and:[(lastGeneratedProtocols includes:self class nameListEntryForALL) |
|
535 |
and:[(selectedProtocolsHolder value ? #()) includes:self class nameListEntryForALL]]) |
|
536 |
ifTrue:[ |
|
537 |
"/ no need to update generator |
|
538 |
] ifFalse:[ |
|
539 |
self updateOutputGenerator. |
|
540 |
] |
|
541 |
]. |
|
542 |
^ self |
|
5591 | 543 |
]. |
544 |
||
545 |
(changedObject == variableFilter |
|
546 |
or:[changedObject == filterClassVars |
|
547 |
or:[changedObject == packageFilterOnInput]]) ifTrue:[ |
|
6412 | 548 |
self invalidateList. |
549 |
^ self |
|
5591 | 550 |
]. |
551 |
||
552 |
changedObject == methodVisibilityHolder ifTrue:[ |
|
6412 | 553 |
self invalidateList. |
554 |
self updateOutputGenerator. |
|
555 |
^ self |
|
5591 | 556 |
]. |
557 |
||
558 |
lastGeneratedProtocols := nil. |
|
559 |
||
560 |
changedObject == inGeneratorHolder ifTrue:[ |
|
6412 | 561 |
selectedCategories := selectedProtocolsHolder value. |
5591 | 562 |
|
6412 | 563 |
selectedCategories size > 0 ifTrue:[ |
564 |
oldSelectedProtocols := selectedCategories ? #(). |
|
565 |
oldSelectedProtocols := oldSelectedProtocols collect:[:each | each ifNil:[self class nameListEntryForNILCategory]]. |
|
566 |
oldSelectedProtocols := oldSelectedProtocols collect:[:each | each string]. |
|
567 |
self updateList. |
|
568 |
rawProtocolList := rawProtocolListHolder value. |
|
569 |
newSelectedProtocols := oldSelectedProtocols select:[:each | rawProtocolList includes:each]. |
|
5591 | 570 |
"/ selectedProtocolsHolder setValue:nil. "/ to force update |
6412 | 571 |
selectedProtocolsHolder value:newSelectedProtocols. |
572 |
^ self |
|
573 |
]. |
|
5591 | 574 |
]. |
575 |
||
576 |
super delayedUpdate:something with:aParameter from:changedObject |
|
577 |
||
578 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
579 |
"Modified: / 29.2.2000 / 11:11:39 / cg" |
|
580 |
! |
|
581 |
||
582 |
getSelectedProtocolsFromIndices |
|
583 |
|l| |
|
584 |
||
585 |
l := self rawProtocolList value. |
|
586 |
^ self selectedProtocolIndices value collect:[:idx | l at:idx]. |
|
587 |
! |
|
588 |
||
589 |
selectionChanged |
|
590 |
|newSelectedCategories allEntry| |
|
591 |
||
592 |
newSelectedCategories := self selectedProtocols value. |
|
593 |
||
594 |
"/ the outputGenerator is only to be updated, if the output would really |
|
595 |
"/ change ... |
|
596 |
allEntry := self class nameListEntryForALL. |
|
597 |
||
598 |
(lastSelectedProtocols notNil |
|
599 |
and:[newSelectedCategories notNil |
|
600 |
and:[(lastSelectedProtocols includes:(allEntry)) |
|
601 |
and:[newSelectedCategories includes:(allEntry)]]]) ifTrue:[ |
|
602 |
"/ no change ... |
|
603 |
^ self |
|
604 |
]. |
|
605 |
||
606 |
super selectionChanged. |
|
607 |
||
608 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
609 |
"Modified: / 24.2.2000 / 14:12:12 / cg" |
|
610 |
! |
|
611 |
||
612 |
selectionChangedByClick |
|
613 |
"we are not interested in that - get another notification |
|
614 |
via the changed valueHolder" |
|
615 |
||
616 |
lastSelectedProtocols := self getSelectedProtocolsFromIndices |
|
617 |
! |
|
618 |
||
619 |
update:something with:aParameter from:changedObject |
|
620 |
||
621 |
"/ some can be ignored immediately |
|
622 |
changedObject == Smalltalk ifTrue:[ |
|
623 |
something isNil ifTrue:[ |
|
624 |
"/ self halt "/ huh - Smalltalk changed - so what ? |
|
625 |
^ self. |
|
626 |
]. |
|
627 |
"/ something == #classDefinition ifTrue:[ |
|
628 |
"/ ^ self. |
|
629 |
"/ ]. |
|
630 |
something == #newClass ifTrue:[ |
|
631 |
^ self. |
|
632 |
]. |
|
633 |
something == #classRemove ifTrue:[ |
|
634 |
^ self. |
|
635 |
]. |
|
636 |
something == #classRename ifTrue:[ |
|
637 |
^ self. |
|
638 |
]. |
|
639 |
"/ something == #classVariables ifTrue:[ |
|
640 |
"/ ^ self. |
|
641 |
"/ ]. |
|
642 |
something == #classComment ifTrue:[ |
|
643 |
^ self. |
|
644 |
]. |
|
645 |
something == #organization ifTrue:[ |
|
646 |
^ self. |
|
647 |
]. |
|
648 |
something == #methodTrap ifTrue:[ |
|
649 |
^ self |
|
650 |
]. |
|
651 |
]. |
|
652 |
||
653 |
super update:something with:aParameter from:changedObject. |
|
654 |
! ! |
|
655 |
||
656 |
!MethodCategoryList methodsFor:'drag & drop'! |
|
657 |
||
6469 | 658 |
canDropContext:aDropContext |
5591 | 659 |
|cat methods| |
660 |
||
661 |
methods := aDropContext dropObjects collect:[:obj | obj theObject]. |
|
662 |
||
663 |
(methods contains:[:aMethod | aMethod isMethod not]) ifTrue:[^ false]. |
|
664 |
||
665 |
cat := self categoryAtTargetPointOf:aDropContext. |
|
6492 | 666 |
cat isNil ifTrue:[^ false]. |
5591 | 667 |
|
668 |
(methods contains:[:aMethod | aMethod category ~= cat]) ifFalse:[^ false]. |
|
6492 | 669 |
^ true |
5591 | 670 |
! |
671 |
||
672 |
categoryAtTargetPointOf:aDropContext |
|
673 |
|p methodListView lineNr cat| |
|
674 |
||
675 |
p := aDropContext targetPoint. |
|
676 |
||
677 |
methodListView := aDropContext targetWidget. |
|
678 |
||
679 |
lineNr := methodListView lineAtY:p y. |
|
680 |
lineNr isNil ifTrue:[^ nil]. |
|
681 |
||
682 |
cat := rawProtocolList at:lineNr. |
|
683 |
cat := cat string. |
|
684 |
cat = self class nameListEntryForALL ifTrue:[^ nil]. |
|
685 |
||
686 |
^ cat |
|
687 |
! |
|
688 |
||
6469 | 689 |
doDropContext:aDropContext |
5591 | 690 |
|cat methods| |
691 |
||
692 |
methods := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject]. |
|
693 |
(methods contains:[:something | something isMethod not]) ifTrue:[^ self]. |
|
694 |
||
695 |
cat := self categoryAtTargetPointOf:aDropContext. |
|
696 |
cat notNil ifTrue:[ |
|
6469 | 697 |
self masterApplication moveMethods:methods toProtocol:cat. |
5591 | 698 |
]. |
699 |
! ! |
|
700 |
||
701 |
!MethodCategoryList methodsFor:'generators'! |
|
702 |
||
703 |
makeGenerator |
|
704 |
"return a generator which enumerates the methods from the selected protocol; |
|
705 |
that generator generates 4-element elements (includes the class and protocol), |
|
706 |
in order to make the consumers only depend on one input |
|
707 |
(i.e. to pass multiple-class and multiple-protocol info |
|
708 |
without a need for another classHolder/protocolHolder in the methodList)." |
|
709 |
||
710 |
^ Iterator on:[:whatToDo | |
|
711 |
|protocols allProtocols noCat static notStatic classSelectorPairsAlreadyDone |
|
712 |
packages remainingClasses remainingCategories classesAlreadyDone| |
|
713 |
||
714 |
noCat := (self class nameListEntryForNILCategory). |
|
715 |
static := (self class nameListEntryForStatic). |
|
716 |
notStatic := (self class nameListEntryForNonStatic). |
|
717 |
||
718 |
protocols := self selectedProtocols value ? #(). |
|
719 |
protocols := protocols collect:[:each | (each ifNil:[noCat]) string]. |
|
720 |
lastGeneratedProtocols := protocols. |
|
721 |
protocols := protocols asSet. |
|
722 |
||
723 |
(leafClasses size > 0 |
|
724 |
and:[protocols size > 0]) ifTrue:[ |
|
725 |
allProtocols := protocols includes:(self class nameListEntryForALL). |
|
726 |
||
727 |
packages := packageFilter value value. |
|
728 |
(packages notNil and:[packages includes:(self class nameListEntryForALL)]) ifTrue:[ |
|
729 |
packages := nil. |
|
730 |
]. |
|
731 |
||
732 |
remainingClasses := leafClasses copy asIdentitySet. |
|
733 |
remainingCategories := protocols copy asSet. |
|
734 |
||
735 |
classesAlreadyDone := IdentitySet new. |
|
736 |
classSelectorPairsAlreadyDone := Set new. |
|
737 |
||
738 |
leafClasses do:[:aLeafClass | |
|
739 |
(self classesToProcessForClasses:(Array with:aLeafClass)) do:[:aClass | |
|
740 |
|supportsMethodCategories isJavaClass anyInThisClass| |
|
741 |
||
742 |
(classesAlreadyDone includes:aClass) ifFalse:[ |
|
743 |
classesAlreadyDone add:aClass. |
|
744 |
||
745 |
supportsMethodCategories := aClass supportsMethodCategories. |
|
746 |
isJavaClass := aClass isJavaClass. |
|
747 |
anyInThisClass := false. |
|
748 |
||
749 |
aClass methodDictionary keysAndValuesDo:[:sel :mthd | |
|
750 |
|cat| |
|
751 |
||
752 |
supportsMethodCategories ifTrue:[ |
|
753 |
cat := mthd category. |
|
754 |
] ifFalse:[ |
|
755 |
isJavaClass ifTrue:[ |
|
756 |
cat := mthd isStatic ifTrue:[static] ifFalse:[notStatic] |
|
757 |
] ifFalse:[ |
|
758 |
cat := noCat. |
|
759 |
] |
|
760 |
]. |
|
761 |
(allProtocols or:[protocols includes:cat]) ifTrue:[ |
|
762 |
(packages isNil or:[packages includes:mthd package]) |
|
763 |
ifTrue:[ |
|
764 |
||
765 |
(methodVisibilityHolder value == #class) ifTrue:[ |
|
766 |
whatToDo value:aClass value:cat value:sel value:mthd. |
|
767 |
] ifFalse:[ |
|
768 |
(classSelectorPairsAlreadyDone includes:(aLeafClass->sel)) ifFalse:[ |
|
769 |
classSelectorPairsAlreadyDone add:(aLeafClass->sel). |
|
770 |
whatToDo value:aClass value:cat value:sel value:mthd. |
|
771 |
]. |
|
772 |
]. |
|
773 |
||
774 |
anyInThisClass := true. |
|
775 |
remainingCategories remove:cat ifAbsent:nil. |
|
776 |
] |
|
777 |
] |
|
778 |
]. |
|
779 |
anyInThisClass ifTrue:[ remainingClasses remove:aClass ifAbsent:nil. ]. |
|
780 |
]. |
|
781 |
]. |
|
782 |
]. |
|
783 |
remainingClasses do:[:aClass | |
|
784 |
whatToDo value:aClass value:nil value:nil value:nil. |
|
785 |
]. |
|
786 |
remainingCategories do:[:cat | |
|
787 |
whatToDo value:nil value:cat value:nil value:nil. |
|
788 |
] |
|
789 |
] |
|
790 |
] |
|
791 |
||
792 |
"Created: / 5.2.2000 / 13:42:10 / cg" |
|
793 |
"Modified: / 25.2.2000 / 22:21:52 / cg" |
|
794 |
! ! |
|
795 |
||
796 |
!MethodCategoryList methodsFor:'private'! |
|
797 |
||
798 |
class:cls protocol:cat includesMethodsInAnyPackage:packageFilter |
|
799 |
cls methodDictionary keysAndValuesDo:[:sel :mthd | |
|
800 |
mthd category == cat ifTrue:[ |
|
801 |
(packageFilter includes:mthd package) ifTrue:[ |
|
802 |
^ true |
|
803 |
] |
|
804 |
] |
|
805 |
]. |
|
806 |
^ false |
|
807 |
! |
|
808 |
||
809 |
class:cls protocol:cat includesModsOfClassVariable:variablesToHighLight |
|
810 |
^ self class:cls protocol:cat includesRefsToVariable:variablesToHighLight askParserWith:#modifiedClassVars |
|
811 |
! |
|
812 |
||
813 |
class:cls protocol:cat includesModsOfInstanceVariable:variablesToHighLight |
|
814 |
^ self class:cls protocol:cat includesRefsToVariable:variablesToHighLight askParserWith:#modifiedInstVars |
|
815 |
! |
|
816 |
||
817 |
class:cls protocol:cat includesRefsToClassVariable:variablesToHighLight |
|
818 |
^ self class:cls protocol:cat includesRefsToVariable:variablesToHighLight askParserWith:#usedClassVars |
|
819 |
! |
|
820 |
||
821 |
class:cls protocol:cat includesRefsToInstanceVariable:variablesToHighLight |
|
822 |
^ self class:cls protocol:cat includesRefsToVariable:variablesToHighLight askParserWith:#usedInstVars |
|
823 |
! |
|
824 |
||
825 |
class:cls protocol:cat includesRefsToVariable:variablesToHighLight askParserWith:querySelector |
|
826 |
|anyVarNameAccessable| |
|
827 |
||
828 |
anyVarNameAccessable := cls allInstVarNames includesAny:variablesToHighLight. |
|
829 |
anyVarNameAccessable ifFalse:[ |
|
830 |
anyVarNameAccessable := cls theNonMetaclass allClassVarNames includesAny:variablesToHighLight. |
|
831 |
]. |
|
832 |
anyVarNameAccessable ifFalse:[ |
|
833 |
"/ no need to parse |
|
834 |
^ false |
|
835 |
]. |
|
836 |
||
837 |
cls selectorsAndMethodsDo:[:sel :mthd | |
|
838 |
|src parser usedVars| |
|
839 |
||
840 |
mthd category = cat ifTrue:[ |
|
841 |
src := mthd source. |
|
842 |
src notNil ifTrue:[ |
|
843 |
" |
|
844 |
before doing a slow parse, quickly scan the |
|
845 |
methods source for the variables name ... |
|
846 |
" |
|
847 |
(variablesToHighLight contains:[:varName | (src findString:varName) ~~ 0]) ifTrue:[ |
|
848 |
parser := Parser |
|
849 |
parseMethod:src |
|
850 |
in:cls |
|
851 |
ignoreErrors:true |
|
852 |
ignoreWarnings:true. |
|
853 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
|
854 |
usedVars := parser perform:querySelector. |
|
855 |
(usedVars includesAny:variablesToHighLight) |
|
856 |
ifTrue:[ |
|
857 |
^ true |
|
858 |
] |
|
859 |
] |
|
860 |
] |
|
861 |
] ifFalse:[ |
|
862 |
Transcript showCR:'Oops - cannot access methods source'. |
|
863 |
] |
|
864 |
] |
|
865 |
]. |
|
866 |
^ false |
|
867 |
! |
|
868 |
||
869 |
classesToProcessForClasses:classes |
|
870 |
^ self classesToProcessForClasses:classes withVisibility:methodVisibilityHolder value. |
|
871 |
! |
|
872 |
||
873 |
listOfMethodCategories |
|
874 |
|categoryList plainCategories classesProcessed leafClassesProcessed |
|
875 |
generator nm variablesToHighlight classVarsToHighLight |
|
876 |
itemsWithVarRefs itemsWithVarMods itemsWithExtensions itemsWithSuppressedExtensions |
|
877 |
itemsInChangeSet |
|
5814 | 878 |
item packageFilterOnInput packageFilter nameListEntryForALL emp |
879 |
changeSet classesInChangeSet| |
|
5591 | 880 |
|
881 |
generator := inGeneratorHolder value. |
|
882 |
generator isNil ifTrue:[ ^ #() ]. |
|
883 |
||
884 |
nameListEntryForALL := self class nameListEntryForALL. |
|
885 |
||
886 |
packageFilterOnInput := self packageFilterOnInput value. |
|
887 |
(packageFilterOnInput notNil and:[packageFilterOnInput includes:nameListEntryForALL]) ifTrue:[ |
|
5814 | 888 |
packageFilterOnInput := nil |
5591 | 889 |
]. |
890 |
packageFilter := self packageFilter value. |
|
891 |
(packageFilter notNil and:[packageFilter includes:nameListEntryForALL]) ifTrue:[ |
|
5814 | 892 |
packageFilter := nil |
5591 | 893 |
]. |
894 |
||
895 |
categoryList := Set new. |
|
896 |
itemsWithVarRefs := Set new. |
|
897 |
itemsWithVarMods := Set new. |
|
898 |
itemsWithExtensions := Set new. |
|
899 |
itemsWithSuppressedExtensions := Set new. |
|
900 |
itemsInChangeSet := Set new. |
|
901 |
plainCategories := Set new. |
|
902 |
classesProcessed := IdentitySet new. |
|
903 |
leafClassesProcessed := IdentitySet new. |
|
904 |
variablesToHighlight := variableFilter value. |
|
905 |
classVarsToHighLight := filterClassVars value. |
|
906 |
||
907 |
generator do:[:clsIn :catIn | |
|
5814 | 908 |
|emptyProtocols clsName doHighLight doHighLightRed suppress| |
5591 | 909 |
|
5814 | 910 |
leafClassesProcessed add:clsIn. |
911 |
(self classesToProcessForClasses:(Array with:clsIn)) do:[:cls | |
|
912 |
|cats| |
|
5591 | 913 |
|
5814 | 914 |
classesProcessed add:cls. |
5591 | 915 |
|
5814 | 916 |
cls ~~ clsIn ifTrue:[ |
917 |
cats := cls categories |
|
918 |
] ifFalse:[ |
|
919 |
cats := Array with:catIn. |
|
920 |
]. |
|
921 |
cats do:[:cat | |
|
922 |
cat notNil ifTrue:[ |
|
923 |
suppress := packageFilterOnInput notNil |
|
924 |
and:[ (self class:cls protocol:cat includesMethodsInAnyPackage:packageFilterOnInput) not ]. |
|
5591 | 925 |
|
5814 | 926 |
suppress ifFalse:[ |
927 |
variablesToHighlight size > 0 ifTrue:[ |
|
928 |
(itemsWithVarRefs includes:cat) ifFalse:[ |
|
929 |
classVarsToHighLight ifTrue:[ |
|
930 |
doHighLight := self class:cls protocol:cat includesRefsToClassVariable:variablesToHighlight. |
|
931 |
doHighLight ifTrue:[ |
|
932 |
doHighLightRed := self class:cls protocol:cat includesModsOfClassVariable:variablesToHighlight. |
|
933 |
]. |
|
934 |
] ifFalse:[ |
|
935 |
doHighLight := self class:cls protocol:cat includesRefsToInstanceVariable:variablesToHighlight. |
|
936 |
doHighLight ifTrue:[ |
|
937 |
doHighLightRed := self class:cls protocol:cat includesModsOfInstanceVariable:variablesToHighlight. |
|
938 |
]. |
|
939 |
]. |
|
940 |
doHighLight ifTrue:[ |
|
941 |
itemsWithVarRefs add:cat. |
|
942 |
doHighLightRed ifTrue:[ |
|
943 |
itemsWithVarMods add:cat. |
|
944 |
]. |
|
945 |
] |
|
946 |
] |
|
947 |
]. |
|
948 |
categoryList add:cat. |
|
5591 | 949 |
|
5814 | 950 |
AdditionalEmptyCategoriesPerClassName size > 0 ifTrue:[ |
951 |
clsName := cls name. |
|
952 |
emptyProtocols := AdditionalEmptyCategoriesPerClassName at:clsName ifAbsent:nil. |
|
953 |
emptyProtocols size > 0 ifTrue:[ |
|
954 |
emptyProtocols remove:cat ifAbsent:nil. |
|
955 |
]. |
|
956 |
emptyProtocols size == 0 ifTrue:[ |
|
957 |
AdditionalEmptyCategoriesPerClassName removeKey:clsName ifAbsent:nil |
|
958 |
]. |
|
959 |
]. |
|
960 |
] |
|
961 |
] |
|
962 |
] |
|
963 |
] |
|
964 |
]. |
|
965 |
||
966 |
changeSet := ChangeSet current. |
|
967 |
classesInChangeSet := changeSet changedClasses. |
|
5591 | 968 |
|
969 |
classesProcessed do:[:eachClass | |
|
5814 | 970 |
|classPackage| |
5591 | 971 |
|
5814 | 972 |
classPackage := eachClass package. |
973 |
eachClass methodDictionary keysAndValuesDo:[:sel :mthd | |
|
974 |
|mPackage mCategory| |
|
5591 | 975 |
|
5814 | 976 |
mPackage := mthd package. |
977 |
mCategory := mthd category. |
|
5591 | 978 |
|
5814 | 979 |
#fixme. |
980 |
mPackage = classPackage ifTrue:[ |
|
981 |
mPackage ~~ classPackage ifTrue:[ |
|
982 |
mthd setPackage:(mPackage := mPackage string asSymbol). |
|
983 |
] |
|
984 |
]. |
|
985 |
mPackage ~~ classPackage ifTrue:[ |
|
986 |
itemsWithExtensions add:mCategory. |
|
5591 | 987 |
|
5814 | 988 |
(packageFilter notNil |
989 |
and:[ (packageFilter includes:mPackage) not]) |
|
990 |
ifTrue:[ |
|
991 |
itemsWithSuppressedExtensions add:mCategory. |
|
992 |
]. |
|
993 |
]. |
|
994 |
(classesInChangeSet includes:eachClass) ifTrue:[ |
|
995 |
(changeSet includesChangeForClass:eachClass selector:mthd selector) ifTrue:[ |
|
996 |
itemsInChangeSet add:mCategory. |
|
997 |
] |
|
998 |
] |
|
999 |
] |
|
5591 | 1000 |
]. |
1001 |
||
1002 |
categoryList := categoryList asOrderedCollection. |
|
1003 |
self rawProtocolList removeAll. |
|
1004 |
rawProtocolList addAll:categoryList. |
|
1005 |
||
1006 |
itemsWithExtensions do:[:cat | |
|
5814 | 1007 |
(categoryList includes:cat) ifTrue:[ |
1008 |
(itemsWithVarRefs includes:cat) ifFalse:[ |
|
1009 |
categoryList remove:cat. |
|
1010 |
rawProtocolList remove:cat. |
|
5950 | 1011 |
(true "itemsWithSuppressedExtensions includes:cat") ifTrue:[ |
5814 | 1012 |
item := cat , (self colorizeForDifferentPackage:' [ + ]'). |
1013 |
] ifFalse:[ |
|
1014 |
item := self colorizeForDifferentPackage:cat. |
|
1015 |
]. |
|
1016 |
categoryList add:item. |
|
1017 |
rawProtocolList add:cat. |
|
1018 |
] |
|
1019 |
] |
|
5591 | 1020 |
]. |
1021 |
||
1022 |
itemsInChangeSet do:[:cat | |
|
5814 | 1023 |
(categoryList includes:cat) ifTrue:[ |
1024 |
categoryList remove:cat. |
|
1025 |
rawProtocolList remove:cat. |
|
1026 |
item := self colorizeForChangedCode:cat. |
|
1027 |
categoryList add:item. |
|
1028 |
rawProtocolList add:cat. |
|
1029 |
] |
|
5591 | 1030 |
]. |
1031 |
||
1032 |
categoryList removeAll:itemsWithVarRefs. |
|
1033 |
rawProtocolList removeAll:itemsWithVarRefs. |
|
1034 |
||
1035 |
itemsWithVarRefs do:[:cat | |
|
5814 | 1036 |
item := cat allBold. |
1037 |
(itemsWithVarMods includes:cat) ifTrue:[ |
|
1038 |
emp := (UserPreferences current emphasisForWrittenVariable). |
|
1039 |
] ifFalse:[ |
|
1040 |
emp := (UserPreferences current emphasisForReadVariable). |
|
1041 |
]. |
|
1042 |
item emphasisAllAdd:emp. |
|
1043 |
categoryList add:item. |
|
1044 |
rawProtocolList add:cat. |
|
5591 | 1045 |
]. |
1046 |
||
1047 |
classesProcessed size > 0 ifTrue:[ |
|
5814 | 1048 |
"/ those are simulated - in ST/X, empty categories do not |
1049 |
"/ really exist; however, during browsing, it makes sense. |
|
1050 |
AdditionalEmptyCategoriesPerClassName size > 0 ifTrue:[ |
|
1051 |
AdditionalEmptyCategoriesPerClassName keysAndValuesDo:[:clsName :protocols | |
|
1052 |
(classesProcessed contains:[:cls | cls name = clsName]) ifTrue:[ |
|
1053 |
categoryList addAll:protocols. |
|
1054 |
rawProtocolList addAll:protocols. |
|
1055 |
] |
|
1056 |
] |
|
1057 |
]. |
|
5591 | 1058 |
]. |
1059 |
||
1060 |
self makeIndependent. |
|
1061 |
classes := classesProcessed. |
|
1062 |
leafClasses := leafClassesProcessed. |
|
1063 |
self makeDependent. |
|
1064 |
||
1065 |
"/ itemsWithExtensions size > 0 ifTrue:[ |
|
1066 |
"/ categoryList := categoryList collect:[:eachCat | (itemsWithExtensions includes:eachCat) |
|
1067 |
"/ ifTrue:[ |
|
1068 |
"/ eachCat , ' [ + ]' |
|
1069 |
"/ ] ifFalse:[ |
|
1070 |
"/ eachCat |
|
1071 |
"/ ] |
|
1072 |
"/ ]. |
|
1073 |
"/ ]. |
|
1074 |
"/ |
|
1075 |
rawProtocolList sortWith:categoryList. |
|
1076 |
categoryList size == 1 ifTrue:[ |
|
5814 | 1077 |
nm := categoryList first string. |
1078 |
classes size == 1 ifTrue:[ |
|
1079 |
nm := classes first name , '-' , nm |
|
1080 |
]. |
|
1081 |
self protocolLabelHolder value:nm |
|
5591 | 1082 |
]. |
1083 |
categoryList notEmpty ifTrue:[ |
|
5814 | 1084 |
noAllItem value ~~ true ifTrue:[ |
1085 |
categoryList addFirst:nameListEntryForALL. |
|
1086 |
rawProtocolList addFirst:nameListEntryForALL. |
|
1087 |
] |
|
5591 | 1088 |
]. |
1089 |
^ categoryList |
|
1090 |
||
1091 |
"Created: / 5.2.2000 / 13:42:11 / cg" |
|
1092 |
"Modified: / 5.11.2001 / 13:59:19 / cg" |
|
1093 |
! |
|
1094 |
||
1095 |
makeDependent |
|
1096 |
Smalltalk addDependent:self |
|
1097 |
! |
|
1098 |
||
1099 |
makeIndependent |
|
1100 |
Smalltalk removeDependent:self. |
|
1101 |
! |
|
1102 |
||
1103 |
release |
|
1104 |
super release. |
|
1105 |
||
1106 |
filterClassVars removeDependent:self. |
|
1107 |
methodVisibilityHolder removeDependent:self. |
|
1108 |
noAllItem removeDependent:self. |
|
1109 |
packageFilterOnInput removeDependent:self. |
|
1110 |
selectedProtocolIndices removeDependent:self. |
|
1111 |
variableFilter removeDependent:self. |
|
1112 |
! |
|
1113 |
||
1114 |
updateList |
|
1115 |
|prevClasses prevSelection newSelection newList oldList sameContents selectedProtocolsHolder rawList| |
|
1116 |
||
1117 |
selectedProtocolsHolder := self selectedProtocols. |
|
1118 |
||
1119 |
prevClasses := classes ifNil:[ #() ] ifNotNil:[ classes copy ]. |
|
1120 |
oldList := self protocolList value copy. |
|
1121 |
newList := self listOfMethodCategories. |
|
1122 |
||
1123 |
"/ oldListSize := self browserNameList size. |
|
1124 |
"/ newListSize := newList size. |
|
1125 |
self selectedProtocolIndices removeDependent:self. |
|
1126 |
sameContents := self updateListFor:newList. |
|
1127 |
self selectedProtocolIndices addDependent:self. |
|
1128 |
sameContents ifFalse:[ |
|
1129 |
prevSelection := lastSelectedProtocols ? (selectedProtocolsHolder value) ? #(). |
|
1130 |
"/ prevSelection := selectedProtocolsHolder value ? lastSelectedProtocols ? #(). |
|
1131 |
||
1132 |
rawList := self rawProtocolList value. |
|
1133 |
newSelection := prevSelection select:[:item | rawList includes:item string]. |
|
1134 |
||
1135 |
newSelection size > 0 ifTrue:[ |
|
1136 |
"/ force change (for dependents) |
|
1137 |
"/ selectedProtocolsHolder value:nil. |
|
1138 |
"/ selectedProtocolsHolder value:newSelection. |
|
1139 |
selectedProtocolsHolder setValue:newSelection. |
|
1140 |
selectedProtocolsHolder changed:#value. |
|
1141 |
] ifFalse:[ |
|
1142 |
prevSelection := selectedProtocolsHolder value. |
|
1143 |
selectedProtocolsHolder value:nil. |
|
1144 |
]. |
|
1145 |
(prevSelection size > 0 or:[newSelection size > 0]) ifTrue:[ |
|
1146 |
self enqueueDelayedUpdateOutputGenerator. |
|
1147 |
"/ self updateOutputGenerator. |
|
1148 |
]. |
|
1149 |
||
1150 |
"/ prevSelection notNil ifTrue:[ |
|
1151 |
"/ lastSelectedProtocols := prevSelection. |
|
1152 |
"/ ]. |
|
1153 |
] ifTrue:[ |
|
1154 |
"/ same list - but classes might have changed |
|
1155 |
"/ that is the case, if the class selection has been changed, |
|
1156 |
"/ to another class which has the same categories. |
|
1157 |
(prevClasses size ~= classes size |
|
1158 |
or:[prevClasses asOrderedCollection ~= (classes ? #()) asOrderedCollection ]) ifTrue:[ |
|
1159 |
(newList size > 0 or:[oldList size > 0]) ifTrue:[ |
|
1160 |
self updateOutputGenerator |
|
1161 |
] |
|
1162 |
] ifFalse:[ |
|
1163 |
"/ self protocolList value:newList. |
|
1164 |
] |
|
1165 |
]. |
|
1166 |
listValid := true. |
|
1167 |
||
1168 |
"Created: / 5.2.2000 / 13:42:11 / cg" |
|
1169 |
"Modified: / 29.2.2000 / 11:08:55 / cg" |
|
1170 |
! ! |
|
1171 |
||
1172 |
!MethodCategoryList methodsFor:'special'! |
|
1173 |
||
1174 |
addAdditionalProtocol:aProtocol forClass:aClass |
|
1175 |
|categories| |
|
1176 |
||
1177 |
"/ those are simulated - in ST/X, empty categories do not |
|
1178 |
"/ really exist; however, during browsing, it makes sense. |
|
1179 |
AdditionalEmptyCategoriesPerClassName isNil ifTrue:[ |
|
1180 |
AdditionalEmptyCategoriesPerClassName := Dictionary new. |
|
1181 |
]. |
|
1182 |
categories := AdditionalEmptyCategoriesPerClassName at:aClass name ifAbsent:nil. |
|
1183 |
categories isNil ifTrue:[ |
|
1184 |
categories := Set new. |
|
1185 |
AdditionalEmptyCategoriesPerClassName at:aClass name put:categories. |
|
1186 |
]. |
|
1187 |
categories add:aProtocol. |
|
1188 |
aClass changed:#organization. "/ not really ... to force update |
|
1189 |
Smalltalk changed:#classOrganization with:aClass. "/ not really ... to force update |
|
1190 |
! |
|
1191 |
||
1192 |
additionalProtocolForClass:aClass |
|
1193 |
"/ those are simulated - in ST/X, empty categories do not |
|
1194 |
"/ really exist; however, during browsing, it makes sense. |
|
1195 |
AdditionalEmptyCategoriesPerClassName isNil ifTrue:[ ^ #() ]. |
|
1196 |
^ AdditionalEmptyCategoriesPerClassName at:aClass name ifAbsent:[ #() ]. |
|
1197 |
! |
|
1198 |
||
1199 |
clearLastSelectedProtocol |
|
1200 |
lastSelectedProtocols := nil |
|
1201 |
! |
|
1202 |
||
6342
698b45d51014
new method-category initial offer
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1203 |
lastSelectedProtocols |
698b45d51014
new method-category initial offer
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1204 |
^ lastSelectedProtocols |
698b45d51014
new method-category initial offer
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1205 |
! |
698b45d51014
new method-category initial offer
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1206 |
|
5591 | 1207 |
removeAdditionalProtocol:aListOfProtocols forClass:aClass |
1208 |
|categories| |
|
1209 |
||
1210 |
"/ those are simulated - in ST/X, empty categories do not |
|
1211 |
"/ really exist; however, during browsing, it makes sense. |
|
1212 |
||
1213 |
AdditionalEmptyCategoriesPerClassName isNil ifTrue:[^ self]. |
|
1214 |
||
1215 |
categories := AdditionalEmptyCategoriesPerClassName at:aClass name ifAbsent:nil. |
|
1216 |
categories isNil ifTrue:[^ self]. |
|
1217 |
categories removeAllFoundIn:aListOfProtocols. |
|
1218 |
categories isEmpty ifTrue:[ |
|
1219 |
AdditionalEmptyCategoriesPerClassName removeKey:aClass name. |
|
1220 |
]. |
|
1221 |
||
1222 |
aClass changed:#organization. "/ not really ... to force update |
|
1223 |
Smalltalk changed:#classOrganization with:aClass. "/ not really ... to force update |
|
1224 |
! |
|
1225 |
||
1226 |
removeAllAdditionalProtocol |
|
1227 |
"/ those are simulated - in ST/X, empty categories do not |
|
1228 |
"/ really exist; however, during browsing, it makes sense. |
|
1229 |
AdditionalEmptyCategoriesPerClassName := nil |
|
1230 |
||
1231 |
||
1232 |
! |
|
1233 |
||
1234 |
removeAllAdditionalProtocolForClass:aClass |
|
1235 |
"/ those are simulated - in ST/X, empty categories do not |
|
1236 |
"/ really exist; however, during browsing, it makes sense. |
|
1237 |
AdditionalEmptyCategoriesPerClassName notNil ifTrue:[ |
|
1238 |
AdditionalEmptyCategoriesPerClassName removeKey:aClass name ifAbsent:nil |
|
1239 |
]. |
|
1240 |
||
1241 |
||
1242 |
! |
|
1243 |
||
1244 |
renameAdditionalProtocol:oldName to:newName forClass:aClass |
|
1245 |
|categories| |
|
1246 |
||
1247 |
"/ those are simulated - in ST/X, empty categories do not |
|
1248 |
"/ really exist; however, during browsing, it makes sense. |
|
1249 |
||
1250 |
AdditionalEmptyCategoriesPerClassName isNil ifTrue:[^ self]. |
|
1251 |
categories := AdditionalEmptyCategoriesPerClassName at:aClass name ifAbsent:nil. |
|
1252 |
categories isNil ifTrue:[^ self]. |
|
1253 |
categories remove:oldName ifAbsent:nil. |
|
1254 |
categories add:newName. |
|
1255 |
||
1256 |
aClass changed:#organization. "/ not really ... to force update |
|
1257 |
Smalltalk changed:#classOrganization with:aClass. "/ not really ... to force update |
|
1258 |
! ! |
|
1259 |
||
1260 |
!MethodCategoryList class methodsFor:'documentation'! |
|
1261 |
||
1262 |
version |
|
6492 | 1263 |
^ '$Header: /cvs/stx/stx/libtool/Tools_MethodCategoryList.st,v 1.8 2006-01-24 16:55:41 cg Exp $' |
5591 | 1264 |
! ! |