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