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