author | sr |
Mon, 13 Mar 2006 17:56:35 +0100 | |
changeset 2038 | dfa6f1e641a7 |
parent 2026 | df5b0b3902de |
child 2309 | 777065a9ff59 |
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 |
|
1986 | 360 |
model: classNameHolder |
1751 | 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 |
|
1986 | 395 |
model: resourceSelectorHolder |
1751 | 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 |
||
1986 | 495 |
classNameHolder |
496 |
"returns the value holder for the name of the class" |
|
497 |
||
498 |
|holder| |
|
499 |
||
500 |
(holder := builder bindingAt:#valueOfClassName) isNil ifTrue:[ |
|
501 |
builder aspectAt:#valueOfClassName put:(holder := '' asValue). |
|
502 |
holder onChangeEvaluate:[self classSelectionUpdate:holder value]. |
|
503 |
]. |
|
504 |
^ holder |
|
505 |
! |
|
506 |
||
773 | 507 |
helpEnabled |
508 |
"returns whether there is a documentation file" |
|
509 |
||
510 |
^true |
|
511 |
! |
|
512 |
||
771 | 513 |
listOfResourceMethods |
514 |
"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
|
515 |
|
1184 | 516 |
^ builder listAspectFor:#listOfResourceMethods |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
517 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
518 |
|
771 | 519 |
resourceMethodColumns |
520 |
"returns the columns for the table of the resource methods as value holder" |
|
425 | 521 |
|
522 |
|holder| |
|
771 | 523 |
(holder := builder bindingAt:#resourceMethodColumns) isNil ifTrue:[ |
821 | 524 |
builder aspectAt:#resourceMethodColumns put:(holder := List new). |
822 | 525 |
holder addAll: (self class tableColumnsForResourceMethodAttributes collect: [:i| i decodeAsLiteralArray]). |
771 | 526 |
]. |
527 |
^ holder |
|
528 |
! |
|
529 |
||
1986 | 530 |
resourceSelectorHolder |
531 |
"returns the value holder for the name of the selector" |
|
532 |
||
533 |
|holder| |
|
534 |
(holder := builder bindingAt:#valueOfResourceSelector) isNil ifTrue:[ |
|
535 |
builder aspectAt:#valueOfResourceSelector put:(holder := '' asValue). |
|
536 |
]. |
|
537 |
^ holder |
|
538 |
! |
|
539 |
||
906 | 540 |
rootOfClassCategories |
541 |
"returns the value holder for the root of the class tree list" |
|
542 |
||
543 |
|holder| |
|
544 |
||
545 |
(holder := builder bindingAt:#rootOfClassCategories) isNil ifTrue:[ |
|
546 |
ClassPresentation = #'Class Categories' ifTrue: [ |
|
547 |
builder aspectAt:#rootOfClassCategories put: (holder := TreeItem name: 'Categories')]. |
|
548 |
]. |
|
549 |
^ holder |
|
550 |
||
551 |
||
552 |
! |
|
553 |
||
554 |
rootOfClassHierarchy |
|
771 | 555 |
"returns the value holder for the root of the class tree list" |
556 |
||
557 |
|holder| |
|
906 | 558 |
|
559 |
||
560 |
(holder := builder bindingAt:#rootOfClassHierarchy) isNil ifTrue:[ |
|
561 |
ClassPresentation = #'Class Hierarchy' ifTrue: [ |
|
562 |
builder aspectAt:#rootOfClassHierarchy put: (holder := TreeItem new)] |
|
425 | 563 |
]. |
564 |
^ holder |
|
565 |
||
566 |
||
567 |
! |
|
568 |
||
906 | 569 |
selectionOfClassCategories |
570 |
"returns the value holder for the selected class of the class tree list" |
|
571 |
||
572 |
|holder| |
|
573 |
(holder := builder bindingAt:#selectionOfClassCategories) isNil ifTrue:[ |
|
574 |
builder aspectAt:#selectionOfClassCategories put:(holder := ValueHolder new). |
|
575 |
]. |
|
576 |
^ holder |
|
577 |
! |
|
578 |
||
579 |
selectionOfClassHierarchy |
|
771 | 580 |
"returns the value holder for the selected class of the class tree list" |
425 | 581 |
|
906 | 582 |
|holder| |
583 |
(holder := builder bindingAt:#selectionOfClassHierarchy) isNil ifTrue:[ |
|
584 |
builder aspectAt:#selectionOfClassHierarchy put:(holder := ValueHolder new). |
|
585 |
]. |
|
586 |
^ holder |
|
587 |
! |
|
588 |
||
589 |
selectionOfClassPresentation |
|
590 |
"returns the value holder for the selected class presentation" |
|
591 |
||
425 | 592 |
|holder| |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
593 |
|
906 | 594 |
(holder := builder bindingAt:#selectionOfClassPresentation) isNil ifTrue:[ |
595 |
builder aspectAt:#selectionOfClassPresentation put:(holder := RadioButtonGroup with: (ClassPresentation := ClassPresentation ? #'Class Categories')). |
|
1329 | 596 |
holder onChangeEvaluate: |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
597 |
[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
598 |
|hv comp newRoot| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
599 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
600 |
hv := holder value. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
601 |
ClassPresentation := hv. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
602 |
hv = #'Class Hierarchy' ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
603 |
comp := builder componentAt: #listOfClassHierarchyView. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
604 |
newRoot := self rootOfClassHierarchy. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
605 |
] ifFalse: [ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
606 |
comp := builder componentAt: #listOfClassCategoriesView. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
607 |
newRoot := self rootOfClassCategories. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
608 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
609 |
comp root:newRoot. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
610 |
comp raise. |
1986 | 611 |
classSelectionBlock value: self classNameHolder value |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
612 |
] |
425 | 613 |
]. |
614 |
^ holder |
|
615 |
! |
|
616 |
||
771 | 617 |
selectionOfResourceMethod |
618 |
"returns the value holder for the selected resource method of the resource method list" |
|
425 | 619 |
|
620 |
|holder| |
|
771 | 621 |
(holder := builder bindingAt:#selectionOfResourceMethod) isNil ifTrue:[ |
622 |
builder aspectAt:#selectionOfResourceMethod put:(holder := '' asValue). |
|
425 | 623 |
]. |
624 |
^ holder |
|
625 |
! |
|
626 |
||
467 | 627 |
valueOfClassName |
771 | 628 |
"returns the value holder for the name of the class" |
467 | 629 |
|
1986 | 630 |
self obsoleteMethodWarning:'stupid name - use #classNameHolder'. |
631 |
^ self classNameHolder |
|
467 | 632 |
! |
633 |
||
771 | 634 |
valueOfResourceSelector |
635 |
"returns the value holder for the name of the selector" |
|
425 | 636 |
|
1986 | 637 |
self obsoleteMethodWarning:'stupid name - use #resourceSelectorHolder'. |
638 |
^ self resourceSelectorHolder |
|
425 | 639 |
! ! |
640 |
||
1720 | 641 |
!ResourceSelectionBrowser methodsFor:'callbacks-class list'! |
632 | 642 |
|
906 | 643 |
treeViewClassCategoryChildren |
644 |
"returns the children for the contents (class) of aTreeItem as a block" |
|
645 |
||
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
646 |
"/ cg: tz's algorithm was very-very slow, |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
647 |
"/ (it enumerated classes hundreds of times, |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
648 |
"/ leading to a square runtime behavior |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
649 |
"/ - i.e. very slow scrolling ) |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
650 |
"/ Speed up things by caching facts while enumerating |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
651 |
"/ classes once only. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
652 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
653 |
|allClasses topClass childrenPerCategory privateClasses| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
654 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
655 |
topClass := self treeViewClassHierarchyContents. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
656 |
allClasses := topClass withAllSubclasses. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
657 |
privateClasses := IdentitySet new. |
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 |
childrenPerCategory := Dictionary new. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
660 |
allClasses do:[:cls | |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
661 |
|cat set| |
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 |
cls isPrivate ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
664 |
cat := cls category. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
665 |
set := childrenPerCategory at:cat ifAbsent:nil. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
666 |
set isNil ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
667 |
childrenPerCategory at:cat put:(set := IdentitySet new). |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
668 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
669 |
set add:cls |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
670 |
] ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
671 |
privateClasses add:cls |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
672 |
] |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
673 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
674 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
675 |
^ [:aTreeItem| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
676 |
|cont children initialContents setOfCategories itemCategory setOfClasses| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
677 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
678 |
(cont := aTreeItem contents) isBehavior ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
679 |
children := privateClasses select:[:cls | cls owningClass == aTreeItem contents]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
680 |
children := children asSortedCollection: [:c1 :c2| c1 name <= c2 name]. |
1732 | 681 |
"/ children := children collect: [:child| TreeItem name: child name , ' (', child superclass name, ')' contents: child] |
682 |
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
|
683 |
] ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
684 |
cont size == 0 ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
685 |
setOfCategories := childrenPerCategory keys. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
686 |
children := setOfCategories asSortedCollection. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
687 |
children := children collect: [:nm | TreeItem name:nm contents:#Category] |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
688 |
] ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
689 |
cont == #Category ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
690 |
itemCategory := aTreeItem name. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
691 |
setOfClasses := childrenPerCategory at:itemCategory ifAbsent:[Set new]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
692 |
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
|
693 |
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
|
694 |
] ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
695 |
"/ huh ? |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
696 |
children := OrderedCollection new. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
697 |
] |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
698 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
699 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
700 |
children |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
701 |
] |
906 | 702 |
! |
703 |
||
704 |
treeViewClassCategoryIcon |
|
705 |
"returns the icon for aTreeItem as a block" |
|
706 |
||
707 |
^self class treeViewClassHierarchyIcon |
|
708 |
||
709 |
||
710 |
! |
|
711 |
||
712 |
treeViewClassHierarchyContents |
|
771 | 713 |
"returns the contents of the root of the class tree list" |
632 | 714 |
|
802 | 715 |
|cls| |
632 | 716 |
|
802 | 717 |
resourceSuperclass notNil ifTrue:[ |
1978 | 718 |
cls := Smalltalk classNamed: resourceSuperclass. |
802 | 719 |
]. |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
720 |
cls notNil ifTrue:[^ cls]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
721 |
^ self class treeViewClassHierarchyContents |
771 | 722 |
! |
723 |
||
724 |
validateDoubleClick: aTreeItem |
|
725 |
"returns whether a class may be selected" |
|
726 |
||
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
727 |
|cont| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
728 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
729 |
^ (cont := aTreeItem contents) ~= '' |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
730 |
and: [cont ~~ self treeViewClassHierarchyContents] |
771 | 731 |
|
732 |
||
733 |
||
632 | 734 |
! ! |
735 |
||
1720 | 736 |
!ResourceSelectionBrowser methodsFor:'callbacks-user'! |
425 | 737 |
|
771 | 738 |
classSelected |
739 |
"after a class selection, read the allowed resource methods of the selected class" |
|
730 | 740 |
|
1732 | 741 |
|sel| |
906 | 742 |
|
1919 | 743 |
ClassPresentation = #'Class Hierarchy' |
1732 | 744 |
"/ ifTrue: [sel := self selectionOfClassHierarchy value] |
1919 | 745 |
ifFalse: [sel := self selectionOfClassCategories value]. |
746 |
||
747 |
sel notNil ifTrue:[ |
|
1978 | 748 |
resourceClass := sel. |
1919 | 749 |
]. |
1732 | 750 |
self updateResourceMethodList. |
425 | 751 |
! |
752 |
||
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
753 |
classSelectionUpdate:clsPattern |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
754 |
|foundClass classes| |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
755 |
|
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
756 |
clsPattern notNil ifTrue:[ |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
757 |
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
|
758 |
]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
759 |
(foundClass isClass not or:[foundClass name ~= clsPattern]) |
1732 | 760 |
ifTrue: [ |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
761 |
classes := allClasses select: [:cls| cls name size >= clsPattern size]. |
1732 | 762 |
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
|
763 |
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
|
764 |
]. |
1835 | 765 |
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
|
766 |
]. |
1732 | 767 |
|
768 |
foundClass notNil ifTrue: [ |
|
1835 | 769 |
foundClass := foundClass autoload. |
1978 | 770 |
resourceClass := foundClass. |
1732 | 771 |
|
772 |
ClassPresentation = #'Class Hierarchy' ifTrue: [ |
|
773 |
|searchArgs nonSuperclasses hierItem| |
|
774 |
||
775 |
false "foundClass isPrivate" |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
776 |
ifFalse: [searchArgs := foundClass withAllSuperclasses reverse] |
1978 | 777 |
ifTrue: [searchArgs := foundClass owningClass withAllSuperclasses reverse. |
778 |
searchArgs add: foundClass]. |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
779 |
(nonSuperclasses := self treeViewClassHierarchyContents allSuperclasses) notNil |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
780 |
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
|
781 |
|
1732 | 782 |
hierItem := self rootOfClassHierarchy detectChild:[:child :arg| child contents == arg] arguments:searchArgs. |
783 |
hierItem notNil ifTrue:[ |
|
784 |
self selectionOfClassHierarchy value:hierItem. |
|
785 |
]. |
|
1835 | 786 |
] ifFalse: [ |
1732 | 787 |
|searchArgs hierItem| |
788 |
||
789 |
false "foundClass isPrivate" |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
790 |
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
|
791 |
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
|
792 |
|
1732 | 793 |
hierItem := self rootOfClassCategories detectChild:[:child :arg| (child name upTo: $ ) = arg] arguments:searchArgs. |
794 |
hierItem notNil ifTrue:[ |
|
795 |
self selectionOfClassCategories value: hierItem. |
|
796 |
]. |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
797 |
]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
798 |
]. |
1986 | 799 |
self classNameHolder value: clsPattern. |
1919 | 800 |
self updateResourceMethodList. |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
801 |
! |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
802 |
|
425 | 803 |
resourceDoubleClicked |
771 | 804 |
"after a double click on resource method, accept it and close" |
425 | 805 |
|
806 |
accept value: true. |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
807 |
self closeRequest |
425 | 808 |
! |
809 |
||
810 |
resourceSelected |
|
771 | 811 |
"after a click on a resource method, set its selector into the field" |
425 | 812 |
|
771 | 813 |
self selectionOfResourceMethod value notNil |
1986 | 814 |
ifTrue: [self resourceSelectorHolder value: self selectionOfResourceMethod value selector] |
1732 | 815 |
! |
816 |
||
817 |
updateResourceMethodList |
|
818 |
"read the allowed resource methods of the selected class" |
|
819 |
||
820 |
|class className item| |
|
821 |
||
1978 | 822 |
(class := resourceClass) isNil ifTrue:[ |
1732 | 823 |
ClassPresentation = #'Class Hierarchy' |
824 |
ifTrue: [item := self selectionOfClassHierarchy value ] |
|
825 |
ifFalse: [item := self selectionOfClassCategories value ]. |
|
1978 | 826 |
|
1732 | 827 |
item notNil ifTrue:[ |
828 |
className := item name. |
|
829 |
class := Smalltalk at:className asSymbol |
|
830 |
]. |
|
831 |
]. |
|
832 |
||
833 |
class isNil ifTrue: [^self]. |
|
834 |
||
2038 | 835 |
className := class name."/class theNonMetaclass name |
1732 | 836 |
|
1920 | 837 |
self withWaitCursorDo:[ |
1732 | 838 |
|newContents| |
839 |
||
840 |
resourceTypes isNil ifTrue: [resourceTypes := Method resourceTypes]. |
|
841 |
||
1986 | 842 |
self classNameHolder value: className. |
1732 | 843 |
self class lastSelection: className. |
844 |
||
845 |
newContents := class class methodDictionary asOrderedCollection |
|
846 |
select: [:m | m resources notNil |
|
847 |
and: [resourceTypes includes: m resourceType] |
|
848 |
]. |
|
849 |
newContents := newContents sort:[:m1 :m2 | m1 selector < m2 selector]. |
|
850 |
newContents := newContents collect:[:m| (ResourceMethod new method:m)]. |
|
851 |
||
852 |
self listOfResourceMethods contents:newContents |
|
853 |
. |
|
854 |
] |
|
425 | 855 |
! ! |
856 |
||
857 |
!ResourceSelectionBrowser methodsFor:'instance creation'! |
|
858 |
||
1978 | 859 |
openOnSuperclass: aSuperclassOrSymbol andClass:aClassOrClassName andSelector: aSelector withResourceTypes: aResourceTypes |
860 |
"opens a ResourceSelectionBrowser; return a Message-object or nil" |
|
425 | 861 |
|
1978 | 862 |
|selectedClass enteredClassName className cls| |
771 | 863 |
|
517 | 864 |
resourceMethod := aSelector. |
425 | 865 |
resourceTypes := aResourceTypes. |
866 |
resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol]. |
|
802 | 867 |
resourceClass := nil. |
868 |
||
1978 | 869 |
aClassOrClassName notNil ifTrue:[ |
870 |
aClassOrClassName isClass ifTrue: [ |
|
871 |
cls := aClassOrClassName. |
|
872 |
resourceClass := aClassOrClassName |
|
873 |
] ifFalse: [ |
|
874 |
cls := Smalltalk classNamed: aClassOrClassName. |
|
875 |
cls notNil ifTrue:[ |
|
876 |
resourceClass := cls |
|
802 | 877 |
] |
1978 | 878 |
] |
879 |
]. |
|
1986 | 880 |
self resourceSelectorHolder value:(aSelector ? ''). |
463 | 881 |
self open. |
882 |
||
1978 | 883 |
(selectedClass := self selectionOfClassHierarchy value) isNil ifTrue:[ |
884 |
(selectedClass := self selectionOfClassCategories value) isNil ifTrue:[ |
|
1986 | 885 |
(enteredClassName := self classNameHolder value) isNil ifTrue:[ |
1086
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
886 |
accept value ifTrue:[ |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
887 |
self warn:'No valid class selected/entered'. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
888 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
889 |
^ nil |
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 |
] |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
892 |
]. |
693 | 893 |
|
1978 | 894 |
className := enteredClassName. |
895 |
className isNil ifTrue:[ |
|
896 |
className := selectedClass name |
|
425 | 897 |
]. |
1978 | 898 |
cls := Smalltalk classNamed:className. |
899 |
(cls isClass and:[accept value]) ifTrue:[ |
|
1986 | 900 |
^ 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
|
901 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
902 |
|
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
903 |
accept value ifTrue:[ |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
904 |
self warn:'No valid class selected/entered'. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
905 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
906 |
^ nil |
802 | 907 |
|
908 |
"Modified: / 22.4.1998 / 14:51:03 / cg" |
|
425 | 909 |
! ! |
910 |
||
1716 | 911 |
!ResourceSelectionBrowser methodsFor:'startup & release'! |
425 | 912 |
|
623 | 913 |
postBuildWith:aBuilder |
771 | 914 |
"after building and before opening, |
906 | 915 |
create a class selection block, an entry completion block for the class name field" |
623 | 916 |
|
771 | 917 |
|classSelection classNameInputField| |
906 | 918 |
|
919 |
allClasses := self treeViewClassHierarchyContents withAllSubclasses reject: [:cls| cls isPrivate]. |
|
1978 | 920 |
classSelection := resourceClass isNil ifTrue:[nil] ifFalse:[resourceClass name]. |
802 | 921 |
|
1978 | 922 |
(classSelection isNil or:[ (Smalltalk classNamed: classSelection) isNil]) |
689 | 923 |
ifTrue: [classSelection := self class lastSelection]. |
1732 | 924 |
"/ (classSelection isNil or:[Smalltalk at: classSelection]) isNil |
925 |
"/ ifTrue: [classSelection := self treeViewContents]. |
|
802 | 926 |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
927 |
classSelectionBlock := [:clsPattern | self classSelectionUpdate:clsPattern]. |
1986 | 928 |
self classNameHolder value:classSelection. |
771 | 929 |
|
1920 | 930 |
(classNameInputField := builder componentAt: #classNameInputField) |
931 |
entryCompletionBlock: |
|
932 |
[:value| |
|
933 |
|s what m| |
|
934 |
||
935 |
s := classNameInputField contents withoutSpaces. |
|
936 |
what := Smalltalk classnameCompletion:s inEnvironment:Smalltalk. |
|
937 |
classNameInputField contents:what first. |
|
938 |
(what at:2) size ~~ 1 ifTrue:[ |
|
939 |
classNameInputField device beep |
|
940 |
] |
|
941 |
"/ |what oldClassName| |
|
942 |
"/ oldClassName := classNameInputField contents. |
|
943 |
"/ what := Smalltalk classnameCompletion: value withoutSpaces. |
|
944 |
"/ classNameInputField contents:what first. |
|
945 |
"/ oldClassName = classNameInputField contents ifTrue:[classNameInputField flash]. |
|
946 |
"/ classSelectionBlock value: classNameInputField contents |
|
947 |
]. |
|
771 | 948 |
|
1986 | 949 |
classSelectionBlock value: self classNameHolder value. |
1732 | 950 |
self updateResourceMethodList. |
906 | 951 |
self selectionOfResourceMethod value: (self listOfResourceMethods detect: [:m| m selector == resourceMethod] ifNone: nil). |
909 | 952 |
|
953 |
^super postBuildWith:aBuilder |
|
910 | 954 |
! |
955 |
||
956 |
postOpenWith:aBuilder |
|
957 |
"after opening and if turned on make hierarchy view visible" |
|
958 |
||
959 |
ClassPresentation = #'Class Hierarchy' |
|
960 |
ifTrue: [(builder componentAt: #listOfClassHierarchyView) raise]. |
|
961 |
||
2026 | 962 |
super postOpenWith:aBuilder |
425 | 963 |
! ! |
964 |
||
771 | 965 |
!ResourceSelectionBrowser::ResourceMethod methodsFor:'accessing'! |
523 | 966 |
|
967 |
iconOn:aGC |
|
771 | 968 |
"registers and returns an icon indicating the resource type" |
523 | 969 |
|
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
970 |
|cls sel image imageKey| |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
971 |
|
730 | 972 |
self resourceType isNil ifTrue: [^nil]. |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
973 |
|
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
974 |
icon isNil ifTrue:[ |
1412 | 975 |
((self resourceType = #image) or: [resourceType = #fileImage]) |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
976 |
ifTrue:[ |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
977 |
cls := method mclass theNonMetaclass. |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
978 |
sel := method selector. |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
979 |
] ifFalse: [ |
1412 | 980 |
cls := SystemBrowser. |
981 |
sel := (resourceType, 'Icon') asSymbol. |
|
982 |
]. |
|
983 |
imageKey := (cls name, sel) asSymbol. |
|
984 |
(icon := aGC registeredImageAt: imageKey) isNil |
|
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
985 |
ifTrue: [ |
1412 | 986 |
image := cls perform: sel. |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
987 |
(image extent y > 18) ifTrue: [ |
1412 | 988 |
image := image magnifiedBy: 18/image extent y |
989 |
]. |
|
990 |
aGC registerImage: image key: imageKey. |
|
991 |
icon := aGC registeredImageAt: imageKey. |
|
992 |
]. |
|
730 | 993 |
]. |
523 | 994 |
^icon |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
995 |
|
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
996 |
"Modified: / 5.11.2001 / 16:48:35 / cg" |
523 | 997 |
! |
998 |
||
999 |
method: aMethod |
|
771 | 1000 |
"sets aMethod" |
523 | 1001 |
|
1002 |
method := aMethod |
|
1003 |
! |
|
1004 |
||
1005 |
resourceType |
|
771 | 1006 |
"returns resourceType" |
523 | 1007 |
|
1008 |
resourceType isNil ifTrue: [resourceType := method resourceType]. |
|
1009 |
^resourceType |
|
1010 |
! |
|
1011 |
||
1012 |
selector |
|
771 | 1013 |
"returns selector" |
523 | 1014 |
|
1015 |
selector isNil ifTrue: [selector := method who methodSelector]. |
|
1016 |
^selector |
|
1017 |
! ! |
|
1018 |
||
425 | 1019 |
!ResourceSelectionBrowser class methodsFor:'documentation'! |
1020 |
||
1021 |
version |
|
1022 |
^ '$Header$' |
|
1023 |
! ! |