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