author | Claus Gittinger <cg@exept.de> |
Sat, 28 Jul 2018 10:07:36 +0200 | |
changeset 3578 | 9965b6b7e99b |
parent 3531 | cf715db898dd |
child 3652 | 2b6236bab321 |
permissions | -rw-r--r-- |
3531 | 1 |
"{ Encoding: utf8 }" |
2 |
||
425 | 3 |
" |
771 | 4 |
COPYRIGHT (c) 1997-1998 by eXept Software AG |
425 | 5 |
All Rights Reserved |
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
14 |
"{ Package: 'stx:libtool2' }" |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
15 |
|
3198
d0f01dc022bb
class: ResourceSelectionBrowser
Claus Gittinger <cg@exept.de>
parents:
3117
diff
changeset
|
16 |
"{ NameSpace: Smalltalk }" |
d0f01dc022bb
class: ResourceSelectionBrowser
Claus Gittinger <cg@exept.de>
parents:
3117
diff
changeset
|
17 |
|
425 | 18 |
SelectionBrowser subclass:#ResourceSelectionBrowser |
477 | 19 |
instanceVariableNames:'resourceMethod resourceClass resourceSuperclass resourceTypes |
3531 | 20 |
allClasses classSelectionBlock classFilter packageFilter |
21 |
metaClassOnly existingOnly filter classPresentation' |
|
22 |
classVariableNames:'LastClassPresentation' |
|
425 | 23 |
poolDictionaries:'' |
619 | 24 |
category:'Interface-Dialogs' |
425 | 25 |
! |
26 |
||
771 | 27 |
Object subclass:#ResourceMethod |
523 | 28 |
instanceVariableNames:'method icon resourceType selector' |
29 |
classVariableNames:'' |
|
30 |
poolDictionaries:'' |
|
31 |
privateIn:ResourceSelectionBrowser |
|
32 |
! |
|
33 |
||
425 | 34 |
!ResourceSelectionBrowser class methodsFor:'documentation'! |
35 |
||
36 |
copyright |
|
37 |
" |
|
771 | 38 |
COPYRIGHT (c) 1997-1998 by eXept Software AG |
425 | 39 |
All Rights Reserved |
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
" |
|
48 |
||
49 |
! |
|
50 |
||
51 |
documentation |
|
52 |
" |
|
746 | 53 |
The ResourceSelectionBrowser allows you to browse in class hierarchies |
771 | 54 |
and to select resource methods for loading or to saving resource |
55 |
specifications (#canvas, #menu, etc.). |
|
56 |
||
57 |
[instance variables:] |
|
907 | 58 |
resourceMethod <Symbol> selector of the resource spec |
59 |
resourceClass <Symbol> class of the resource spec |
|
60 |
resourceSuperclass <Symbol> root class of the tree list |
|
61 |
resourceTypes <Array> allowed resource types |
|
62 |
allClasses <Array> list of the subclasses of resourceSuperclass |
|
63 |
classSelectionBlock <Block> by evaluating this block the class selection is done |
|
3531 | 64 |
classFilter <Block> if non-nil, given a class, has to return true for a class to be shown |
65 |
packageFilter <Block> if non-nil, given a package, has to return true for a class to be shown |
|
66 |
existingOnly <Boolean> if set, only classes with existing resources are shown (for load dialogs); |
|
67 |
otherwise, empty classes are also shown (for save dialogs) |
|
746 | 68 |
|
504 | 69 |
[start with:] |
907 | 70 |
ResourceSelectionBrowser open |
504 | 71 |
|
72 |
[author:] |
|
907 | 73 |
Thomas Zwick, eXept Software AG |
425 | 74 |
" |
75 |
! ! |
|
76 |
||
77 |
!ResourceSelectionBrowser class methodsFor:'instance creation'! |
|
78 |
||
1978 | 79 |
request:aTitle onSuperclass:aSuperclass andClass:aClassOrClassName andSelector:aSelector withResourceTypes:resourceTypes |
3531 | 80 |
"opens a ResourceSelectionBrowser; |
81 |
return a Message-object (whoInfo) or nil." |
|
1978 | 82 |
|
3531 | 83 |
^ (self |
84 |
title:aTitle |
|
85 |
onSuperclass:aSuperclass |
|
86 |
andClass:aClassOrClassName andSelector:aSelector |
|
87 |
withResourceTypes:resourceTypes |
|
88 |
) openAndLetUserChoose |
|
1978 | 89 |
|
649 | 90 |
" |
1978 | 91 |
ResourceSelectionBrowser |
906 | 92 |
request: 'Select a Resource Selector' |
93 |
onSuperclass: #ApplicationModel |
|
3531 | 94 |
andClass: MenuEditor andSelector: #menuItemImage |
906 | 95 |
withResourceTypes: #(image) |
425 | 96 |
" |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
97 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
98 |
|
3531 | 99 |
title:aTitle onSuperclass:aSuperclass andClass:aClassOrClassName andSelector:aSelector withResourceTypes:resourceTypes |
100 |
"creates and returns a ResourceSelectionBrowser but does not open it. |
|
101 |
To open, |
|
102 |
send the returned browser an openAndLetUserChoose message, |
|
103 |
which returns the selected resource method's info (whoInfo) or nil on cancel. |
|
104 |
Use this to set additional filters before opening" |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
105 |
|
3531 | 106 |
^ (self new |
107 |
title: aTitle) |
|
108 |
onSuperclass:aSuperclass |
|
109 |
andClass:aClassOrClassName |
|
110 |
andSelector:aSelector |
|
111 |
withResourceTypes:resourceTypes |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
112 |
|
3531 | 113 |
" |
114 |
(ResourceSelectionBrowser |
|
115 |
title: 'Select a Resource Selector' |
|
116 |
onSuperclass: #ApplicationModel |
|
117 |
andClass: MenuEditor andSelector: #menuItemImage |
|
118 |
withResourceTypes: #(image) |
|
119 |
) openAndLetUserChoose |
|
120 |
" |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
121 |
! ! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
122 |
|
730 | 123 |
!ResourceSelectionBrowser class methodsFor:'image specs'! |
124 |
||
906 | 125 |
iconCategory |
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
126 |
<resource: #image> |
906 | 127 |
"This resource specification was automatically generated |
128 |
by the ImageEditor of ST/X." |
|
129 |
"Do not manually edit this!! If it is corrupted, |
|
130 |
the ImageEditor may not be able to read the specification." |
|
131 |
" |
|
132 |
self iconCategory inspect |
|
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
133 |
ImageEditor openOnClass:self andSelector:#iconCategory" |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
134 |
|
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
135 |
^ Icon constantNamed:#'ResourceSelectionBrowser class iconCategory' |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
136 |
ifAbsentPut:[ |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
137 |
(Depth4Image new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
138 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
139 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
140 |
photometric:(#palette); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
141 |
bitsPerSample:(#( 4 )); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
142 |
samplesPerPixel:(1); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
143 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
144 |
fromPackedString:'3L0@@@@@@L3L3L@@@@@@@@3L3@@3L3L3L0CL3@LQDQDQD#CL3@LRH"H"H3CL3@LRH"H"H3CL3@LRH"H"H3CL3@LRH"H"H3CL3@LRH"H"H3CL3@LRH"H"H3CL3@LRH"H"H3CL3@LRH"H"H3CL3@L#L3L3L3CL3@@3L3L3L0CL3L@@@@@@@@3L3L0@@@@@@L3L'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
145 |
colorMapFromArray:#[ 0 0 0 255 255 255 170 170 170 127 127 127 255 0 0 0 255 0 0 0 255 0 255 255 255 255 0 255 0 255 127 0 0 0 127 0 0 0 127 0 127 127 127 127 0 127 0 127 ]; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
146 |
mask:((ImageMask new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
147 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
148 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
149 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
150 |
fromPackedString:'<@O@8@G@3?3@7?;@7?;@7?;@7?;@7?;@7?;@7?;@7?;@7?;@7?;@3?3@8@G@<@O@'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
151 |
yourself); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
152 |
yourself |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
153 |
] |
1493 | 154 |
! |
906 | 155 |
|
730 | 156 |
iconClass |
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
157 |
<resource: #image> |
746 | 158 |
"This resource specification was automatically generated |
159 |
by the ImageEditor of ST/X." |
|
160 |
"Do not manually edit this!! If it is corrupted, |
|
161 |
the ImageEditor may not be able to read the specification." |
|
730 | 162 |
" |
1404 | 163 |
self iconClass inspect |
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
164 |
ImageEditor openOnClass:self andSelector:#iconClass" |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
165 |
|
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
166 |
^ Icon constantNamed:#'ResourceSelectionBrowser class iconClass' |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
167 |
ifAbsentPut:[ |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
168 |
(Depth2Image new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
169 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
170 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
171 |
photometric:(#palette); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
172 |
bitsPerSample:(#( 2 )); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
173 |
samplesPerPixel:(1); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
174 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
175 |
fromPackedString:'@@@@@@@*****ABUUUUT@IUUUUP@%UUUU@BUUUUT@IUUUUP@%UUUU@BUUUUT@IUUUUP@%UUUU@BUUUUT@IUUUUP@%UUUU@A@@@@@@@@@@@@@b'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
176 |
colorMapFromArray:#[ 0 0 0 170 170 170 255 255 255 ]; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
177 |
mask:((ImageMask new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
178 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
179 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
180 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
181 |
fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
182 |
yourself); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
183 |
yourself |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
184 |
] |
1493 | 185 |
! |
730 | 186 |
|
187 |
iconPrivateClass |
|
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
188 |
<resource: #image> |
746 | 189 |
"This resource specification was automatically generated |
190 |
by the ImageEditor of ST/X." |
|
191 |
"Do not manually edit this!! If it is corrupted, |
|
192 |
the ImageEditor may not be able to read the specification." |
|
730 | 193 |
" |
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
194 |
ImageEditor openOnClass:self andSelector:#iconPrivateClass" |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
195 |
|
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
196 |
^ Icon constantNamed:#'ResourceSelectionBrowser class iconPrivateClass' |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
197 |
ifAbsentPut:[ |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
198 |
(Depth2Image new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
199 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
200 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
201 |
photometric:(#palette); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
202 |
bitsPerSample:(#( 2 )); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
203 |
samplesPerPixel:(1); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
204 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
205 |
fromPackedString:'@@@@@@PUUUUU A****(@F*??* @Z+??*@A*/*>(OF*>+: @Z+??*@A*/?:(DF*>** @Z+:**@A*/**(@F*>** @Z****C2@@@@@@@@@@@@@b'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
206 |
colorMapFromArray:#[ 0 0 0 255 255 255 170 170 170 255 0 0 ]; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
207 |
mask:((ImageMask new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
208 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
209 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
210 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
211 |
fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
212 |
yourself); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
213 |
yourself |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
214 |
] |
1493 | 215 |
! ! |
730 | 216 |
|
425 | 217 |
!ResourceSelectionBrowser class methodsFor:'interface specs'! |
218 |
||
219 |
windowSpec |
|
746 | 220 |
"This resource specification was automatically generated |
221 |
by the UIPainter of ST/X." |
|
425 | 222 |
|
746 | 223 |
"Do not manually edit this!! If it is corrupted, |
224 |
the UIPainter may not be able to read the specification." |
|
425 | 225 |
|
226 |
" |
|
227 |
UIPainter new openOnClass:ResourceSelectionBrowser andSelector:#windowSpec |
|
228 |
ResourceSelectionBrowser new openInterface:#windowSpec |
|
746 | 229 |
ResourceSelectionBrowser open |
425 | 230 |
" |
231 |
||
232 |
<resource: #canvas> |
|
233 |
||
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
234 |
^ |
3531 | 235 |
#(FullSpec |
236 |
name: windowSpec |
|
237 |
uuid: 'fb378b3c-07aa-11e8-8563-b8f6b1108e05' |
|
238 |
window: |
|
239 |
(WindowSpec |
|
240 |
label: 'Resource Selection Browser' |
|
241 |
name: 'Resource Selection Browser' |
|
242 |
uuid: 'f1361a68-0791-11e8-8563-b8f6b1108e05' |
|
243 |
min: (Point 400 300) |
|
244 |
bounds: (Rectangle 0 0 644 460) |
|
245 |
) |
|
246 |
component: |
|
247 |
(SpecCollection |
|
248 |
collection: ( |
|
249 |
(VariableHorizontalPanelSpec |
|
250 |
name: 'VariableHorizontalPanel' |
|
251 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -36 1.0) |
|
252 |
uuid: 'f1361c5c-0791-11e8-8563-b8f6b1108e05' |
|
253 |
component: |
|
254 |
(SpecCollection |
|
255 |
collection: ( |
|
256 |
(ViewSpec |
|
257 |
name: 'Box1' |
|
258 |
uuid: 'f1361df6-0791-11e8-8563-b8f6b1108e05' |
|
259 |
component: |
|
260 |
(SpecCollection |
|
261 |
collection: ( |
|
262 |
(HorizontalPanelViewSpec |
|
263 |
name: 'HorizontalPanel2' |
|
264 |
layout: (LayoutFrame 0 0 2 0 297 0 23 0) |
|
265 |
uuid: 'f1361ebe-0791-11e8-8563-b8f6b1108e05' |
|
266 |
horizontalLayout: leftSpace |
|
267 |
verticalLayout: fit |
|
268 |
horizontalSpace: 3 |
|
269 |
verticalSpace: 3 |
|
270 |
component: |
|
271 |
(SpecCollection |
|
272 |
collection: ( |
|
273 |
(RadioButtonSpec |
|
274 |
label: 'Flat' |
|
275 |
name: 'RadioButton1' |
|
276 |
uuid: 'f1362062-0791-11e8-8563-b8f6b1108e05' |
|
277 |
translateLabel: true |
|
278 |
model: selectionOfClassPresentation |
|
279 |
isTriggerOnDown: true |
|
280 |
lampColor: (Color 0.0 0.0 0.0) |
|
281 |
select: Flat |
|
282 |
extent: (Point 80 21) |
|
283 |
) |
|
284 |
(RadioButtonSpec |
|
285 |
label: 'Categories' |
|
286 |
name: 'ClassCategoriesRadioButton' |
|
287 |
uuid: 'f1362062-0791-11e8-8563-b8f6b1108e05' |
|
288 |
translateLabel: true |
|
289 |
model: selectionOfClassPresentation |
|
290 |
isTriggerOnDown: true |
|
291 |
lampColor: (Color 0.0 0.0 0.0) |
|
292 |
select: #'Class Categories' |
|
293 |
extent: (Point 124 21) |
|
294 |
) |
|
295 |
(RadioButtonSpec |
|
296 |
label: 'Hierarchy' |
|
297 |
name: 'ClassHierarchyRadioButton' |
|
298 |
uuid: 'f136233c-0791-11e8-8563-b8f6b1108e05' |
|
299 |
translateLabel: true |
|
300 |
model: selectionOfClassPresentation |
|
301 |
isTriggerOnDown: true |
|
302 |
lampColor: (Color 0.0 0.0 0.0) |
|
303 |
select: #'Class Hierarchy' |
|
304 |
extent: (Point 145 21) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
305 |
) |
3531 | 306 |
) |
307 |
||
308 |
) |
|
309 |
) |
|
310 |
(SequenceViewSpec |
|
311 |
name: 'listOfClassesView' |
|
312 |
layout: (LayoutFrame 0 0.0 23 0.0 0 1.0 -24 1.0) |
|
313 |
uuid: 'f13624d6-0791-11e8-8563-b8f6b1108e05' |
|
314 |
tabable: true |
|
315 |
model: indexOfSelectedClassInFlatList |
|
316 |
hasHorizontalScrollBar: true |
|
317 |
hasVerticalScrollBar: true |
|
318 |
miniScrollerHorizontal: true |
|
319 |
useIndex: true |
|
320 |
sequenceList: listOfClassNames |
|
321 |
) |
|
322 |
(SelectionInTreeViewSpec |
|
323 |
name: 'listOfClassHierarchyView' |
|
324 |
layout: (LayoutFrame 0 0.0 23 0.0 0 1.0 -24 1.0) |
|
325 |
uuid: 'f13624d6-0791-11e8-8563-b8f6b1108e05' |
|
326 |
tabable: true |
|
327 |
model: selectionOfClassHierarchy |
|
328 |
hasHorizontalScrollBar: true |
|
329 |
hasVerticalScrollBar: true |
|
330 |
miniScrollerHorizontal: true |
|
331 |
showDirectoryIndicatorForRoot: false |
|
332 |
showDirectoryIndicator: true |
|
333 |
valueChangeSelector: classSelected |
|
334 |
hierarchicalList: rootOfClassHierarchy |
|
335 |
validateDoubleClickSelector: validateDoubleClick: |
|
336 |
contentsSelector: treeViewClassHierarchyContents |
|
337 |
labelSelector: treeViewClassHierarchyLabel |
|
338 |
childrenSelector: treeViewClassHierarchyChildren |
|
339 |
iconSelector: treeViewClassHierarchyIcon |
|
340 |
highlightMode: line |
|
341 |
) |
|
342 |
(SelectionInTreeViewSpec |
|
343 |
name: 'listOfClassCategoriesView' |
|
344 |
layout: (LayoutFrame 0 0.0 23 0.0 0 1.0 -24 1.0) |
|
345 |
uuid: 'f13627ba-0791-11e8-8563-b8f6b1108e05' |
|
346 |
tabable: true |
|
347 |
model: selectionOfClassCategories |
|
348 |
hasHorizontalScrollBar: true |
|
349 |
hasVerticalScrollBar: true |
|
350 |
miniScrollerHorizontal: true |
|
351 |
showRoot: false |
|
352 |
showDirectoryIndicator: true |
|
353 |
valueChangeSelector: classSelected |
|
354 |
hierarchicalList: rootOfClassCategories |
|
355 |
validateDoubleClickSelector: validateDoubleClick: |
|
356 |
childrenSelector: treeViewClassCategoryChildren |
|
357 |
iconSelector: treeViewClassCategoryIcon |
|
358 |
highlightMode: line |
|
359 |
) |
|
360 |
(InputFieldSpec |
|
361 |
name: 'classNameInputField' |
|
362 |
layout: (LayoutFrame 2 0.0 -22 1 -1 1.0 0 1) |
|
363 |
uuid: 'f1362922-0791-11e8-8563-b8f6b1108e05' |
|
364 |
tabable: true |
|
365 |
model: classNameHolder |
|
366 |
acceptOnLeave: true |
|
367 |
acceptOnLostFocus: true |
|
368 |
acceptOnPointerLeave: true |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
369 |
) |
3531 | 370 |
) |
371 |
||
372 |
) |
|
373 |
) |
|
374 |
(ViewSpec |
|
375 |
name: 'Box2' |
|
376 |
uuid: 'f1362aee-0791-11e8-8563-b8f6b1108e05' |
|
377 |
component: |
|
378 |
(SpecCollection |
|
379 |
collection: ( |
|
380 |
(VariableVerticalPanelSpec |
|
381 |
name: 'ResourcePanel' |
|
382 |
layout: (LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0) |
|
383 |
uuid: '51c4b91e-07a8-11e8-8563-b8f6b1108e05' |
|
384 |
component: |
|
385 |
(SpecCollection |
|
386 |
collection: ( |
|
387 |
(DataSetSpec |
|
388 |
name: 'resourcesDataSetView' |
|
389 |
uuid: 'f1362bac-0791-11e8-8563-b8f6b1108e05' |
|
390 |
model: selectionOfResourceMethod |
|
391 |
hasHorizontalScrollBar: true |
|
392 |
hasVerticalScrollBar: true |
|
393 |
miniScrollerHorizontal: true |
|
394 |
rowClassName: 'ResourceSelectionBrowser::Row' |
|
395 |
dataList: listOfResourceMethods |
|
396 |
useIndex: false |
|
397 |
has3Dseparators: true |
|
398 |
doubleClickSelector: resourceDoubleClicked |
|
399 |
columnHolder: resourceMethodColumns |
|
400 |
valueChangeSelector: resourceSelected |
|
401 |
verticalSpacing: 1 |
|
402 |
) |
|
403 |
(ArbitraryComponentSpec |
|
404 |
name: 'ImageView' |
|
405 |
uuid: '51c4bd9c-07a8-11e8-8563-b8f6b1108e05' |
|
406 |
hasBorder: false |
|
407 |
component: ImageView |
|
408 |
) |
|
409 |
) |
|
410 |
||
411 |
) |
|
412 |
handles: (Any 0.98999999999999999 1.0) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
413 |
) |
3531 | 414 |
(InputFieldSpec |
415 |
name: 'selectorInputField' |
|
416 |
layout: (LayoutFrame 2 0.0 -22 1 -2 1.0 0 1) |
|
417 |
uuid: 'f1362db4-0791-11e8-8563-b8f6b1108e05' |
|
418 |
tabable: true |
|
419 |
model: resourceSelectorHolder |
|
420 |
acceptOnLeave: true |
|
421 |
acceptOnLostFocus: true |
|
422 |
acceptOnPointerLeave: true |
|
423 |
) |
|
424 |
) |
|
425 |
||
426 |
) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
427 |
) |
3531 | 428 |
) |
429 |
||
430 |
) |
|
431 |
handles: (Any 0.5 1.0) |
|
432 |
) |
|
433 |
(HorizontalPanelViewSpec |
|
434 |
name: 'ButtonPanel' |
|
435 |
layout: (LayoutFrame 2 0.0 -30 1 -18 1.0 -4 1.0) |
|
436 |
uuid: 'f1362f3a-0791-11e8-8563-b8f6b1108e05' |
|
437 |
horizontalLayout: fit |
|
438 |
verticalLayout: fit |
|
439 |
reverseOrderIfOKAtLeft: true |
|
440 |
component: |
|
441 |
(SpecCollection |
|
442 |
collection: ( |
|
443 |
(ActionButtonSpec |
|
444 |
label: 'Help' |
|
445 |
name: 'HelpButton' |
|
446 |
activeHelpKey: dss |
|
447 |
uuid: 'f136303e-0791-11e8-8563-b8f6b1108e05' |
|
448 |
translateLabel: true |
|
449 |
model: openHTMLDocument: |
|
450 |
initiallyDisabled: true |
|
451 |
enableChannel: helpEnabled |
|
452 |
actionValue: 'tools/uipainter/ResourceSelectionBrowser.html' |
|
453 |
extent: (Point 204 26) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
454 |
) |
3531 | 455 |
(ActionButtonSpec |
456 |
label: 'Cancel' |
|
457 |
name: 'cancelButton' |
|
458 |
activeHelpKey: commitCancel |
|
459 |
uuid: 'f13631ba-0791-11e8-8563-b8f6b1108e05' |
|
460 |
translateLabel: true |
|
461 |
tabable: true |
|
462 |
model: cancel |
|
463 |
extent: (Point 204 26) |
|
464 |
) |
|
465 |
(ActionButtonSpec |
|
466 |
label: 'OK' |
|
467 |
name: 'okButton' |
|
468 |
activeHelpKey: commitOK |
|
469 |
uuid: 'f1363336-0791-11e8-8563-b8f6b1108e05' |
|
470 |
translateLabel: true |
|
471 |
tabable: true |
|
472 |
model: accept |
|
473 |
isDefault: true |
|
474 |
extent: (Point 204 26) |
|
475 |
) |
|
476 |
) |
|
477 |
||
478 |
) |
|
479 |
keepSpaceForOSXResizeHandleH: true |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
480 |
) |
3531 | 481 |
) |
482 |
||
483 |
) |
|
484 |
) |
|
425 | 485 |
! ! |
486 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
487 |
!ResourceSelectionBrowser class methodsFor:'list specs'! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
488 |
|
822 | 489 |
tableColumnsForResourceMethodAttributes |
821 | 490 |
"This resource specification was automatically generated |
491 |
by the DataSetBuilder of ST/X." |
|
492 |
||
493 |
"Do not manually edit this!! If it is corrupted, |
|
494 |
the DataSetBuilder may not be able to read the specification." |
|
495 |
||
496 |
" |
|
822 | 497 |
DataSetBuilder new openOnClass:ResourceSelectionBrowser andSelector:#tableColumnsForResourceMethodAttributes |
821 | 498 |
" |
499 |
||
500 |
<resource: #tableColumns> |
|
501 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
502 |
|
821 | 503 |
^ #( |
504 |
#(#DataSetColumnSpec |
|
505 |
#width: 20 |
|
506 |
#height: 20 |
|
507 |
#printSelector: #iconOn: |
|
508 |
#canSelect: false |
|
509 |
) |
|
510 |
#(#DataSetColumnSpec |
|
511 |
#label: ' Selector' |
|
512 |
#labelAlignment: #left |
|
513 |
#model: #selector |
|
514 |
#canSelect: false |
|
515 |
) |
|
516 |
#(#DataSetColumnSpec |
|
517 |
#label: ' Resource Type' |
|
518 |
#labelAlignment: #left |
|
519 |
#model: #resourceType |
|
520 |
#canSelect: false |
|
521 |
) |
|
522 |
) |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
523 |
! ! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
524 |
|
3531 | 525 |
!ResourceSelectionBrowser methodsFor:'accessing'! |
526 |
||
527 |
classFilter:aBlock |
|
528 |
"aBlock to return true/false, given a class. |
|
529 |
With false, it is not shown in the tree" |
|
530 |
||
531 |
classFilter := aBlock. |
|
532 |
! |
|
533 |
||
534 |
existingOnly:something |
|
535 |
existingOnly := something. |
|
536 |
! |
|
537 |
||
538 |
metaClassOnly:aBoolean |
|
539 |
"force selection to be limited to the metaclass" |
|
540 |
||
541 |
metaClassOnly := aBoolean. |
|
542 |
! |
|
543 |
||
544 |
packageFilter:aBlock |
|
545 |
"aBlock to return true/false, given a packageID. |
|
546 |
With false, the class is not shown in the tree" |
|
547 |
||
548 |
packageFilter := aBlock. |
|
549 |
! ! |
|
550 |
||
425 | 551 |
!ResourceSelectionBrowser methodsFor:'aspects'! |
552 |
||
1986 | 553 |
classNameHolder |
554 |
"returns the value holder for the name of the class" |
|
555 |
||
556 |
|holder| |
|
557 |
||
558 |
(holder := builder bindingAt:#valueOfClassName) isNil ifTrue:[ |
|
559 |
builder aspectAt:#valueOfClassName put:(holder := '' asValue). |
|
560 |
holder onChangeEvaluate:[self classSelectionUpdate:holder value]. |
|
561 |
]. |
|
562 |
^ holder |
|
563 |
! |
|
564 |
||
773 | 565 |
helpEnabled |
566 |
"returns whether there is a documentation file" |
|
567 |
||
568 |
^true |
|
569 |
! |
|
570 |
||
3531 | 571 |
indexOfSelectedClassInFlatList |
572 |
|holder| |
|
573 |
||
574 |
(holder := builder bindingAt:#indexOfSelectedClassInFlatList) isNil ifTrue:[ |
|
575 |
builder aspectAt:#indexOfSelectedClassInFlatList put:(holder := nil asValue). |
|
576 |
holder onChangeEvaluate:[ |
|
577 |
|clsName| |
|
578 |
||
579 |
clsName := self listOfClassNames at:holder value ifAbsent:nil. |
|
580 |
clsName notNil ifTrue:[ |
|
581 |
classSelectionBlock value:clsName |
|
582 |
]. |
|
583 |
]. |
|
584 |
]. |
|
585 |
^ holder |
|
586 |
! |
|
587 |
||
588 |
listOfClassNames |
|
589 |
"returns the value holder for the flat class list" |
|
590 |
||
591 |
|holder| |
|
592 |
||
593 |
||
594 |
(holder := builder bindingAt:#listOfClassNames) isNil ifTrue:[ |
|
595 |
builder aspectAt:#listOfClassNames put: (holder := List new). |
|
596 |
]. |
|
597 |
^ holder |
|
598 |
! |
|
599 |
||
771 | 600 |
listOfResourceMethods |
601 |
"returns the value holder for the list of the resource methods" |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
602 |
|
1184 | 603 |
^ builder listAspectFor:#listOfResourceMethods |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
604 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
605 |
|
771 | 606 |
resourceMethodColumns |
607 |
"returns the columns for the table of the resource methods as value holder" |
|
425 | 608 |
|
609 |
|holder| |
|
771 | 610 |
(holder := builder bindingAt:#resourceMethodColumns) isNil ifTrue:[ |
821 | 611 |
builder aspectAt:#resourceMethodColumns put:(holder := List new). |
822 | 612 |
holder addAll: (self class tableColumnsForResourceMethodAttributes collect: [:i| i decodeAsLiteralArray]). |
771 | 613 |
]. |
614 |
^ holder |
|
615 |
! |
|
616 |
||
1986 | 617 |
resourceSelectorHolder |
618 |
"returns the value holder for the name of the selector" |
|
619 |
||
620 |
|holder| |
|
621 |
(holder := builder bindingAt:#valueOfResourceSelector) isNil ifTrue:[ |
|
622 |
builder aspectAt:#valueOfResourceSelector put:(holder := '' asValue). |
|
623 |
]. |
|
624 |
^ holder |
|
625 |
! |
|
626 |
||
906 | 627 |
rootOfClassCategories |
628 |
"returns the value holder for the root of the class tree list" |
|
629 |
||
630 |
|holder| |
|
631 |
||
632 |
(holder := builder bindingAt:#rootOfClassCategories) isNil ifTrue:[ |
|
3531 | 633 |
classPresentation = #'Class Categories' ifTrue: [ |
634 |
builder aspectAt:#rootOfClassCategories put: (holder := TreeItem name: 'Categories') |
|
635 |
]. |
|
906 | 636 |
]. |
637 |
^ holder |
|
638 |
! |
|
639 |
||
640 |
rootOfClassHierarchy |
|
771 | 641 |
"returns the value holder for the root of the class tree list" |
642 |
||
643 |
|holder| |
|
906 | 644 |
|
645 |
||
646 |
(holder := builder bindingAt:#rootOfClassHierarchy) isNil ifTrue:[ |
|
3531 | 647 |
classPresentation = #'Class Hierarchy' ifTrue: [ |
648 |
builder aspectAt:#rootOfClassHierarchy put: (holder := TreeItem new) |
|
649 |
] |
|
425 | 650 |
]. |
651 |
^ holder |
|
652 |
! |
|
653 |
||
906 | 654 |
selectionOfClassCategories |
655 |
"returns the value holder for the selected class of the class tree list" |
|
656 |
||
657 |
|holder| |
|
658 |
(holder := builder bindingAt:#selectionOfClassCategories) isNil ifTrue:[ |
|
659 |
builder aspectAt:#selectionOfClassCategories put:(holder := ValueHolder new). |
|
660 |
]. |
|
661 |
^ holder |
|
662 |
! |
|
663 |
||
664 |
selectionOfClassHierarchy |
|
771 | 665 |
"returns the value holder for the selected class of the class tree list" |
425 | 666 |
|
906 | 667 |
|holder| |
668 |
(holder := builder bindingAt:#selectionOfClassHierarchy) isNil ifTrue:[ |
|
669 |
builder aspectAt:#selectionOfClassHierarchy put:(holder := ValueHolder new). |
|
670 |
]. |
|
671 |
^ holder |
|
672 |
! |
|
673 |
||
674 |
selectionOfClassPresentation |
|
3531 | 675 |
"returns the value holder for the selected class presentation |
676 |
(Flat, Hierarchy or Category)" |
|
906 | 677 |
|
425 | 678 |
|holder| |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
679 |
|
906 | 680 |
(holder := builder bindingAt:#selectionOfClassPresentation) isNil ifTrue:[ |
3531 | 681 |
builder |
682 |
aspectAt:#selectionOfClassPresentation |
|
683 |
put:(holder := RadioButtonGroup with: (classPresentation := classPresentation ? LastClassPresentation ? #'Class Categories')). |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
684 |
|
3531 | 685 |
holder onChangeEvaluate:[self classPresentationChanged ]. |
425 | 686 |
]. |
687 |
^ holder |
|
688 |
! |
|
689 |
||
771 | 690 |
selectionOfResourceMethod |
691 |
"returns the value holder for the selected resource method of the resource method list" |
|
425 | 692 |
|
693 |
|holder| |
|
771 | 694 |
(holder := builder bindingAt:#selectionOfResourceMethod) isNil ifTrue:[ |
695 |
builder aspectAt:#selectionOfResourceMethod put:(holder := '' asValue). |
|
425 | 696 |
]. |
697 |
^ holder |
|
698 |
! |
|
699 |
||
467 | 700 |
valueOfClassName |
2309 | 701 |
<resource: #obsolete> |
771 | 702 |
"returns the value holder for the name of the class" |
467 | 703 |
|
1986 | 704 |
self obsoleteMethodWarning:'stupid name - use #classNameHolder'. |
705 |
^ self classNameHolder |
|
467 | 706 |
! |
707 |
||
771 | 708 |
valueOfResourceSelector |
2309 | 709 |
<resource: #obsolete> |
771 | 710 |
"returns the value holder for the name of the selector" |
425 | 711 |
|
1986 | 712 |
self obsoleteMethodWarning:'stupid name - use #resourceSelectorHolder'. |
713 |
^ self resourceSelectorHolder |
|
425 | 714 |
! ! |
715 |
||
3531 | 716 |
!ResourceSelectionBrowser methodsFor:'callbacks-user'! |
906 | 717 |
|
3531 | 718 |
classPresentationChanged |
719 |
"returns the value holder for the selected class presentation |
|
720 |
(Flat, Hierarchy or Category)" |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
721 |
|
3531 | 722 |
|comp newRoot| |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
723 |
|
3531 | 724 |
classPresentation := LastClassPresentation := self selectionOfClassPresentation value. |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
725 |
|
3531 | 726 |
classPresentation == #'Flat' ifTrue:[ |
727 |
self listOfClassNames isEmpty ifTrue:[ self updateListOfClasses ]. |
|
728 |
comp := builder componentAt: #listOfClassesView. |
|
729 |
] ifFalse:[ |
|
730 |
classPresentation == #'Class Hierarchy' ifTrue:[ |
|
731 |
comp := builder componentAt: #listOfClassHierarchyView. |
|
732 |
newRoot := self rootOfClassHierarchy. |
|
733 |
] ifFalse: [ |
|
734 |
comp := builder componentAt: #listOfClassCategoriesView. |
|
735 |
newRoot := self rootOfClassCategories. |
|
736 |
]. |
|
737 |
comp root:newRoot. |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
738 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
739 |
|
3531 | 740 |
comp raise; requestFocus. |
741 |
classSelectionBlock value:(self classNameHolder value) |
|
742 |
! |
|
743 |
||
744 |
classSelected |
|
745 |
"after a class selection, read the allowed resource methods of the selected class" |
|
746 |
||
747 |
|sel className| |
|
748 |
||
749 |
classPresentation = #'Class Hierarchy' |
|
750 |
"/ ifTrue: [sel := self selectionOfClassHierarchy value] |
|
751 |
ifFalse: [sel := self selectionOfClassCategories value]. |
|
752 |
||
753 |
resourceClass := nil. |
|
754 |
sel notNil ifTrue:[ |
|
755 |
sel contents ~~ #Category ifTrue:[ |
|
756 |
className := sel name. |
|
757 |
resourceClass := Smalltalk classNamed:className. |
|
758 |
] |
|
759 |
]. |
|
760 |
self updateResourceMethodList. |
|
761 |
! |
|
762 |
||
763 |
classSelectionUpdate:clsPattern |
|
764 |
"called when a new class is selected AND when switching presentation modes" |
|
765 |
||
766 |
|foundClass classes| |
|
767 |
||
768 |
"/ because this is also called for presentation switch, |
|
769 |
"/ we cannot tune it this way... |
|
770 |
"/ (self classNameHolder value = clsPattern) ifTrue:[ |
|
771 |
"/ resourceClass notNil ifTrue:[ |
|
772 |
"/ resourceClass name = clsPattern ifTrue:[ |
|
773 |
"/ ^ self |
|
774 |
"/ ]. |
|
775 |
"/ ]. |
|
776 |
"/ ]. |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
777 |
|
3531 | 778 |
clsPattern notNil ifTrue:[ |
779 |
foundClass := Smalltalk classNamed:clsPattern. |
|
780 |
]. |
|
781 |
(foundClass isClass not or:[foundClass name ~= clsPattern]) |
|
782 |
ifTrue: [ |
|
783 |
classes := allClasses select: [:cls| cls name size >= clsPattern size]. |
|
784 |
1 to: clsPattern size do: [:i| |
|
785 |
classes := classes select: [:cls| (cls name at: i) == (clsPattern at: i)]. |
|
786 |
]. |
|
787 |
foundClass := classes at: 1 ifAbsent:[]. |
|
788 |
]. |
|
789 |
||
790 |
foundClass notNil ifTrue: [ |
|
791 |
foundClass := foundClass autoload. |
|
792 |
resourceClass := foundClass. |
|
793 |
||
794 |
classPresentation = #'Flat' ifTrue: [ |
|
795 |
|index| |
|
796 |
||
797 |
index := self listOfClassNames indexOf:resourceClass name. |
|
798 |
self indexOfSelectedClassInFlatList value:index. |
|
799 |
] ifFalse: [ |
|
800 |
classPresentation = #'Class Hierarchy' ifTrue: [ |
|
801 |
|searchArgs nonSuperclasses hierItem| |
|
802 |
||
803 |
false "foundClass isPrivate" |
|
804 |
ifFalse: [searchArgs := foundClass withAllSuperclasses reversed] |
|
805 |
ifTrue: [searchArgs := foundClass owningClass withAllSuperclasses reversed. |
|
806 |
searchArgs add: foundClass]. |
|
807 |
(nonSuperclasses := self treeViewClassHierarchyContents allSuperclasses) notNil |
|
808 |
ifTrue: [searchArgs := searchArgs reject: [:cls| nonSuperclasses includes: cls]]. |
|
809 |
||
810 |
hierItem := self rootOfClassHierarchy detectChild:[:child :arg| child contents == arg] arguments:searchArgs. |
|
811 |
hierItem notNil ifTrue:[ |
|
812 |
self selectionOfClassHierarchy value:hierItem. |
|
813 |
]. |
|
814 |
] ifFalse: [ |
|
815 |
|searchArgs hierItem| |
|
816 |
||
817 |
false "foundClass isPrivate" |
|
818 |
ifTrue: [searchArgs := Array with: 'Categories' with: foundClass category with: foundClass owningClass name with: foundClass name] |
|
819 |
ifFalse: [searchArgs := Array with: 'Categories' with: foundClass category with: foundClass name]. |
|
820 |
||
821 |
hierItem := self rootOfClassCategories detectChild:[:child :arg| (child name upTo: $ ) = arg] arguments:searchArgs. |
|
822 |
hierItem notNil ifTrue:[ |
|
823 |
self selectionOfClassCategories value: hierItem. |
|
824 |
]. |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
825 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
826 |
]. |
3531 | 827 |
]. |
828 |
||
829 |
self classNameHolder value: clsPattern. |
|
830 |
self updateResourceMethodList. |
|
831 |
! |
|
832 |
||
833 |
resourceDoubleClicked |
|
834 |
"after a double click on resource method, accept it and close" |
|
835 |
||
836 |
accept value: true. |
|
837 |
self closeRequest |
|
838 |
! |
|
839 |
||
840 |
resourceSelected |
|
841 |
"after a click on a resource method, set its selector into the field" |
|
842 |
||
843 |
|selectedMethodInfo mthd| |
|
844 |
||
845 |
selectedMethodInfo := self selectionOfResourceMethod value. |
|
846 |
selectedMethodInfo notNil ifTrue: [ |
|
847 |
self resourceSelectorHolder value:(selectedMethodInfo selector). |
|
848 |
mthd := selectedMethodInfo method. |
|
849 |
(mthd hasResource:#image) ifTrue:[ |
|
850 |
(builder componentAt:#ImageView) |
|
851 |
image:(mthd valueWithReceiver:nil arguments:#()) |
|
852 |
]. |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
853 |
] |
3531 | 854 |
! |
2908
178288821f0a
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
855 |
|
3531 | 856 |
updateListOfClasses |
857 |
|names| |
|
858 |
||
859 |
classPresentation = #'Flat' ifTrue: [ |
|
860 |
self listOfClassNames isEmpty ifTrue:[ |
|
861 |
names := (Smalltalk allClasses asOrderedCollection sortBySelector:#name) |
|
862 |
select:[:cls | self filterClass:cls] |
|
863 |
thenCollect:[:cls | cls name]. |
|
864 |
self listOfClassNames addAll:names. |
|
865 |
] |
|
866 |
] |
|
906 | 867 |
! |
868 |
||
3531 | 869 |
updateResourceMethodList |
870 |
"read the allowed resource methods of the selected class" |
|
871 |
||
872 |
|class className item| |
|
873 |
||
874 |
(class := resourceClass) isNil ifTrue:[ |
|
875 |
classPresentation = #'Class Hierarchy' |
|
876 |
ifTrue: [item := self selectionOfClassHierarchy value ] |
|
877 |
ifFalse: [item := self selectionOfClassCategories value ]. |
|
906 | 878 |
|
3531 | 879 |
item notNil ifTrue:[ |
880 |
item contents ~~ #Category ifTrue:[ |
|
881 |
className := item name. |
|
882 |
class := Smalltalk at:className asSymbol. |
|
883 |
] |
|
884 |
]. |
|
885 |
] ifFalse:[ |
|
886 |
class := resourceClass |
|
887 |
]. |
|
906 | 888 |
|
3531 | 889 |
class isNil ifTrue: [ |
890 |
self listOfResourceMethods contents:#(). |
|
891 |
^self |
|
892 |
]. |
|
632 | 893 |
|
3531 | 894 |
className := class name."/class theNonMetaclass name |
895 |
||
896 |
self withWaitCursorDo:[ |
|
897 |
|newContents| |
|
898 |
||
899 |
resourceTypes isNil ifTrue: [resourceTypes := Method resourceTypes]. |
|
632 | 900 |
|
3531 | 901 |
self classNameHolder value: className. |
902 |
self class lastSelection: className. |
|
903 |
||
904 |
newContents := class theMetaclass methodDictionary asOrderedCollection |
|
905 |
select:[:m | resourceTypes includes: m resourceType]. |
|
906 |
||
907 |
newContents := newContents sort:[:m1 :m2 | m1 selector < m2 selector]. |
|
908 |
newContents := newContents collect:[:m| (ResourceMethod new method:m)]. |
|
909 |
||
910 |
self listOfResourceMethods contents:newContents |
|
911 |
. |
|
912 |
] |
|
771 | 913 |
! |
914 |
||
915 |
validateDoubleClick: aTreeItem |
|
916 |
"returns whether a class may be selected" |
|
917 |
||
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
918 |
|cont| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
919 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
920 |
^ (cont := aTreeItem contents) ~= '' |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
921 |
and: [cont ~~ self treeViewClassHierarchyContents] |
771 | 922 |
|
923 |
||
924 |
||
632 | 925 |
! ! |
926 |
||
3531 | 927 |
!ResourceSelectionBrowser methodsFor:'initialization'! |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
928 |
|
3531 | 929 |
initialize |
930 |
"Invoked when a new instance is created." |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
931 |
|
3531 | 932 |
metaClassOnly := true. |
933 |
existingOnly := false. |
|
1732 | 934 |
|
3531 | 935 |
super initialize. |
425 | 936 |
! ! |
937 |
||
938 |
!ResourceSelectionBrowser methodsFor:'instance creation'! |
|
939 |
||
3531 | 940 |
onSuperclass: aSuperclassOrSymbol andClass:aClassOrClassName andSelector: aSelector withResourceTypes: aResourceTypes |
941 |
"create - but do not yet open |
|
942 |
a ResourceSelectionBrowser" |
|
425 | 943 |
|
3531 | 944 |
|cls| |
771 | 945 |
|
517 | 946 |
resourceMethod := aSelector. |
425 | 947 |
resourceTypes := aResourceTypes. |
948 |
resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol]. |
|
802 | 949 |
resourceClass := nil. |
950 |
||
1978 | 951 |
aClassOrClassName notNil ifTrue:[ |
952 |
aClassOrClassName isClass ifTrue: [ |
|
953 |
cls := aClassOrClassName. |
|
954 |
resourceClass := aClassOrClassName |
|
955 |
] ifFalse: [ |
|
956 |
cls := Smalltalk classNamed: aClassOrClassName. |
|
957 |
cls notNil ifTrue:[ |
|
958 |
resourceClass := cls |
|
802 | 959 |
] |
1978 | 960 |
] |
961 |
]. |
|
1986 | 962 |
self resourceSelectorHolder value:(aSelector ? ''). |
3531 | 963 |
! ! |
964 |
||
965 |
!ResourceSelectionBrowser methodsFor:'startup & release'! |
|
966 |
||
967 |
openAndLetUserChoose |
|
968 |
"opens the previously configured receiver; |
|
969 |
return a Message-object or nil" |
|
970 |
||
971 |
|selectedClass enteredClassName className cls| |
|
972 |
||
463 | 973 |
self open. |
974 |
||
1978 | 975 |
(selectedClass := self selectionOfClassHierarchy value) isNil ifTrue:[ |
976 |
(selectedClass := self selectionOfClassCategories value) isNil ifTrue:[ |
|
1986 | 977 |
(enteredClassName := self classNameHolder value) isNil ifTrue:[ |
1086
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
978 |
accept value ifTrue:[ |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
979 |
self warn:'No valid class selected/entered'. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
980 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
981 |
^ nil |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
982 |
] |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
983 |
] |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
984 |
]. |
693 | 985 |
|
1978 | 986 |
className := enteredClassName. |
987 |
className isNil ifTrue:[ |
|
988 |
className := selectedClass name |
|
425 | 989 |
]. |
1978 | 990 |
cls := Smalltalk classNamed:className. |
991 |
(cls isClass and:[accept value]) ifTrue:[ |
|
1986 | 992 |
^ Method::MethodWhoInfo class:cls selector:(self resourceSelectorHolder value) |
1086
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
993 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
994 |
|
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
995 |
accept value ifTrue:[ |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
996 |
self warn:'No valid class selected/entered'. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
997 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
998 |
^ nil |
802 | 999 |
|
1000 |
"Modified: / 22.4.1998 / 14:51:03 / cg" |
|
3531 | 1001 |
! |
1002 |
||
1003 |
openOnSuperclass: aSuperclassOrSymbol andClass:aClassOrClassName andSelector: aSelector withResourceTypes: aResourceTypes |
|
1004 |
"opens a ResourceSelectionBrowser; return a Message-object or nil" |
|
425 | 1005 |
|
3531 | 1006 |
self |
1007 |
onSuperclass: aSuperclassOrSymbol |
|
1008 |
andClass:aClassOrClassName andSelector: aSelector |
|
1009 |
withResourceTypes: aResourceTypes. |
|
1010 |
||
1011 |
self openAndLetUserChoose |
|
1012 |
! |
|
425 | 1013 |
|
623 | 1014 |
postBuildWith:aBuilder |
771 | 1015 |
"after building and before opening, |
906 | 1016 |
create a class selection block, an entry completion block for the class name field" |
623 | 1017 |
|
771 | 1018 |
|classSelection classNameInputField| |
3531 | 1019 |
|
1020 |
(resourceTypes notNil and:[(resourceTypes includesAny:#(image programImage))]) ifTrue:[ |
|
1021 |
(builder componentAt: #resourcesDataSetView) |
|
1022 |
origin:0.0@0.0 extent:(1.0 @ 0.7). |
|
1023 |
(builder componentAt: #ImageView) |
|
1024 |
origin:0.0@0.7 extent:(1.0 @ 0.3); beVisible. |
|
1025 |
(builder componentAt: #ResourcePanel) |
|
1026 |
resizeSubviews; sizeChanged:nil. |
|
1027 |
]. |
|
1028 |
||
906 | 1029 |
allClasses := self treeViewClassHierarchyContents withAllSubclasses reject: [:cls| cls isPrivate]. |
1978 | 1030 |
classSelection := resourceClass isNil ifTrue:[nil] ifFalse:[resourceClass name]. |
802 | 1031 |
|
1978 | 1032 |
(classSelection isNil or:[ (Smalltalk classNamed: classSelection) isNil]) |
689 | 1033 |
ifTrue: [classSelection := self class lastSelection]. |
1732 | 1034 |
"/ (classSelection isNil or:[Smalltalk at: classSelection]) isNil |
1035 |
"/ ifTrue: [classSelection := self treeViewContents]. |
|
802 | 1036 |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
1037 |
classSelectionBlock := [:clsPattern | self classSelectionUpdate:clsPattern]. |
1986 | 1038 |
self classNameHolder value:classSelection. |
771 | 1039 |
|
1920 | 1040 |
(classNameInputField := builder componentAt: #classNameInputField) |
1041 |
entryCompletionBlock: |
|
1042 |
[:value| |
|
1043 |
|s what m| |
|
1044 |
||
1045 |
s := classNameInputField contents withoutSpaces. |
|
1046 |
what := Smalltalk classnameCompletion:s inEnvironment:Smalltalk. |
|
1047 |
classNameInputField contents:what first. |
|
1048 |
(what at:2) size ~~ 1 ifTrue:[ |
|
3528 | 1049 |
classNameInputField device beepInEditor |
3531 | 1050 |
]. |
1051 |
(Smalltalk classNamed:(what at:1)) notNil ifTrue:[ |
|
1052 |
self classNameHolder value:(what at:1) |
|
1053 |
]. |
|
1920 | 1054 |
"/ |what oldClassName| |
1055 |
"/ oldClassName := classNameInputField contents. |
|
1056 |
"/ what := Smalltalk classnameCompletion: value withoutSpaces. |
|
1057 |
"/ classNameInputField contents:what first. |
|
1058 |
"/ oldClassName = classNameInputField contents ifTrue:[classNameInputField flash]. |
|
1059 |
"/ classSelectionBlock value: classNameInputField contents |
|
1060 |
]. |
|
771 | 1061 |
|
1986 | 1062 |
classSelectionBlock value: self classNameHolder value. |
3531 | 1063 |
"/ self updateResourceMethodList. -- will be done automatically via change |
906 | 1064 |
self selectionOfResourceMethod value: (self listOfResourceMethods detect: [:m| m selector == resourceMethod] ifNone: nil). |
909 | 1065 |
|
1066 |
^super postBuildWith:aBuilder |
|
910 | 1067 |
! |
1068 |
||
1069 |
postOpenWith:aBuilder |
|
1070 |
"after opening and if turned on make hierarchy view visible" |
|
1071 |
||
3531 | 1072 |
classPresentation = #'Class Hierarchy' ifTrue: [ |
1073 |
(builder componentAt: #listOfClassHierarchyView) raise |
|
1074 |
]. |
|
1075 |
classPresentation = #'Flat' ifTrue: [ |
|
1076 |
self updateListOfClasses. |
|
1077 |
(builder componentAt: #listOfClassesView) raise |
|
1078 |
]. |
|
910 | 1079 |
|
2026 | 1080 |
super postOpenWith:aBuilder |
425 | 1081 |
! ! |
1082 |
||
3531 | 1083 |
!ResourceSelectionBrowser methodsFor:'tree building - category'! |
1084 |
||
1085 |
filterClass:cls |
|
1086 |
"true if cls is to be shown" |
|
1087 |
||
1088 |
classFilter notNil ifTrue:[ |
|
1089 |
(classFilter value:cls) ifFalse:[^ false]. |
|
1090 |
]. |
|
1091 |
packageFilter notNil ifTrue:[ |
|
1092 |
(packageFilter value:cls package) ifFalse:[^ false]. |
|
1093 |
]. |
|
1094 |
existingOnly == true ifTrue:[ |
|
1095 |
^ cls theMetaclass methodDictionary |
|
1096 |
contains:[:m | |
|
1097 |
resourceTypes includes:m resourceType |
|
1098 |
]. |
|
1099 |
]. |
|
1100 |
^ true |
|
1101 |
! |
|
1102 |
||
1103 |
treeViewClassCategoryChildren |
|
1104 |
"returns the children for the contents (class) of aTreeItem as a block" |
|
1105 |
||
1106 |
"/ cg: tz's algorithm was very-very slow, |
|
1107 |
"/ (it enumerated classes hundreds of times, |
|
1108 |
"/ leading to a square runtime behavior |
|
1109 |
"/ - i.e. very slow scrolling ) |
|
1110 |
"/ Speed up things by caching facts while enumerating |
|
1111 |
"/ classes once only. |
|
1112 |
||
1113 |
|topClass childrenPerCategory privateClasses| |
|
1114 |
||
1115 |
topClass := self treeViewClassHierarchyContents. |
|
1116 |
privateClasses := IdentitySet new. |
|
1117 |
||
1118 |
childrenPerCategory := Dictionary new. |
|
1119 |
||
1120 |
"/ collect all classes to be inserted into the tree(s) |
|
1121 |
topClass withAllSubclassesDo:[:cls | |
|
1122 |
|shown cat set| |
|
1123 |
||
1124 |
(self filterClass:cls) ifTrue:[ |
|
1125 |
cls isPrivate ifFalse:[ |
|
1126 |
cat := cls category. |
|
1127 |
cat notNil ifTrue:[ |
|
1128 |
(childrenPerCategory at:cat ifAbsentPut:[Set new]) add:cls |
|
1129 |
]. |
|
1130 |
] ifTrue:[ |
|
1131 |
privateClasses add:cls |
|
1132 |
] |
|
1133 |
]. |
|
1134 |
]. |
|
1135 |
||
1136 |
"/ need the owningclasses in the tree |
|
1137 |
privateClasses do:[:each | |
|
1138 |
|owner| |
|
1139 |
||
1140 |
owner := each owningClass. |
|
1141 |
(childrenPerCategory at:(owner category) ifAbsentPut:[Set new]) add:owner |
|
1142 |
]. |
|
1143 |
||
1144 |
^ [:aTreeItem| |
|
1145 |
|cont children initialContents setOfCategories itemCategory setOfClasses| |
|
1146 |
||
1147 |
(cont := aTreeItem contents) isBehavior ifTrue:[ |
|
1148 |
children := privateClasses select:[:cls | cls owningClass == aTreeItem contents]. |
|
1149 |
children := children select:[:cls | self filterClass:cls]. |
|
1150 |
children := children asSortedCollection: [:c1 :c2| c1 name <= c2 name]. |
|
1151 |
"/ children := children collect: [:child| TreeItem name: child name , ' (', child superclass name, ')' contents: child] |
|
1152 |
children := children collect: [:child| TreeItem name:(child name) contents: child] |
|
1153 |
] ifFalse:[ |
|
1154 |
cont size == 0 ifTrue:[ |
|
1155 |
setOfCategories := childrenPerCategory keys. |
|
1156 |
children := setOfCategories asSortedCollection. |
|
1157 |
children := children collect: [:nm | TreeItem name:nm contents:#Category] |
|
1158 |
] ifFalse:[ |
|
1159 |
cont == #Category ifTrue:[ |
|
1160 |
itemCategory := aTreeItem name. |
|
1161 |
setOfClasses := childrenPerCategory at:itemCategory ifAbsent:[Set new]. |
|
1162 |
setOfClasses := setOfClasses select:[:cls | self filterClass:cls]. |
|
1163 |
children := setOfClasses asOrderedCollection sort:[:c1 :c2 | c1 name <= c2 name]. |
|
1164 |
children := children collect:[:child | TreeItem name:child name contents:child]. |
|
1165 |
] ifFalse:[ |
|
1166 |
"/ huh ? |
|
1167 |
children := OrderedCollection new. |
|
1168 |
] |
|
1169 |
]. |
|
1170 |
]. |
|
1171 |
children |
|
1172 |
] |
|
1173 |
||
1174 |
"Modified: / 22-08-2012 / 19:44:59 / cg" |
|
1175 |
! |
|
1176 |
||
1177 |
treeViewClassCategoryIcon |
|
1178 |
"returns the icon for aTreeItem as a block" |
|
1179 |
||
1180 |
^self treeViewClassHierarchyIcon |
|
1181 |
! ! |
|
1182 |
||
1183 |
!ResourceSelectionBrowser methodsFor:'tree building - hierarchy'! |
|
1184 |
||
1185 |
treeViewClassHierarchyChildren |
|
1186 |
"returns the children for the contents (class) of aTreeItem as a block" |
|
1187 |
||
1188 |
"/ cg: tz's algorithm was very-very slow, |
|
1189 |
"/ (it enumerated classes hundreds of times, |
|
1190 |
"/ leading to a square runtime behavior |
|
1191 |
"/ - i.e. very slow scrolling ) |
|
1192 |
"/ Speed up things by caching facts while enumerating |
|
1193 |
"/ classes once only. |
|
1194 |
||
1195 |
|subclassesAndPrivateClassesPerClass classesWithResourceOrResourceInAnySubclass| |
|
1196 |
||
1197 |
subclassesAndPrivateClassesPerClass := IdentityDictionary new. |
|
1198 |
classesWithResourceOrResourceInAnySubclass := IdentitySet new. |
|
1199 |
||
1200 |
Smalltalk allClassesDo:[:cls | |
|
1201 |
|owner superclass info| |
|
1202 |
||
1203 |
superclass := cls superclass. |
|
1204 |
superclass notNil ifTrue:[ |
|
1205 |
info := subclassesAndPrivateClassesPerClass at:superclass ifAbsent:nil. |
|
1206 |
info isNil ifTrue:[ |
|
1207 |
subclassesAndPrivateClassesPerClass |
|
1208 |
at:superclass |
|
1209 |
put:(info := {IdentitySet new. IdentitySet new} ). |
|
1210 |
]. |
|
1211 |
(info at:1) add:cls |
|
1212 |
]. |
|
1213 |
(self filterClass:cls) ifTrue:[ |
|
1214 |
cls withAllSuperclassesDo:[:each | |
|
1215 |
classesWithResourceOrResourceInAnySubclass add:each |
|
1216 |
]. |
|
1217 |
]. |
|
1218 |
]. |
|
1219 |
||
1220 |
^ [:aTreeItem| |
|
1221 |
|classes itemClass info| |
|
1222 |
||
1223 |
classes := OrderedCollection new. |
|
1224 |
itemClass := aTreeItem contents. |
|
1225 |
info := subclassesAndPrivateClassesPerClass at:itemClass ifAbsent:nil. |
|
1226 |
info notNil ifTrue:[ |
|
1227 |
classes addAll:((info at:1) asSortedCollection: [:cls1 :cls2| cls1 name < cls2 name]). |
|
1228 |
classes addAll:((info at:2) asSortedCollection: [:cls1 :cls2| cls1 name < cls2 name]). |
|
1229 |
]. |
|
1230 |
classes select:[:cls | classesWithResourceOrResourceInAnySubclass includes:cls]. |
|
1231 |
] |
|
1232 |
! |
|
1233 |
||
1234 |
treeViewClassHierarchyContents |
|
1235 |
"returns the contents of the root of the class tree list" |
|
1236 |
||
1237 |
|cls| |
|
1238 |
||
1239 |
resourceSuperclass notNil ifTrue:[ |
|
1240 |
cls := Smalltalk classNamed: resourceSuperclass. |
|
1241 |
]. |
|
1242 |
cls := cls ? Object. |
|
1243 |
^ cls |
|
1244 |
! |
|
1245 |
||
1246 |
treeViewClassHierarchyIcon |
|
1247 |
"returns the icon for aTreeItem as a block" |
|
1248 |
||
1249 |
^[:aTreeItem| |
|
1250 |
|icon| |
|
1251 |
||
1252 |
aTreeItem contents isClass ifTrue:[ |
|
1253 |
icon := self class iconClass. |
|
1254 |
aTreeItem contents isPrivate ifTrue:[ |
|
1255 |
icon := self class iconPrivateClass |
|
1256 |
]. |
|
1257 |
icon |
|
1258 |
] ifFalse:[ |
|
1259 |
self class iconCategory |
|
1260 |
] |
|
1261 |
] |
|
1262 |
! |
|
1263 |
||
1264 |
treeViewClassHierarchyLabel |
|
1265 |
"returns the label for aTreeItem as a block" |
|
1266 |
||
1267 |
^[:aTreeItem| |
|
1268 |
|label superCls itemContents| |
|
1269 |
||
1270 |
itemContents := aTreeItem contents. |
|
1271 |
label := itemContents name. |
|
1272 |
"/ (itemContents isPrivate |
|
1273 |
"/ and:[aTreeItem parent contents ~~ (superCls := itemContents superclass)]) |
|
1274 |
"/ ifTrue: [label := label, ' (', superCls name, ')']. |
|
1275 |
label |
|
1276 |
] |
|
1277 |
! ! |
|
1278 |
||
771 | 1279 |
!ResourceSelectionBrowser::ResourceMethod methodsFor:'accessing'! |
523 | 1280 |
|
1281 |
iconOn:aGC |
|
771 | 1282 |
"registers and returns an icon indicating the resource type" |
523 | 1283 |
|
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1284 |
|cls sel image imageKey| |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1285 |
|
730 | 1286 |
self resourceType isNil ifTrue: [^nil]. |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1287 |
|
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1288 |
icon isNil ifTrue:[ |
1412 | 1289 |
((self resourceType = #image) or: [resourceType = #fileImage]) |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1290 |
ifTrue:[ |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1291 |
cls := method mclass theNonMetaclass. |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1292 |
sel := method selector. |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1293 |
] ifFalse: [ |
1412 | 1294 |
cls := SystemBrowser. |
1295 |
sel := (resourceType, 'Icon') asSymbol. |
|
1296 |
]. |
|
1297 |
imageKey := (cls name, sel) asSymbol. |
|
1298 |
(icon := aGC registeredImageAt: imageKey) isNil |
|
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1299 |
ifTrue: [ |
1412 | 1300 |
image := cls perform: sel. |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1301 |
(image extent y > 18) ifTrue: [ |
1412 | 1302 |
image := image magnifiedBy: 18/image extent y |
1303 |
]. |
|
1304 |
aGC registerImage: image key: imageKey. |
|
1305 |
icon := aGC registeredImageAt: imageKey. |
|
1306 |
]. |
|
730 | 1307 |
]. |
523 | 1308 |
^icon |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1309 |
|
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1310 |
"Modified: / 5.11.2001 / 16:48:35 / cg" |
523 | 1311 |
! |
1312 |
||
3531 | 1313 |
method |
1314 |
^ method |
|
1315 |
! |
|
1316 |
||
523 | 1317 |
method: aMethod |
771 | 1318 |
"sets aMethod" |
523 | 1319 |
|
1320 |
method := aMethod |
|
1321 |
! |
|
1322 |
||
1323 |
resourceType |
|
771 | 1324 |
"returns resourceType" |
523 | 1325 |
|
1326 |
resourceType isNil ifTrue: [resourceType := method resourceType]. |
|
1327 |
^resourceType |
|
1328 |
! |
|
1329 |
||
1330 |
selector |
|
771 | 1331 |
"returns selector" |
523 | 1332 |
|
1333 |
selector isNil ifTrue: [selector := method who methodSelector]. |
|
1334 |
^selector |
|
1335 |
! ! |
|
1336 |
||
425 | 1337 |
!ResourceSelectionBrowser class methodsFor:'documentation'! |
1338 |
||
1339 |
version |
|
1340 |
^ '$Header$' |
|
2760
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
1341 |
! |
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
1342 |
|
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
1343 |
version_CVS |
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
1344 |
^ '$Header$' |
425 | 1345 |
! ! |
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
1346 |