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