author | Claus Gittinger <cg@exept.de> |
Wed, 24 Mar 2004 11:28:53 +0100 | |
changeset 5794 | bda2cf9d0702 |
parent 5793 | 23aa2ad9b7b4 |
child 6179 | 182d948dcf05 |
permissions | -rw-r--r-- |
5592 | 1 |
"{ Package: 'stx:libtool' }" |
5591 | 2 |
|
3 |
"{ NameSpace: Tools }" |
|
4 |
||
5 |
ClassCategoryList subclass:#HierarchicalClassCategoryList |
|
6 |
instanceVariableNames:'hierarchicalCategoryTree hierarchicalCategoryList |
|
7 |
hierarchicalCategorySelection categoryToItemDictionary' |
|
8 |
classVariableNames:'' |
|
9 |
poolDictionaries:'' |
|
10 |
category:'Interface-Browsers-New' |
|
11 |
! |
|
12 |
||
5670
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
13 |
HierarchicalItem subclass:#ClassCategoryItem |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
14 |
instanceVariableNames:'label category' |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
15 |
classVariableNames:'' |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
16 |
poolDictionaries:'' |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
17 |
privateIn:HierarchicalClassCategoryList |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
18 |
! |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
19 |
|
5591 | 20 |
!HierarchicalClassCategoryList class methodsFor:'documentation'! |
21 |
||
22 |
documentation |
|
23 |
" |
|
24 |
embeddable application displaying the classes as listed by |
|
25 |
the inputGenerator. |
|
26 |
Provides an outputGenerator, which enumerates the classes and |
|
27 |
their protocols (method-categories) in the selected classes. |
|
28 |
||
29 |
[author:] |
|
30 |
Claus Gittinger (cg@exept.de) |
|
31 |
" |
|
32 |
||
33 |
||
34 |
! ! |
|
35 |
||
36 |
!HierarchicalClassCategoryList class methodsFor:'interface specs'! |
|
37 |
||
38 |
windowSpec |
|
39 |
"This resource specification was automatically generated |
|
40 |
by the UIPainter of ST/X." |
|
41 |
||
42 |
"Do not manually edit this!! If it is corrupted, |
|
43 |
the UIPainter may not be able to read the specification." |
|
44 |
||
45 |
" |
|
46 |
UIPainter new openOnClass:HierarchicalClassCategoryList andSelector:#windowSpec |
|
47 |
HierarchicalClassCategoryList new openInterface:#windowSpec |
|
48 |
HierarchicalClassCategoryList open |
|
49 |
" |
|
50 |
||
51 |
<resource: #canvas> |
|
52 |
||
53 |
^ |
|
54 |
#(#FullSpec |
|
5592 | 55 |
#name: #windowSpec |
56 |
#window: |
|
5591 | 57 |
#(#WindowSpec |
5592 | 58 |
#label: 'ClassCategoryList' |
59 |
#name: 'ClassCategoryList' |
|
60 |
#min: #(#Point 0 0) |
|
61 |
#max: #(#Point 1024 721) |
|
62 |
#bounds: #(#Rectangle 16 46 316 346) |
|
63 |
) |
|
64 |
#component: |
|
5591 | 65 |
#(#SpecCollection |
5592 | 66 |
#collection: #( |
67 |
#(#HierarchicalListViewSpec |
|
68 |
#name: 'List' |
|
69 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
70 |
#tabable: true |
|
71 |
#model: #hierarchicalCategorySelection |
|
72 |
#menu: #menuHolder |
|
73 |
#hasHorizontalScrollBar: true |
|
74 |
#hasVerticalScrollBar: true |
|
75 |
#miniScrollerHorizontal: true |
|
76 |
#listModel: #hierarchicalCategoryList |
|
77 |
#multipleSelectOk: true |
|
78 |
#highlightMode: #line |
|
79 |
#doubleClickSelector: #doubleClicked: |
|
80 |
#showLines: false |
|
81 |
#indicatorSelector: #indicatorPressed: |
|
82 |
#useDefaultIcons: false |
|
83 |
#properties: |
|
84 |
#(#PropertyListDictionary |
|
85 |
#dragArgument: nil |
|
86 |
#dropArgument: nil |
|
87 |
#canDropSelector: #canDrop: |
|
88 |
#dropSelector: #doDrop: |
|
89 |
) |
|
90 |
) |
|
91 |
) |
|
5591 | 92 |
|
5592 | 93 |
) |
5591 | 94 |
) |
95 |
! ! |
|
96 |
||
97 |
!HierarchicalClassCategoryList class methodsFor:'plugIn spec'! |
|
98 |
||
99 |
aspectSelectors |
|
100 |
"This resource specification was automatically generated |
|
101 |
by the UIPainter of ST/X." |
|
102 |
||
103 |
"Do not manually edit this. If it is corrupted, |
|
104 |
the UIPainter may not be able to read the specification." |
|
105 |
||
106 |
"Return a description of exported aspects; |
|
107 |
these can be connected to aspects of an embedding application |
|
108 |
(if this app is embedded in a subCanvas)." |
|
109 |
||
110 |
^ #( |
|
111 |
#(#doubleClickChannel #action ) |
|
112 |
#forceGeneratorTrigger |
|
113 |
#hideUnloadedClasses |
|
114 |
#immediateUpdate |
|
115 |
#inGeneratorHolder |
|
116 |
#menuHolder |
|
117 |
#nameSpaceFilter |
|
118 |
#organizerMode |
|
119 |
#outGeneratorHolder |
|
120 |
#packageFilter |
|
121 |
#selectedCategories |
|
122 |
#selectionChangeCondition |
|
123 |
#slaveMode |
|
124 |
#updateTrigger |
|
125 |
). |
|
126 |
||
127 |
! ! |
|
128 |
||
129 |
!HierarchicalClassCategoryList methodsFor:'aspects'! |
|
130 |
||
131 |
addCategory:category |
|
132 |
|item path parentPath parentCategory parentItem| |
|
133 |
||
134 |
item:= categoryToItemDictionary at:category ifAbsent:nil. |
|
135 |
item isNil ifTrue:[ |
|
136 |
path := category asCollectionOfSubstringsSeparatedBy:$-. |
|
137 |
||
138 |
item := ClassCategoryItem new. |
|
139 |
item category:category. |
|
140 |
item label:(path last). |
|
141 |
categoryToItemDictionary at:category put:item. |
|
142 |
||
143 |
category size > 0 ifTrue:[ |
|
144 |
"/ find the parent ... |
|
145 |
parentPath := path copyWithoutLast:1. |
|
146 |
parentCategory := parentPath asStringWith:$-. |
|
147 |
||
148 |
parentItem := self addCategory:parentCategory . |
|
149 |
||
150 |
parentItem add:item sortBlock:[:i1 :i2 | i1 category asLowercase < i2 category asLowercase]. |
|
151 |
] |
|
152 |
]. |
|
153 |
^ item |
|
154 |
! |
|
155 |
||
156 |
generateHierarchicalCategoryTree |
|
157 |
|anchor| |
|
158 |
||
159 |
self categoryList value isNil ifTrue:[ |
|
160 |
self updateList. |
|
161 |
self categoryList value isNil ifTrue:[ |
|
162 |
^ nil. |
|
163 |
] |
|
164 |
]. |
|
165 |
||
166 |
anchor := ClassCategoryItem new. |
|
167 |
anchor category:nil. |
|
168 |
anchor label:nil. |
|
169 |
||
170 |
categoryToItemDictionary := Dictionary new. |
|
171 |
categoryToItemDictionary at:'' asSymbol put:anchor. |
|
172 |
||
173 |
self categoryList value do:[:eachCategory | |
|
174 |
(categoryToItemDictionary includesKey:eachCategory) ifFalse:[ |
|
175 |
self addCategory:eachCategory |
|
176 |
]. |
|
177 |
]. |
|
178 |
||
179 |
anchor recursiveSortChildren:[:i1 :i2 | i1 category asLowercase < i2 category asLowercase]. |
|
180 |
anchor expand. |
|
181 |
||
182 |
^ anchor |
|
183 |
! |
|
184 |
||
185 |
hierarchicalCategoryList |
|
186 |
|anchor | |
|
187 |
||
188 |
hierarchicalCategoryList isNil ifTrue:[ |
|
189 |
hierarchicalCategoryList := HierarchicalList new. |
|
190 |
hierarchicalCategoryList showRoot:false. |
|
191 |
||
192 |
(self slaveMode value ~~ true) ifTrue:[ |
|
193 |
anchor := self generateHierarchicalCategoryTree. |
|
194 |
hierarchicalCategoryList root:anchor. |
|
195 |
listValid := true |
|
196 |
] ifFalse:[ |
|
197 |
listValid := false |
|
198 |
] |
|
199 |
]. |
|
200 |
^ hierarchicalCategoryList |
|
201 |
! |
|
202 |
||
203 |
hierarchicalCategorySelection |
|
204 |
hierarchicalCategorySelection isNil ifTrue:[ |
|
205 |
hierarchicalCategorySelection := #() asValue. |
|
206 |
hierarchicalCategorySelection addDependent:self. |
|
207 |
]. |
|
208 |
^ hierarchicalCategorySelection. |
|
209 |
! ! |
|
210 |
||
211 |
!HierarchicalClassCategoryList methodsFor:'change & update'! |
|
212 |
||
213 |
delayedUpdate:something with:aParameter from:changedObject |
|
214 |
|cls sel oldMethod newMethod newPackage| |
|
215 |
||
216 |
self inSlaveModeOrInvisible ifTrue:[ |
|
217 |
super delayedUpdate:something with:aParameter from:changedObject. |
|
218 |
^ self. |
|
219 |
]. |
|
220 |
||
221 |
changedObject == updateTrigger ifTrue:[ |
|
222 |
hierarchicalCategoryTree := nil. |
|
223 |
self hierarchicalCategoryList. |
|
224 |
self updateTreeSelectionFromList. |
|
225 |
^ self |
|
226 |
]. |
|
227 |
||
228 |
changedObject == slaveMode ifTrue:[ |
|
229 |
listValid ~~ true ifTrue:[ |
|
230 |
self enqueueDelayedUpdateList |
|
231 |
]. |
|
232 |
"/ self invalidateList. |
|
233 |
^ self |
|
234 |
]. |
|
235 |
||
236 |
changedObject == hierarchicalCategorySelection ifTrue:[ |
|
237 |
self updateSelectionFromTree. |
|
238 |
^ self |
|
239 |
]. |
|
240 |
changedObject == self selectedCategories ifTrue:[ |
|
241 |
"/ update the trees selection as appropriate |
|
242 |
"/ self updateTreeSelection. |
|
243 |
self updateTreeSelectionFromList. |
|
244 |
]. |
|
245 |
changedObject == categoryList ifTrue:[ |
|
246 |
"/ update the tree |
|
247 |
self hierarchicalCategoryList root:(self generateHierarchicalCategoryTree). |
|
248 |
^ self. |
|
249 |
]. |
|
250 |
||
251 |
super delayedUpdate:something with:aParameter from:changedObject |
|
252 |
||
253 |
"Created: / 17.2.2000 / 23:41:02 / cg" |
|
254 |
"Modified: / 26.2.2000 / 01:21:49 / cg" |
|
255 |
! |
|
256 |
||
257 |
updateSelectionFromTree |
|
258 |
|treeSelection| |
|
259 |
||
260 |
treeSelection := hierarchicalCategorySelection value |
|
261 |
collect:[:eachIndex | |item| |
|
262 |
item := hierarchicalCategoryList at:eachIndex ifAbsent:nil. |
|
263 |
item category |
|
264 |
]. |
|
265 |
||
266 |
treeSelection asSet ~= (self selectedCategories value ? #()) asSet ifTrue:[ |
|
267 |
self selectedCategories value:treeSelection. |
|
268 |
] |
|
269 |
! |
|
270 |
||
271 |
updateTreeSelectionFromList |
|
272 |
|listSelection selectedTreeItems treeSelection| |
|
273 |
||
274 |
listSelection := self selectedCategories value. |
|
275 |
selectedTreeItems := listSelection collect:[:itemString | self treeItemForString:itemString string]. |
|
276 |
treeSelection := selectedTreeItems collect:[:eachItem | hierarchicalCategoryList identityIndexOf:eachItem]. |
|
277 |
treeSelection := treeSelection asOrderedCollection. |
|
278 |
"/hierarchicalCategorySelection value |
|
279 |
"/ collect:[:eachIndex | |item| |
|
280 |
"/ item := hierarchicalCategoryList at:eachIndex ifAbsent:nil. |
|
281 |
"/ item category |
|
282 |
"/ ]. |
|
283 |
"/ |
|
284 |
"/ treeSelection asSet ~= (self selectedCategories value ? #()) asSet ifTrue:[ |
|
285 |
"/ self selectedCategories value:treeSelection. |
|
286 |
"/ ] |
|
287 |
self hierarchicalCategorySelection value:treeSelection |
|
288 |
! ! |
|
289 |
||
290 |
!HierarchicalClassCategoryList methodsFor:'private'! |
|
291 |
||
292 |
makeItemVisible:itemString |
|
293 |
|treeItem idx listView| |
|
294 |
||
295 |
treeItem := self treeItemForString:itemString. |
|
296 |
idx := hierarchicalCategoryList identityIndexOf:treeItem. |
|
297 |
idx ~~ 0 ifTrue:[ |
|
298 |
(listView := self listView) notNil ifTrue:[ |
|
299 |
listView makeLineVisible:idx. |
|
300 |
] |
|
301 |
] |
|
302 |
! |
|
303 |
||
304 |
release |
|
305 |
super release. |
|
306 |
||
307 |
hierarchicalCategorySelection removeDependent:self. |
|
308 |
! |
|
309 |
||
310 |
treeItemForString:itemString |
|
311 |
|itemPath treeItem| |
|
312 |
||
313 |
itemPath := itemString string asCollectionOfSubstringsSeparatedBy:$-. |
|
314 |
treeItem := hierarchicalCategoryList root. |
|
315 |
[itemPath notEmpty] whileTrue:[ |
|
316 |
treeItem expand. |
|
317 |
treeItem := treeItem detect:[:childItem | childItem label string = itemPath first] ifNone:nil. |
|
318 |
itemPath := itemPath copyFrom:2. |
|
319 |
]. |
|
320 |
^ treeItem |
|
321 |
! ! |
|
322 |
||
323 |
!HierarchicalClassCategoryList methodsFor:'user actions'! |
|
324 |
||
325 |
doubleClicked:anIndex |
|
326 |
|item| |
|
327 |
||
328 |
item := hierarchicalCategoryList at:anIndex ifAbsent:nil. |
|
329 |
item isNil ifTrue:[ |
|
330 |
^ self |
|
331 |
]. |
|
332 |
||
333 |
(item canExpand not or:[item isExpanded]) ifTrue:[ |
|
334 |
doubleClickChannel notNil ifTrue:[ |
|
335 |
doubleClickChannel value:anIndex. |
|
336 |
] ifFalse:[ |
|
337 |
item collapse. |
|
338 |
]. |
|
339 |
^ self |
|
340 |
]. |
|
341 |
||
342 |
item expand. |
|
343 |
! |
|
344 |
||
345 |
indicatorPressed:anIndex |
|
346 |
|item sensor| |
|
347 |
||
348 |
item := hierarchicalCategoryList at:anIndex ifAbsent:nil. |
|
349 |
||
350 |
item isNil ifTrue:[ |
|
351 |
^ self |
|
352 |
]. |
|
353 |
||
354 |
sensor := self window sensor. |
|
355 |
(sensor ctrlDown or:[sensor shiftDown]) ifTrue:[ |
|
356 |
item recursiveToggleExpand |
|
357 |
] ifFalse:[ |
|
358 |
item toggleExpand |
|
359 |
]. |
|
360 |
! ! |
|
361 |
||
5793 | 362 |
!HierarchicalClassCategoryList::ClassCategoryItem methodsFor:'accessing'! |
5670
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
363 |
|
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
364 |
category |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
365 |
^ category |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
366 |
! |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
367 |
|
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
368 |
category:something |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
369 |
category := something. |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
370 |
! |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
371 |
|
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
372 |
icon |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
373 |
^ nil "/ SystemBrowser packageIcon |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
374 |
! |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
375 |
|
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
376 |
label |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
377 |
^ label |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
378 |
! |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
379 |
|
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
380 |
label:something |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
381 |
label := something. |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
382 |
! ! |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
383 |
|
5591 | 384 |
!HierarchicalClassCategoryList class methodsFor:'documentation'! |
385 |
||
386 |
version |
|
5794 | 387 |
^ '$Header: /cvs/stx/stx/libtool/Tools_HierarchicalClassCategoryList.st,v 1.5 2004-03-24 10:28:53 cg Exp $' |
5591 | 388 |
! ! |