author | Claus Gittinger <cg@exept.de> |
Mon, 21 Apr 2008 18:06:38 +0200 | |
changeset 8072 | 313da6c692f8 |
parent 8011 | cfd99bd90591 |
child 8166 | f90857fb2227 |
permissions | -rw-r--r-- |
6179 | 1 |
" |
2 |
COPYRIGHT (c) 2004 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 |
" |
|
5592 | 12 |
"{ Package: 'stx:libtool' }" |
5591 | 13 |
|
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
BrowserList subclass:#ClassList |
|
17 |
instanceVariableNames:'classList classNameList meta lastSelectedClasses |
|
18 |
selectedClassNameIndices currentNamespace hidePrivateClasses |
|
19 |
unloadedClassesColor markApplicationsHolder' |
|
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Interface-Browsers-New' |
|
23 |
! |
|
24 |
||
25 |
!ClassList class methodsFor:'documentation'! |
|
26 |
||
6179 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
5591 | 41 |
documentation |
42 |
" |
|
43 |
embeddable application displaying the classes as listed by |
|
44 |
the inputGenerator. |
|
45 |
Provides an outputGenerator, which enumerates the classes and |
|
46 |
their protocols (method-categories) in the selected classes. |
|
47 |
||
48 |
[author:] |
|
49 |
Claus Gittinger (cg@exept.de) |
|
50 |
" |
|
51 |
||
52 |
||
53 |
! ! |
|
54 |
||
55 |
!ClassList class methodsFor:'interface specs'! |
|
56 |
||
57 |
singleClassWindowSpec |
|
58 |
"This resource specification was automatically generated |
|
59 |
by the UIPainter of ST/X." |
|
60 |
||
61 |
"Do not manually edit this!! If it is corrupted, |
|
62 |
the UIPainter may not be able to read the specification." |
|
63 |
||
64 |
" |
|
65 |
UIPainter new openOnClass:ClassList andSelector:#singleClassWindowSpec |
|
66 |
ClassList new openInterface:#singleClassWindowSpec |
|
67 |
" |
|
68 |
||
69 |
<resource: #canvas> |
|
70 |
||
71 |
^ |
|
72 |
#(#FullSpec |
|
5592 | 73 |
#name: #windowSpec |
74 |
#window: |
|
5591 | 75 |
#(#WindowSpec |
5592 | 76 |
#label: 'ClassList' |
77 |
#name: 'ClassList' |
|
78 |
#min: #(#Point 0 0) |
|
79 |
#max: #(#Point 1024 721) |
|
80 |
#bounds: #(#Rectangle 12 22 312 322) |
|
81 |
) |
|
82 |
#component: |
|
5591 | 83 |
#(#SpecCollection |
5592 | 84 |
#collection: #( |
85 |
#(#LabelSpec |
|
86 |
#label: 'ClassName' |
|
87 |
#name: 'ClassLabel' |
|
88 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 25 0) |
|
89 |
#translateLabel: true |
|
90 |
#labelChannel: #classLabelHolder |
|
91 |
#menu: #menuHolder |
|
92 |
) |
|
5591 | 93 |
"/ #(#UISubSpecification |
94 |
"/ #name: 'MetaToggleSpec' |
|
95 |
"/ #layout: #(#LayoutFrame 0 0.0 -25 1.0 0 1.0 0 1.0) |
|
96 |
"/ #minorKey: #metaSpec |
|
97 |
"/ ) |
|
5592 | 98 |
) |
5591 | 99 |
|
5592 | 100 |
) |
5591 | 101 |
) |
102 |
! |
|
103 |
||
104 |
windowSpec |
|
105 |
"This resource specification was automatically generated |
|
106 |
by the UIPainter of ST/X." |
|
107 |
||
108 |
"Do not manually edit this!! If it is corrupted, |
|
109 |
the UIPainter may not be able to read the specification." |
|
110 |
||
111 |
" |
|
112 |
UIPainter new openOnClass:ClassList andSelector:#windowSpec |
|
113 |
ClassList new openInterface:#windowSpec |
|
114 |
ClassList open |
|
115 |
" |
|
116 |
||
117 |
<resource: #canvas> |
|
118 |
||
119 |
^ |
|
120 |
#(#FullSpec |
|
6468 | 121 |
#name: #windowSpec |
122 |
#window: |
|
5591 | 123 |
#(#WindowSpec |
6468 | 124 |
#label: 'ClassList' |
125 |
#name: 'ClassList' |
|
126 |
#min: #(#Point 0 0) |
|
127 |
#max: #(#Point 1024 721) |
|
128 |
#bounds: #(#Rectangle 16 46 316 346) |
|
129 |
) |
|
130 |
#component: |
|
5591 | 131 |
#(#SpecCollection |
6468 | 132 |
#collection: #( |
133 |
#(#SequenceViewSpec |
|
134 |
#name: 'List' |
|
135 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
136 |
#tabable: true |
|
137 |
#model: #selectedClassNameIndices |
|
138 |
#menu: #menuHolder |
|
139 |
#hasHorizontalScrollBar: true |
|
140 |
#hasVerticalScrollBar: true |
|
141 |
#miniScrollerHorizontal: true |
|
142 |
#isMultiSelect: true |
|
143 |
#valueChangeSelector: #selectionChangedByClick |
|
144 |
#useIndex: true |
|
145 |
#sequenceList: #classNameList |
|
146 |
#doubleClickChannel: #doubleClickChannel |
|
147 |
#properties: |
|
148 |
#(#PropertyListDictionary |
|
149 |
#dragArgument: nil |
|
150 |
#dropArgument: nil |
|
151 |
#canDropSelector: #canDropContext: |
|
152 |
#dropSelector: #doDropContext: |
|
153 |
) |
|
154 |
) |
|
155 |
) |
|
5591 | 156 |
|
6468 | 157 |
) |
5591 | 158 |
) |
159 |
! ! |
|
160 |
||
161 |
!ClassList class methodsFor:'plugIn spec'! |
|
162 |
||
163 |
aspectSelectors |
|
164 |
"This resource specification was automatically generated |
|
165 |
by the UIPainter of ST/X." |
|
166 |
||
167 |
"Do not manually edit this. If it is corrupted, |
|
168 |
the UIPainter may not be able to read the specification." |
|
169 |
||
170 |
"Return a description of exported aspects; |
|
171 |
these can be connected to aspects of an embedding application |
|
172 |
(if this app is embedded in a subCanvas)." |
|
173 |
||
174 |
^ #( |
|
175 |
#currentNamespace |
|
176 |
#(#doubleClickChannel #action ) |
|
177 |
#forceGeneratorTrigger |
|
178 |
#hidePrivateClasses |
|
179 |
#hideUnloadedClasses |
|
180 |
#immediateUpdate |
|
181 |
#inGeneratorHolder |
|
182 |
#menuHolder |
|
183 |
#meta |
|
184 |
#organizerMode |
|
185 |
#outGeneratorHolder |
|
186 |
#packageFilter |
|
187 |
#nameSpaceFilter |
|
188 |
#selectedClasses |
|
189 |
#selectionChangeCondition |
|
190 |
#showClassPackages |
|
191 |
#slaveMode |
|
192 |
#updateTrigger |
|
193 |
#markApplicationsHolder |
|
194 |
). |
|
195 |
||
196 |
"Modified: / 18.8.2000 / 18:49:08 / cg" |
|
197 |
! ! |
|
198 |
||
199 |
!ClassList methodsFor:'accessing'! |
|
200 |
||
201 |
markApplications |
|
202 |
"return the value of the instance variable 'markApplications' (automatically generated)" |
|
203 |
||
204 |
^ self markApplicationsHolder value |
|
205 |
||
206 |
"Created: / 3.11.2001 / 14:06:19 / cg" |
|
207 |
! |
|
208 |
||
209 |
markApplications:something |
|
210 |
"set the value of the instance variable 'markApplications' (automatically generated)" |
|
211 |
||
212 |
self markApplicationsHolder value:something. |
|
213 |
||
214 |
"Created: / 3.11.2001 / 14:06:25 / cg" |
|
215 |
! |
|
216 |
||
217 |
unloadedClassesColor |
|
218 |
"return the value of the instance variable 'unloadedClassesColor' (automatically generated)" |
|
219 |
||
220 |
^ unloadedClassesColor |
|
221 |
! |
|
222 |
||
223 |
unloadedClassesColor:something |
|
224 |
"set the value of the instance variable 'unloadedClassesColor' (automatically generated)" |
|
225 |
||
226 |
unloadedClassesColor := something. |
|
227 |
! ! |
|
228 |
||
229 |
!ClassList methodsFor:'aspects'! |
|
230 |
||
231 |
classLabelHolder |
|
232 |
^ self pseudoListLabelHolder |
|
233 |
! |
|
234 |
||
235 |
classList |
|
236 |
classList isNil ifTrue:[ |
|
237 |
classList := ValueHolder new. |
|
238 |
]. |
|
239 |
^ classList |
|
240 |
||
241 |
"Created: / 5.2.2000 / 13:42:16 / cg" |
|
242 |
"Modified: / 25.2.2000 / 02:21:07 / cg" |
|
243 |
! |
|
244 |
||
245 |
classNameList |
|
246 |
classNameList isNil ifTrue:[ |
|
247 |
classNameList := ValueHolder new |
|
248 |
]. |
|
249 |
^ classNameList |
|
250 |
! |
|
251 |
||
252 |
currentNamespace:aValueHolder |
|
253 |
currentNamespace notNil ifTrue:[ |
|
254 |
currentNamespace removeDependent:self |
|
255 |
]. |
|
256 |
currentNamespace := aValueHolder. |
|
257 |
currentNamespace notNil ifTrue:[ |
|
258 |
currentNamespace isBehavior ifTrue:[self halt:'should not happen']. |
|
259 |
currentNamespace addDependent:self |
|
260 |
]. |
|
261 |
||
262 |
"Modified: / 4.2.2000 / 23:34:28 / cg" |
|
263 |
"Created: / 5.2.2000 / 21:37:57 / cg" |
|
264 |
! |
|
265 |
||
266 |
doubleClick |
|
267 |
self halt:'should not happen'. |
|
268 |
! |
|
269 |
||
270 |
hidePrivateClasses |
|
271 |
hidePrivateClasses isNil ifTrue:[ |
|
272 |
hidePrivateClasses := false asValue. |
|
273 |
hidePrivateClasses addDependent:self. |
|
274 |
]. |
|
275 |
^ hidePrivateClasses. |
|
276 |
||
277 |
"Created: / 24.2.2000 / 15:06:44 / cg" |
|
278 |
! |
|
279 |
||
280 |
hidePrivateClasses:aValueHolder |
|
281 |
hidePrivateClasses notNil ifTrue:[ |
|
282 |
hidePrivateClasses removeDependent:self |
|
283 |
]. |
|
284 |
hidePrivateClasses := aValueHolder. |
|
285 |
hidePrivateClasses notNil ifTrue:[ |
|
286 |
hidePrivateClasses addDependent:self |
|
287 |
]. |
|
288 |
||
289 |
"Created: / 24.2.2000 / 15:06:46 / cg" |
|
290 |
! |
|
291 |
||
292 |
markApplicationsHolder |
|
293 |
markApplicationsHolder isNil ifTrue:[ |
|
294 |
markApplicationsHolder := true asValue. |
|
295 |
markApplicationsHolder addDependent:self. |
|
296 |
]. |
|
297 |
^ markApplicationsHolder. |
|
298 |
! |
|
299 |
||
300 |
markApplicationsHolder:aValueHolder |
|
301 |
markApplicationsHolder notNil ifTrue:[ |
|
302 |
markApplicationsHolder removeDependent:self |
|
303 |
]. |
|
304 |
markApplicationsHolder := aValueHolder. |
|
305 |
markApplicationsHolder notNil ifTrue:[ |
|
306 |
markApplicationsHolder addDependent:self |
|
307 |
]. |
|
308 |
||
309 |
"Created: / 24.2.2000 / 15:06:46 / cg" |
|
310 |
! |
|
311 |
||
312 |
meta |
|
313 |
meta isNil ifTrue:[ |
|
314 |
meta := false asValue. |
|
315 |
meta addDependent:self |
|
316 |
]. |
|
317 |
^ meta |
|
318 |
||
319 |
"Modified: / 31.1.2000 / 01:19:59 / cg" |
|
320 |
"Created: / 5.2.2000 / 13:42:16 / cg" |
|
321 |
! |
|
322 |
||
323 |
meta:aValueHolder |
|
324 |
"/ (aValueHolder == true or:[aValueHolder == false]) ifTrue:[self halt]. |
|
325 |
||
326 |
meta notNil ifTrue:[ |
|
327 |
meta removeDependent:self |
|
328 |
]. |
|
329 |
meta := aValueHolder. |
|
330 |
meta notNil ifTrue:[ |
|
331 |
meta addDependent:self |
|
332 |
]. |
|
333 |
! |
|
334 |
||
335 |
selectedClassNameIndices |
|
336 |
selectedClassNameIndices isNil ifTrue:[ |
|
337 |
selectedClassNameIndices := #() asValue. |
|
338 |
selectedClassNameIndices addDependent:self |
|
339 |
]. |
|
340 |
^ selectedClassNameIndices. |
|
341 |
||
342 |
"Created: / 5.2.2000 / 21:31:48 / cg" |
|
343 |
"Modified: / 5.2.2000 / 21:43:02 / cg" |
|
344 |
! |
|
345 |
||
346 |
selectedClasses |
|
347 |
^ self selectionHolder |
|
348 |
||
349 |
! |
|
350 |
||
351 |
selectedClasses:aValueHolder |
|
352 |
^ self selectionHolder:aValueHolder |
|
353 |
||
354 |
! |
|
355 |
||
356 |
showClassPackages |
|
357 |
showClassPackages isNil ifTrue:[ |
|
358 |
showClassPackages := false asValue. |
|
359 |
showClassPackages addDependent:self. |
|
360 |
]. |
|
361 |
^ showClassPackages. |
|
362 |
||
363 |
"Created: / 24.2.2000 / 15:06:44 / cg" |
|
364 |
! |
|
365 |
||
366 |
showClassPackages:aValueHolder |
|
367 |
showClassPackages notNil ifTrue:[ |
|
368 |
showClassPackages removeDependent:self |
|
369 |
]. |
|
370 |
showClassPackages := aValueHolder. |
|
371 |
showClassPackages notNil ifTrue:[ |
|
372 |
showClassPackages addDependent:self |
|
373 |
]. |
|
374 |
! ! |
|
375 |
||
376 |
!ClassList methodsFor:'change & update'! |
|
377 |
||
378 |
classDefinitionChanged:aClassOrNil |
|
379 |
||
380 |
listValid ifFalse:[^ self]. |
|
381 |
||
382 |
slaveMode value == true ifTrue:[ |
|
5592 | 383 |
self invalidateList. |
384 |
^ self. |
|
5591 | 385 |
]. |
386 |
self slaveMode value isNil ifTrue:[ |
|
5592 | 387 |
self window shown ifFalse:[ |
388 |
self invalidateList. |
|
389 |
^ self |
|
390 |
]. |
|
5591 | 391 |
]. |
392 |
||
393 |
aClassOrNil isNil ifTrue:[ |
|
5592 | 394 |
self halt:'should not happen'. |
5591 | 395 |
]. |
396 |
||
397 |
"/ if that class is in my list ... |
|
398 |
((self classList value ? #()) contains:[:cls | cls notNil and:[cls theNonMetaclass name = aClassOrNil theNonMetaclass name]]) |
|
399 |
ifTrue:[ |
|
5592 | 400 |
self updateListsFor:aClassOrNil. |
401 |
"/ force update |
|
402 |
self selectedClassNameIndices value:(self selectedClassNameIndices value). |
|
5591 | 403 |
|
5592 | 404 |
((self selectedClasses value ? #()) contains:[:cls | cls notNil ifTrue:[cls theNonMetaclass name = aClassOrNil theNonMetaclass name] ifFalse:[false]]) |
405 |
ifTrue:[ |
|
406 |
self updateOutputGenerator |
|
407 |
]. |
|
5591 | 408 |
] ifFalse:[ |
5592 | 409 |
self invalidateList |
5591 | 410 |
] |
411 |
||
412 |
||
413 |
"Modified: / 29.2.2000 / 00:15:23 / cg" |
|
414 |
! |
|
415 |
||
416 |
classRemoved:aClass |
|
417 |
|list| |
|
418 |
||
419 |
list := self classList value. |
|
420 |
list notNil ifTrue:[ |
|
421 |
(list includesIdentical:aClass) ifTrue:[ |
|
422 |
self invalidateList. |
|
423 |
] |
|
424 |
] |
|
425 |
||
426 |
"Modified: / 25.2.2000 / 23:53:51 / cg" |
|
427 |
! |
|
428 |
||
429 |
delayedUpdate:something with:aParameter from:changedObject |
|
430 |
|cls classes chgClass wg| |
|
431 |
||
432 |
classes := self classList value ? #(). |
|
433 |
||
434 |
self inSlaveModeOrInvisible ifTrue:[ |
|
5592 | 435 |
self invalidateList. |
436 |
^ self. |
|
5591 | 437 |
]. |
438 |
||
439 |
"/ (self slaveMode value == true) ifTrue:[^ self]. |
|
440 |
"/ self slaveMode value isNil ifTrue:[ |
|
441 |
"/ self window shown ifFalse:[ |
|
442 |
"/ self invalidateList. |
|
443 |
"/ ^ self |
|
444 |
"/ ]. |
|
445 |
"/ ]. |
|
446 |
||
447 |
changedObject == slaveMode ifTrue:[ |
|
5592 | 448 |
listValid ~~ true ifTrue:[ |
449 |
self enqueueDelayedUpdateList. |
|
450 |
]. |
|
451 |
self enqueueDelayedClassSelectionChanged. |
|
452 |
^ self |
|
5591 | 453 |
]. |
454 |
||
455 |
changedObject == Smalltalk ifTrue:[ |
|
5592 | 456 |
something == #methodInClass ifTrue:[ |
457 |
^ self "no interest" |
|
458 |
]. |
|
459 |
something == #methodInClassRemoved ifTrue:[ |
|
460 |
"/ must update the list, if the methods package is different from |
|
461 |
"/ the classes package (to undo any has-exension highlighting) |
|
462 |
cls := aParameter first. |
|
463 |
self updateListsFor:cls. |
|
464 |
^ self |
|
465 |
]. |
|
466 |
something == #organization ifTrue:[^ self "no interest" ]. |
|
5591 | 467 |
|
5592 | 468 |
(something == #classDefinition |
469 |
or:[something == #classVariables |
|
470 |
or:[something == #newClass]]) ifTrue:[ |
|
471 |
"/ update that class in my classList and the selection |
|
472 |
listValid ifTrue:[ |
|
473 |
self classDefinitionChanged:aParameter. |
|
474 |
]. |
|
475 |
^ self. |
|
476 |
]. |
|
477 |
(something == #lastTestRunResult) ifTrue:[ |
|
478 |
"/ update that class in my classList and the selection |
|
479 |
listValid ifTrue:[ |
|
480 |
self updateListsFor:aParameter. |
|
481 |
"/ self classDefinitionChanged:aParameter. |
|
482 |
]. |
|
483 |
^ self. |
|
484 |
]. |
|
485 |
something == #classRemove ifTrue:[ |
|
486 |
"/ update my classList and the selection |
|
487 |
self classRemoved:aParameter. |
|
488 |
^ self. |
|
489 |
]. |
|
490 |
something == #classRename ifTrue:[ |
|
491 |
"/ update that class in my classList and the selection |
|
492 |
listValid ifTrue:[ |
|
493 |
aParameter isArray ifTrue:[ |
|
494 |
cls := aParameter at:1. |
|
495 |
self classDefinitionChanged:cls. |
|
496 |
] |
|
497 |
]. |
|
498 |
^ self. |
|
499 |
]. |
|
5591 | 500 |
|
5592 | 501 |
something == #projectOrganization ifTrue:[ |
502 |
aParameter isNil ifTrue:[ |
|
503 |
self invalidateList. |
|
504 |
organizerMode value == #project ifTrue:[ |
|
505 |
self enqueueDelayedUpdateOutputGenerator. |
|
506 |
]. |
|
507 |
^ self |
|
508 |
]. |
|
5591 | 509 |
|
5592 | 510 |
cls := aParameter at:1. |
511 |
cls notNil ifTrue:[ "/ should not happen (but does occasionally) |
|
512 |
((classes includes:cls theMetaclass) |
|
513 |
or:[(classes includes:cls theNonMetaclass)]) ifTrue:[ |
|
514 |
self invalidateList. |
|
515 |
organizerMode value == #project ifTrue:[ |
|
516 |
self enqueueDelayedUpdateOutputGenerator. |
|
517 |
] |
|
518 |
]. |
|
519 |
]. |
|
520 |
^ self |
|
521 |
]. |
|
522 |
^ self. |
|
5591 | 523 |
]. |
524 |
||
525 |
(something == #lastTestRunResult) ifTrue:[ |
|
5592 | 526 |
^ self |
5591 | 527 |
]. |
528 |
||
529 |
changedObject == ChangeSet ifTrue:[ |
|
5592 | 530 |
wg := self windowGroup. |
531 |
wg isNil ifTrue:[ |
|
532 |
changedObject removeDependent:self. |
|
533 |
] ifFalse:[ |
|
534 |
"/ react on changes of the changeSet to recolorize items |
|
535 |
something == #addChange: ifTrue:[ |
|
536 |
chgClass := aParameter changeClass. |
|
537 |
chgClass notNil ifTrue:[ |
|
538 |
((classes includes:chgClass theNonMetaclass) |
|
539 |
or:[classes includes:chgClass theMetaclass]) ifTrue:[ |
|
540 |
"/ remove all other addChange notifications ... |
|
541 |
wg sensor |
|
542 |
flushEventsFor:self |
|
543 |
where:[:ev | ev isMessageSendEvent |
|
544 |
and:[ev selector == #delayedUpdate:with:from: |
|
545 |
and:[(ev arguments at:3) == ChangeSet]]]. |
|
546 |
self reconstructNameList. |
|
547 |
] |
|
548 |
] |
|
549 |
] ifFalse:[ |
|
550 |
"/ remove all other ChangeSet notifications ... |
|
551 |
wg sensor |
|
552 |
flushEventsFor:self |
|
553 |
where:[:ev | ev isMessageSendEvent |
|
554 |
and:[ev selector == #delayedUpdate:with:from: |
|
555 |
and:[(ev arguments at:3) == ChangeSet]]]. |
|
556 |
self reconstructNameList. |
|
557 |
]. |
|
558 |
]. |
|
559 |
^ self |
|
5591 | 560 |
]. |
561 |
||
562 |
changedObject == self selectedClasses ifTrue:[ |
|
5592 | 563 |
slaveMode value ~~ true ifTrue:[ |
564 |
listValid == true ifFalse:[ |
|
565 |
self updateList |
|
566 |
]. |
|
567 |
self selectedClassesChanged. |
|
568 |
self updateOutputGenerator. |
|
569 |
] ifFalse:[ |
|
570 |
listValid := false. |
|
571 |
]. |
|
572 |
^ self |
|
5591 | 573 |
]. |
574 |
||
575 |
(changedObject == meta |
|
576 |
or:[changedObject == selectedClassNameIndices]) ifTrue:[ |
|
5592 | 577 |
self selectionChanged. |
578 |
^ self |
|
5591 | 579 |
]. |
580 |
changedObject == showClassPackages ifTrue:[ |
|
5592 | 581 |
self classNameList value:nil. |
582 |
self invalidateList. |
|
583 |
^ self |
|
5591 | 584 |
]. |
585 |
||
586 |
(changedObject == hideUnloadedClasses |
|
587 |
or:[changedObject == hidePrivateClasses |
|
588 |
or:[changedObject == nameSpaceFilter |
|
589 |
or:[changedObject == packageFilter]]]) ifTrue:[ |
|
5592 | 590 |
self invalidateList. |
591 |
^ self |
|
5591 | 592 |
]. |
593 |
||
594 |
super delayedUpdate:something with:aParameter from:changedObject |
|
595 |
||
596 |
"Modified: / 13.11.2001 / 11:32:10 / cg" |
|
597 |
! |
|
598 |
||
599 |
enqueueDelayedClassSelectionChanged |
|
600 |
(NewSystemBrowser synchronousUpdate == true |
|
601 |
or:[ immediateUpdate value == true ]) |
|
602 |
ifTrue:[ |
|
6716 | 603 |
self selectedClassesChanged. |
604 |
^ self. |
|
5591 | 605 |
]. |
606 |
||
607 |
self enqueueMessage:#selectedClassesChanged for:self arguments:#() |
|
608 |
! |
|
609 |
||
610 |
getSelectedClassIndicesFromClasses |
|
611 |
"the class selection has changed; |
|
612 |
return a collection of selection-indices" |
|
613 |
||
614 |
|classes selectedClasses numSelected| |
|
615 |
||
616 |
classes := self classList value. |
|
617 |
selectedClasses := self selectedClasses value. |
|
618 |
||
619 |
numSelected := selectedClasses size. |
|
620 |
numSelected == 0 ifTrue:[ |
|
621 |
^ #() |
|
622 |
]. |
|
623 |
||
624 |
numSelected == classes size ifTrue:[ |
|
625 |
"/ all selected - easy |
|
626 |
^ (1 to:numSelected) asOrderedCollection |
|
627 |
]. |
|
628 |
meta value ifTrue:[ |
|
629 |
classes := classes collect:[:eachClass | eachClass theMetaclass]. |
|
630 |
]. |
|
631 |
||
632 |
classes := selectedClasses collect:[:aSelectedClass | classes identityIndexOf:aSelectedClass.]. |
|
633 |
classes := classes select:[:idx | idx ~= 0]. |
|
634 |
^ classes |
|
635 |
||
636 |
"Created: / 24.2.2000 / 19:47:52 / cg" |
|
637 |
! |
|
638 |
||
639 |
getSelectedClassesFromIndices |
|
640 |
"the selection-index collection has changed; |
|
641 |
return a collection of corresponding classes" |
|
642 |
||
643 |
|selected classes allEntrySelected isMeta anyLost selectedClassNameIndices| |
|
644 |
||
645 |
allEntrySelected := false. |
|
646 |
||
647 |
classes := classList value. |
|
7928
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
648 |
classes isNil ifTrue:[ |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
649 |
self updateList. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
650 |
classes := classList value. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
651 |
]. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
652 |
|
5591 | 653 |
isMeta := meta value. |
654 |
anyLost := false. |
|
655 |
||
656 |
selectedClassNameIndices := self selectedClassNameIndices value. |
|
657 |
selectedClassNameIndices size == classes size ifTrue:[ |
|
7928
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
658 |
selectedClassNameIndices size == 0 ifTrue:[^ #()]. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
659 |
isMeta ifTrue:[ |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
660 |
^ classes collect:[:eachClass | eachClass theMetaclass]. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
661 |
]. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
662 |
^ classes collect:[:eachClass | eachClass theNonMetaclass]. |
5591 | 663 |
]. |
664 |
||
665 |
selected := selectedClassNameIndices |
|
7928
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
666 |
collect:[:idx | |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
667 |
|cls| |
5591 | 668 |
|
7928
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
669 |
cls := classes at:idx. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
670 |
cls == (self class nameListEntryForALL) ifTrue:[ |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
671 |
allEntrySelected := true. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
672 |
] ifFalse:[ |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
673 |
cls notNil ifTrue:[ |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
674 |
isMeta ifTrue:[ |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
675 |
cls := cls theMetaclass |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
676 |
] ifFalse:[ |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
677 |
cls := cls theNonMetaclass |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
678 |
]. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
679 |
] ifFalse:[ |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
680 |
anyLost := true |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
681 |
]. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
682 |
]. |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
683 |
cls |
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
684 |
]. |
5591 | 685 |
anyLost ifTrue:[ |
7928
93623a1f78a6
getSelectedClass if there has not been a classList fetch yet
Claus Gittinger <cg@exept.de>
parents:
7743
diff
changeset
|
686 |
selected := selected select:[:each | each notNil]. |
5591 | 687 |
]. |
688 |
||
689 |
"/ allEntrySelected ifTrue:[ |
|
690 |
"/ selected := classList value select:[:cls | cls ~~ AllEntry]. |
|
691 |
"/ meta value ifTrue:[ |
|
692 |
"/ selected := selected collect:[:cls | cls theMetaclass]. |
|
693 |
"/ ] ifFalse:[ |
|
694 |
"/ selected := selected collect:[:cls | cls theNonMetaclass]. |
|
695 |
"/ ]. |
|
696 |
"/ ]. |
|
697 |
||
698 |
^ selected. |
|
699 |
||
700 |
"Created: / 24.2.2000 / 19:43:37 / cg" |
|
701 |
! |
|
702 |
||
703 |
selectedClassesChanged |
|
704 |
|indices selectedClassNameIndicesHolder| |
|
705 |
||
706 |
self classList value size == 0 ifTrue:[ |
|
707 |
"/ this may happen during early startup, |
|
708 |
"/ when invoked with a preset classSelection, |
|
709 |
"/ and the classGenerator has not yet been setup |
|
710 |
"/ to not clobber the selection, defer the update |
|
711 |
"/ until the classList arrives ... |
|
712 |
^ self |
|
713 |
]. |
|
714 |
"/ lastSelectedClasses := self selectedClasses value copy. |
|
715 |
||
716 |
indices := self getSelectedClassIndicesFromClasses. |
|
717 |
selectedClassNameIndicesHolder := self selectedClassNameIndices. |
|
718 |
selectedClassNameIndicesHolder value ~= indices ifTrue:[ |
|
719 |
"/ in slaveMode, do not update selectedClasses from indices |
|
720 |
true "slaveMode value" ifTrue:[ |
|
721 |
selectedClassNameIndicesHolder value:indices withoutNotifying:self |
|
722 |
] ifFalse:[ |
|
723 |
selectedClassNameIndicesHolder value:indices. |
|
724 |
] |
|
725 |
] |
|
726 |
||
727 |
"Created: / 13.2.2000 / 22:18:10 / cg" |
|
728 |
"Modified: / 24.2.2000 / 19:48:56 / cg" |
|
729 |
! |
|
730 |
||
731 |
selectionChanged |
|
732 |
"the lists selection has changed. Since the list uses indices, |
|
733 |
update the corresponding selectedClasses collection" |
|
734 |
||
735 |
|selected prevSelection selectedClassesHolder| |
|
736 |
||
737 |
selectedClassesHolder := self selectedClasses. |
|
738 |
"/ lastSelectedClasses := selectedClassesHolder value copy. |
|
739 |
||
740 |
selected := self getSelectedClassesFromIndices. |
|
741 |
||
742 |
prevSelection := selectedClassesHolder value ? #(). |
|
743 |
||
744 |
"/ to allow reselect, change my valueHolder, even if the same collection |
|
745 |
||
746 |
prevSelection ~= selected ifTrue:[ |
|
747 |
selectedClassesHolder value:selected. |
|
748 |
"/ ] ifFalse:[ |
|
749 |
"/ selectedClassesHolder value:selected withoutNotifying:self |
|
750 |
]. |
|
751 |
||
752 |
"/ (selectedClassesHolder value = lastSelectedClasses |
|
753 |
"/ and:[lastSelectedClasses size == 1]) ifTrue:[ |
|
754 |
"/ "/ thats a kludge - we want to turn off the protocol selection, |
|
755 |
"/ "/ when a class is reselected. |
|
756 |
"/ |
|
757 |
"/ (masterApplication notNil |
|
758 |
"/ and:[(mm := masterApplication masterApplication) notNil |
|
759 |
"/ and:[mm respondsTo:#selectedProtocols]]) ifTrue:[ |
|
760 |
"/ mm selectedProtocols value:#() |
|
761 |
"/ ]. |
|
762 |
"/ ]. |
|
763 |
! |
|
764 |
||
765 |
selectionChangedByClick |
|
766 |
"we are not interested in that - get another notification |
|
767 |
via the changed valueHolder" |
|
768 |
||
769 |
|selected master| |
|
770 |
||
771 |
selected := self getSelectedClassesFromIndices. |
|
772 |
(selected = lastSelectedClasses and:[selected size == 1]) |
|
773 |
ifTrue:[ |
|
774 |
"/ thats a kludge - we want to turn off the protocol selection, |
|
775 |
"/ when a class is reselected. |
|
776 |
||
777 |
masterApplication notNil ifTrue:[ |
|
778 |
master := masterApplication. |
|
779 |
masterApplication masterApplication notNil ifTrue:[ |
|
780 |
master := masterApplication masterApplication. |
|
781 |
]. |
|
782 |
(master respondsTo:#classReselected) ifTrue:[ |
|
783 |
master classReselected. |
|
784 |
]. |
|
785 |
] |
|
786 |
] ifFalse:[ |
|
787 |
lastSelectedClasses := selected copy. |
|
788 |
] |
|
789 |
! |
|
790 |
||
791 |
update:something with:aParameter from:changedObject |
|
6847 | 792 |
|cls sel newMethod oldMethod idx classListValue| |
5591 | 793 |
|
794 |
self slaveMode value == true ifTrue:[ |
|
6847 | 795 |
something == #methodInClass ifTrue:[ ^ self ]. |
796 |
something == #addChange: ifTrue:[ self invalidateList. ^ self ]. |
|
5591 | 797 |
]. |
798 |
"/ self window sensor isNil ifTrue:[ |
|
799 |
"/ "/ not visible ... |
|
800 |
"/ self invalidateList. |
|
801 |
"/ ^ self |
|
802 |
"/ ]. |
|
803 |
||
804 |
classListValue := classList value. |
|
805 |
||
806 |
changedObject == Smalltalk ifTrue:[ |
|
6847 | 807 |
something == #classComment ifTrue:[ |
808 |
^ self. |
|
809 |
]. |
|
810 |
something == #methodDictionary ifTrue:[ |
|
811 |
^ self |
|
812 |
]. |
|
813 |
something == #methodTrap ifTrue:[ |
|
814 |
^ self |
|
815 |
]. |
|
816 |
something == #lastTestRunResult ifTrue:[ |
|
817 |
cls := aParameter at:1. |
|
818 |
sel := aParameter at:2. |
|
819 |
(cls notNil and:[sel isNil]) ifTrue:[ |
|
820 |
classListValue size > 0 ifTrue:[ |
|
821 |
((classListValue includesIdentical:cls theNonMetaclass) |
|
822 |
or:[(classListValue includesIdentical:cls theMetaclass)]) ifTrue:[ |
|
823 |
self enqueueDelayedUpdateList |
|
824 |
] |
|
825 |
] |
|
826 |
]. |
|
827 |
^ self |
|
828 |
]. |
|
829 |
||
830 |
something == #methodInClassRemoved ifTrue:[ |
|
831 |
cls := aParameter at:1. |
|
832 |
cls notNil ifTrue:[ |
|
833 |
classListValue size > 0 ifTrue:[ |
|
834 |
((classListValue includesIdentical:cls theNonMetaclass) |
|
835 |
or:[(classListValue includesIdentical:cls theMetaclass)]) ifTrue:[ |
|
836 |
self enqueueDelayedUpdateList |
|
837 |
] |
|
838 |
] |
|
839 |
]. |
|
840 |
^ self |
|
841 |
]. |
|
5591 | 842 |
|
6847 | 843 |
something == #methodInClass ifTrue:[ |
844 |
cls := aParameter at:1. |
|
845 |
cls notNil ifTrue:[ |
|
846 |
classListValue size > 0 ifTrue:[ |
|
847 |
((classListValue includesIdentical:cls theNonMetaclass) |
|
848 |
or:[(classListValue includesIdentical:cls theMetaclass)]) ifTrue:[ |
|
849 |
newMethod := cls compiledMethodAt:(aParameter at:2). |
|
850 |
oldMethod := aParameter at:3. |
|
851 |
((oldMethod isNil |
|
852 |
and:[newMethod package ~= cls package]) |
|
853 |
or:[oldMethod notNil |
|
854 |
and:[newMethod package ~= oldMethod package]]) |
|
855 |
ifTrue:[ |
|
856 |
"/ must update the list (for the package-info) |
|
857 |
self enqueueDelayedUpdateList |
|
858 |
] |
|
859 |
] |
|
860 |
] |
|
861 |
]. |
|
862 |
^ self |
|
863 |
]. |
|
5591 | 864 |
|
6847 | 865 |
"/ kludge: must be careful if my inGenerator is a constant list. |
866 |
"/ in that case, I have to update it |
|
867 |
"/ (sigh - all a consequence of not #becoming the new class) |
|
868 |
((something == #classDefinition) or:[something == #newClass]) ifTrue:[ |
|
869 |
inGeneratorHolder value isOrderedCollection ifTrue:[ |
|
870 |
idx := inGeneratorHolder value findFirst:[:eachClass | eachClass name = aParameter theNonMetaclass name]. |
|
871 |
idx ~~ 0 ifTrue:[ |
|
872 |
inGeneratorHolder value at:idx put:aParameter. |
|
873 |
self updateListsFor:aParameter. |
|
874 |
"/ self enqueueDelayedUpdateList. |
|
875 |
] |
|
876 |
] ifFalse:[ |
|
877 |
classListValue size > 0 ifTrue:[ |
|
878 |
idx := classListValue findFirst:[:eachClass | eachClass name = aParameter theNonMetaclass name]. |
|
879 |
idx ~~ 0 ifTrue:[ |
|
880 |
listValid ifTrue:[ |
|
881 |
self classDefinitionChanged:aParameter. |
|
882 |
^ self. |
|
883 |
] |
|
884 |
] |
|
885 |
]. |
|
886 |
]. |
|
887 |
]. |
|
5591 | 888 |
]. |
889 |
||
890 |
super update:something with:aParameter from:changedObject |
|
891 |
||
6847 | 892 |
"Modified: / 06-08-2006 / 11:13:59 / cg" |
5591 | 893 |
! ! |
894 |
||
895 |
!ClassList methodsFor:'drag & drop'! |
|
896 |
||
6468 | 897 |
canDropContext:aDropContext |
7424
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
898 |
|objects| |
5591 | 899 |
|
7424
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
900 |
objects := aDropContext dropObjects collect:[:obj | obj theObject]. |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
901 |
(objects conform:[:anObject | anObject isMethod]) ifTrue:[ |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
902 |
|methods cls| |
5591 | 903 |
|
7424
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
904 |
methods := objects. |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
905 |
cls := self classAtTargetPointOf:aDropContext. |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
906 |
cls isNil ifTrue:[^ false]. |
5591 | 907 |
|
7424
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
908 |
^ methods contains:[:aMethod | aMethod mclass ~= cls] |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
909 |
]. |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
910 |
(self objectsAreClassFiles:objects) ifTrue:[^ true]. |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
911 |
^ false. |
7121 | 912 |
|
7424
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
913 |
"Modified: / 17-10-2006 / 18:26:07 / cg" |
5591 | 914 |
! |
915 |
||
916 |
classAtTargetPointOf:aDropContext |
|
917 |
|p classListView lineNr cls| |
|
918 |
||
919 |
p := aDropContext targetPoint. |
|
920 |
||
921 |
classListView := aDropContext targetWidget. |
|
922 |
||
923 |
lineNr := classListView lineAtY:p y. |
|
924 |
lineNr isNil ifTrue:[^ nil]. |
|
925 |
||
926 |
cls := classList value at:lineNr. |
|
927 |
^ cls |
|
928 |
! |
|
929 |
||
6468 | 930 |
doDropContext:aDropContext |
7424
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
931 |
|objects| |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
932 |
|
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
933 |
objects := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject]. |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
934 |
(objects conform:[:something | something isMethod]) ifTrue:[ |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
935 |
|cls methods| |
5591 | 936 |
|
7436 | 937 |
methods := objects. |
7424
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
938 |
cls := self classAtTargetPointOf:aDropContext. |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
939 |
methods first mclass isMeta ifTrue:[ |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
940 |
cls := cls theMetaclass |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
941 |
]. |
5591 | 942 |
|
7424
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
943 |
cls notNil ifTrue:[ |
8011
cfd99bd90591
Allow to copy methods with drag&drop (CTRL-key must be pressed)
Stefan Vogel <sv@exept.de>
parents:
7988
diff
changeset
|
944 |
self window sensor ctrlDown ifTrue:[ |
cfd99bd90591
Allow to copy methods with drag&drop (CTRL-key must be pressed)
Stefan Vogel <sv@exept.de>
parents:
7988
diff
changeset
|
945 |
self masterApplication copyMethods:methods toClass:cls. |
cfd99bd90591
Allow to copy methods with drag&drop (CTRL-key must be pressed)
Stefan Vogel <sv@exept.de>
parents:
7988
diff
changeset
|
946 |
] ifFalse:[ |
cfd99bd90591
Allow to copy methods with drag&drop (CTRL-key must be pressed)
Stefan Vogel <sv@exept.de>
parents:
7988
diff
changeset
|
947 |
self masterApplication moveMethods:methods toClass:cls. |
cfd99bd90591
Allow to copy methods with drag&drop (CTRL-key must be pressed)
Stefan Vogel <sv@exept.de>
parents:
7988
diff
changeset
|
948 |
]. |
7424
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
949 |
]. |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
950 |
^ self |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
951 |
]. |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
952 |
(objects conform:[:something | something isFilename]) ifTrue:[ |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
953 |
self dropClassFiles:objects. |
cb6c951e5728
drag&drop:allow dropping st-files from the windows explorer
Claus Gittinger <cg@exept.de>
parents:
7121
diff
changeset
|
954 |
^ self |
5591 | 955 |
]. |
956 |
||
7436 | 957 |
"Modified: / 21-10-2006 / 20:39:55 / cg" |
5591 | 958 |
! ! |
959 |
||
960 |
!ClassList methodsFor:'generators'! |
|
961 |
||
962 |
makeGenerator |
|
963 |
"return a generator which enumerates the method categories from the selected class; |
|
964 |
that generator generates 2-element elements (includes the class), in order |
|
965 |
to make the consumers only depend on one input (i.e. no need for another |
|
966 |
classHolder in the methodList)." |
|
967 |
||
968 |
^ Iterator on:[:whatToDo | |
|
969 |
|allEntry classes cls already anyMethod packages classIsInPackage| |
|
970 |
||
971 |
allEntry := self class nameListEntryForALL. |
|
972 |
||
973 |
classes := self selectedClasses value ? #(). |
|
974 |
packages := packageFilter value value. |
|
975 |
(packages notNil and:[packages includes:allEntry]) ifTrue:[packages := nil]. |
|
976 |
||
977 |
classes do:[:cls | |
|
978 |
(cls notNil and:[cls ~~ allEntry]) ifTrue:[ |
|
979 |
anyMethod := false. |
|
980 |
classIsInPackage := packages isNil or:[packages includes:cls package]. |
|
981 |
||
982 |
cls theNonMetaclass isJavaClass ifTrue:[ |
|
983 |
cls isMeta ifTrue:[ |
|
984 |
whatToDo value:cls theNonMetaclass value:(self class nameListEntryForStatic). |
|
985 |
] ifFalse:[ |
|
986 |
whatToDo value:cls value:(self class nameListEntryForNonStatic). |
|
987 |
] |
|
988 |
] ifFalse:[ |
|
989 |
cls supportsMethodCategories ifTrue:[ |
|
990 |
already := Set new. |
|
991 |
cls methodDictionary keysAndValuesDo:[:sel :mthd | |
|
992 |
|cat| |
|
993 |
||
994 |
cat := mthd category. |
|
995 |
(already includes:cat) ifFalse:[ |
|
996 |
(classIsInPackage |
|
997 |
or:[packages isNil |
|
998 |
or:[packages includes:mthd package]]) |
|
999 |
ifTrue:[ |
|
1000 |
already add:cat. |
|
1001 |
whatToDo value:cls value:cat. |
|
1002 |
] |
|
1003 |
] |
|
1004 |
]. |
|
1005 |
] ifFalse:[ |
|
1006 |
whatToDo value:cls value:(self class nameListEntryForNILCategory). |
|
1007 |
]. |
|
1008 |
]. |
|
1009 |
||
1010 |
anyMethod ifFalse:[ |
|
1011 |
"/ tell the one below, which classes are seen here, |
|
1012 |
"/ (even if no method is present) |
|
1013 |
"/ to allow him to decide if the className is to be shown in the list |
|
1014 |
whatToDo value:cls value:nil. |
|
1015 |
]. |
|
1016 |
]. |
|
1017 |
]. |
|
1018 |
] |
|
1019 |
||
1020 |
"Modified: / 24.2.2000 / 23:18:26 / cg" |
|
1021 |
! ! |
|
1022 |
||
1023 |
!ClassList methodsFor:'private'! |
|
1024 |
||
6902 | 1025 |
iconForClass:aClass |
1026 |
^ SystemBrowser iconForClass:aClass |
|
1027 |
||
1028 |
"Created: / 17-08-2006 / 09:12:32 / cg" |
|
1029 |
! |
|
1030 |
||
7988 | 1031 |
indentPerPrivacyLevel |
1032 |
^ 4 |
|
1033 |
! |
|
1034 |
||
5591 | 1035 |
listOfClasses |
1036 |
|classesAlready classesOrdered generator nameSpaceFilter packageFilter allName hidePrivate |
|
1037 |
privateClassesPerClass| |
|
1038 |
||
1039 |
allName := self class nameListEntryForALL. |
|
7708 | 1040 |
(self showAllClassesInNameSpaceOrganisation value) ifFalse:[ |
1041 |
nameSpaceFilter := self nameSpaceFilter value. |
|
1042 |
nameSpaceFilter notNil ifTrue:[ |
|
1043 |
(nameSpaceFilter includes:allName) ifTrue:[ |
|
1044 |
nameSpaceFilter := nil |
|
1045 |
]. |
|
1046 |
]. |
|
5591 | 1047 |
]. |
1048 |
packageFilter := self packageFilter value. |
|
1049 |
packageFilter notNil ifTrue:[ |
|
6879 | 1050 |
(packageFilter includes:allName) ifTrue:[packageFilter := nil]. |
5591 | 1051 |
]. |
1052 |
||
1053 |
inGeneratorHolder isNil ifTrue:[ |
|
6879 | 1054 |
"/ for standAlone testing |
1055 |
generator := Smalltalk allClasses. |
|
1056 |
(self hideUnloadedClasses value) ifTrue:[ |
|
1057 |
generator := generator select:[:cls | cls isLoaded] |
|
1058 |
]. |
|
5591 | 1059 |
] ifFalse:[ |
6879 | 1060 |
generator := inGeneratorHolder value. |
1061 |
generator isNil ifTrue:[^ #() ]. |
|
5591 | 1062 |
]. |
1063 |
||
1064 |
classesAlready := IdentitySet new. |
|
1065 |
classesOrdered := OrderedCollection new. |
|
1066 |
hidePrivate := self hidePrivateClasses value. |
|
1067 |
||
1068 |
privateClassesPerClass := IdentityDictionary new. |
|
1069 |
||
1070 |
generator do:[:cls | |
|
6879 | 1071 |
|owner bucket| |
5591 | 1072 |
|
6879 | 1073 |
(hidePrivate not or:[cls isPrivate not]) |
1074 |
ifTrue:[ |
|
1075 |
(nameSpaceFilter isNil |
|
1076 |
or:[self isClass:cls shownWithNameSpaceFilter:nameSpaceFilter]) ifTrue:[ |
|
1077 |
(packageFilter isNil |
|
1078 |
or:[self isClass:cls shownWithPackageFilter:packageFilter]) ifTrue:[ |
|
1079 |
(classesAlready includes:cls) ifFalse:[ |
|
1080 |
classesAlready add:cls. |
|
1081 |
(owner := cls owningClass) notNil ifTrue:[ |
|
7743
e19202de8928
dont crash with nil class names
Claus Gittinger <cg@exept.de>
parents:
7708
diff
changeset
|
1082 |
bucket := privateClassesPerClass at:owner ifAbsentPut:[SortedCollection new sortBlock:[:a :b | (a name ? '?') < (b name ? '?')] ]. |
6879 | 1083 |
bucket add:cls. |
1084 |
] ifFalse:[ |
|
1085 |
classesOrdered add:cls. |
|
1086 |
] |
|
1087 |
] |
|
1088 |
] |
|
1089 |
] |
|
1090 |
] |
|
5591 | 1091 |
]. |
1092 |
||
1093 |
classesOrdered size == 1 ifTrue:[ |
|
6879 | 1094 |
self classLabelHolder value:(classesOrdered first name) |
5591 | 1095 |
] ifFalse:[ |
1096 |
"/ self classLabelHolder value:(classes size printString , ' classes'). |
|
6879 | 1097 |
sortBy value ~~ #doNotSort ifTrue:[ |
1098 |
classesOrdered sort:[:a :b | a name < b name]. |
|
1099 |
] |
|
5591 | 1100 |
]. |
1101 |
||
1102 |
privateClassesPerClass notEmpty ifTrue:[ |
|
6879 | 1103 |
|stream action| |
5591 | 1104 |
|
6879 | 1105 |
stream := WriteStream on:(Array new). |
5591 | 1106 |
|
6879 | 1107 |
action := [:eachClass | |
1108 |
|bucket| |
|
5591 | 1109 |
|
6879 | 1110 |
stream nextPut:eachClass. |
1111 |
bucket := privateClassesPerClass at:eachClass ifAbsent:nil. |
|
1112 |
bucket notNil ifTrue:[ |
|
1113 |
bucket do:action. |
|
1114 |
] |
|
1115 |
]. |
|
5591 | 1116 |
|
6879 | 1117 |
classesOrdered do:action. |
1118 |
classesOrdered := stream contents. |
|
5591 | 1119 |
]. |
1120 |
||
1121 |
"/ |
|
1122 |
"/ does not work (yet) |
|
1123 |
"/ classes addFirst:AllEntry. |
|
1124 |
^ classesOrdered |
|
1125 |
||
7708 | 1126 |
"Modified: / 05-03-2007 / 16:58:12 / cg" |
5591 | 1127 |
! |
1128 |
||
1129 |
makeDependent |
|
1130 |
Smalltalk addDependent:self. |
|
1131 |
ChangeSet addDependent:self. |
|
1132 |
||
1133 |
"Created: / 5.2.2000 / 13:42:17 / cg" |
|
1134 |
! |
|
1135 |
||
1136 |
makeIndependent |
|
1137 |
Smalltalk removeDependent:self. |
|
1138 |
ChangeSet removeDependent:self. |
|
1139 |
! |
|
1140 |
||
1141 |
nameListEntryFor:aClass withNameSpace:useFullName |
|
7988 | 1142 |
|nm indent owner orgMode indentString javaPackage| |
5591 | 1143 |
|
1144 |
aClass == (self class nameListEntryForALL) ifTrue:[ ^ aClass ]. |
|
1145 |
||
1146 |
nm := aClass nameInBrowser. |
|
6006 | 1147 |
|
5591 | 1148 |
aClass isLoaded ifFalse:[ |
6006 | 1149 |
unloadedClassesColor notNil ifTrue:[ |
1150 |
nm := nm asText emphasizeAllWith:(#color->unloadedClassesColor) |
|
1151 |
] |
|
5591 | 1152 |
]. |
1153 |
||
1154 |
orgMode := organizerMode value. |
|
6738
8226c7e2907b
magic constants (organizerMode) removed
Claus Gittinger <cg@exept.de>
parents:
6716
diff
changeset
|
1155 |
orgMode == OrganizerCanvas organizerModeHierarchy ifTrue:[ |
6006 | 1156 |
"/ always show the full name |
1157 |
^ nm |
|
5591 | 1158 |
]. |
6738
8226c7e2907b
magic constants (organizerMode) removed
Claus Gittinger <cg@exept.de>
parents:
6716
diff
changeset
|
1159 |
orgMode == OrganizerCanvas organizerModeClassHierarchy ifTrue:[ |
6006 | 1160 |
"/ always show the full name |
1161 |
^ nm |
|
5591 | 1162 |
]. |
1163 |
||
1164 |
aClass isJavaClass ifTrue:[ |
|
6006 | 1165 |
"/ only show the last name, unless multiple packages are shown in the list |
1166 |
javaPackage := aClass package. |
|
1167 |
(self classList value contains:[:cls | cls package ~= javaPackage]) ifTrue:[ |
|
1168 |
^ nm |
|
1169 |
]. |
|
1170 |
^ aClass lastName |
|
5591 | 1171 |
]. |
1172 |
||
1173 |
useFullName ifFalse:[ |
|
6006 | 1174 |
aClass isPrivate ifFalse:[ |
1175 |
^ aClass nameWithoutNameSpacePrefix |
|
1176 |
] |
|
5591 | 1177 |
]. |
1178 |
||
1179 |
"/ full name required if owner is not in the list |
|
1180 |
owner := aClass owningClass. |
|
1181 |
(owner isNil |
|
1182 |
or:[(self classList value includesIdentical:owner) not]) ifTrue:[ |
|
6006 | 1183 |
^ nm |
5591 | 1184 |
]. |
1185 |
||
1186 |
"/ namespace |
|
1187 |
indent := 0. |
|
7988 | 1188 |
indent := (nm count:[:char | char == $:]) // 2. |
1189 |
indent > 0 ifTrue:[ |
|
1190 |
indent := indent * self indentPerPrivacyLevel. |
|
1191 |
indent <= 12 ifTrue:[ |
|
6006 | 1192 |
indentString := #( |
7988 | 1193 |
' ' |
6006 | 1194 |
' ' |
7988 | 1195 |
' ' |
6006 | 1196 |
' ' |
7988 | 1197 |
' ' |
6006 | 1198 |
' ' |
7988 | 1199 |
' ' |
6006 | 1200 |
' ' |
7988 | 1201 |
' ' |
6006 | 1202 |
' ' |
7988 | 1203 |
' ' |
1204 |
' ' |
|
1205 |
) at:indent. |
|
6006 | 1206 |
] ifFalse:[ |
7988 | 1207 |
indentString := String new:indent withAll:Character space. |
6006 | 1208 |
]. |
1209 |
nm := indentString , '::' , aClass nameWithoutPrefix |
|
5591 | 1210 |
]. |
1211 |
^ nm |
|
1212 |
||
1213 |
"Modified: / 24.2.2000 / 17:52:28 / cg" |
|
1214 |
! |
|
1215 |
||
1216 |
nameListForClasses:aClassList |
|
1217 |
"only reconstruct the names - class list & selection remains |
|
1218 |
unschanged. Invoked when the organizerMode mode changes" |
|
1219 |
||
1220 |
|orgMode namespaces showNamespaces fullNameList nameList |
|
7708 | 1221 |
filteredPackages filteredNameSpaces classesInCangeSet classesInRemoteChangeSet |
1222 |
classNamesInChangeSet classNamesInRemoteChangeSet| |
|
5591 | 1223 |
|
1224 |
showNamespaces := false. |
|
1225 |
||
1226 |
filteredNameSpaces := nameSpaceFilter value. |
|
1227 |
(filteredNameSpaces isNil |
|
6738
8226c7e2907b
magic constants (organizerMode) removed
Claus Gittinger <cg@exept.de>
parents:
6716
diff
changeset
|
1228 |
and:[self organizerMode value ~~ OrganizerCanvas organizerModeNamespace]) ifTrue:[ |
5950 | 1229 |
showNamespaces := true. "/ if no filter, always show the namespace. |
5591 | 1230 |
] ifFalse:[ |
5950 | 1231 |
(filteredNameSpaces size > 1 |
1232 |
or:[(filteredNameSpaces size > 0) |
|
1233 |
and:[filteredNameSpaces includes:(self class nameListEntryForALL)]]) ifTrue:[ |
|
1234 |
showNamespaces := true |
|
1235 |
] ifFalse:[ |
|
1236 |
"/ if there are classes from multiple namespaces, |
|
1237 |
"/ show the full name |
|
5591 | 1238 |
|
5950 | 1239 |
namespaces := IdentitySet new. |
1240 |
fullNameList := OrderedCollection new. |
|
5591 | 1241 |
|
5950 | 1242 |
aClassList |
1243 |
do:[:cls | |nm| |
|
1244 |
nm := cls nameInBrowser. |
|
1245 |
fullNameList add:nm. |
|
1246 |
namespaces add:cls topNameSpace. |
|
1247 |
]. |
|
1248 |
showNamespaces := namespaces size > 1 |
|
1249 |
]. |
|
5591 | 1250 |
]. |
1251 |
||
1252 |
orgMode := organizerMode value. |
|
1253 |
filteredPackages := packageFilter value value. |
|
1254 |
||
1255 |
classesInCangeSet := ChangeSet current changedClasses. |
|
1256 |
classesInCangeSet := classesInCangeSet collect:[:each | each theNonMetaclass]. |
|
7708 | 1257 |
classNamesInChangeSet := classesInCangeSet collect:[:each | each name]. |
5591 | 1258 |
|
7503 | 1259 |
classesInRemoteChangeSet := SmallTeam isNil ifTrue:[#()] ifFalse:[ SmallTeam changedClasses ]. |
1260 |
classesInRemoteChangeSet := classesInRemoteChangeSet collect:[:each | each theNonMetaclass]. |
|
7708 | 1261 |
classNamesInRemoteChangeSet := classesInRemoteChangeSet collect:[:each | each name]. |
7503 | 1262 |
|
5591 | 1263 |
nameList := aClassList |
5950 | 1264 |
collect:[:cls | |
5591 | 1265 |
|
7503 | 1266 |
|nm pkg emPkg hasExtensions isInChangeSet isInRemoteChangeSet icon| |
5591 | 1267 |
|
7708 | 1268 |
isInChangeSet := classNamesInChangeSet includes:(cls theNonMetaclass name). |
1269 |
isInRemoteChangeSet := classNamesInRemoteChangeSet includes:(cls theNonMetaclass name). |
|
5591 | 1270 |
|
5950 | 1271 |
nm := self nameListEntryFor:cls withNameSpace:showNamespaces. |
1272 |
isInChangeSet ifTrue:[ |
|
1273 |
nm := self emphasizeForChangedCode:nm |
|
1274 |
]. |
|
7503 | 1275 |
isInRemoteChangeSet ifTrue:[ |
1276 |
nm := (self colorizeForChangedCodeInSmallTeam:'!! '),nm |
|
1277 |
]. |
|
5591 | 1278 |
|
6916 | 1279 |
pkg := cls package ? '-'. |
5950 | 1280 |
hasExtensions := cls hasExtensions. |
1281 |
hasExtensions ifTrue:[ |
|
1282 |
emPkg := self emphasizeForDifferentPackage:'+'. "/ self emphasizeForDifferentPackage:pkg. |
|
1283 |
]. |
|
5591 | 1284 |
|
6738
8226c7e2907b
magic constants (organizerMode) removed
Claus Gittinger <cg@exept.de>
parents:
6716
diff
changeset
|
1285 |
orgMode == OrganizerCanvas organizerModeProject ifTrue:[ |
5950 | 1286 |
(filteredPackages notNil |
1287 |
and:[(filteredPackages includes:cls package) not]) ifTrue:[ |
|
1288 |
"/ class is in another packae; |
|
1289 |
"/ however, class is listed due to methods |
|
1290 |
"/ in the filtered package |
|
1291 |
hasExtensions ifTrue:[ |
|
1292 |
nm := nm , emPkg. |
|
1293 |
] ifFalse:[ |
|
1294 |
nm := nm , ' [ ' , pkg, ' ]'. |
|
1295 |
]. |
|
1296 |
] ifFalse:[ |
|
1297 |
"/ any methods from other packages in this class ? |
|
1298 |
hasExtensions ifTrue:[ |
|
1299 |
nm := nm , (self emphasizeForDifferentPackage:'+'). |
|
1300 |
]. |
|
1301 |
]. |
|
1302 |
] ifFalse:[ |
|
1303 |
showClassPackages value == true ifTrue:[ |
|
1304 |
"/ add the package; |
|
1305 |
hasExtensions ifTrue:[ |
|
6006 | 1306 |
nm := nm , ' [ ' , pkg, ' ]' , (self emphasizeForDifferentPackage:'+'). |
5950 | 1307 |
"/ isInChangeSet ifFalse:[ |
1308 |
"/ nm := self colorizeForDifferentPackage:nm |
|
1309 |
"/ ]. |
|
1310 |
] ifFalse:[ |
|
1311 |
nm := nm , (self colorizeGrey:(' [ ' , pkg, ' ]')). |
|
1312 |
]. |
|
1313 |
] ifFalse:[ |
|
1314 |
hasExtensions ifTrue:[ |
|
1315 |
nm := nm , emPkg. |
|
1316 |
"/ isInChangeSet ifFalse:[ |
|
1317 |
"/ nm := self colorizeForDifferentPackage:nm |
|
1318 |
"/ ] |
|
1319 |
]. |
|
1320 |
] |
|
1321 |
]. |
|
6879 | 1322 |
|
1323 |
isInChangeSet ifTrue:[ |
|
7055 | 1324 |
nm := nm , self class markForBeingInChangeList |
6879 | 1325 |
]. |
5591 | 1326 |
"/ cls isVisualStartable ifTrue:[ |
1327 |
"/ nm := LabelAndIcon icon:((SystemBrowser visualStartableClassIcon) |
|
1328 |
"/ onDevice:self window device) |
|
1329 |
"/ string:nm |
|
1330 |
"/ ]. |
|
5950 | 1331 |
markApplicationsHolder value== true ifTrue:[ |
6902 | 1332 |
icon := self iconForClass:cls theNonMetaclass. |
5950 | 1333 |
icon isNil ifTrue:[ |
1334 |
icon := SystemBrowser emptyIcon |
|
1335 |
]. |
|
1336 |
nm := LabelAndIcon icon:icon string:nm |
|
5591 | 1337 |
|
5950 | 1338 |
]. |
1339 |
nm |
|
1340 |
]. |
|
5591 | 1341 |
|
1342 |
^ nameList |
|
1343 |
||
7708 | 1344 |
"Modified: / 05-03-2007 / 17:01:39 / cg" |
5591 | 1345 |
! |
1346 |
||
1347 |
reconstructNameList |
|
1348 |
"only reconstruct the names - class list & selection remains |
|
1349 |
unschanged. Invoked when the organizerMode mode changes" |
|
1350 |
||
1351 |
|prevMode listView oldNameList newNameList sav| |
|
1352 |
||
1353 |
self classList value isNil ifTrue:[ |
|
8072 | 1354 |
self updateList |
5591 | 1355 |
]. |
1356 |
||
1357 |
newNameList := self nameListForClasses:(classList value ? #()). |
|
1358 |
oldNameList := self classNameList value ? #(). |
|
1359 |
(newNameList |
|
8072 | 1360 |
sameContentsAs: oldNameList |
1361 |
whenComparedWith:[:a :b | (a sameStringAndEmphasisAs: b) |
|
1362 |
and:[ a hasImage == b hasImage |
|
1363 |
and:[ a hasIcon == b hasIcon ]]] |
|
5591 | 1364 |
) |
1365 |
ifTrue:[ |
|
8072 | 1366 |
"/ no need to update |
5591 | 1367 |
] ifFalse:[ |
8072 | 1368 |
builder notNil ifTrue:[ |
1369 |
listView := builder componentAt:#List. |
|
1370 |
]. |
|
1371 |
(listView isNil or:[listView scrolledView isNil]) ifTrue:[ |
|
1372 |
"/ invoked very early during setup |
|
1373 |
self classNameList value:newNameList |
|
1374 |
] ifFalse:[ |
|
1375 |
"/ avoid flicker and useless redraws |
|
5591 | 1376 |
|
8072 | 1377 |
prevMode := listView scrollWhenUpdating. |
1378 |
listView scrollWhenUpdating:nil. |
|
5591 | 1379 |
|
8072 | 1380 |
"/ this will lead to a selectionIndex change (done by the selListView); |
1381 |
"/ however, we dont want this here, since it recurses into |
|
1382 |
"/ a selectionChange. Therefore, temporarily disconnect the selectionIndexHolder... |
|
1383 |
[ |
|
1384 |
self selectedClassNameIndices removeDependent:self. |
|
1385 |
"/ also, dont want a callback (selectionChangedByClick) |
|
1386 |
sav := listView action. |
|
1387 |
listView action:nil. |
|
1388 |
self classNameList value:newNameList. |
|
1389 |
] ensure:[ |
|
1390 |
listView action:sav. |
|
1391 |
self selectedClassNameIndices addDependent:self. |
|
1392 |
listView scrollWhenUpdating:prevMode. |
|
1393 |
]. |
|
1394 |
] |
|
5591 | 1395 |
]. |
1396 |
||
1397 |
"Modified: / 31.10.2001 / 11:33:21 / cg" |
|
1398 |
! |
|
1399 |
||
1400 |
release |
|
1401 |
super release. |
|
1402 |
||
1403 |
currentNamespace removeDependent:self. |
|
1404 |
hidePrivateClasses removeDependent:self. |
|
1405 |
markApplicationsHolder removeDependent:self. |
|
1406 |
meta removeDependent:self. |
|
1407 |
selectedClassNameIndices removeDependent:self. |
|
1408 |
showClassPackages removeDependent:self. |
|
1409 |
||
1410 |
"Created: / 5.2.2000 / 13:42:18 / cg" |
|
1411 |
! |
|
1412 |
||
1413 |
updateClassesIn:aCollection |
|
1414 |
"replace any obsolete class in aCollection; |
|
1415 |
return true, if any was found" |
|
1416 |
||
1417 |
|found meta classes| |
|
1418 |
||
1419 |
found := false. |
|
1420 |
||
1421 |
aCollection isSequenceable ifFalse:[ |
|
1422 |
classes := aCollection copy. |
|
1423 |
aCollection removeAll. |
|
1424 |
classes do:[:cls | |
|
1425 |
|newClass| |
|
1426 |
||
1427 |
meta := cls isMeta. |
|
1428 |
newClass := Smalltalk at:(cls theNonMetaclass name). |
|
1429 |
newClass isNil ifTrue:[ |
|
1430 |
newClass := cls |
|
1431 |
] ifFalse:[ |
|
1432 |
meta ifTrue:[ |
|
1433 |
newClass := newClass class |
|
1434 |
] |
|
1435 |
]. |
|
1436 |
found := cls ~~ newClass. |
|
1437 |
aCollection add:newClass. |
|
1438 |
]. |
|
1439 |
] ifTrue:[ |
|
1440 |
aCollection keysAndValuesDo:[:idx :cls | |
|
1441 |
|newClass| |
|
1442 |
||
1443 |
cls notNil ifTrue:[ |
|
1444 |
meta := cls isMeta. |
|
1445 |
newClass := Smalltalk at:(cls theNonMetaclass name). |
|
1446 |
newClass isNil ifTrue:[ |
|
1447 |
newClass := cls |
|
1448 |
] ifFalse:[ |
|
1449 |
meta ifTrue:[ |
|
1450 |
newClass := newClass class |
|
1451 |
] |
|
1452 |
]. |
|
1453 |
found := cls ~~ newClass. |
|
1454 |
aCollection at:idx put:newClass. |
|
1455 |
] |
|
1456 |
]. |
|
1457 |
]. |
|
1458 |
^ found |
|
1459 |
! |
|
1460 |
||
1461 |
updateList |
|
1462 |
|prevSelection oldList newList newSelectionIndices |
|
6712 | 1463 |
forceSelectionChange selectedClassNameIndicesHolder classList |
1464 |
classesAddedToList classesRemovedFromList newSet oldSet| |
|
5591 | 1465 |
|
1466 |
newList := self listOfClasses. |
|
1467 |
classList := self classList. |
|
1468 |
oldList := classList value ? #(). |
|
1469 |
||
6712 | 1470 |
autoSelect == true ifTrue:[ |
1471 |
classesRemovedFromList := OrderedCollection new. |
|
1472 |
newSet := newList asSet. |
|
1473 |
oldSet := oldList asSet. |
|
1474 |
classesAddedToList := newSet select:[:eachNewClass | (oldSet includes:eachNewClass) not]. |
|
1475 |
classesRemovedFromList := oldSet select:[:eachOldClass | (newSet includes:eachOldClass) not]. |
|
1476 |
]. |
|
1477 |
||
5591 | 1478 |
(newList ~= oldList |
1479 |
or:[self classNameList value isNil and:[newList size > 0]]) ifTrue:[ |
|
6318
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1480 |
prevSelection := lastSelectedClasses ? #(). |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1481 |
prevSelection := prevSelection select:[:each | each notNil]. |
5591 | 1482 |
|
6318
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1483 |
(newList collect:[:each | each name]) = (oldList collect:[:each | each name]) ifTrue:[ |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1484 |
"/ no need to tell anybody |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1485 |
classList setValue:newList. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1486 |
] ifFalse:[ |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1487 |
classList value:newList. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1488 |
]. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1489 |
self reconstructNameList. |
5591 | 1490 |
|
6318
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1491 |
(prevSelection size == 0 |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1492 |
and:[self selectedClasses value size ~~ 0]) ifTrue:[ |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1493 |
"/ this happens during early startup time, |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1494 |
"/ when the selection is already (pre-)set, |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1495 |
"/ and the classList is generated the first time |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1496 |
"/ (i.e. when opened with preset selection) |
5591 | 1497 |
|
6318
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1498 |
"/ do not clobber the selection in this case. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1499 |
prevSelection := self selectedClasses value. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1500 |
prevSelection := prevSelection select:[:cls | cls notNil]. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1501 |
"/ simulate a change, to force selection update in listView |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1502 |
forceSelectionChange := true. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1503 |
]. |
5591 | 1504 |
|
6712 | 1505 |
autoSelect == true ifTrue:[ |
1506 |
prevSelection isNil ifTrue:[ |
|
1507 |
prevSelection := OrderedCollection new |
|
1508 |
]. |
|
1509 |
prevSelection := prevSelection asOrderedCollection. |
|
1510 |
||
1511 |
classesAddedToList do:[:eachNewClass | |
|
1512 |
(prevSelection includes:eachNewClass) ifFalse:[ |
|
1513 |
prevSelection add:eachNewClass. |
|
1514 |
]. |
|
1515 |
]. |
|
1516 |
classesRemovedFromList do:[:eachOldClass | |
|
1517 |
prevSelection remove:eachOldClass ifAbsent:[]. |
|
1518 |
]. |
|
1519 |
]. |
|
1520 |
||
6318
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1521 |
newSelectionIndices := prevSelection |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1522 |
collect:[:item | |cls| |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1523 |
cls := Smalltalk at:item theNonMetaclass name. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1524 |
newList identityIndexOf:cls] |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1525 |
thenSelect:[:index | index ~~ 0]. |
5591 | 1526 |
|
6318
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1527 |
selectedClassNameIndicesHolder := self selectedClassNameIndices. |
6749
7ba97d579490
fixes for use in MetricViewer
Claus Gittinger <cg@exept.de>
parents:
6738
diff
changeset
|
1528 |
|
6318
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1529 |
((selectedClassNameIndicesHolder value size ~~ self selectedClasses value size) |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1530 |
or:[newSelectionIndices ~= selectedClassNameIndicesHolder value]) |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1531 |
ifTrue:[ |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1532 |
newSelectionIndices notEmpty ifTrue:[ |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1533 |
"/ force change (for dependents) |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1534 |
"/ selectedClassNameIndicesHolder value:newSelectionIndices. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1535 |
] ifFalse:[ |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1536 |
prevSelection := self selectedClasses value. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1537 |
newSelectionIndices := #(). |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1538 |
]. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1539 |
selectedClassNameIndicesHolder value:newSelectionIndices. |
5591 | 1540 |
|
6318
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1541 |
prevSelection notNil ifTrue:[ |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1542 |
lastSelectedClasses := prevSelection. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1543 |
]. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1544 |
self updateOutputGenerator. |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1545 |
]. |
5591 | 1546 |
|
1547 |
] ifFalse:[ |
|
6318
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1548 |
"/ same classes - but name(s) could be differnet |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1549 |
newList size > 0 ifTrue:[ |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1550 |
self reconstructNameList |
9a3fc13f86be
care for non-existing class in selection
Claus Gittinger <cg@exept.de>
parents:
6208
diff
changeset
|
1551 |
] |
5591 | 1552 |
]. |
1553 |
listValid := true. |
|
1554 |
||
1555 |
"Created: / 5.2.2000 / 13:42:18 / cg" |
|
1556 |
"Modified: / 31.10.2001 / 11:35:39 / cg" |
|
1557 |
! |
|
1558 |
||
1559 |
updateListsFor:aClass |
|
1560 |
|classes found foundInSelection| |
|
1561 |
||
1562 |
found := foundInSelection := false. |
|
1563 |
||
1564 |
"/ update for a changed class in the classList |
|
1565 |
(classes := classList value) size > 0 ifTrue:[ |
|
7984 | 1566 |
(self updateClassesIn:classes) ifTrue:[ |
1567 |
found := true |
|
1568 |
]. |
|
1569 |
(classes includes:nil) ifTrue:[ |
|
7985 | 1570 |
"/ self halt:'should not happen'. |
7984 | 1571 |
classList value:(classes := classes select:[:each | each notNil]). |
1572 |
]. |
|
5591 | 1573 |
]. |
1574 |
"/ possibly in the generator |
|
1575 |
((classes := inGeneratorHolder value) isOrderedCollection |
|
1576 |
and:[classes size > 0]) ifTrue:[ |
|
7984 | 1577 |
(self updateClassesIn:classes) ifTrue:[ |
1578 |
found := true |
|
1579 |
]. |
|
1580 |
(classes includes:nil) ifTrue:[ |
|
7985 | 1581 |
"/ self halt:'should not happen'. |
7984 | 1582 |
inGeneratorHolder value:(classes select:[:each | each notNil]). |
1583 |
] |
|
5591 | 1584 |
]. |
1585 |
"/ and in the selection |
|
1586 |
(classes := self selectedClasses value) size > 0 ifTrue:[ |
|
7984 | 1587 |
(self updateClassesIn:classes) ifTrue:[ |
1588 |
found := true. |
|
1589 |
foundInSelection := true. |
|
1590 |
]. |
|
1591 |
(classes includes:nil) ifTrue:[ |
|
7985 | 1592 |
"/ self halt:'should not happen'. |
7984 | 1593 |
self selectedClasses value:(classes select:[:each | each notNil]). |
1594 |
] |
|
5591 | 1595 |
]. |
1596 |
"/ and in the last selection |
|
1597 |
(classes := lastSelectedClasses) size > 0 ifTrue:[ |
|
7984 | 1598 |
(self updateClassesIn:classes) ifTrue:[ |
1599 |
found := true |
|
1600 |
]. |
|
1601 |
(classes includes:nil) ifTrue:[ |
|
1602 |
"/ self halt:'should not happen'. |
|
1603 |
lastSelectedClasses := (classes select:[:each | each notNil]). |
|
1604 |
] |
|
5591 | 1605 |
]. |
1606 |
||
1607 |
found ifFalse:[ |
|
7984 | 1608 |
"/ could be a new class (or no-longer autolaoded one). |
1609 |
listValid ifTrue:[ |
|
1610 |
self enqueueDelayedUpdateList. |
|
1611 |
]. |
|
1612 |
listValid := false. |
|
5591 | 1613 |
]. |
1614 |
foundInSelection ifTrue:[ |
|
7984 | 1615 |
"/ force update of output generator |
1616 |
self selectedClasses |
|
1617 |
removeDependent:self; |
|
1618 |
changed; |
|
1619 |
addDependent:self. |
|
5591 | 1620 |
]. |
1621 |
||
1622 |
"Modified: / 25.2.2000 / 23:54:19 / cg" |
|
1623 |
! ! |
|
1624 |
||
1625 |
!ClassList methodsFor:'setup'! |
|
1626 |
||
6749
7ba97d579490
fixes for use in MetricViewer
Claus Gittinger <cg@exept.de>
parents:
6738
diff
changeset
|
1627 |
autoSelect:aBoolean |
7ba97d579490
fixes for use in MetricViewer
Claus Gittinger <cg@exept.de>
parents:
6738
diff
changeset
|
1628 |
autoSelect ~~ aBoolean ifTrue:[ |
7ba97d579490
fixes for use in MetricViewer
Claus Gittinger <cg@exept.de>
parents:
6738
diff
changeset
|
1629 |
autoSelect := aBoolean. |
7ba97d579490
fixes for use in MetricViewer
Claus Gittinger <cg@exept.de>
parents:
6738
diff
changeset
|
1630 |
classList value:nil. |
7ba97d579490
fixes for use in MetricViewer
Claus Gittinger <cg@exept.de>
parents:
6738
diff
changeset
|
1631 |
]. |
7ba97d579490
fixes for use in MetricViewer
Claus Gittinger <cg@exept.de>
parents:
6738
diff
changeset
|
1632 |
! |
7ba97d579490
fixes for use in MetricViewer
Claus Gittinger <cg@exept.de>
parents:
6738
diff
changeset
|
1633 |
|
5591 | 1634 |
postBuildWith:aBuilder |
1635 |
|classListView| |
|
1636 |
||
1637 |
super postBuildWith:aBuilder. |
|
1638 |
||
1639 |
classListView := aBuilder componentAt:'List'. |
|
1640 |
classListView notNil ifTrue:[ |
|
1641 |
classListView allowDrag:true. |
|
1642 |
classListView dragObjectConverter:[:obj | |
|
1643 |
|nm class idx| |
|
1644 |
||
1645 |
nm := obj theObject asString. |
|
1646 |
idx := classNameList value indexOf:nm. |
|
1647 |
idx == 0 ifTrue:[ |
|
1648 |
idx := classNameList value indexOf:nm string. |
|
1649 |
]. |
|
1650 |
class := classList value at:idx. |
|
1651 |
DropObject newClass:class. |
|
1652 |
]. |
|
1653 |
] |
|
1654 |
! ! |
|
1655 |
||
1656 |
!ClassList class methodsFor:'documentation'! |
|
1657 |
||
1658 |
version |
|
8072 | 1659 |
^ '$Header: /cvs/stx/stx/libtool/Tools_ClassList.st,v 1.33 2008-04-21 16:06:38 cg Exp $' |
5591 | 1660 |
! ! |