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