author | Claus Gittinger <cg@exept.de> |
Wed, 15 Feb 2006 17:32:40 +0100 | |
changeset 1981 | d28960fc1576 |
parent 1978 | c4334704dc58 |
child 1986 | 5cb77205ce00 |
permissions | -rw-r--r-- |
425 | 1 |
" |
771 | 2 |
COPYRIGHT (c) 1997-1998 by eXept Software AG |
425 | 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 |
" |
|
12 |
||
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 |
|
425 | 16 |
SelectionBrowser subclass:#ResourceSelectionBrowser |
477 | 17 |
instanceVariableNames:'resourceMethod resourceClass resourceSuperclass resourceTypes |
906 | 18 |
allClasses classSelectionBlock' |
19 |
classVariableNames:'ClassPresentation' |
|
425 | 20 |
poolDictionaries:'' |
619 | 21 |
category:'Interface-Dialogs' |
425 | 22 |
! |
23 |
||
771 | 24 |
Object subclass:#ResourceMethod |
523 | 25 |
instanceVariableNames:'method icon resourceType selector' |
26 |
classVariableNames:'' |
|
27 |
poolDictionaries:'' |
|
28 |
privateIn:ResourceSelectionBrowser |
|
29 |
! |
|
30 |
||
425 | 31 |
!ResourceSelectionBrowser class methodsFor:'documentation'! |
32 |
||
33 |
copyright |
|
34 |
" |
|
771 | 35 |
COPYRIGHT (c) 1997-1998 by eXept Software AG |
425 | 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 |
! |
|
47 |
||
48 |
documentation |
|
49 |
" |
|
746 | 50 |
The ResourceSelectionBrowser allows you to browse in class hierarchies |
771 | 51 |
and to select resource methods for loading or to saving resource |
52 |
specifications (#canvas, #menu, etc.). |
|
53 |
||
54 |
[instance variables:] |
|
907 | 55 |
resourceMethod <Symbol> selector of the resource spec |
56 |
resourceClass <Symbol> class of the resource spec |
|
57 |
resourceSuperclass <Symbol> root class of the tree list |
|
58 |
resourceTypes <Array> allowed resource types |
|
59 |
allClasses <Array> list of the subclasses of resourceSuperclass |
|
60 |
classSelectionBlock <Block> by evaluating this block the class selection is done |
|
746 | 61 |
|
504 | 62 |
[start with:] |
907 | 63 |
ResourceSelectionBrowser open |
504 | 64 |
|
65 |
[author:] |
|
907 | 66 |
Thomas Zwick, eXept Software AG |
425 | 67 |
" |
68 |
! ! |
|
69 |
||
70 |
!ResourceSelectionBrowser class methodsFor:'instance creation'! |
|
71 |
||
1978 | 72 |
request:aTitle onSuperclass:aSuperclass andClass:aClassOrClassName andSelector:aSelector withResourceTypes:resourceTypes |
73 |
"opens a ResourceSelectionBrowser; return a Message-object or nil." |
|
74 |
||
75 |
^ (self new |
|
76 |
title: aTitle) |
|
77 |
openOnSuperclass:aSuperclass |
|
78 |
andClass:aClassOrClassName |
|
79 |
andSelector:aSelector |
|
80 |
withResourceTypes:resourceTypes |
|
81 |
||
649 | 82 |
" |
1978 | 83 |
ResourceSelectionBrowser |
906 | 84 |
request: 'Select a Resource Selector' |
85 |
onSuperclass: #ApplicationModel |
|
1978 | 86 |
andClassNamed: #MenuEditor |
906 | 87 |
andSelector: #menuItemImage |
88 |
withResourceTypes: #(image) |
|
425 | 89 |
" |
90 |
! ! |
|
91 |
||
1725 | 92 |
!ResourceSelectionBrowser class methodsFor:'callbacks-default'! |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
93 |
|
906 | 94 |
treeViewClassHierarchyChildren |
771 | 95 |
"returns the children for the contents (class) of aTreeItem as a block" |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
96 |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
97 |
"/ cg: tz's algorithm was very-very slow, |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
98 |
"/ (it enumerated classes hundreds of times, |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
99 |
"/ leading to a square runtime behavior |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
100 |
"/ - i.e. very slow scrolling ) |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
101 |
"/ Speed up things by caching facts while enumerating |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
102 |
"/ classes once only. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
103 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
104 |
|subclassesAndPrivateClassesPerClass| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
105 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
106 |
subclassesAndPrivateClassesPerClass := IdentityDictionary new. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
107 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
108 |
Smalltalk allClassesDo:[:cls | |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
109 |
|owner superclass info| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
110 |
|
1732 | 111 |
"/ (owner := cls owningClass) notNil ifTrue:[ |
112 |
"/ info := subclassesAndPrivateClassesPerClass at:owner ifAbsent:nil. |
|
113 |
"/ info isNil ifTrue:[ |
|
114 |
"/ subclassesAndPrivateClassesPerClass at:owner put:(info := Array with:IdentitySet new |
|
115 |
"/ with:IdentitySet new). |
|
116 |
"/ ]. |
|
117 |
"/ (info at:2) add:cls |
|
118 |
"/ ] ifFalse:[ |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
119 |
superclass := cls superclass. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
120 |
superclass notNil ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
121 |
info := subclassesAndPrivateClassesPerClass at:superclass ifAbsent:nil. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
122 |
info isNil ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
123 |
subclassesAndPrivateClassesPerClass at:superclass put:(info := Array with:IdentitySet new |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
124 |
with:IdentitySet new). |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
125 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
126 |
(info at:1) add:cls |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
127 |
] |
1732 | 128 |
"/ ] |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
129 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
130 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
131 |
^ [:aTreeItem| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
132 |
|classes itemClass info| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
133 |
|
906 | 134 |
classes := OrderedCollection new. |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
135 |
itemClass := aTreeItem contents. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
136 |
info := subclassesAndPrivateClassesPerClass at:itemClass ifAbsent:nil. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
137 |
info notNil ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
138 |
classes addAll:((info at:1) asSortedCollection: [:cls1 :cls2| cls1 name < cls2 name]). |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
139 |
classes addAll:((info at:2) asSortedCollection: [:cls1 :cls2| cls1 name < cls2 name]). |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
140 |
]. |
906 | 141 |
classes |
718 | 142 |
] |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
143 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
144 |
|
906 | 145 |
treeViewClassHierarchyContents |
771 | 146 |
"returns the default contents of the root of the class tree list" |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
147 |
|
802 | 148 |
^ Object |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
149 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
150 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
151 |
|
906 | 152 |
treeViewClassHierarchyIcon |
771 | 153 |
"returns the icon for aTreeItem as a block" |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
154 |
|
718 | 155 |
^[:aTreeItem| |
906 | 156 |
|icon| |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
157 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
158 |
aTreeItem contents isClass ifTrue:[ |
906 | 159 |
icon := self iconClass. |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
160 |
aTreeItem contents isPrivate ifTrue:[ |
906 | 161 |
icon := self iconPrivateClass |
162 |
]. |
|
163 |
icon |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
164 |
] ifFalse:[ |
906 | 165 |
self iconCategory |
166 |
] |
|
771 | 167 |
] |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
168 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
169 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
170 |
|
906 | 171 |
treeViewClassHierarchyLabel |
771 | 172 |
"returns the label for aTreeItem as a block" |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
173 |
|
718 | 174 |
^[:aTreeItem| |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
175 |
|label superCls itemContents| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
176 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
177 |
itemContents := aTreeItem contents. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
178 |
label := itemContents name. |
1732 | 179 |
"/ (itemContents isPrivate |
180 |
"/ and:[aTreeItem parent contents ~~ (superCls := itemContents superclass)]) |
|
181 |
"/ ifTrue: [label := label, ' (', superCls name, ')']. |
|
906 | 182 |
label |
718 | 183 |
] |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
184 |
! ! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
185 |
|
730 | 186 |
!ResourceSelectionBrowser class methodsFor:'image specs'! |
187 |
||
906 | 188 |
iconCategory |
189 |
"This resource specification was automatically generated |
|
190 |
by the ImageEditor of ST/X." |
|
191 |
||
192 |
"Do not manually edit this!! If it is corrupted, |
|
193 |
the ImageEditor may not be able to read the specification." |
|
194 |
||
195 |
" |
|
196 |
self iconCategory inspect |
|
197 |
ImageEditor openOnClass:self andSelector:#iconCategory |
|
198 |
" |
|
199 |
||
200 |
<resource: #image> |
|
201 |
||
202 |
^Icon |
|
203 |
constantNamed:#'ResourceSelectionBrowser iconCategory' |
|
1493 | 204 |
ifAbsentPut:[(Depth4Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray 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') ; 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]; mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'<@O@8@G@3?3@7?;@7?;@7?;@7?;@7?;@7?;@7?;@7?;@7?;@7?;@3?3@8@G@<@O@') ; yourself); yourself] |
205 |
! |
|
906 | 206 |
|
730 | 207 |
iconClass |
746 | 208 |
"This resource specification was automatically generated |
209 |
by the ImageEditor of ST/X." |
|
210 |
||
211 |
"Do not manually edit this!! If it is corrupted, |
|
212 |
the ImageEditor may not be able to read the specification." |
|
213 |
||
730 | 214 |
" |
1404 | 215 |
self iconClass inspect |
746 | 216 |
ImageEditor openOnClass:self andSelector:#iconClass |
730 | 217 |
" |
218 |
||
219 |
<resource: #image> |
|
220 |
||
221 |
^Icon |
|
1404 | 222 |
constantNamed:#'ResourceSelectionBrowser iconClass' |
1493 | 223 |
ifAbsentPut:[(Depth2Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@*****ABUUUUT@IUUUUP@%UUUU@BUUUUT@IUUUUP@%UUUU@BUUUUT@IUUUUP@%UUUU@BUUUUT@IUUUUP@%UUUU@A@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 170 170 170 255 255 255]; mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@') ; yourself); yourself] |
224 |
! |
|
730 | 225 |
|
226 |
iconPrivateClass |
|
746 | 227 |
"This resource specification was automatically generated |
228 |
by the ImageEditor of ST/X." |
|
229 |
||
230 |
"Do not manually edit this!! If it is corrupted, |
|
231 |
the ImageEditor may not be able to read the specification." |
|
232 |
||
730 | 233 |
" |
746 | 234 |
ImageEditor openOnClass:self andSelector:#iconPrivateClass |
730 | 235 |
" |
236 |
||
237 |
<resource: #image> |
|
238 |
||
239 |
^Icon |
|
771 | 240 |
constantNamed:#'ResourceSelectionBrowser iconPrivateClass' |
1493 | 241 |
ifAbsentPut:[(Depth2Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@PUUUUU A****(@F*??* @Z+??*@A*/*>(OF*>+: @Z+??*@A*/?:(DF*>** @Z+:**@A*/**(@F*>** @Z****C2@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 255 0 0]; mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@') ; yourself); yourself] |
242 |
! ! |
|
730 | 243 |
|
425 | 244 |
!ResourceSelectionBrowser class methodsFor:'interface specs'! |
245 |
||
246 |
windowSpec |
|
746 | 247 |
"This resource specification was automatically generated |
248 |
by the UIPainter of ST/X." |
|
425 | 249 |
|
746 | 250 |
"Do not manually edit this!! If it is corrupted, |
251 |
the UIPainter may not be able to read the specification." |
|
425 | 252 |
|
253 |
" |
|
254 |
UIPainter new openOnClass:ResourceSelectionBrowser andSelector:#windowSpec |
|
255 |
ResourceSelectionBrowser new openInterface:#windowSpec |
|
746 | 256 |
ResourceSelectionBrowser open |
425 | 257 |
" |
258 |
||
259 |
<resource: #canvas> |
|
260 |
||
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
261 |
^ |
1751 | 262 |
#(FullSpec |
263 |
name: windowSpec |
|
264 |
window: |
|
265 |
(WindowSpec |
|
266 |
label: 'Resource Selection Browser' |
|
267 |
name: 'Resource Selection Browser' |
|
268 |
min: (Point 400 300) |
|
269 |
max: (Point 1152 864) |
|
270 |
bounds: (Rectangle 12 22 612 372) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
271 |
) |
1751 | 272 |
component: |
273 |
(SpecCollection |
|
274 |
collection: ( |
|
275 |
(VariableHorizontalPanelSpec |
|
276 |
name: 'VariableHorizontalPanel' |
|
277 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -36 1.0) |
|
278 |
component: |
|
279 |
(SpecCollection |
|
280 |
collection: ( |
|
281 |
(ViewSpec |
|
282 |
name: 'Box1' |
|
283 |
component: |
|
284 |
(SpecCollection |
|
285 |
collection: ( |
|
286 |
(HorizontalPanelViewSpec |
|
287 |
name: 'HorizontalPanel2' |
|
288 |
layout: (LayoutFrame 0 0 2 0 297 0 23 0) |
|
289 |
horizontalLayout: leftSpace |
|
290 |
verticalLayout: fit |
|
291 |
horizontalSpace: 3 |
|
292 |
verticalSpace: 3 |
|
293 |
component: |
|
294 |
(SpecCollection |
|
295 |
collection: ( |
|
296 |
(RadioButtonSpec |
|
297 |
label: 'Categories' |
|
298 |
name: 'ClassCategoriesRadioButton' |
|
299 |
translateLabel: true |
|
300 |
model: selectionOfClassPresentation |
|
301 |
isTriggerOnDown: true |
|
302 |
lampColor: (Color 0.0 0.0 0.0) |
|
303 |
select: #'Class Categories' |
|
304 |
extent: (Point 124 21) |
|
773 | 305 |
) |
1751 | 306 |
(RadioButtonSpec |
307 |
label: 'Hierarchy' |
|
308 |
name: 'ClassHierarchyRadioButton' |
|
309 |
translateLabel: true |
|
310 |
model: selectionOfClassPresentation |
|
311 |
isTriggerOnDown: true |
|
312 |
lampColor: (Color 0.0 0.0 0.0) |
|
313 |
select: #'Class Hierarchy' |
|
314 |
extent: (Point 145 21) |
|
773 | 315 |
) |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
316 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
317 |
|
773 | 318 |
) |
319 |
) |
|
1751 | 320 |
(SelectionInTreeViewSpec |
321 |
name: 'listOfClassHierarchyView' |
|
322 |
layout: (LayoutFrame 0 0.0 23 0.0 0 1.0 -24 1.0) |
|
323 |
tabable: true |
|
324 |
model: selectionOfClassHierarchy |
|
325 |
hasHorizontalScrollBar: true |
|
326 |
hasVerticalScrollBar: true |
|
327 |
miniScrollerHorizontal: true |
|
328 |
showDirectoryIndicatorForRoot: false |
|
329 |
showDirectoryIndicator: true |
|
330 |
valueChangeSelector: classSelected |
|
331 |
hierarchicalList: rootOfClassHierarchy |
|
332 |
validateDoubleClickSelector: validateDoubleClick: |
|
333 |
contentsSelector: treeViewClassHierarchyContents |
|
334 |
labelSelector: treeViewClassHierarchyLabel |
|
335 |
childrenSelector: treeViewClassHierarchyChildren |
|
336 |
iconSelector: treeViewClassHierarchyIcon |
|
337 |
highlightMode: line |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
338 |
) |
1751 | 339 |
(SelectionInTreeViewSpec |
340 |
name: 'listOfClassCategoriesView' |
|
341 |
layout: (LayoutFrame 0 0.0 23 0.0 0 1.0 -24 1.0) |
|
342 |
tabable: true |
|
343 |
model: selectionOfClassCategories |
|
344 |
hasHorizontalScrollBar: true |
|
345 |
hasVerticalScrollBar: true |
|
346 |
miniScrollerHorizontal: true |
|
347 |
showRoot: false |
|
348 |
showDirectoryIndicator: true |
|
349 |
valueChangeSelector: classSelected |
|
350 |
hierarchicalList: rootOfClassCategories |
|
351 |
validateDoubleClickSelector: validateDoubleClick: |
|
352 |
childrenSelector: treeViewClassCategoryChildren |
|
353 |
iconSelector: treeViewClassCategoryIcon |
|
354 |
highlightMode: line |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
355 |
) |
1751 | 356 |
(InputFieldSpec |
357 |
name: 'classNameInputField' |
|
358 |
layout: (LayoutFrame 2 0.0 -22 1 -1 1.0 0 1) |
|
359 |
tabable: true |
|
360 |
model: valueOfClassName |
|
361 |
acceptOnLeave: true |
|
362 |
acceptOnLostFocus: true |
|
363 |
acceptOnPointerLeave: true |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
364 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
365 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
366 |
|
773 | 367 |
) |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
368 |
) |
1751 | 369 |
(ViewSpec |
370 |
name: 'Box2' |
|
371 |
component: |
|
372 |
(SpecCollection |
|
373 |
collection: ( |
|
374 |
(DataSetSpec |
|
375 |
name: 'resourcesDataSetView' |
|
376 |
layout: (LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0) |
|
377 |
model: selectionOfResourceMethod |
|
378 |
hasHorizontalScrollBar: true |
|
379 |
hasVerticalScrollBar: true |
|
380 |
miniScrollerHorizontal: true |
|
381 |
rowClassName: 'ResourceSelectionBrowser::Row' |
|
382 |
dataList: listOfResourceMethods |
|
383 |
useIndex: false |
|
384 |
has3Dsepartors: true |
|
385 |
has3Dseparators: true |
|
386 |
doubleClickSelector: resourceDoubleClicked |
|
387 |
columnHolder: resourceMethodColumns |
|
388 |
valueChangeSelector: resourceSelected |
|
389 |
verticalSpacing: 1 |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
390 |
) |
1751 | 391 |
(InputFieldSpec |
392 |
name: 'selectorInputField' |
|
393 |
layout: (LayoutFrame 2 0.0 -22 1 -2 1.0 0 1) |
|
394 |
tabable: true |
|
395 |
model: valueOfResourceSelector |
|
396 |
acceptOnLeave: true |
|
397 |
acceptOnLostFocus: true |
|
398 |
acceptOnPointerLeave: true |
|
906 | 399 |
) |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
400 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
401 |
|
906 | 402 |
) |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
403 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
404 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
405 |
|
773 | 406 |
) |
1751 | 407 |
handles: (Any 0.5 1.0) |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
408 |
) |
1751 | 409 |
(HorizontalPanelViewSpec |
410 |
name: 'ButtonPanel' |
|
411 |
layout: (LayoutFrame 2 0.0 -30 1 -2 1.0 -4 1.0) |
|
412 |
horizontalLayout: fit |
|
413 |
verticalLayout: fit |
|
414 |
reverseOrderIfOKAtLeft: true |
|
415 |
component: |
|
416 |
(SpecCollection |
|
417 |
collection: ( |
|
418 |
(ActionButtonSpec |
|
419 |
label: 'Help' |
|
420 |
name: 'HelpButton' |
|
421 |
activeHelpKey: dss |
|
422 |
model: openHTMLDocument: |
|
423 |
initiallyDisabled: true |
|
424 |
enableChannel: helpEnabled |
|
425 |
actionValue: 'tools/uipainter/ResourceSelectionBrowser.html' |
|
426 |
extent: (Point 196 26) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
427 |
) |
1751 | 428 |
(ActionButtonSpec |
429 |
label: 'Cancel' |
|
430 |
name: 'cancelButton' |
|
431 |
activeHelpKey: commitCancel |
|
432 |
tabable: true |
|
433 |
model: cancel |
|
434 |
extent: (Point 197 26) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
435 |
) |
1751 | 436 |
(ActionButtonSpec |
437 |
label: 'OK' |
|
438 |
name: 'okButton' |
|
439 |
activeHelpKey: commitOK |
|
440 |
tabable: true |
|
441 |
model: accept |
|
442 |
isDefault: true |
|
443 |
extent: (Point 197 26) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
444 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
445 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
446 |
|
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
447 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
448 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
449 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
450 |
|
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
451 |
) |
425 | 452 |
) |
453 |
! ! |
|
454 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
455 |
!ResourceSelectionBrowser class methodsFor:'list specs'! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
456 |
|
822 | 457 |
tableColumnsForResourceMethodAttributes |
821 | 458 |
"This resource specification was automatically generated |
459 |
by the DataSetBuilder of ST/X." |
|
460 |
||
461 |
"Do not manually edit this!! If it is corrupted, |
|
462 |
the DataSetBuilder may not be able to read the specification." |
|
463 |
||
464 |
" |
|
822 | 465 |
DataSetBuilder new openOnClass:ResourceSelectionBrowser andSelector:#tableColumnsForResourceMethodAttributes |
821 | 466 |
" |
467 |
||
468 |
<resource: #tableColumns> |
|
469 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
470 |
|
821 | 471 |
^ #( |
472 |
#(#DataSetColumnSpec |
|
473 |
#width: 20 |
|
474 |
#height: 20 |
|
475 |
#printSelector: #iconOn: |
|
476 |
#canSelect: false |
|
477 |
) |
|
478 |
#(#DataSetColumnSpec |
|
479 |
#label: ' Selector' |
|
480 |
#labelAlignment: #left |
|
481 |
#model: #selector |
|
482 |
#canSelect: false |
|
483 |
) |
|
484 |
#(#DataSetColumnSpec |
|
485 |
#label: ' Resource Type' |
|
486 |
#labelAlignment: #left |
|
487 |
#model: #resourceType |
|
488 |
#canSelect: false |
|
489 |
) |
|
490 |
) |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
491 |
! ! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
492 |
|
425 | 493 |
!ResourceSelectionBrowser methodsFor:'aspects'! |
494 |
||
773 | 495 |
helpEnabled |
496 |
"returns whether there is a documentation file" |
|
497 |
||
498 |
^true |
|
499 |
! |
|
500 |
||
771 | 501 |
listOfResourceMethods |
502 |
"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
|
503 |
|
1184 | 504 |
^ builder listAspectFor:#listOfResourceMethods |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
505 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
506 |
|
771 | 507 |
resourceMethodColumns |
508 |
"returns the columns for the table of the resource methods as value holder" |
|
425 | 509 |
|
510 |
|holder| |
|
771 | 511 |
(holder := builder bindingAt:#resourceMethodColumns) isNil ifTrue:[ |
821 | 512 |
builder aspectAt:#resourceMethodColumns put:(holder := List new). |
822 | 513 |
holder addAll: (self class tableColumnsForResourceMethodAttributes collect: [:i| i decodeAsLiteralArray]). |
771 | 514 |
]. |
515 |
^ holder |
|
516 |
! |
|
517 |
||
906 | 518 |
rootOfClassCategories |
519 |
"returns the value holder for the root of the class tree list" |
|
520 |
||
521 |
|holder| |
|
522 |
||
523 |
(holder := builder bindingAt:#rootOfClassCategories) isNil ifTrue:[ |
|
524 |
ClassPresentation = #'Class Categories' ifTrue: [ |
|
525 |
builder aspectAt:#rootOfClassCategories put: (holder := TreeItem name: 'Categories')]. |
|
526 |
]. |
|
527 |
^ holder |
|
528 |
||
529 |
||
530 |
! |
|
531 |
||
532 |
rootOfClassHierarchy |
|
771 | 533 |
"returns the value holder for the root of the class tree list" |
534 |
||
535 |
|holder| |
|
906 | 536 |
|
537 |
||
538 |
(holder := builder bindingAt:#rootOfClassHierarchy) isNil ifTrue:[ |
|
539 |
ClassPresentation = #'Class Hierarchy' ifTrue: [ |
|
540 |
builder aspectAt:#rootOfClassHierarchy put: (holder := TreeItem new)] |
|
425 | 541 |
]. |
542 |
^ holder |
|
543 |
||
544 |
||
545 |
! |
|
546 |
||
906 | 547 |
selectionOfClassCategories |
548 |
"returns the value holder for the selected class of the class tree list" |
|
549 |
||
550 |
|holder| |
|
551 |
(holder := builder bindingAt:#selectionOfClassCategories) isNil ifTrue:[ |
|
552 |
builder aspectAt:#selectionOfClassCategories put:(holder := ValueHolder new). |
|
553 |
]. |
|
554 |
^ holder |
|
555 |
! |
|
556 |
||
557 |
selectionOfClassHierarchy |
|
771 | 558 |
"returns the value holder for the selected class of the class tree list" |
425 | 559 |
|
906 | 560 |
|holder| |
561 |
(holder := builder bindingAt:#selectionOfClassHierarchy) isNil ifTrue:[ |
|
562 |
builder aspectAt:#selectionOfClassHierarchy put:(holder := ValueHolder new). |
|
563 |
]. |
|
564 |
^ holder |
|
565 |
! |
|
566 |
||
567 |
selectionOfClassPresentation |
|
568 |
"returns the value holder for the selected class presentation" |
|
569 |
||
425 | 570 |
|holder| |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
571 |
|
906 | 572 |
(holder := builder bindingAt:#selectionOfClassPresentation) isNil ifTrue:[ |
573 |
builder aspectAt:#selectionOfClassPresentation put:(holder := RadioButtonGroup with: (ClassPresentation := ClassPresentation ? #'Class Categories')). |
|
1329 | 574 |
holder onChangeEvaluate: |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
575 |
[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
576 |
|hv comp newRoot| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
577 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
578 |
hv := holder value. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
579 |
ClassPresentation := hv. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
580 |
hv = #'Class Hierarchy' ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
581 |
comp := builder componentAt: #listOfClassHierarchyView. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
582 |
newRoot := self rootOfClassHierarchy. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
583 |
] ifFalse: [ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
584 |
comp := builder componentAt: #listOfClassCategoriesView. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
585 |
newRoot := self rootOfClassCategories. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
586 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
587 |
comp root:newRoot. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
588 |
comp raise. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
589 |
classSelectionBlock value: self valueOfClassName value |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
590 |
] |
425 | 591 |
]. |
592 |
^ holder |
|
593 |
! |
|
594 |
||
771 | 595 |
selectionOfResourceMethod |
596 |
"returns the value holder for the selected resource method of the resource method list" |
|
425 | 597 |
|
598 |
|holder| |
|
771 | 599 |
(holder := builder bindingAt:#selectionOfResourceMethod) isNil ifTrue:[ |
600 |
builder aspectAt:#selectionOfResourceMethod put:(holder := '' asValue). |
|
425 | 601 |
]. |
602 |
^ holder |
|
603 |
! |
|
604 |
||
467 | 605 |
valueOfClassName |
771 | 606 |
"returns the value holder for the name of the class" |
467 | 607 |
|
906 | 608 |
|holder| |
467 | 609 |
(holder := builder bindingAt:#valueOfClassName) isNil ifTrue:[ |
906 | 610 |
builder aspectAt:#valueOfClassName put:(holder := '' asValue). |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
611 |
holder onChangeEvaluate:[self classSelectionUpdate:holder value]. |
467 | 612 |
]. |
613 |
^ holder |
|
614 |
! |
|
615 |
||
771 | 616 |
valueOfResourceSelector |
617 |
"returns the value holder for the name of the selector" |
|
425 | 618 |
|
619 |
|holder| |
|
771 | 620 |
(holder := builder bindingAt:#valueOfResourceSelector) isNil ifTrue:[ |
621 |
builder aspectAt:#valueOfResourceSelector put:(holder := '' asValue). |
|
425 | 622 |
]. |
623 |
^ holder |
|
624 |
! ! |
|
625 |
||
1720 | 626 |
!ResourceSelectionBrowser methodsFor:'callbacks-class list'! |
632 | 627 |
|
906 | 628 |
treeViewClassCategoryChildren |
629 |
"returns the children for the contents (class) of aTreeItem as a block" |
|
630 |
||
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
631 |
"/ cg: tz's algorithm was very-very slow, |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
632 |
"/ (it enumerated classes hundreds of times, |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
633 |
"/ leading to a square runtime behavior |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
634 |
"/ - i.e. very slow scrolling ) |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
635 |
"/ Speed up things by caching facts while enumerating |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
636 |
"/ classes once only. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
637 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
638 |
|allClasses topClass childrenPerCategory privateClasses| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
639 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
640 |
topClass := self treeViewClassHierarchyContents. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
641 |
allClasses := topClass withAllSubclasses. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
642 |
privateClasses := IdentitySet new. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
643 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
644 |
childrenPerCategory := Dictionary new. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
645 |
allClasses do:[:cls | |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
646 |
|cat set| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
647 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
648 |
cls isPrivate ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
649 |
cat := cls category. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
650 |
set := childrenPerCategory at:cat ifAbsent:nil. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
651 |
set isNil ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
652 |
childrenPerCategory at:cat put:(set := IdentitySet new). |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
653 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
654 |
set add:cls |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
655 |
] ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
656 |
privateClasses add:cls |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
657 |
] |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
658 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
659 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
660 |
^ [:aTreeItem| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
661 |
|cont children initialContents setOfCategories itemCategory setOfClasses| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
662 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
663 |
(cont := aTreeItem contents) isBehavior ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
664 |
children := privateClasses select:[:cls | cls owningClass == aTreeItem contents]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
665 |
children := children asSortedCollection: [:c1 :c2| c1 name <= c2 name]. |
1732 | 666 |
"/ children := children collect: [:child| TreeItem name: child name , ' (', child superclass name, ')' contents: child] |
667 |
children := children collect: [:child| TreeItem name:(child name) contents: child] |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
668 |
] ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
669 |
cont size == 0 ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
670 |
setOfCategories := childrenPerCategory keys. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
671 |
children := setOfCategories asSortedCollection. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
672 |
children := children collect: [:nm | TreeItem name:nm contents:#Category] |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
673 |
] ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
674 |
cont == #Category ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
675 |
itemCategory := aTreeItem name. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
676 |
setOfClasses := childrenPerCategory at:itemCategory ifAbsent:[Set new]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
677 |
children := setOfClasses asOrderedCollection sort:[:c1 :c2 | c1 name <= c2 name]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
678 |
children := children collect:[:child | TreeItem name:child name contents:child]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
679 |
] ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
680 |
"/ huh ? |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
681 |
children := OrderedCollection new. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
682 |
] |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
683 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
684 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
685 |
children |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
686 |
] |
906 | 687 |
! |
688 |
||
689 |
treeViewClassCategoryIcon |
|
690 |
"returns the icon for aTreeItem as a block" |
|
691 |
||
692 |
^self class treeViewClassHierarchyIcon |
|
693 |
||
694 |
||
695 |
! |
|
696 |
||
697 |
treeViewClassHierarchyContents |
|
771 | 698 |
"returns the contents of the root of the class tree list" |
632 | 699 |
|
802 | 700 |
|cls| |
632 | 701 |
|
802 | 702 |
resourceSuperclass notNil ifTrue:[ |
1978 | 703 |
cls := Smalltalk classNamed: resourceSuperclass. |
802 | 704 |
]. |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
705 |
cls notNil ifTrue:[^ cls]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
706 |
^ self class treeViewClassHierarchyContents |
771 | 707 |
! |
708 |
||
709 |
validateDoubleClick: aTreeItem |
|
710 |
"returns whether a class may be selected" |
|
711 |
||
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
712 |
|cont| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
713 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
714 |
^ (cont := aTreeItem contents) ~= '' |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
715 |
and: [cont ~~ self treeViewClassHierarchyContents] |
771 | 716 |
|
717 |
||
718 |
||
632 | 719 |
! ! |
720 |
||
1720 | 721 |
!ResourceSelectionBrowser methodsFor:'callbacks-user'! |
425 | 722 |
|
771 | 723 |
classSelected |
724 |
"after a class selection, read the allowed resource methods of the selected class" |
|
730 | 725 |
|
1732 | 726 |
|sel| |
906 | 727 |
|
1919 | 728 |
ClassPresentation = #'Class Hierarchy' |
1732 | 729 |
"/ ifTrue: [sel := self selectionOfClassHierarchy value] |
1919 | 730 |
ifFalse: [sel := self selectionOfClassCategories value]. |
731 |
||
732 |
sel notNil ifTrue:[ |
|
1978 | 733 |
resourceClass := sel. |
1919 | 734 |
]. |
1732 | 735 |
self updateResourceMethodList. |
425 | 736 |
! |
737 |
||
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
738 |
classSelectionUpdate:clsPattern |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
739 |
|foundClass classes| |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
740 |
|
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
741 |
clsPattern notNil ifTrue:[ |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
742 |
foundClass := Smalltalk at:(clsPattern printString asSymbol). |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
743 |
]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
744 |
(foundClass isClass not or:[foundClass name ~= clsPattern]) |
1732 | 745 |
ifTrue: [ |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
746 |
classes := allClasses select: [:cls| cls name size >= clsPattern size]. |
1732 | 747 |
1 to: clsPattern size do: [:i| |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
748 |
classes := classes select: [:cls| (cls name at: i) == (clsPattern at: i)]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
749 |
]. |
1835 | 750 |
foundClass := classes at: 1 ifAbsent:[]. |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
751 |
]. |
1732 | 752 |
|
753 |
foundClass notNil ifTrue: [ |
|
1835 | 754 |
foundClass := foundClass autoload. |
1978 | 755 |
resourceClass := foundClass. |
1732 | 756 |
|
757 |
ClassPresentation = #'Class Hierarchy' ifTrue: [ |
|
758 |
|searchArgs nonSuperclasses hierItem| |
|
759 |
||
760 |
false "foundClass isPrivate" |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
761 |
ifFalse: [searchArgs := foundClass withAllSuperclasses reverse] |
1978 | 762 |
ifTrue: [searchArgs := foundClass owningClass withAllSuperclasses reverse. |
763 |
searchArgs add: foundClass]. |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
764 |
(nonSuperclasses := self treeViewClassHierarchyContents allSuperclasses) notNil |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
765 |
ifTrue: [searchArgs := searchArgs reject: [:cls| nonSuperclasses includes: cls]]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
766 |
|
1732 | 767 |
hierItem := self rootOfClassHierarchy detectChild:[:child :arg| child contents == arg] arguments:searchArgs. |
768 |
hierItem notNil ifTrue:[ |
|
769 |
self selectionOfClassHierarchy value:hierItem. |
|
770 |
]. |
|
1835 | 771 |
] ifFalse: [ |
1732 | 772 |
|searchArgs hierItem| |
773 |
||
774 |
false "foundClass isPrivate" |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
775 |
ifTrue: [searchArgs := Array with: 'Categories' with: foundClass category with: foundClass owningClass name with: foundClass name] |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
776 |
ifFalse: [searchArgs := Array with: 'Categories' with: foundClass category with: foundClass name]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
777 |
|
1732 | 778 |
hierItem := self rootOfClassCategories detectChild:[:child :arg| (child name upTo: $ ) = arg] arguments:searchArgs. |
779 |
hierItem notNil ifTrue:[ |
|
780 |
self selectionOfClassCategories value: hierItem. |
|
781 |
]. |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
782 |
]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
783 |
]. |
1919 | 784 |
self valueOfClassName value: clsPattern. |
785 |
self updateResourceMethodList. |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
786 |
! |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
787 |
|
425 | 788 |
resourceDoubleClicked |
771 | 789 |
"after a double click on resource method, accept it and close" |
425 | 790 |
|
791 |
accept value: true. |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
792 |
self closeRequest |
425 | 793 |
! |
794 |
||
795 |
resourceSelected |
|
771 | 796 |
"after a click on a resource method, set its selector into the field" |
425 | 797 |
|
771 | 798 |
self selectionOfResourceMethod value notNil |
799 |
ifTrue: [self valueOfResourceSelector value: self selectionOfResourceMethod value selector] |
|
1732 | 800 |
! |
801 |
||
802 |
updateResourceMethodList |
|
803 |
"read the allowed resource methods of the selected class" |
|
804 |
||
805 |
|class className item| |
|
806 |
||
1978 | 807 |
(class := resourceClass) isNil ifTrue:[ |
1732 | 808 |
ClassPresentation = #'Class Hierarchy' |
809 |
ifTrue: [item := self selectionOfClassHierarchy value ] |
|
810 |
ifFalse: [item := self selectionOfClassCategories value ]. |
|
1978 | 811 |
|
1732 | 812 |
item notNil ifTrue:[ |
813 |
className := item name. |
|
814 |
class := Smalltalk at:className asSymbol |
|
815 |
]. |
|
816 |
]. |
|
817 |
||
818 |
class isNil ifTrue: [^self]. |
|
819 |
||
820 |
className := class theNonMetaclass name. |
|
821 |
||
1920 | 822 |
self withWaitCursorDo:[ |
1732 | 823 |
|newContents| |
824 |
||
825 |
resourceTypes isNil ifTrue: [resourceTypes := Method resourceTypes]. |
|
826 |
||
827 |
self valueOfClassName value: className. |
|
828 |
self class lastSelection: className. |
|
829 |
||
830 |
newContents := class class methodDictionary asOrderedCollection |
|
831 |
select: [:m | m resources notNil |
|
832 |
and: [resourceTypes includes: m resourceType] |
|
833 |
]. |
|
834 |
newContents := newContents sort:[:m1 :m2 | m1 selector < m2 selector]. |
|
835 |
newContents := newContents collect:[:m| (ResourceMethod new method:m)]. |
|
836 |
||
837 |
self listOfResourceMethods contents:newContents |
|
838 |
. |
|
839 |
] |
|
425 | 840 |
! ! |
841 |
||
842 |
!ResourceSelectionBrowser methodsFor:'instance creation'! |
|
843 |
||
1978 | 844 |
openOnSuperclass: aSuperclassOrSymbol andClass:aClassOrClassName andSelector: aSelector withResourceTypes: aResourceTypes |
845 |
"opens a ResourceSelectionBrowser; return a Message-object or nil" |
|
425 | 846 |
|
1978 | 847 |
|selectedClass enteredClassName className cls| |
771 | 848 |
|
517 | 849 |
resourceMethod := aSelector. |
425 | 850 |
resourceTypes := aResourceTypes. |
851 |
resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol]. |
|
802 | 852 |
resourceClass := nil. |
853 |
||
1978 | 854 |
aClassOrClassName notNil ifTrue:[ |
855 |
aClassOrClassName isClass ifTrue: [ |
|
856 |
cls := aClassOrClassName. |
|
857 |
resourceClass := aClassOrClassName |
|
858 |
] ifFalse: [ |
|
859 |
cls := Smalltalk classNamed: aClassOrClassName. |
|
860 |
cls notNil ifTrue:[ |
|
861 |
resourceClass := cls |
|
802 | 862 |
] |
1978 | 863 |
] |
864 |
]. |
|
771 | 865 |
self valueOfResourceSelector value:(aSelector ? ''). |
463 | 866 |
self open. |
867 |
||
1978 | 868 |
(selectedClass := self selectionOfClassHierarchy value) isNil ifTrue:[ |
869 |
(selectedClass := self selectionOfClassCategories value) isNil ifTrue:[ |
|
870 |
(enteredClassName := self valueOfClassName value) isNil ifTrue:[ |
|
1086
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
871 |
accept value ifTrue:[ |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
872 |
self warn:'No valid class selected/entered'. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
873 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
874 |
^ nil |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
875 |
] |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
876 |
] |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
877 |
]. |
693 | 878 |
|
1978 | 879 |
className := enteredClassName. |
880 |
className isNil ifTrue:[ |
|
881 |
className := selectedClass name |
|
425 | 882 |
]. |
1978 | 883 |
cls := Smalltalk classNamed:className. |
884 |
(cls isClass and:[accept value]) ifTrue:[ |
|
885 |
^ Method::MethodWhoInfo class:cls selector:(self valueOfResourceSelector value) |
|
1086
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
886 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
887 |
|
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
888 |
accept value ifTrue:[ |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
889 |
self warn:'No valid class selected/entered'. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
890 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
891 |
^ nil |
802 | 892 |
|
893 |
"Modified: / 22.4.1998 / 14:51:03 / cg" |
|
425 | 894 |
! ! |
895 |
||
1716 | 896 |
!ResourceSelectionBrowser methodsFor:'startup & release'! |
425 | 897 |
|
623 | 898 |
postBuildWith:aBuilder |
771 | 899 |
"after building and before opening, |
906 | 900 |
create a class selection block, an entry completion block for the class name field" |
623 | 901 |
|
771 | 902 |
|classSelection classNameInputField| |
906 | 903 |
|
904 |
allClasses := self treeViewClassHierarchyContents withAllSubclasses reject: [:cls| cls isPrivate]. |
|
1978 | 905 |
classSelection := resourceClass isNil ifTrue:[nil] ifFalse:[resourceClass name]. |
802 | 906 |
|
1978 | 907 |
(classSelection isNil or:[ (Smalltalk classNamed: classSelection) isNil]) |
689 | 908 |
ifTrue: [classSelection := self class lastSelection]. |
1732 | 909 |
"/ (classSelection isNil or:[Smalltalk at: classSelection]) isNil |
910 |
"/ ifTrue: [classSelection := self treeViewContents]. |
|
802 | 911 |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
912 |
classSelectionBlock := [:clsPattern | self classSelectionUpdate:clsPattern]. |
1978 | 913 |
self valueOfClassName value:classSelection. |
771 | 914 |
|
1920 | 915 |
(classNameInputField := builder componentAt: #classNameInputField) |
916 |
entryCompletionBlock: |
|
917 |
[:value| |
|
918 |
|s what m| |
|
919 |
||
920 |
s := classNameInputField contents withoutSpaces. |
|
921 |
what := Smalltalk classnameCompletion:s inEnvironment:Smalltalk. |
|
922 |
classNameInputField contents:what first. |
|
923 |
(what at:2) size ~~ 1 ifTrue:[ |
|
924 |
classNameInputField device beep |
|
925 |
] |
|
926 |
"/ |what oldClassName| |
|
927 |
"/ oldClassName := classNameInputField contents. |
|
928 |
"/ what := Smalltalk classnameCompletion: value withoutSpaces. |
|
929 |
"/ classNameInputField contents:what first. |
|
930 |
"/ oldClassName = classNameInputField contents ifTrue:[classNameInputField flash]. |
|
931 |
"/ classSelectionBlock value: classNameInputField contents |
|
932 |
]. |
|
771 | 933 |
|
906 | 934 |
classSelectionBlock value: self valueOfClassName value. |
1732 | 935 |
self updateResourceMethodList. |
906 | 936 |
self selectionOfResourceMethod value: (self listOfResourceMethods detect: [:m| m selector == resourceMethod] ifNone: nil). |
909 | 937 |
|
938 |
^super postBuildWith:aBuilder |
|
910 | 939 |
! |
940 |
||
941 |
postOpenWith:aBuilder |
|
942 |
"after opening and if turned on make hierarchy view visible" |
|
943 |
||
944 |
ClassPresentation = #'Class Hierarchy' |
|
945 |
ifTrue: [(builder componentAt: #listOfClassHierarchyView) raise]. |
|
946 |
||
947 |
^super postOpenWith:aBuilder |
|
948 |
||
425 | 949 |
! ! |
950 |
||
771 | 951 |
!ResourceSelectionBrowser::ResourceMethod methodsFor:'accessing'! |
523 | 952 |
|
953 |
iconOn:aGC |
|
771 | 954 |
"registers and returns an icon indicating the resource type" |
523 | 955 |
|
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
956 |
|cls sel image imageKey| |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
957 |
|
730 | 958 |
self resourceType isNil ifTrue: [^nil]. |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
959 |
|
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
960 |
icon isNil ifTrue:[ |
1412 | 961 |
((self resourceType = #image) or: [resourceType = #fileImage]) |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
962 |
ifTrue:[ |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
963 |
cls := method mclass theNonMetaclass. |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
964 |
sel := method selector. |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
965 |
] ifFalse: [ |
1412 | 966 |
cls := SystemBrowser. |
967 |
sel := (resourceType, 'Icon') asSymbol. |
|
968 |
]. |
|
969 |
imageKey := (cls name, sel) asSymbol. |
|
970 |
(icon := aGC registeredImageAt: imageKey) isNil |
|
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
971 |
ifTrue: [ |
1412 | 972 |
image := cls perform: sel. |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
973 |
(image extent y > 18) ifTrue: [ |
1412 | 974 |
image := image magnifiedBy: 18/image extent y |
975 |
]. |
|
976 |
aGC registerImage: image key: imageKey. |
|
977 |
icon := aGC registeredImageAt: imageKey. |
|
978 |
]. |
|
730 | 979 |
]. |
523 | 980 |
^icon |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
981 |
|
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
982 |
"Modified: / 5.11.2001 / 16:48:35 / cg" |
523 | 983 |
! |
984 |
||
985 |
method: aMethod |
|
771 | 986 |
"sets aMethod" |
523 | 987 |
|
988 |
method := aMethod |
|
989 |
! |
|
990 |
||
991 |
resourceType |
|
771 | 992 |
"returns resourceType" |
523 | 993 |
|
994 |
resourceType isNil ifTrue: [resourceType := method resourceType]. |
|
995 |
^resourceType |
|
996 |
! |
|
997 |
||
998 |
selector |
|
771 | 999 |
"returns selector" |
523 | 1000 |
|
1001 |
selector isNil ifTrue: [selector := method who methodSelector]. |
|
1002 |
^selector |
|
1003 |
! ! |
|
1004 |
||
425 | 1005 |
!ResourceSelectionBrowser class methodsFor:'documentation'! |
1006 |
||
1007 |
version |
|
1008 |
^ '$Header$' |
|
1009 |
! ! |