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:#NamespaceList
|
|
18 |
instanceVariableNames:'namespaceNameList namespaceList'
|
|
19 |
classVariableNames:''
|
|
20 |
poolDictionaries:''
|
|
21 |
category:'Interface-Browsers-New'
|
|
22 |
!
|
|
23 |
|
|
24 |
!NamespaceList class methodsFor:'documentation'!
|
|
25 |
|
|
26 |
copyright
|
|
27 |
"
|
|
28 |
COPYRIGHT (c) 2000 by eXept Software AG
|
|
29 |
All Rights Reserved
|
|
30 |
|
|
31 |
This software is furnished under a license and may be used
|
|
32 |
only in accordance with the terms of that license and with the
|
|
33 |
inclusion of the above copyright notice. This software may not
|
|
34 |
be provided or otherwise made available to, or used by, any
|
|
35 |
other person. No title to or ownership of the software is
|
|
36 |
hereby transferred.
|
|
37 |
"
|
|
38 |
! !
|
|
39 |
|
|
40 |
!NamespaceList class methodsFor:'interface specs'!
|
|
41 |
|
|
42 |
singleNameSpaceWindowSpec
|
|
43 |
"This resource specification was automatically generated
|
|
44 |
by the UIPainter of ST/X."
|
|
45 |
|
|
46 |
"Do not manually edit this!! If it is corrupted,
|
|
47 |
the UIPainter may not be able to read the specification."
|
|
48 |
|
|
49 |
"
|
|
50 |
UIPainter new openOnClass:ClassCategoryList andSelector:#singleCategoryWindowSpec
|
|
51 |
ClassCategoryList new openInterface:#singleCategoryWindowSpec
|
|
52 |
"
|
|
53 |
|
|
54 |
<resource: #canvas>
|
|
55 |
|
|
56 |
^
|
|
57 |
#(#FullSpec
|
5592
|
58 |
#name: #singleNameSpaceWindowSpec
|
|
59 |
#window:
|
5591
|
60 |
#(#WindowSpec
|
5592
|
61 |
#label: 'NameSpaceList'
|
|
62 |
#name: 'NameSpaceList'
|
|
63 |
#min: #(#Point 0 0)
|
|
64 |
#max: #(#Point 1024 721)
|
|
65 |
#bounds: #(#Rectangle 218 175 518 475)
|
|
66 |
)
|
|
67 |
#component:
|
5591
|
68 |
#(#SpecCollection
|
5592
|
69 |
#collection: #(
|
|
70 |
#(#LabelSpec
|
|
71 |
#label: 'NameSpaceName'
|
|
72 |
#name: 'NameSpaceLabel'
|
|
73 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 25 0)
|
|
74 |
#translateLabel: true
|
|
75 |
#labelChannel: #nameSpaceLabelHolder
|
|
76 |
#menu: #menuHolder
|
|
77 |
)
|
|
78 |
)
|
5591
|
79 |
|
5592
|
80 |
)
|
5591
|
81 |
)
|
|
82 |
!
|
|
83 |
|
|
84 |
singleNamespaceWindowSpec
|
|
85 |
"This resource specification was automatically generated
|
|
86 |
by the UIPainter of ST/X."
|
|
87 |
|
|
88 |
"Do not manually edit this!! If it is corrupted,
|
|
89 |
the UIPainter may not be able to read the specification."
|
|
90 |
|
|
91 |
"
|
|
92 |
UIPainter new openOnClass:ClassCategoryList andSelector:#singleCategoryWindowSpec
|
|
93 |
ClassCategoryList new openInterface:#singleCategoryWindowSpec
|
|
94 |
"
|
|
95 |
|
|
96 |
<resource: #canvas>
|
|
97 |
|
|
98 |
^
|
|
99 |
#(#FullSpec
|
5592
|
100 |
#name: #singleNamespaceWindowSpec
|
|
101 |
#window:
|
5591
|
102 |
#(#WindowSpec
|
5592
|
103 |
#label: 'NamespaceList'
|
|
104 |
#name: 'NamespaceList'
|
|
105 |
#min: #(#Point 0 0)
|
|
106 |
#max: #(#Point 1024 721)
|
|
107 |
#bounds: #(#Rectangle 218 175 518 475)
|
|
108 |
)
|
|
109 |
#component:
|
5591
|
110 |
#(#SpecCollection
|
5592
|
111 |
#collection: #(
|
|
112 |
#(#LabelSpec
|
|
113 |
#label: 'NamespaceName'
|
|
114 |
#name: 'NamespaceLabel'
|
|
115 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 25 0)
|
|
116 |
#translateLabel: true
|
|
117 |
#labelChannel: #nameSpaceLabelHolder
|
|
118 |
#menu: #menuHolder
|
|
119 |
)
|
|
120 |
)
|
5591
|
121 |
|
5592
|
122 |
)
|
5591
|
123 |
)
|
|
124 |
!
|
|
125 |
|
|
126 |
windowSpec
|
|
127 |
"This resource specification was automatically generated
|
|
128 |
by the UIPainter of ST/X."
|
|
129 |
|
|
130 |
"Do not manually edit this!! If it is corrupted,
|
|
131 |
the UIPainter may not be able to read the specification."
|
|
132 |
|
|
133 |
"
|
|
134 |
UIPainter new openOnClass:ProjectList andSelector:#windowSpec
|
|
135 |
ProjectList new openInterface:#windowSpec
|
|
136 |
ProjectList open
|
|
137 |
"
|
|
138 |
|
|
139 |
<resource: #canvas>
|
|
140 |
|
|
141 |
^
|
|
142 |
#(#FullSpec
|
5592
|
143 |
#name: #windowSpec
|
|
144 |
#window:
|
5591
|
145 |
#(#WindowSpec
|
5592
|
146 |
#label: 'NamespaceList'
|
|
147 |
#name: 'NamespaceList'
|
|
148 |
#min: #(#Point 0 0)
|
|
149 |
#max: #(#Point 1024 721)
|
|
150 |
#bounds: #(#Rectangle 13 23 313 323)
|
|
151 |
)
|
|
152 |
#component:
|
5591
|
153 |
#(#SpecCollection
|
5592
|
154 |
#collection: #(
|
|
155 |
#(#SequenceViewSpec
|
|
156 |
#name: 'List'
|
|
157 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
158 |
#tabable: true
|
|
159 |
#model: #selectedNamespaces
|
|
160 |
#menu: #menuHolder
|
|
161 |
#hasHorizontalScrollBar: true
|
|
162 |
#hasVerticalScrollBar: true
|
|
163 |
#miniScrollerHorizontal: true
|
|
164 |
#isMultiSelect: true
|
|
165 |
#valueChangeSelector: #selectionChangedByClick
|
|
166 |
#useIndex: false
|
|
167 |
#sequenceList: #nameSpaceList
|
|
168 |
#doubleClickChannel: #doubleClickChannel
|
|
169 |
)
|
|
170 |
)
|
5591
|
171 |
|
5592
|
172 |
)
|
5591
|
173 |
)
|
|
174 |
|
|
175 |
"Created: / 18.2.2000 / 01:06:05 / cg"
|
|
176 |
"Modified: / 18.2.2000 / 01:24:50 / cg"
|
|
177 |
! !
|
|
178 |
|
|
179 |
!NamespaceList class methodsFor:'queries-plugin'!
|
|
180 |
|
|
181 |
aspectSelectors
|
|
182 |
^ #(
|
|
183 |
#(#doubleClickChannel #action )
|
|
184 |
immediateUpdate
|
|
185 |
selectedNamespaces
|
|
186 |
menuHolder
|
|
187 |
inGeneratorHolder
|
|
188 |
outGeneratorHolder
|
|
189 |
selectionChangeCondition
|
|
190 |
updateTrigger
|
|
191 |
forceGeneratorTrigger
|
|
192 |
hideUnloadedClasses
|
|
193 |
organizerMode
|
|
194 |
slaveMode
|
|
195 |
)
|
|
196 |
|
|
197 |
"Created: / 18.2.2000 / 01:06:27 / cg"
|
|
198 |
"Modified: / 25.2.2000 / 22:32:20 / cg"
|
|
199 |
! !
|
|
200 |
|
|
201 |
!NamespaceList methodsFor:'aspects'!
|
|
202 |
|
|
203 |
nameSpaceLabelHolder
|
|
204 |
^ self pseudoListLabelHolder
|
|
205 |
!
|
|
206 |
|
|
207 |
nameSpaceList
|
|
208 |
namespaceList isNil ifTrue:[
|
|
209 |
namespaceList := ValueHolder new
|
|
210 |
].
|
|
211 |
^ namespaceList
|
|
212 |
|
|
213 |
"Created: / 18.2.2000 / 00:59:01 / cg"
|
|
214 |
!
|
|
215 |
|
|
216 |
selectedNamespaces
|
|
217 |
^ self selectionHolder
|
|
218 |
|
|
219 |
!
|
|
220 |
|
|
221 |
selectedNamespaces:aValueHolder
|
|
222 |
^ self selectionHolder:aValueHolder
|
|
223 |
|
|
224 |
! !
|
|
225 |
|
|
226 |
!NamespaceList methodsFor:'change & update'!
|
|
227 |
|
|
228 |
delayedUpdate:something with:aParameter from:changedObject
|
|
229 |
|
|
230 |
self inSlaveModeOrInvisible
|
|
231 |
ifTrue:[
|
|
232 |
changedObject == Smalltalk ifTrue:[
|
|
233 |
something == #classComment ifTrue:[^ self].
|
|
234 |
].
|
|
235 |
self invalidateList.
|
|
236 |
^ self
|
|
237 |
].
|
|
238 |
|
|
239 |
changedObject == slaveMode ifTrue:[
|
|
240 |
listValid ~~ true ifTrue:[
|
|
241 |
self enqueueDelayedUpdateList
|
|
242 |
].
|
|
243 |
"/ self invalidateList.
|
|
244 |
^ self
|
|
245 |
].
|
|
246 |
|
|
247 |
changedObject == Smalltalk ifTrue:[
|
|
248 |
something == #newClass ifTrue:[
|
|
249 |
listValid == true ifTrue:[
|
|
250 |
aParameter isNameSpace ifTrue:[
|
|
251 |
(namespaceList value includes:aParameter name) ifFalse:[
|
|
252 |
self invalidateList.
|
|
253 |
]
|
|
254 |
].
|
|
255 |
].
|
|
256 |
^ self
|
|
257 |
].
|
|
258 |
something == #classRemove ifTrue:[
|
|
259 |
listValid == true ifTrue:[
|
|
260 |
aParameter isNameSpace ifTrue:[
|
|
261 |
self invalidateList.
|
|
262 |
].
|
|
263 |
].
|
|
264 |
^ self
|
|
265 |
].
|
|
266 |
^ self
|
|
267 |
].
|
|
268 |
|
|
269 |
super delayedUpdate:something with:aParameter from:changedObject
|
|
270 |
|
|
271 |
"Created: / 18.2.2000 / 01:00:07 / cg"
|
|
272 |
"Modified: / 26.2.2000 / 01:10:46 / cg"
|
|
273 |
!
|
|
274 |
|
|
275 |
selectionChangedByClick
|
|
276 |
"we are not interested in that - get another notification
|
|
277 |
via the changed valueHolder"
|
|
278 |
|
|
279 |
"Created: / 18.2.2000 / 01:00:14 / cg"
|
|
280 |
!
|
|
281 |
|
|
282 |
update:something with:aParameter from:changedObject
|
|
283 |
changedObject == Smalltalk ifTrue:[
|
|
284 |
something == #methodDictionary ifTrue:[
|
|
285 |
^ self
|
|
286 |
].
|
|
287 |
something == #methodTrap ifTrue:[
|
|
288 |
^ self
|
|
289 |
].
|
|
290 |
something == #methodInClass ifTrue:[
|
|
291 |
^ self
|
|
292 |
].
|
|
293 |
something == #classVariables ifTrue:[
|
|
294 |
^ self
|
|
295 |
].
|
|
296 |
something == #classComment ifTrue:[
|
|
297 |
^ self.
|
|
298 |
].
|
|
299 |
something == #methodInClassRemoved ifTrue:[
|
|
300 |
^ self.
|
|
301 |
].
|
|
302 |
].
|
|
303 |
super update:something with:aParameter from:changedObject
|
|
304 |
! !
|
|
305 |
|
|
306 |
!NamespaceList methodsFor:'generators'!
|
|
307 |
|
|
308 |
makeGenerator
|
|
309 |
"return a generator which enumerates the classes from the selected namespace(s)."
|
|
310 |
|
|
311 |
|spaceNames hideUnloadedClasses|
|
|
312 |
|
|
313 |
spaceNames := self selectedNamespaces value.
|
|
314 |
spaceNames size == 0 ifTrue:[
|
|
315 |
^ #()
|
|
316 |
].
|
|
317 |
|
|
318 |
hideUnloadedClasses := self hideUnloadedClasses value.
|
|
319 |
|
|
320 |
(spaceNames includes:(self class nameListEntryForALL)) ifTrue:[
|
|
321 |
hideUnloadedClasses ifTrue:[
|
|
322 |
^ Iterator on:[:whatToDo |
|
|
323 |
Smalltalk allClassesDo:[:cls |
|
|
324 |
cls isLoaded ifTrue:[
|
|
325 |
cls isNameSpace ifFalse:[
|
|
326 |
whatToDo value:cls
|
|
327 |
]
|
|
328 |
]
|
|
329 |
]
|
|
330 |
]
|
|
331 |
].
|
|
332 |
^ Iterator on:[:whatToDo |
|
|
333 |
Smalltalk allClassesDo:whatToDo
|
|
334 |
]
|
|
335 |
].
|
|
336 |
|
|
337 |
(spaceNames size == 1
|
|
338 |
and:[spaceNames first = 'Smalltalk']) ifTrue:[
|
|
339 |
"/ somewhat tuned - quick look if classes name
|
|
340 |
"/ includes colons ...
|
|
341 |
^ Iterator on:[:whatToDo |
|
|
342 |
Smalltalk allClassesDo:[:cls |
|
|
343 |
|includeIt|
|
|
344 |
|
|
345 |
includeIt := (cls name includes:$:) not.
|
|
346 |
includeIt := includeIt
|
|
347 |
or:[(cls isPrivate not
|
|
348 |
and:[(cls nameSpace == Smalltalk)])].
|
|
349 |
includeIt := includeIt
|
|
350 |
or:[(cls isPrivate
|
|
351 |
and:[(cls topOwningClass nameSpace == Smalltalk)])].
|
|
352 |
|
|
353 |
includeIt := includeIt
|
|
354 |
and:[hideUnloadedClasses not
|
|
355 |
or:[cls isLoaded]].
|
|
356 |
includeIt ifTrue:[
|
|
357 |
cls isNameSpace ifFalse:[
|
|
358 |
whatToDo value:cls
|
|
359 |
]
|
|
360 |
]
|
|
361 |
]
|
|
362 |
]
|
|
363 |
].
|
|
364 |
|
|
365 |
^ Iterator on:[:whatToDo |
|
|
366 |
Smalltalk allClassesDo:[:cls |
|
|
367 |
|spaceOfClass spaceNameOfClass includeIt|
|
|
368 |
|
|
369 |
spaceOfClass := cls isPrivate ifTrue:[cls topOwningClass nameSpace] ifFalse:[cls nameSpace].
|
|
370 |
spaceNameOfClass := spaceOfClass name.
|
|
371 |
|
|
372 |
includeIt := spaceNames contains:[:nm | nm = spaceNameOfClass
|
|
373 |
or:[spaceNameOfClass startsWith:(nm , '::')]].
|
|
374 |
|
|
375 |
hideUnloadedClasses ifTrue:[
|
|
376 |
includeIt := includeIt and:[cls isLoaded].
|
|
377 |
].
|
|
378 |
includeIt ifTrue:[
|
|
379 |
cls isNameSpace ifFalse:[
|
|
380 |
whatToDo value:cls
|
|
381 |
]
|
|
382 |
]
|
|
383 |
]
|
|
384 |
]
|
|
385 |
|
|
386 |
"Created: / 18.2.2000 / 01:01:58 / cg"
|
|
387 |
"Modified: / 24.2.2000 / 13:42:58 / cg"
|
|
388 |
! !
|
|
389 |
|
|
390 |
!NamespaceList methodsFor:'private'!
|
|
391 |
|
|
392 |
defaultSlaveModeValue
|
6710
|
393 |
|mode|
|
|
394 |
|
|
395 |
mode := self topApplication perform:#initialOrganizerMode ifNotUnderstood:nil.
|
|
396 |
mode == #namespace ifTrue:[^ false].
|
5591
|
397 |
"/ self organizerMode value == #category ifTrue:[^ true].
|
|
398 |
"/ ^ false
|
|
399 |
^ true
|
|
400 |
!
|
|
401 |
|
|
402 |
initialOrganizerMode
|
|
403 |
^ #namespace
|
|
404 |
!
|
|
405 |
|
|
406 |
listOfNamespaces
|
|
407 |
|allNamespaces showAllNamespaces generator|
|
|
408 |
|
|
409 |
showAllNamespaces := false.
|
|
410 |
allNamespaces := IdentitySet new.
|
|
411 |
|
|
412 |
inGeneratorHolder isNil ifTrue:[
|
6675
|
413 |
(self hideUnloadedClasses value) ifTrue:[
|
|
414 |
Smalltalk allClassesDo:[:eachClass |
|
|
415 |
eachClass isLoaded ifTrue:[
|
|
416 |
allNamespaces add:(eachClass theNonMetaclass topNameSpace)
|
|
417 |
].
|
|
418 |
]
|
|
419 |
] ifFalse:[
|
6679
|
420 |
allNamespaces := NameSpace allNamespaces.
|
6675
|
421 |
].
|
5591
|
422 |
|
6675
|
423 |
showAllNamespaces ifFalse:[
|
|
424 |
"/ only topLevel namespaces are shown
|
|
425 |
"/ i.e. ignore subspaces
|
5591
|
426 |
|
6675
|
427 |
allNamespaces := allNamespaces select:[:ns | ns isTopLevelNameSpace].
|
|
428 |
].
|
|
429 |
allNamespaces := allNamespaces collect:[:ns | ns name].
|
5591
|
430 |
] ifFalse:[
|
6675
|
431 |
generator := inGeneratorHolder value.
|
|
432 |
generator isNil ifTrue:[^ #() ].
|
|
433 |
generator do:[:ns | allNamespaces add:ns].
|
5591
|
434 |
].
|
|
435 |
|
|
436 |
allNamespaces := allNamespaces asOrderedCollection.
|
|
437 |
allNamespaces sort.
|
|
438 |
allNamespaces size == 1 ifTrue:[
|
6675
|
439 |
self nameSpaceLabelHolder value:(LabelAndIcon icon:(self class nameSpaceIcon) string:allNamespaces first).
|
5591
|
440 |
].
|
|
441 |
allNamespaces addFirst:(self class nameListEntryForALL).
|
|
442 |
^ allNamespaces
|
|
443 |
|
|
444 |
"Created: / 18.2.2000 / 01:04:27 / cg"
|
|
445 |
"Modified: / 25.2.2000 / 22:11:29 / cg"
|
|
446 |
!
|
|
447 |
|
|
448 |
makeDependent
|
|
449 |
Smalltalk addDependent:self
|
|
450 |
|
|
451 |
"Created: / 18.2.2000 / 01:04:36 / cg"
|
|
452 |
!
|
|
453 |
|
|
454 |
makeIndependent
|
|
455 |
Smalltalk removeDependent:self.
|
|
456 |
|
|
457 |
"Created: / 18.2.2000 / 01:04:42 / cg"
|
|
458 |
!
|
|
459 |
|
|
460 |
updateList
|
|
461 |
|newList oldSelection newSelection selectedNamespacesHolder|
|
|
462 |
|
|
463 |
selectedNamespacesHolder := self selectedNamespaces.
|
|
464 |
oldSelection := selectedNamespacesHolder value.
|
|
465 |
newList := self listOfNamespaces.
|
|
466 |
newList ~= namespaceList value ifTrue:[
|
|
467 |
"/ oldSelection size > 0 ifTrue:[
|
|
468 |
"/ selectedNamespacesHolder removeDependent:self.
|
|
469 |
"/ selectedNamespacesHolder value:#().
|
|
470 |
"/ selectedNamespacesHolder addDependent:self.
|
|
471 |
"/ ].
|
|
472 |
self nameSpaceList value:newList.
|
|
473 |
|
|
474 |
oldSelection size > 0 ifTrue:[
|
|
475 |
newSelection := oldSelection select:[:nm |
|
|
476 |
(nm = self class nameListEntryForALL)
|
|
477 |
or:[ (Smalltalk at:nm asSymbol) isNameSpace]
|
|
478 |
].
|
|
479 |
newSelection ~= oldSelection ifTrue:[
|
|
480 |
selectedNamespacesHolder value:newSelection.
|
|
481 |
]
|
|
482 |
]
|
|
483 |
].
|
|
484 |
listValid := true.
|
|
485 |
! !
|
|
486 |
|
|
487 |
!NamespaceList class methodsFor:'documentation'!
|
|
488 |
|
|
489 |
version
|
6710
|
490 |
^ '$Header: /cvs/stx/stx/libtool/Tools_NamespaceList.st,v 1.5 2006-03-16 20:16:45 cg Exp $'
|
5591
|
491 |
! !
|