author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 03 Sep 2013 16:14:28 +0100 | |
branch | default-browser-environment |
changeset 13473 | d8e9ed472e9f |
parent 12715 | 755f78ea626b |
permissions | -rw-r--r-- |
9990 | 1 |
" |
10062 | 2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
3 |
All Rights Reserved |
|
9990 | 4 |
|
10062 | 5 |
Permission is hereby granted, free of charge, to any person |
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9990 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
HierarchicalProjectList subclass:#HierarchicalPackageFilterList |
|
31 |
instanceVariableNames:'' |
|
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'Interface-Browsers-New-Profiler' |
|
35 |
! |
|
36 |
||
37 |
HierarchicalItemWithLabel subclass:#PackageItem |
|
38 |
instanceVariableNames:'packageID selected' |
|
39 |
classVariableNames:'' |
|
40 |
poolDictionaries:'' |
|
41 |
privateIn:HierarchicalPackageFilterList |
|
42 |
! |
|
43 |
||
44 |
!HierarchicalPackageFilterList class methodsFor:'documentation'! |
|
45 |
||
46 |
copyright |
|
47 |
" |
|
10062 | 48 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
49 |
All Rights Reserved |
|
50 |
||
51 |
Permission is hereby granted, free of charge, to any person |
|
52 |
obtaining a copy of this software and associated documentation |
|
53 |
files (the 'Software'), to deal in the Software without |
|
54 |
restriction, including without limitation the rights to use, |
|
55 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
56 |
copies of the Software, and to permit persons to whom the |
|
57 |
Software is furnished to do so, subject to the following |
|
58 |
conditions: |
|
9990 | 59 |
|
10062 | 60 |
The above copyright notice and this permission notice shall be |
61 |
included in all copies or substantial portions of the Software. |
|
62 |
||
63 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
64 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
65 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
66 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
67 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
68 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
69 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
70 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9990 | 71 |
" |
72 |
! ! |
|
73 |
||
74 |
!HierarchicalPackageFilterList class methodsFor:'interface specs'! |
|
75 |
||
76 |
windowSpec |
|
77 |
"This resource specification was automatically generated |
|
78 |
by the UIPainter of ST/X." |
|
79 |
||
80 |
"Do not manually edit this!! If it is corrupted, |
|
81 |
the UIPainter may not be able to read the specification." |
|
82 |
||
83 |
" |
|
84 |
UIPainter new openOnClass:Tools::HierarchicalPackageFilterList andSelector:#windowSpec |
|
85 |
Tools::HierarchicalPackageFilterList new openInterface:#windowSpec |
|
86 |
Tools::HierarchicalPackageFilterList open |
|
87 |
" |
|
88 |
||
89 |
<resource: #canvas> |
|
90 |
||
91 |
^ |
|
92 |
#(FullSpec |
|
93 |
name: windowSpec |
|
94 |
window: |
|
95 |
(WindowSpec |
|
96 |
label: 'ProjectList' |
|
97 |
name: 'ProjectList' |
|
98 |
min: (Point 0 0) |
|
99 |
max: (Point 1024 721) |
|
100 |
bounds: (Rectangle 0 0 346 324) |
|
101 |
) |
|
102 |
component: |
|
103 |
(SpecCollection |
|
104 |
collection: ( |
|
105 |
(HierarchicalListViewSpec |
|
106 |
name: 'HierarchicalListView1' |
|
107 |
layout: (LayoutFrame 0 0 0 0 0 1 -30 1) |
|
108 |
tabable: true |
|
109 |
model: hierarchicalProjectSelection |
|
110 |
menu: menuHolder |
|
111 |
hasHorizontalScrollBar: true |
|
112 |
hasVerticalScrollBar: true |
|
113 |
miniScrollerHorizontal: true |
|
114 |
listModel: hierarchicalProjectList |
|
115 |
highlightMode: line |
|
116 |
doubleClickSelector: doubleClicked: |
|
117 |
showLines: false |
|
118 |
indicatorSelector: indicatorPressed: |
|
119 |
properties: |
|
120 |
(PropertyListDictionary |
|
121 |
dragArgument: nil |
|
122 |
dropArgument: nil |
|
123 |
canDropSelector: canDrop: |
|
124 |
dropSelector: doDrop: |
|
125 |
) |
|
126 |
) |
|
127 |
(LabelSpec |
|
128 |
label: 'Hint: double-click on item to (de)select' |
|
129 |
name: 'Hint' |
|
130 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
131 |
translateLabel: true |
|
132 |
adjust: left |
|
133 |
) |
|
134 |
) |
|
135 |
||
136 |
) |
|
137 |
) |
|
138 |
||
139 |
"Modified: / 10-10-2007 / 12:25:16 / janfrog" |
|
140 |
! ! |
|
141 |
||
142 |
!HierarchicalPackageFilterList class methodsFor:'plugIn spec'! |
|
143 |
||
144 |
aspectSelectors |
|
145 |
"This resource specification was automatically generated |
|
146 |
by the UIPainter of ST/X." |
|
147 |
||
148 |
"Do not manually edit this. If it is corrupted, |
|
149 |
the UIPainter may not be able to read the specification." |
|
150 |
||
151 |
"Return a description of exported aspects; |
|
152 |
these can be connected to aspects of an embedding application |
|
153 |
(if this app is embedded in a subCanvas)." |
|
154 |
||
155 |
^ #( |
|
156 |
#packageFilter |
|
157 |
). |
|
158 |
||
159 |
"Modified: / 10-10-2007 / 12:24:58 / janfrog" |
|
160 |
! ! |
|
161 |
||
162 |
!HierarchicalPackageFilterList methodsFor:'aspects'! |
|
163 |
||
164 |
generateHierarchicalProjectTree |
|
165 |
|anchor| |
|
166 |
||
167 |
self projectList value isNil ifTrue:[ |
|
168 |
self updateList. |
|
169 |
self projectList value isNil ifTrue:[ |
|
170 |
^ nil. |
|
171 |
] |
|
172 |
]. |
|
173 |
||
174 |
anchor := Tools::HierarchicalPackageFilterList::PackageItem new. |
|
175 |
anchor package:''. |
|
176 |
anchor label:nil. |
|
177 |
||
178 |
packageToItemDictionary := IdentityDictionary new. |
|
179 |
packageToItemDictionary at:'' asSymbol put:anchor. |
|
180 |
||
181 |
self projectList value do:[:eachPackageString | |
|
182 |
|package| |
|
183 |
eachPackageString = '* all *' ifFalse:[ |
|
184 |
package := eachPackageString asSymbol. |
|
185 |
(packageToItemDictionary includesKey:package) ifFalse:[ |
|
186 |
self addPackage:package |
|
187 |
] |
|
188 |
]. |
|
189 |
]. |
|
190 |
||
13473
d8e9ed472e9f
Introduced environment instvar in Tools::NavigatorModel.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12715
diff
changeset
|
191 |
"/ environment allClassesDo:[:eachClass | |
9990 | 192 |
"/ |package| |
193 |
"/ |
|
194 |
"/ package := eachClass package asSymbol. |
|
195 |
"/ (packageToItemDictionary includesKey:package) ifFalse:[ |
|
196 |
"/ self addPackage:package |
|
197 |
"/ ]. |
|
198 |
"/ ]. |
|
199 |
anchor recursiveSortChildren:[:i1 :i2 | i1 label asLowercase < i2 label asLowercase]. |
|
200 |
anchor expand. |
|
201 |
anchor selected: true. |
|
202 |
||
203 |
^ anchor |
|
204 |
||
205 |
"Created: / 10-10-2007 / 10:16:57 / janfrog" |
|
206 |
"Modified: / 10-10-2007 / 12:40:52 / janfrog" |
|
207 |
! |
|
208 |
||
209 |
hierarchicalProjectList |
|
210 |
|anchor | |
|
211 |
||
212 |
hierarchicalProjectList isNil ifTrue:[ |
|
213 |
hierarchicalProjectList := HierarchicalList new. |
|
214 |
hierarchicalProjectList showRoot:false. |
|
215 |
hierarchicalProjectList application: self. |
|
216 |
||
217 |
("self slaveMode value ~~" true) ifTrue:[ |
|
218 |
anchor := self generateHierarchicalProjectTree. |
|
219 |
hierarchicalProjectList root:anchor. |
|
220 |
anchor parent: hierarchicalProjectList. |
|
221 |
listValid := true |
|
222 |
] ifFalse:[ |
|
223 |
listValid := false |
|
224 |
] |
|
225 |
]. |
|
226 |
^ hierarchicalProjectList |
|
227 |
||
228 |
"Created: / 10-10-2007 / 10:36:38 / janfrog" |
|
229 |
! ! |
|
230 |
||
231 |
!HierarchicalPackageFilterList methodsFor:'change & update'! |
|
232 |
||
233 |
updatePackageFilter |
|
234 |
||
235 |
| selectedPackages | |
|
236 |
selectedPackages := self hierarchicalProjectList root selectedPackageIDs. |
|
237 |
self packageFilter value: selectedPackages |
|
238 |
||
239 |
"Created: / 10-10-2007 / 12:41:46 / janfrog" |
|
240 |
! |
|
241 |
||
242 |
updateSelectionFromTree |
|
243 |
||
244 |
"nothing to do" |
|
245 |
||
246 |
"Created: / 10-10-2007 / 12:13:10 / janfrog" |
|
247 |
! ! |
|
248 |
||
249 |
!HierarchicalPackageFilterList methodsFor:'private'! |
|
250 |
||
251 |
addPackage:package |
|
252 |
|i p pp l parentPackage parentItem idx| |
|
253 |
||
254 |
i:= packageToItemDictionary at:package asSymbol ifAbsent:nil. |
|
255 |
i isNil ifTrue:[ |
|
256 |
i := Tools::HierarchicalPackageFilterList::PackageItem new. |
|
257 |
i package:package. |
|
258 |
packageToItemDictionary at:package asSymbol put:i. |
|
259 |
||
260 |
package size > 0 ifTrue:[ |
|
261 |
"/ find the parent ... |
|
262 |
p := package asCollectionOfSubstringsSeparatedByAny:':/.'. |
|
12715
755f78ea626b
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10062
diff
changeset
|
263 |
pp := p copyButLast:1. |
9990 | 264 |
l := (pp asStringWith:$/) size. |
265 |
parentPackage := package copyTo:l. |
|
266 |
||
267 |
parentItem := self addPackage:parentPackage asSymbol . |
|
268 |
||
269 |
parentPackage size == 0 ifTrue:[ |
|
270 |
idx := 1. |
|
271 |
] ifFalse:[ |
|
272 |
idx := parentPackage size + 2 |
|
273 |
]. |
|
274 |
i label:(package copyFrom:idx). |
|
275 |
||
276 |
parentItem add:i sortBlock:[:i1 :i2 | i1 label asLowercase < i2 label asLowercase]. |
|
277 |
||
278 |
"/ TODO: special items for classes, resources etc. |
|
279 |
||
280 |
] |
|
281 |
]. |
|
282 |
^ i |
|
283 |
||
284 |
"Created: / 10-10-2007 / 10:17:10 / janfrog" |
|
285 |
! ! |
|
286 |
||
287 |
!HierarchicalPackageFilterList methodsFor:'user actions'! |
|
288 |
||
289 |
doubleClicked:anIndex |
|
290 |
||
291 |
| selectedPackageItem | |
|
292 |
selectedPackageItem := self hierarchicalProjectList at: |
|
293 |
self hierarchicalProjectSelection value. |
|
294 |
selectedPackageItem toggleSelection |
|
295 |
||
296 |
"Created: / 10-10-2007 / 10:19:17 / janfrog" |
|
297 |
"Modified: / 10-10-2007 / 12:15:53 / janfrog" |
|
298 |
! ! |
|
299 |
||
300 |
!HierarchicalPackageFilterList::PackageItem class methodsFor:'documentation'! |
|
301 |
||
302 |
version |
|
12715
755f78ea626b
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10062
diff
changeset
|
303 |
^'$Header: /cvs/stx/stx/libtool/Tools__HierarchicalPackageFilterList.st,v 1.3 2013-04-25 13:11:37 stefan Exp $' |
9990 | 304 |
! ! |
305 |
||
306 |
!HierarchicalPackageFilterList::PackageItem class methodsFor:'image specs'! |
|
307 |
||
308 |
checkedIcon |
|
309 |
"This resource specification was automatically generated |
|
310 |
by the ImageEditor of ST/X." |
|
311 |
||
312 |
"Do not manually edit this!! If it is corrupted, |
|
313 |
the ImageEditor may not be able to read the specification." |
|
314 |
||
315 |
" |
|
316 |
self checkedIcon inspect |
|
317 |
ImageEditor openOnClass:self andSelector:#checkedIcon |
|
318 |
Icon flushCachedIcons |
|
319 |
" |
|
320 |
||
321 |
<resource: #image> |
|
322 |
||
323 |
^Icon |
|
324 |
constantNamed:#'Tools::HierarchicalPackageFilterList::PackageItem class checkedIcon' |
|
325 |
ifAbsentPut:[(Depth1Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@C?<O?0??C?<O?0??C?<O?07?C?<O?0??@@@@@@b') ; colorMapFromArray:#[0 0 0 33 161 33]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
326 |
?????<@C0@O@D<@30GOH8<7C38OG@<HC0@O@@?????<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
327 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
328 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself] |
|
329 |
||
330 |
"Created: / 10-10-2007 / 10:52:06 / janfrog" |
|
331 |
! |
|
332 |
||
333 |
uncheckedIcon |
|
334 |
"This resource specification was automatically generated |
|
335 |
by the ImageEditor of ST/X." |
|
336 |
||
337 |
"Do not manually edit this!! If it is corrupted, |
|
338 |
the ImageEditor may not be able to read the specification." |
|
339 |
||
340 |
" |
|
341 |
self checkFrameForm inspect |
|
342 |
ImageEditor openOnClass:self andSelector:#checkFrameForm |
|
343 |
Icon flushCachedIcons |
|
344 |
" |
|
345 |
||
346 |
<resource: #image> |
|
347 |
||
348 |
^Icon |
|
349 |
constantNamed:#'Tools::HierarchicalPackageFilterList::PackageItem class checkFrameForm' |
|
350 |
ifAbsentPut:[(Depth1Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@C?<O?0??C?<O?0??C?<O?0??C?<O?0??@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
351 |
?????<@C0@O@@<@C0@O@@<@C0@O@@<@C0@O@@?????<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
352 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
353 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself] |
|
354 |
||
355 |
"Created: / 10-10-2007 / 10:49:12 / janfrog" |
|
356 |
! ! |
|
357 |
||
358 |
!HierarchicalPackageFilterList::PackageItem methodsFor:'accessing'! |
|
359 |
||
360 |
children |
|
361 |
children isNil ifTrue:[ |
|
362 |
children := #() |
|
363 |
]. |
|
364 |
^ children |
|
365 |
! |
|
366 |
||
367 |
icon |
|
368 |
||
369 |
^self selected |
|
370 |
ifTrue:[self class checkedIcon] |
|
371 |
ifFalse:[self class uncheckedIcon] |
|
372 |
||
373 |
"Created: / 10-10-2007 / 10:16:04 / janfrog" |
|
374 |
"Modified: / 10-10-2007 / 12:17:50 / janfrog" |
|
375 |
! |
|
376 |
||
377 |
label |
|
378 |
||
379 |
^label |
|
380 |
||
381 |
||
382 |
"Modified: / 20-04-2005 / 19:10:49 / janfrog" |
|
383 |
! |
|
384 |
||
385 |
label:aString |
|
386 |
label ~= aString ifTrue:[ |
|
387 |
label := aString. |
|
388 |
self changed:#label |
|
389 |
]. |
|
390 |
! |
|
391 |
||
392 |
package |
|
393 |
^ packageID |
|
394 |
! |
|
395 |
||
396 |
package:prefixOrPackageID |
|
397 |
packageID := prefixOrPackageID |
|
398 |
! |
|
399 |
||
400 |
packageID |
|
401 |
^ packageID |
|
402 |
||
403 |
"Created: / 10-10-2007 / 12:09:14 / janfrog" |
|
404 |
! |
|
405 |
||
406 |
selected |
|
407 |
^ selected ? false |
|
408 |
||
409 |
"Created: / 10-10-2007 / 12:16:21 / janfrog" |
|
410 |
! |
|
411 |
||
412 |
selected:aBoolean |
|
413 |
||
414 |
self selected: aBoolean doUpdate: true |
|
415 |
||
416 |
"Created: / 10-10-2007 / 12:16:21 / janfrog" |
|
417 |
! |
|
418 |
||
419 |
selected:sel doUpdate: doUpdate |
|
420 |
||
421 |
selected := sel. |
|
422 |
self children do:[:child|child selected: sel doUpdate:false]. |
|
423 |
doUpdate ifTrue:[ |
|
424 |
self model ifNotNil:[ |
|
425 |
self model changed. |
|
426 |
self application updatePackageFilter |
|
427 |
] |
|
428 |
] |
|
429 |
||
430 |
"Created: / 10-10-2007 / 12:19:51 / janfrog" |
|
431 |
! |
|
432 |
||
433 |
selectedPackageIDs |
|
434 |
||
435 |
| stream | |
|
436 |
stream := OrderedCollection new writeStream. |
|
437 |
self selectedPackageIDsOn: stream. |
|
438 |
^stream contents |
|
439 |
||
440 |
"Created: / 10-10-2007 / 13:29:35 / janfrog" |
|
441 |
! |
|
442 |
||
443 |
selectedPackageIDsOn: stream |
|
444 |
||
445 |
self selected ifTrue:[stream nextPut: self packageID]. |
|
446 |
self children do:[:child|child selectedPackageIDsOn: stream]. |
|
447 |
||
448 |
"Created: / 10-10-2007 / 13:30:18 / janfrog" |
|
449 |
! ! |
|
450 |
||
451 |
!HierarchicalPackageFilterList::PackageItem methodsFor:'user actions'! |
|
452 |
||
453 |
toggleSelection |
|
454 |
||
455 |
self selected: self selected not |
|
456 |
||
457 |
"Created: / 10-10-2007 / 12:16:08 / janfrog" |
|
458 |
! ! |
|
459 |
||
460 |
!HierarchicalPackageFilterList class methodsFor:'documentation'! |
|
461 |
||
462 |
version_CVS |
|
12715
755f78ea626b
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10062
diff
changeset
|
463 |
^ '$Header: /cvs/stx/stx/libtool/Tools__HierarchicalPackageFilterList.st,v 1.3 2013-04-25 13:11:37 stefan Exp $' |
9990 | 464 |
! |
465 |
||
466 |
version_SVN |
|
467 |
^ '§Id§' |
|
468 |
! ! |
|
12715
755f78ea626b
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
10062
diff
changeset
|
469 |