5591
|
1 |
"{ Package: 'stx:__NoProject__' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Tools }"
|
|
4 |
|
|
5 |
ProjectList subclass:#HierarchicalProjectList
|
|
6 |
instanceVariableNames:'hierarchicalProjectTree selectedProjectItems packageIcon
|
|
7 |
hierarchicalProjectList hierarchicalProjectSelection
|
|
8 |
packageToItemDictionary'
|
|
9 |
classVariableNames:''
|
|
10 |
poolDictionaries:''
|
|
11 |
category:'Interface-Browsers-New'
|
|
12 |
!
|
|
13 |
|
|
14 |
!HierarchicalProjectList class methodsFor:'documentation'!
|
|
15 |
|
|
16 |
documentation
|
|
17 |
"
|
|
18 |
Like a ClassList, but shows classes hierarchical.
|
|
19 |
|
|
20 |
If topClassHolders value is non-nil, only that classes hierarchy
|
|
21 |
is shown.
|
|
22 |
|
|
23 |
embeddable application displaying the classes as listed by
|
|
24 |
the inputGenerator.
|
|
25 |
Provides an outputGenerator, which enumerates the classes and
|
|
26 |
their protocols (method-categories) in the selected classes.
|
|
27 |
|
|
28 |
[author:]
|
|
29 |
Claus Gittinger (cg@exept.de)
|
|
30 |
"
|
|
31 |
|
|
32 |
|
|
33 |
! !
|
|
34 |
|
|
35 |
!HierarchicalProjectList class methodsFor:'interface specs'!
|
|
36 |
|
|
37 |
windowSpec
|
|
38 |
"This resource specification was automatically generated
|
|
39 |
by the UIPainter of ST/X."
|
|
40 |
|
|
41 |
"Do not manually edit this!! If it is corrupted,
|
|
42 |
the UIPainter may not be able to read the specification."
|
|
43 |
|
|
44 |
"
|
|
45 |
UIPainter new openOnClass:HierarchicalProjectList andSelector:#windowSpec
|
|
46 |
HierarchicalProjectList new openInterface:#windowSpec
|
|
47 |
HierarchicalProjectList open
|
|
48 |
"
|
|
49 |
|
|
50 |
<resource: #canvas>
|
|
51 |
|
|
52 |
^
|
|
53 |
#(#FullSpec
|
|
54 |
#name: #windowSpec
|
|
55 |
#window:
|
|
56 |
#(#WindowSpec
|
|
57 |
#label: 'ProjectList'
|
|
58 |
#name: 'ProjectList'
|
|
59 |
#min: #(#Point 0 0)
|
|
60 |
#max: #(#Point 1024 721)
|
|
61 |
#bounds: #(#Rectangle 16 46 316 346)
|
|
62 |
)
|
|
63 |
#component:
|
|
64 |
#(#SpecCollection
|
|
65 |
#collection: #(
|
|
66 |
#(#HierarchicalListViewSpec
|
|
67 |
#name: 'HierarchicalListView1'
|
|
68 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
69 |
#tabable: true
|
|
70 |
#model: #hierarchicalProjectSelection
|
|
71 |
#menu: #menuHolder
|
|
72 |
#hasHorizontalScrollBar: true
|
|
73 |
#hasVerticalScrollBar: true
|
|
74 |
#miniScrollerHorizontal: true
|
|
75 |
#listModel: #hierarchicalProjectList
|
|
76 |
#multipleSelectOk: true
|
|
77 |
#highlightMode: #line
|
|
78 |
#doubleClickSelector: #doubleClicked:
|
|
79 |
#indicatorSelector: #indicatorPressed:
|
|
80 |
#properties:
|
|
81 |
#(#PropertyListDictionary
|
|
82 |
#dragArgument: nil
|
|
83 |
#dropArgument: nil
|
|
84 |
#canDropSelector: #canDrop:
|
|
85 |
#dropSelector: #doDrop:
|
|
86 |
)
|
|
87 |
)
|
|
88 |
)
|
|
89 |
|
|
90 |
)
|
|
91 |
)
|
|
92 |
!
|
|
93 |
|
|
94 |
xxwindowSpec
|
|
95 |
"This resource specification was automatically generated
|
|
96 |
by the UIPainter of ST/X."
|
|
97 |
|
|
98 |
"Do not manually edit this!! If it is corrupted,
|
|
99 |
the UIPainter may not be able to read the specification."
|
|
100 |
|
|
101 |
"
|
|
102 |
UIPainter new openOnClass:HierarchicalProjectList andSelector:#windowSpec
|
|
103 |
HierarchicalProjectList new openInterface:#windowSpec
|
|
104 |
HierarchicalProjectList open
|
|
105 |
"
|
|
106 |
|
|
107 |
<resource: #canvas>
|
|
108 |
|
|
109 |
^
|
|
110 |
#(#FullSpec
|
|
111 |
#name: #windowSpec
|
|
112 |
#window:
|
|
113 |
#(#WindowSpec
|
|
114 |
#label: 'ProjectList'
|
|
115 |
#name: 'ProjectList'
|
|
116 |
#min: #(#Point 0 0)
|
|
117 |
#max: #(#Point 1024 721)
|
|
118 |
#bounds: #(#Rectangle 12 22 312 322)
|
|
119 |
)
|
|
120 |
#component:
|
|
121 |
#(#SpecCollection
|
|
122 |
#collection: #(
|
|
123 |
#(#SelectionInTreeViewSpec
|
|
124 |
#name: 'List'
|
|
125 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
126 |
#model: #selectedProjectItems
|
|
127 |
#menu: #menuHolder
|
|
128 |
#hasHorizontalScrollBar: true
|
|
129 |
#hasVerticalScrollBar: true
|
|
130 |
#miniScrollerHorizontal: true
|
|
131 |
#showRoot: false
|
|
132 |
#showDirectoryIndicator: true
|
|
133 |
#isMultiSelect: true
|
|
134 |
#valueChangeSelector: #selectionChangedByClick
|
|
135 |
#hierarchicalList: #hierarchicalProjectTree
|
|
136 |
#childrenSelector: #actionToRetrieveChildren
|
|
137 |
#highlightMode: #line
|
|
138 |
#doubleClickChannel: #doubleClickChannel
|
|
139 |
)
|
|
140 |
#(#HierarchicalListViewSpec
|
|
141 |
#name: 'HierarchicalListView1'
|
|
142 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
143 |
#tabable: true
|
|
144 |
#hasHorizontalScrollBar: true
|
|
145 |
#hasVerticalScrollBar: true
|
|
146 |
#miniScrollerHorizontal: true
|
|
147 |
#listModel: #hierarchicalProjectList
|
|
148 |
#multipleSelectOk: true
|
|
149 |
#highlightMode: #line
|
|
150 |
#doubleClickSelector: #doubleClicked:
|
|
151 |
#indicatorSelector: #indicatorPressed:
|
|
152 |
"/ #showLeftIndicators: false
|
|
153 |
)
|
|
154 |
)
|
|
155 |
|
|
156 |
)
|
|
157 |
)
|
|
158 |
! !
|
|
159 |
|
|
160 |
!HierarchicalProjectList class methodsFor:'plugIn spec'!
|
|
161 |
|
|
162 |
aspectSelectors
|
|
163 |
"This resource specification was automatically generated
|
|
164 |
by the UIPainter of ST/X."
|
|
165 |
|
|
166 |
"Do not manually edit this. If it is corrupted,
|
|
167 |
the UIPainter may not be able to read the specification."
|
|
168 |
|
|
169 |
"Return a description of exported aspects;
|
|
170 |
these can be connected to aspects of an embedding application
|
|
171 |
(if this app is embedded in a subCanvas)."
|
|
172 |
|
|
173 |
^ #(
|
|
174 |
#(#doubleClickChannel #action )
|
|
175 |
#forceGeneratorTrigger
|
|
176 |
#hideUnloadedClasses
|
|
177 |
#immediateUpdate
|
|
178 |
#inGeneratorHolder
|
|
179 |
#menuHolder
|
|
180 |
#organizerMode
|
|
181 |
#outGeneratorHolder
|
|
182 |
#selectedProjects
|
|
183 |
#selectionChangeCondition
|
|
184 |
#slaveMode
|
|
185 |
#updateTrigger
|
|
186 |
).
|
|
187 |
|
|
188 |
! !
|
|
189 |
|
|
190 |
!HierarchicalProjectList methodsFor:'aspects'!
|
|
191 |
|
|
192 |
generateHierarchicalProjectTree
|
|
193 |
|anchor|
|
|
194 |
|
|
195 |
self projectList value isNil ifTrue:[
|
|
196 |
self updateList.
|
|
197 |
self projectList value isNil ifTrue:[
|
|
198 |
^ nil.
|
|
199 |
]
|
|
200 |
].
|
|
201 |
|
|
202 |
anchor := ProjectItem new.
|
|
203 |
anchor package:''.
|
|
204 |
anchor label:nil.
|
|
205 |
|
|
206 |
packageToItemDictionary := IdentityDictionary new.
|
|
207 |
packageToItemDictionary at:'' asSymbol put:anchor.
|
|
208 |
|
|
209 |
self projectList value do:[:eachPackageString |
|
|
210 |
|package|
|
|
211 |
|
|
212 |
package := eachPackageString asSymbol.
|
|
213 |
(packageToItemDictionary includesKey:package) ifFalse:[
|
|
214 |
self addPackage:package
|
|
215 |
].
|
|
216 |
].
|
|
217 |
|
|
218 |
"/ Smalltalk allClassesDo:[:eachClass |
|
|
219 |
"/ |package|
|
|
220 |
"/
|
|
221 |
"/ package := eachClass package asSymbol.
|
|
222 |
"/ (packageToItemDictionary includesKey:package) ifFalse:[
|
|
223 |
"/ self addPackage:package
|
|
224 |
"/ ].
|
|
225 |
"/ ].
|
|
226 |
anchor recursiveSortChildren:[:i1 :i2 | i1 label asLowercase < i2 label asLowercase].
|
|
227 |
anchor expand.
|
|
228 |
|
|
229 |
^ anchor
|
|
230 |
!
|
|
231 |
|
|
232 |
hierarchicalProjectList
|
|
233 |
|anchor |
|
|
234 |
|
|
235 |
hierarchicalProjectList isNil ifTrue:[
|
|
236 |
hierarchicalProjectList := HierarchicalList new.
|
|
237 |
hierarchicalProjectList showRoot:false.
|
|
238 |
|
|
239 |
(self slaveMode value ~~ true) ifTrue:[
|
|
240 |
anchor := self generateHierarchicalProjectTree.
|
|
241 |
hierarchicalProjectList root:anchor.
|
|
242 |
listValid := true
|
|
243 |
] ifFalse:[
|
|
244 |
listValid := false
|
|
245 |
]
|
|
246 |
].
|
|
247 |
^ hierarchicalProjectList
|
|
248 |
!
|
|
249 |
|
|
250 |
hierarchicalProjectSelection
|
|
251 |
hierarchicalProjectSelection isNil ifTrue:[
|
|
252 |
hierarchicalProjectSelection := #() asValue.
|
|
253 |
hierarchicalProjectSelection addDependent:self.
|
|
254 |
].
|
|
255 |
^ hierarchicalProjectSelection.
|
|
256 |
!
|
|
257 |
|
|
258 |
updateTreeSelection
|
|
259 |
"/ must expand items as required
|
|
260 |
|itemsToSelect oldSelection newSelection|
|
|
261 |
|
|
262 |
itemsToSelect := OrderedCollection new.
|
|
263 |
|
|
264 |
(self selectedProjects value ? #()) do:[:eachSelectedProject |
|
|
265 |
|item child|
|
|
266 |
|
|
267 |
item := hierarchicalProjectList root.
|
|
268 |
|
|
269 |
(eachSelectedProject asCollectionOfSubstringsSeparatedByAny:':/') do:[:part |
|
|
270 |
item expand.
|
|
271 |
child := item detect:[:child | child label = part] ifNone:nil.
|
|
272 |
child notNil ifTrue:[
|
|
273 |
item := child.
|
|
274 |
].
|
|
275 |
].
|
|
276 |
itemsToSelect add:child.
|
|
277 |
].
|
|
278 |
oldSelection := hierarchicalProjectSelection value.
|
|
279 |
newSelection := itemsToSelect collect:[:eachItem | hierarchicalProjectList identityIndexOf:eachItem].
|
|
280 |
oldSelection ~= newSelection ifTrue:[
|
|
281 |
hierarchicalProjectSelection value:newSelection.
|
|
282 |
].
|
|
283 |
! !
|
|
284 |
|
|
285 |
!HierarchicalProjectList methodsFor:'change & update'!
|
|
286 |
|
|
287 |
delayedUpdate:something with:aParameter from:changedObject
|
|
288 |
|cls sel oldMethod newMethod newPackage|
|
|
289 |
|
|
290 |
self inSlaveModeOrInvisible ifTrue:[
|
|
291 |
super delayedUpdate:something with:aParameter from:changedObject.
|
|
292 |
^ self.
|
|
293 |
].
|
|
294 |
|
|
295 |
"/ (self slaveMode value == true) ifTrue:[
|
|
296 |
"/ super delayedUpdate:something with:aParameter from:changedObject.
|
|
297 |
"/ ^ self
|
|
298 |
"/ ].
|
|
299 |
|
|
300 |
changedObject == updateTrigger ifTrue:[
|
|
301 |
hierarchicalProjectList := nil.
|
|
302 |
self hierarchicalProjectList.
|
|
303 |
self updateTreeSelection.
|
|
304 |
^ self
|
|
305 |
].
|
|
306 |
|
|
307 |
changedObject == slaveMode ifTrue:[
|
|
308 |
listValid ~~ true ifTrue:[
|
|
309 |
self enqueueDelayedUpdateList
|
|
310 |
].
|
|
311 |
"/ self invalidateList.
|
|
312 |
self updateTreeSelection.
|
|
313 |
^ self
|
|
314 |
].
|
|
315 |
|
|
316 |
changedObject == hierarchicalProjectSelection ifTrue:[
|
|
317 |
self updateSelectionFromTree.
|
|
318 |
^ self
|
|
319 |
].
|
|
320 |
"/ changedObject == self selectedProjects ifTrue:[
|
|
321 |
"/ "/ update the trees selection as appropriate
|
|
322 |
"/ self updateTreeSelection.
|
|
323 |
"/ ].
|
|
324 |
changedObject == projectList ifTrue:[
|
|
325 |
"/ update the tree
|
|
326 |
self hierarchicalProjectList root:(self generateHierarchicalProjectTree).
|
|
327 |
^ self.
|
|
328 |
].
|
|
329 |
|
|
330 |
super delayedUpdate:something with:aParameter from:changedObject
|
|
331 |
|
|
332 |
"Created: / 17.2.2000 / 23:41:02 / cg"
|
|
333 |
"Modified: / 26.2.2000 / 01:21:49 / cg"
|
|
334 |
!
|
|
335 |
|
|
336 |
enqueueDelayedAddPackage:package
|
|
337 |
NewSystemBrowser synchronousUpdate == true ifTrue:[
|
|
338 |
self addPackage:package.
|
|
339 |
^ self
|
|
340 |
].
|
|
341 |
^ self
|
|
342 |
enqueueMessage:#addPackage:
|
|
343 |
for:self
|
|
344 |
arguments:(Array with:package)
|
|
345 |
!
|
|
346 |
|
|
347 |
update:something with:aParameter from:changedObject
|
|
348 |
something == #methodTrap ifTrue:[
|
|
349 |
"/ dont care for that.
|
|
350 |
^ self.
|
|
351 |
].
|
|
352 |
changedObject == organizerMode ifTrue:[
|
|
353 |
"/ dont care for that.
|
|
354 |
^ self.
|
|
355 |
].
|
|
356 |
super update:something with:aParameter from:changedObject
|
|
357 |
!
|
|
358 |
|
|
359 |
updateSelectionFromTree
|
|
360 |
|treeSelection|
|
|
361 |
|
|
362 |
treeSelection := hierarchicalProjectSelection value
|
|
363 |
collect:[:eachIndex | |item|
|
|
364 |
item := hierarchicalProjectList at:eachIndex ifAbsent:nil.
|
|
365 |
item package
|
|
366 |
].
|
|
367 |
|
|
368 |
treeSelection asSet ~= (self selectedProjects value ? #()) asSet ifTrue:[
|
|
369 |
self selectedProjects value:treeSelection.
|
|
370 |
]
|
|
371 |
! !
|
|
372 |
|
|
373 |
!HierarchicalProjectList methodsFor:'private'!
|
|
374 |
|
|
375 |
addPackage:package
|
|
376 |
|i p pp l parentPackage parentItem idx|
|
|
377 |
|
|
378 |
i:= packageToItemDictionary at:package asSymbol ifAbsent:nil.
|
|
379 |
i isNil ifTrue:[
|
|
380 |
i := ProjectItem new.
|
|
381 |
i package:package.
|
|
382 |
packageToItemDictionary at:package asSymbol put:i.
|
|
383 |
|
|
384 |
package size > 0 ifTrue:[
|
|
385 |
"/ find the parent ...
|
|
386 |
p := package asCollectionOfSubstringsSeparatedByAny:':/.'.
|
|
387 |
pp := p copyWithoutLast:1.
|
|
388 |
l := (pp asStringWith:$/) size.
|
|
389 |
parentPackage := package copyTo:l.
|
|
390 |
|
|
391 |
parentItem := self addPackage:parentPackage asSymbol .
|
|
392 |
|
|
393 |
parentPackage size == 0 ifTrue:[
|
|
394 |
idx := 1.
|
|
395 |
] ifFalse:[
|
|
396 |
idx := parentPackage size + 2
|
|
397 |
].
|
|
398 |
i label:(package copyFrom:idx).
|
|
399 |
|
|
400 |
parentItem add:i sortBlock:[:i1 :i2 | i1 label asLowercase < i2 label asLowercase].
|
|
401 |
|
|
402 |
"/ TODO: special items for classes, resources etc.
|
|
403 |
|
|
404 |
]
|
|
405 |
].
|
|
406 |
^ i
|
|
407 |
!
|
|
408 |
|
|
409 |
release
|
|
410 |
super release.
|
|
411 |
|
|
412 |
hierarchicalProjectSelection removeDependent:self.
|
|
413 |
! !
|
|
414 |
|
|
415 |
!HierarchicalProjectList methodsFor:'user actions'!
|
|
416 |
|
|
417 |
doubleClicked:anIndex
|
|
418 |
|item|
|
|
419 |
|
|
420 |
item := hierarchicalProjectList at:anIndex ifAbsent:nil.
|
|
421 |
item isNil ifTrue:[
|
|
422 |
^ self
|
|
423 |
].
|
|
424 |
|
|
425 |
(item canExpand not or:[item isExpanded]) ifTrue:[
|
|
426 |
doubleClickChannel notNil ifTrue:[
|
|
427 |
doubleClickChannel value:anIndex.
|
|
428 |
].
|
|
429 |
^ self
|
|
430 |
].
|
|
431 |
|
|
432 |
item expand.
|
|
433 |
!
|
|
434 |
|
|
435 |
indicatorPressed:anIndex
|
|
436 |
|item sensor|
|
|
437 |
|
|
438 |
item := hierarchicalProjectList at:anIndex ifAbsent:nil.
|
|
439 |
|
|
440 |
item isNil ifTrue:[
|
|
441 |
^ self
|
|
442 |
].
|
|
443 |
|
|
444 |
sensor := self window sensor.
|
|
445 |
(sensor ctrlDown or:[sensor shiftDown]) ifTrue:[
|
|
446 |
item recursiveToggleExpand
|
|
447 |
] ifFalse:[
|
|
448 |
item toggleExpand
|
|
449 |
].
|
|
450 |
! !
|
|
451 |
|
|
452 |
!HierarchicalProjectList class methodsFor:'documentation'!
|
|
453 |
|
|
454 |
version
|
|
455 |
^ '$Header: /cvs/stx/stx/libtool/Tools_HierarchicalProjectList.st,v 1.1 2004-02-26 18:56:30 cg Exp $'
|
|
456 |
! !
|