author | Stefan Vogel <sv@exept.de> |
Thu, 23 Feb 2017 14:11:03 +0100 | |
changeset 17434 | bfd610008561 |
parent 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 |
^ #( |
|
14019
bf03aea592f9
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12703
diff
changeset
|
135 |
environmentHolder |
10350 | 136 |
#(#doubleClickChannel #action ) |
137 |
#forceGeneratorTrigger |
|
138 |
#hideUnloadedClasses |
|
139 |
#immediateUpdate |
|
140 |
#inGeneratorHolder |
|
141 |
#menuHolder |
|
142 |
#nameSpaceFilter |
|
143 |
#organizerMode |
|
144 |
#outGeneratorHolder |
|
145 |
#packageFilter |
|
146 |
#selectedCategories |
|
147 |
#selectionChangeCondition |
|
148 |
#slaveMode |
|
149 |
#updateTrigger |
|
150 |
#showCoverageInformation |
|
5591 | 151 |
). |
152 |
||
10350 | 153 |
"Modified: / 20-07-2011 / 14:29:15 / cg" |
14019
bf03aea592f9
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12703
diff
changeset
|
154 |
"Modified: / 24-02-2014 / 10:38:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5591 | 155 |
! ! |
156 |
||
157 |
!HierarchicalClassCategoryList methodsFor:'aspects'! |
|
158 |
||
159 |
addCategory:category |
|
160 |
|item path parentPath parentCategory parentItem| |
|
161 |
||
162 |
item:= categoryToItemDictionary at:category ifAbsent:nil. |
|
163 |
item isNil ifTrue:[ |
|
12703
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
164 |
path := category asCollectionOfSubstringsSeparatedBy:$-. |
5591 | 165 |
|
12703
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
166 |
item := ClassCategoryItem new. |
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
167 |
item category:category. |
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
168 |
item label:(path last). |
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
169 |
categoryToItemDictionary at:category put:item. |
5591 | 170 |
|
12703
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
171 |
category size > 0 ifTrue:[ |
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
172 |
"/ find the parent ... |
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
173 |
parentPath := path copyButLast:1. |
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
174 |
parentCategory := parentPath asStringWith:$-. |
5591 | 175 |
|
12703
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
176 |
parentItem := self addCategory:parentCategory . |
5591 | 177 |
|
12703
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
178 |
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
|
179 |
] |
5591 | 180 |
]. |
181 |
^ item |
|
182 |
! |
|
183 |
||
184 |
generateHierarchicalCategoryTree |
|
185 |
|anchor| |
|
186 |
||
187 |
self categoryList value isNil ifTrue:[ |
|
188 |
self updateList. |
|
189 |
self categoryList value isNil ifTrue:[ |
|
190 |
^ nil. |
|
191 |
] |
|
192 |
]. |
|
193 |
||
194 |
anchor := ClassCategoryItem new. |
|
195 |
anchor category:nil. |
|
196 |
anchor label:nil. |
|
197 |
||
198 |
categoryToItemDictionary := Dictionary new. |
|
199 |
categoryToItemDictionary at:'' asSymbol put:anchor. |
|
200 |
||
201 |
self categoryList value do:[:eachCategory | |
|
202 |
(categoryToItemDictionary includesKey:eachCategory) ifFalse:[ |
|
203 |
self addCategory:eachCategory |
|
204 |
]. |
|
205 |
]. |
|
206 |
||
207 |
anchor recursiveSortChildren:[:i1 :i2 | i1 category asLowercase < i2 category asLowercase]. |
|
208 |
anchor expand. |
|
209 |
||
210 |
^ anchor |
|
211 |
! |
|
212 |
||
213 |
hierarchicalCategoryList |
|
214 |
|anchor | |
|
215 |
||
216 |
hierarchicalCategoryList isNil ifTrue:[ |
|
217 |
hierarchicalCategoryList := HierarchicalList new. |
|
218 |
hierarchicalCategoryList showRoot:false. |
|
219 |
||
220 |
(self slaveMode value ~~ true) ifTrue:[ |
|
221 |
anchor := self generateHierarchicalCategoryTree. |
|
222 |
hierarchicalCategoryList root:anchor. |
|
223 |
listValid := true |
|
224 |
] ifFalse:[ |
|
225 |
listValid := false |
|
226 |
] |
|
227 |
]. |
|
228 |
^ hierarchicalCategoryList |
|
229 |
! |
|
230 |
||
231 |
hierarchicalCategorySelection |
|
232 |
hierarchicalCategorySelection isNil ifTrue:[ |
|
233 |
hierarchicalCategorySelection := #() asValue. |
|
234 |
hierarchicalCategorySelection addDependent:self. |
|
235 |
]. |
|
236 |
^ hierarchicalCategorySelection. |
|
237 |
! ! |
|
238 |
||
239 |
!HierarchicalClassCategoryList methodsFor:'change & update'! |
|
240 |
||
241 |
delayedUpdate:something with:aParameter from:changedObject |
|
242 |
|cls sel oldMethod newMethod newPackage| |
|
243 |
||
244 |
self inSlaveModeOrInvisible ifTrue:[ |
|
245 |
super delayedUpdate:something with:aParameter from:changedObject. |
|
246 |
^ self. |
|
247 |
]. |
|
248 |
||
249 |
changedObject == updateTrigger ifTrue:[ |
|
250 |
hierarchicalCategoryTree := nil. |
|
251 |
self hierarchicalCategoryList. |
|
252 |
self updateTreeSelectionFromList. |
|
253 |
^ self |
|
254 |
]. |
|
255 |
||
256 |
changedObject == slaveMode ifTrue:[ |
|
257 |
listValid ~~ true ifTrue:[ |
|
258 |
self enqueueDelayedUpdateList |
|
259 |
]. |
|
260 |
"/ self invalidateList. |
|
261 |
^ self |
|
262 |
]. |
|
263 |
||
264 |
changedObject == hierarchicalCategorySelection ifTrue:[ |
|
265 |
self updateSelectionFromTree. |
|
266 |
^ self |
|
267 |
]. |
|
268 |
changedObject == self selectedCategories ifTrue:[ |
|
269 |
"/ update the trees selection as appropriate |
|
270 |
"/ self updateTreeSelection. |
|
271 |
self updateTreeSelectionFromList. |
|
272 |
]. |
|
273 |
changedObject == categoryList ifTrue:[ |
|
274 |
"/ update the tree |
|
275 |
self hierarchicalCategoryList root:(self generateHierarchicalCategoryTree). |
|
276 |
^ self. |
|
277 |
]. |
|
278 |
||
279 |
super delayedUpdate:something with:aParameter from:changedObject |
|
280 |
||
281 |
"Created: / 17.2.2000 / 23:41:02 / cg" |
|
282 |
"Modified: / 26.2.2000 / 01:21:49 / cg" |
|
283 |
! |
|
284 |
||
285 |
updateSelectionFromTree |
|
286 |
|treeSelection| |
|
287 |
||
288 |
treeSelection := hierarchicalCategorySelection value |
|
289 |
collect:[:eachIndex | |item| |
|
290 |
item := hierarchicalCategoryList at:eachIndex ifAbsent:nil. |
|
291 |
item category |
|
292 |
]. |
|
293 |
||
294 |
treeSelection asSet ~= (self selectedCategories value ? #()) asSet ifTrue:[ |
|
295 |
self selectedCategories value:treeSelection. |
|
296 |
] |
|
297 |
! |
|
298 |
||
299 |
updateTreeSelectionFromList |
|
300 |
|listSelection selectedTreeItems treeSelection| |
|
301 |
||
302 |
listSelection := self selectedCategories value. |
|
303 |
selectedTreeItems := listSelection collect:[:itemString | self treeItemForString:itemString string]. |
|
304 |
treeSelection := selectedTreeItems collect:[:eachItem | hierarchicalCategoryList identityIndexOf:eachItem]. |
|
305 |
treeSelection := treeSelection asOrderedCollection. |
|
306 |
"/hierarchicalCategorySelection value |
|
307 |
"/ collect:[:eachIndex | |item| |
|
308 |
"/ item := hierarchicalCategoryList at:eachIndex ifAbsent:nil. |
|
309 |
"/ item category |
|
310 |
"/ ]. |
|
311 |
"/ |
|
312 |
"/ treeSelection asSet ~= (self selectedCategories value ? #()) asSet ifTrue:[ |
|
313 |
"/ self selectedCategories value:treeSelection. |
|
314 |
"/ ] |
|
315 |
self hierarchicalCategorySelection value:treeSelection |
|
316 |
! ! |
|
317 |
||
318 |
!HierarchicalClassCategoryList methodsFor:'private'! |
|
319 |
||
320 |
makeItemVisible:itemString |
|
321 |
|treeItem idx listView| |
|
322 |
||
323 |
treeItem := self treeItemForString:itemString. |
|
324 |
idx := hierarchicalCategoryList identityIndexOf:treeItem. |
|
325 |
idx ~~ 0 ifTrue:[ |
|
326 |
(listView := self listView) notNil ifTrue:[ |
|
327 |
listView makeLineVisible:idx. |
|
328 |
] |
|
329 |
] |
|
330 |
! |
|
331 |
||
332 |
release |
|
333 |
super release. |
|
334 |
||
335 |
hierarchicalCategorySelection removeDependent:self. |
|
336 |
! |
|
337 |
||
338 |
treeItemForString:itemString |
|
339 |
|itemPath treeItem| |
|
340 |
||
341 |
itemPath := itemString string asCollectionOfSubstringsSeparatedBy:$-. |
|
342 |
treeItem := hierarchicalCategoryList root. |
|
343 |
[itemPath notEmpty] whileTrue:[ |
|
344 |
treeItem expand. |
|
345 |
treeItem := treeItem detect:[:childItem | childItem label string = itemPath first] ifNone:nil. |
|
346 |
itemPath := itemPath copyFrom:2. |
|
347 |
]. |
|
348 |
^ treeItem |
|
349 |
! ! |
|
350 |
||
351 |
!HierarchicalClassCategoryList methodsFor:'user actions'! |
|
352 |
||
353 |
doubleClicked:anIndex |
|
354 |
|item| |
|
355 |
||
356 |
item := hierarchicalCategoryList at:anIndex ifAbsent:nil. |
|
357 |
item isNil ifTrue:[ |
|
358 |
^ self |
|
359 |
]. |
|
360 |
||
361 |
(item canExpand not or:[item isExpanded]) ifTrue:[ |
|
362 |
doubleClickChannel notNil ifTrue:[ |
|
363 |
doubleClickChannel value:anIndex. |
|
364 |
] ifFalse:[ |
|
365 |
item collapse. |
|
366 |
]. |
|
367 |
^ self |
|
368 |
]. |
|
369 |
||
370 |
item expand. |
|
371 |
! |
|
372 |
||
373 |
indicatorPressed:anIndex |
|
374 |
|item sensor| |
|
375 |
||
376 |
item := hierarchicalCategoryList at:anIndex ifAbsent:nil. |
|
377 |
||
378 |
item isNil ifTrue:[ |
|
379 |
^ self |
|
380 |
]. |
|
381 |
||
382 |
sensor := self window sensor. |
|
383 |
(sensor ctrlDown or:[sensor shiftDown]) ifTrue:[ |
|
384 |
item recursiveToggleExpand |
|
385 |
] ifFalse:[ |
|
386 |
item toggleExpand |
|
387 |
]. |
|
388 |
! ! |
|
389 |
||
5793 | 390 |
!HierarchicalClassCategoryList::ClassCategoryItem methodsFor:'accessing'! |
5670
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
391 |
|
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
392 |
category |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
393 |
^ category |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
394 |
! |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
395 |
|
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
396 |
category:something |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
397 |
category := something. |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
398 |
! |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
399 |
|
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
400 |
icon |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
401 |
^ nil "/ SystemBrowser packageIcon |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
402 |
! ! |
e5c8a8e964dc
oops - private class got lost
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
403 |
|
5591 | 404 |
!HierarchicalClassCategoryList class methodsFor:'documentation'! |
405 |
||
406 |
version |
|
14019
bf03aea592f9
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12703
diff
changeset
|
407 |
^ '$Header: /cvs/stx/stx/libtool/Tools_HierarchicalClassCategoryList.st,v 1.11 2014-02-25 10:40:52 vrany Exp $' |
9470 | 408 |
! |
409 |
||
410 |
version_CVS |
|
14019
bf03aea592f9
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12703
diff
changeset
|
411 |
^ '$Header: /cvs/stx/stx/libtool/Tools_HierarchicalClassCategoryList.st,v 1.11 2014-02-25 10:40:52 vrany Exp $' |
5591 | 412 |
! ! |
12703
f29ee6d1349e
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10350
diff
changeset
|
413 |