author | Claus Gittinger <cg@exept.de> |
Wed, 09 Sep 1998 17:32:59 +0200 | |
changeset 989 | 180731831d8b |
parent 918 | 1172ecb3fd63 |
child 1034 | 3cb196044804 |
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 |
|
680 | 99 |
^[:aTreeItem| |
906 | 100 |
|classes| |
101 |
classes := OrderedCollection new. |
|
102 |
classes addAll: ((aTreeItem contents subclasses reject: [:cls| cls isPrivate]) asSortedCollection: [:cls1 :cls2| cls1 name < cls2 name]). |
|
103 |
classes addAll: (aTreeItem contents privateClasses asSortedCollection: [:cls1 :cls2| cls1 name < cls2 name]). |
|
104 |
classes |
|
718 | 105 |
] |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
106 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
107 |
|
906 | 108 |
treeViewClassHierarchyContents |
771 | 109 |
"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
|
110 |
|
802 | 111 |
^ Object |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
112 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
113 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
114 |
|
906 | 115 |
treeViewClassHierarchyIcon |
771 | 116 |
"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
|
117 |
|
718 | 118 |
^[:aTreeItem| |
906 | 119 |
|icon| |
120 |
aTreeItem contents isClass |
|
121 |
ifTrue: |
|
122 |
[ |
|
123 |
icon := self iconClass. |
|
124 |
aTreeItem contents isPrivate |
|
125 |
ifTrue: |
|
126 |
[ |
|
127 |
icon := self iconPrivateClass |
|
128 |
]. |
|
129 |
icon |
|
130 |
] |
|
131 |
ifFalse: |
|
132 |
[ |
|
133 |
self iconCategory |
|
134 |
] |
|
771 | 135 |
] |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
136 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
137 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
138 |
|
906 | 139 |
treeViewClassHierarchyLabel |
771 | 140 |
"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
|
141 |
|
718 | 142 |
^[:aTreeItem| |
906 | 143 |
|label superCls| |
144 |
label := aTreeItem contents name. |
|
145 |
(aTreeItem contents isPrivate and: [aTreeItem parent contents ~~ (superCls := aTreeItem contents superclass)]) |
|
146 |
ifTrue: [label := label, ' (', superCls name, ')']. |
|
147 |
label |
|
718 | 148 |
] |
149 |
||
150 |
||
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 |
|
730 | 153 |
!ResourceSelectionBrowser class methodsFor:'image specs'! |
154 |
||
906 | 155 |
iconCategory |
156 |
"This resource specification was automatically generated |
|
157 |
by the ImageEditor of ST/X." |
|
158 |
||
159 |
"Do not manually edit this!! If it is corrupted, |
|
160 |
the ImageEditor may not be able to read the specification." |
|
161 |
||
162 |
" |
|
163 |
self iconCategory inspect |
|
164 |
ImageEditor openOnClass:self andSelector:#iconCategory |
|
165 |
" |
|
166 |
||
167 |
<resource: #image> |
|
168 |
||
169 |
^Icon |
|
170 |
constantNamed:#'ResourceSelectionBrowser iconCategory' |
|
171 |
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]! |
|
172 |
||
730 | 173 |
iconClass |
746 | 174 |
"This resource specification was automatically generated |
175 |
by the ImageEditor of ST/X." |
|
176 |
||
177 |
"Do not manually edit this!! If it is corrupted, |
|
178 |
the ImageEditor may not be able to read the specification." |
|
179 |
||
730 | 180 |
" |
746 | 181 |
ImageEditor openOnClass:self andSelector:#iconClass |
730 | 182 |
" |
183 |
||
184 |
<resource: #image> |
|
185 |
||
186 |
^Icon |
|
771 | 187 |
constantNamed:#'ResourceSelectionBrowser iconClass' |
188 |
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 | 189 |
|
190 |
iconPrivateClass |
|
746 | 191 |
"This resource specification was automatically generated |
192 |
by the ImageEditor of ST/X." |
|
193 |
||
194 |
"Do not manually edit this!! If it is corrupted, |
|
195 |
the ImageEditor may not be able to read the specification." |
|
196 |
||
730 | 197 |
" |
746 | 198 |
ImageEditor openOnClass:self andSelector:#iconPrivateClass |
730 | 199 |
" |
200 |
||
201 |
<resource: #image> |
|
202 |
||
203 |
^Icon |
|
771 | 204 |
constantNamed:#'ResourceSelectionBrowser iconPrivateClass' |
205 |
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 | 206 |
|
425 | 207 |
!ResourceSelectionBrowser class methodsFor:'interface specs'! |
208 |
||
209 |
windowSpec |
|
746 | 210 |
"This resource specification was automatically generated |
211 |
by the UIPainter of ST/X." |
|
425 | 212 |
|
746 | 213 |
"Do not manually edit this!! If it is corrupted, |
214 |
the UIPainter may not be able to read the specification." |
|
425 | 215 |
|
216 |
" |
|
217 |
UIPainter new openOnClass:ResourceSelectionBrowser andSelector:#windowSpec |
|
218 |
ResourceSelectionBrowser new openInterface:#windowSpec |
|
746 | 219 |
ResourceSelectionBrowser open |
425 | 220 |
" |
221 |
||
222 |
<resource: #canvas> |
|
223 |
||
224 |
^ |
|
468 | 225 |
|
425 | 226 |
#(#FullSpec |
773 | 227 |
#window: |
228 |
#(#WindowSpec |
|
229 |
#name: 'Resource Selection Browser' |
|
910 | 230 |
#layout: #(#LayoutFrame 194 0 307 0 793 0 656 0) |
773 | 231 |
#label: 'Resource Selection Browser' |
232 |
#min: #(#Point 400 300) |
|
233 |
#max: #(#Point 1152 864) |
|
910 | 234 |
#bounds: #(#Rectangle 194 307 794 657) |
773 | 235 |
#usePreferredExtent: false |
236 |
) |
|
237 |
#component: |
|
238 |
#(#SpecCollection |
|
239 |
#collection: |
|
240 |
#( |
|
241 |
#(#VariableHorizontalPanelSpec |
|
242 |
#name: 'VariableHorizontalPanel' |
|
910 | 243 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -36 1.0) |
773 | 244 |
#component: |
245 |
#(#SpecCollection |
|
246 |
#collection: |
|
247 |
#( |
|
248 |
#(#ViewSpec |
|
249 |
#name: 'Box1' |
|
250 |
#component: |
|
251 |
#(#SpecCollection |
|
252 |
#collection: |
|
253 |
#( |
|
906 | 254 |
#(#HorizontalPanelViewSpec |
255 |
#name: 'HorizontalPanel2' |
|
256 |
#layout: #(#LayoutFrame 0 0 2 0 297 0 23 0) |
|
257 |
#component: |
|
258 |
#(#SpecCollection |
|
259 |
#collection: |
|
260 |
#( |
|
261 |
#(#RadioButtonSpec |
|
262 |
#name: 'ClassCategoriesRadioButton' |
|
918 | 263 |
#label: 'Categories' |
906 | 264 |
#translateLabel: true |
265 |
#model: #selectionOfClassPresentation |
|
266 |
#isTriggerOnDown: true |
|
267 |
#lampColor: #(#Color 0.0 0.0 0.0) |
|
268 |
#select: #'Class Categories' |
|
910 | 269 |
#extent: #(#Point 124 21) |
906 | 270 |
) |
271 |
#(#RadioButtonSpec |
|
272 |
#name: 'ClassHierarchyRadioButton' |
|
918 | 273 |
#label: 'Hierarchy' |
906 | 274 |
#translateLabel: true |
275 |
#model: #selectionOfClassPresentation |
|
276 |
#isTriggerOnDown: true |
|
277 |
#lampColor: #(#Color 0.0 0.0 0.0) |
|
278 |
#select: #'Class Hierarchy' |
|
279 |
#extent: #(#Point 145 21) |
|
280 |
) |
|
281 |
) |
|
282 |
) |
|
283 |
#horizontalLayout: #leftSpace |
|
284 |
#verticalLayout: #fit |
|
285 |
#horizontalSpace: 3 |
|
286 |
#verticalSpace: 3 |
|
773 | 287 |
) |
288 |
#(#SelectionInTreeViewSpec |
|
906 | 289 |
#name: 'listOfClassHierarchyView' |
910 | 290 |
#layout: #(#LayoutFrame 0 0.0 23 0.0 0 1.0 -24 1.0) |
773 | 291 |
#tabable: true |
906 | 292 |
#model: #selectionOfClassHierarchy |
773 | 293 |
#hasHorizontalScrollBar: true |
294 |
#hasVerticalScrollBar: true |
|
295 |
#miniScrollerHorizontal: true |
|
296 |
#showDirectoryIndicatorForRoot: false |
|
297 |
#showDirectoryIndicator: true |
|
298 |
#valueChangeSelector: #classSelected |
|
906 | 299 |
#hierarchicalList: #rootOfClassHierarchy |
773 | 300 |
#validateDoubleClickSelector: #validateDoubleClick: |
906 | 301 |
#contentsSelector: #treeViewClassHierarchyContents |
302 |
#labelSelector: #treeViewClassHierarchyLabel |
|
303 |
#childrenSelector: #treeViewClassHierarchyChildren |
|
304 |
#iconSelector: #treeViewClassHierarchyIcon |
|
305 |
) |
|
306 |
#(#SelectionInTreeViewSpec |
|
307 |
#name: 'listOfClassCategoriesView' |
|
910 | 308 |
#layout: #(#LayoutFrame 0 0.0 23 0.0 0 1.0 -24 1.0) |
906 | 309 |
#tabable: true |
310 |
#model: #selectionOfClassCategories |
|
311 |
#hasHorizontalScrollBar: true |
|
312 |
#hasVerticalScrollBar: true |
|
313 |
#miniScrollerHorizontal: true |
|
909 | 314 |
#showRoot: false |
906 | 315 |
#showDirectoryIndicator: true |
316 |
#valueChangeSelector: #classSelected |
|
317 |
#hierarchicalList: #rootOfClassCategories |
|
318 |
#validateDoubleClickSelector: #validateDoubleClick: |
|
319 |
#childrenSelector: #treeViewClassCategoryChildren |
|
320 |
#iconSelector: #treeViewClassCategoryIcon |
|
773 | 321 |
) |
322 |
#(#InputFieldSpec |
|
323 |
#name: 'classNameInputField' |
|
910 | 324 |
#layout: #(#LayoutFrame 2 0.0 -22 1 -1 1.0 0 1) |
773 | 325 |
#tabable: true |
326 |
#model: #valueOfClassName |
|
327 |
) |
|
328 |
) |
|
329 |
) |
|
330 |
) |
|
331 |
#(#ViewSpec |
|
332 |
#name: 'Box2' |
|
333 |
#component: |
|
334 |
#(#SpecCollection |
|
335 |
#collection: |
|
336 |
#( |
|
337 |
#(#DataSetSpec |
|
338 |
#name: 'resourcesDataSetView' |
|
910 | 339 |
#layout: #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0) |
773 | 340 |
#model: #selectionOfResourceMethod |
341 |
#hasHorizontalScrollBar: true |
|
342 |
#hasVerticalScrollBar: true |
|
343 |
#miniScrollerHorizontal: true |
|
344 |
#rowClassName: 'ResourceSelectionBrowser::Row' |
|
345 |
#dataList: #listOfResourceMethods |
|
346 |
#useIndex: false |
|
347 |
#has3Dsepartors: true |
|
906 | 348 |
#has3Dseparators: true |
773 | 349 |
#doubleClickSelector: #resourceDoubleClicked |
350 |
#columnHolder: #resourceMethodColumns |
|
351 |
#valueChangeSelector: #resourceSelected |
|
352 |
#verticalSpacing: 1 |
|
353 |
) |
|
354 |
#(#InputFieldSpec |
|
355 |
#name: 'selectorInputField' |
|
910 | 356 |
#layout: #(#LayoutFrame 2 0.0 -22 1 -2 1.0 0 1) |
773 | 357 |
#tabable: true |
358 |
#model: #valueOfResourceSelector |
|
359 |
) |
|
360 |
) |
|
361 |
) |
|
362 |
) |
|
363 |
) |
|
364 |
) |
|
365 |
#handles: #(#Any 0.5 1.0) |
|
366 |
) |
|
906 | 367 |
#(#HorizontalPanelViewSpec |
368 |
#name: 'HorizontalPanel1' |
|
369 |
#layout: #(#LayoutFrame 2 0.0 -30 1 -2 1.0 -4 1.0) |
|
370 |
#component: |
|
371 |
#(#SpecCollection |
|
372 |
#collection: |
|
373 |
#( |
|
374 |
#(#ActionButtonSpec |
|
375 |
#name: 'HelpButton' |
|
376 |
#activeHelpKey: #dss |
|
377 |
#label: 'Help' |
|
378 |
#model: #openHTMLDocument: |
|
379 |
#initiallyDisabled: true |
|
380 |
#enableChannel: #helpEnabled |
|
381 |
#actionValue: 'tools/uipainter/ResourceSelectionBrowser.html' |
|
382 |
#extent: #(#Point 196 26) |
|
383 |
) |
|
384 |
#(#ActionButtonSpec |
|
385 |
#name: 'cancelButton' |
|
386 |
#activeHelpKey: #commitCancel |
|
387 |
#label: 'Cancel' |
|
388 |
#tabable: true |
|
389 |
#model: #cancel |
|
390 |
#extent: #(#Point 196 26) |
|
391 |
) |
|
392 |
#(#ActionButtonSpec |
|
393 |
#name: 'okButton' |
|
394 |
#activeHelpKey: #commitOK |
|
395 |
#label: 'OK' |
|
396 |
#tabable: true |
|
397 |
#model: #accept |
|
398 |
#isDefault: true |
|
399 |
#extent: #(#Point 196 24) |
|
400 |
) |
|
401 |
) |
|
402 |
) |
|
403 |
#horizontalLayout: #fit |
|
404 |
#verticalLayout: #fit |
|
405 |
) |
|
773 | 406 |
) |
407 |
) |
|
425 | 408 |
) |
918 | 409 |
|
410 |
"Modified: / 27.7.1998 / 18:05:40 / cg" |
|
425 | 411 |
! ! |
412 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
413 |
!ResourceSelectionBrowser class methodsFor:'list specs'! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
414 |
|
822 | 415 |
tableColumnsForResourceMethodAttributes |
821 | 416 |
"This resource specification was automatically generated |
417 |
by the DataSetBuilder of ST/X." |
|
418 |
||
419 |
"Do not manually edit this!! If it is corrupted, |
|
420 |
the DataSetBuilder may not be able to read the specification." |
|
421 |
||
422 |
" |
|
822 | 423 |
DataSetBuilder new openOnClass:ResourceSelectionBrowser andSelector:#tableColumnsForResourceMethodAttributes |
821 | 424 |
" |
425 |
||
426 |
<resource: #tableColumns> |
|
427 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
428 |
|
821 | 429 |
^ #( |
430 |
#(#DataSetColumnSpec |
|
431 |
#width: 20 |
|
432 |
#height: 20 |
|
433 |
#printSelector: #iconOn: |
|
434 |
#canSelect: false |
|
435 |
) |
|
436 |
#(#DataSetColumnSpec |
|
437 |
#label: ' Selector' |
|
438 |
#labelAlignment: #left |
|
439 |
#model: #selector |
|
440 |
#canSelect: false |
|
441 |
) |
|
442 |
#(#DataSetColumnSpec |
|
443 |
#label: ' Resource Type' |
|
444 |
#labelAlignment: #left |
|
445 |
#model: #resourceType |
|
446 |
#canSelect: false |
|
447 |
) |
|
448 |
) |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
449 |
! ! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
450 |
|
425 | 451 |
!ResourceSelectionBrowser methodsFor:'aspects'! |
452 |
||
773 | 453 |
helpEnabled |
454 |
"returns whether there is a documentation file" |
|
455 |
||
456 |
^true |
|
457 |
! |
|
458 |
||
771 | 459 |
listOfResourceMethods |
460 |
"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
|
461 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
462 |
|holder| |
771 | 463 |
(holder := builder bindingAt:#listOfResourceMethods) isNil ifTrue:[ |
464 |
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
|
465 |
]. |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
466 |
^ holder |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
467 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
468 |
|
771 | 469 |
resourceMethodColumns |
470 |
"returns the columns for the table of the resource methods as value holder" |
|
425 | 471 |
|
472 |
|holder| |
|
771 | 473 |
(holder := builder bindingAt:#resourceMethodColumns) isNil ifTrue:[ |
821 | 474 |
builder aspectAt:#resourceMethodColumns put:(holder := List new). |
822 | 475 |
holder addAll: (self class tableColumnsForResourceMethodAttributes collect: [:i| i decodeAsLiteralArray]). |
771 | 476 |
]. |
477 |
^ holder |
|
478 |
! |
|
479 |
||
906 | 480 |
rootOfClassCategories |
481 |
"returns the value holder for the root of the class tree list" |
|
482 |
||
483 |
|holder| |
|
484 |
||
485 |
(holder := builder bindingAt:#rootOfClassCategories) isNil ifTrue:[ |
|
486 |
ClassPresentation = #'Class Categories' ifTrue: [ |
|
487 |
builder aspectAt:#rootOfClassCategories put: (holder := TreeItem name: 'Categories')]. |
|
488 |
]. |
|
489 |
^ holder |
|
490 |
||
491 |
||
492 |
! |
|
493 |
||
494 |
rootOfClassHierarchy |
|
771 | 495 |
"returns the value holder for the root of the class tree list" |
496 |
||
497 |
|holder| |
|
906 | 498 |
|
499 |
||
500 |
(holder := builder bindingAt:#rootOfClassHierarchy) isNil ifTrue:[ |
|
501 |
ClassPresentation = #'Class Hierarchy' ifTrue: [ |
|
502 |
builder aspectAt:#rootOfClassHierarchy put: (holder := TreeItem new)] |
|
425 | 503 |
]. |
504 |
^ holder |
|
505 |
||
506 |
||
507 |
! |
|
508 |
||
906 | 509 |
selectionOfClassCategories |
510 |
"returns the value holder for the selected class of the class tree list" |
|
511 |
||
512 |
|holder| |
|
513 |
(holder := builder bindingAt:#selectionOfClassCategories) isNil ifTrue:[ |
|
514 |
builder aspectAt:#selectionOfClassCategories put:(holder := ValueHolder new). |
|
515 |
]. |
|
516 |
^ holder |
|
517 |
! |
|
518 |
||
519 |
selectionOfClassHierarchy |
|
771 | 520 |
"returns the value holder for the selected class of the class tree list" |
425 | 521 |
|
906 | 522 |
|holder| |
523 |
(holder := builder bindingAt:#selectionOfClassHierarchy) isNil ifTrue:[ |
|
524 |
builder aspectAt:#selectionOfClassHierarchy put:(holder := ValueHolder new). |
|
525 |
]. |
|
526 |
^ holder |
|
527 |
! |
|
528 |
||
529 |
selectionOfClassPresentation |
|
530 |
"returns the value holder for the selected class presentation" |
|
531 |
||
425 | 532 |
|holder| |
906 | 533 |
(holder := builder bindingAt:#selectionOfClassPresentation) isNil ifTrue:[ |
534 |
builder aspectAt:#selectionOfClassPresentation put:(holder := RadioButtonGroup with: (ClassPresentation := ClassPresentation ? #'Class Categories')). |
|
535 |
holder onChangeSend: #value to: [holder value = #'Class Hierarchy' |
|
536 |
ifTrue: [ClassPresentation := holder value.(builder componentAt: #listOfClassHierarchyView) root: self rootOfClassHierarchy. (builder componentAt: #listOfClassHierarchyView) raise. classSelectionBlock value: self valueOfClassName value] |
|
537 |
ifFalse: [ClassPresentation := holder value.(builder componentAt: #listOfClassCategoriesView) root: self rootOfClassCategories. (builder componentAt: #listOfClassCategoriesView) raise. classSelectionBlock value: self valueOfClassName value]] |
|
425 | 538 |
]. |
539 |
^ holder |
|
540 |
! |
|
541 |
||
771 | 542 |
selectionOfResourceMethod |
543 |
"returns the value holder for the selected resource method of the resource method list" |
|
425 | 544 |
|
545 |
|holder| |
|
771 | 546 |
(holder := builder bindingAt:#selectionOfResourceMethod) isNil ifTrue:[ |
547 |
builder aspectAt:#selectionOfResourceMethod put:(holder := '' asValue). |
|
425 | 548 |
]. |
549 |
^ holder |
|
550 |
! |
|
551 |
||
467 | 552 |
valueOfClassName |
771 | 553 |
"returns the value holder for the name of the class" |
467 | 554 |
|
906 | 555 |
|holder| |
467 | 556 |
(holder := builder bindingAt:#valueOfClassName) isNil ifTrue:[ |
906 | 557 |
builder aspectAt:#valueOfClassName put:(holder := '' asValue). |
467 | 558 |
]. |
559 |
^ holder |
|
560 |
! |
|
561 |
||
771 | 562 |
valueOfResourceSelector |
563 |
"returns the value holder for the name of the selector" |
|
425 | 564 |
|
565 |
|holder| |
|
771 | 566 |
(holder := builder bindingAt:#valueOfResourceSelector) isNil ifTrue:[ |
567 |
builder aspectAt:#valueOfResourceSelector put:(holder := '' asValue). |
|
425 | 568 |
]. |
569 |
^ holder |
|
570 |
! ! |
|
571 |
||
771 | 572 |
!ResourceSelectionBrowser methodsFor:'callbacks - class list'! |
632 | 573 |
|
906 | 574 |
treeViewClassCategoryChildren |
575 |
"returns the children for the contents (class) of aTreeItem as a block" |
|
576 |
||
577 |
^[:aTreeItem| |
|
578 |
|children| |
|
579 |
children := OrderedCollection new. |
|
580 |
aTreeItem contents = '' |
|
581 |
ifTrue: |
|
582 |
[ |
|
583 |
children := (self treeViewClassHierarchyContents withAllSubclasses collect: [:cls| cls category]) asSet asSortedCollection. |
|
584 |
children := children collect: [:child| TreeItem name: child contents: 'Category'] |
|
585 |
]. |
|
586 |
aTreeItem contents = 'Category' |
|
587 |
ifTrue: |
|
588 |
[ |
|
589 |
children := self treeViewClassHierarchyContents withAllSubclasses select: [:cls| cls category = aTreeItem name and: [cls isPrivate not]]. |
|
590 |
children := children asSortedCollection: [:c1 :c2| c1 name <= c2 name]. |
|
591 |
children := children collect: [:child| TreeItem name: child name contents: child] |
|
592 |
]. |
|
593 |
aTreeItem contents isClass |
|
594 |
ifTrue: |
|
595 |
[ |
|
596 |
children := aTreeItem contents privateClasses. |
|
597 |
children := children asSortedCollection: [:c1 :c2| c1 name <= c2 name]. |
|
598 |
children := children collect: [:child| TreeItem name: child name , ' (', child superclass name, ')' contents: child] |
|
599 |
]. |
|
600 |
children |
|
601 |
] |
|
602 |
||
603 |
||
604 |
! |
|
605 |
||
606 |
treeViewClassCategoryIcon |
|
607 |
"returns the icon for aTreeItem as a block" |
|
608 |
||
609 |
^self class treeViewClassHierarchyIcon |
|
610 |
||
611 |
||
612 |
! |
|
613 |
||
614 |
treeViewClassHierarchyContents |
|
771 | 615 |
"returns the contents of the root of the class tree list" |
632 | 616 |
|
802 | 617 |
|cls| |
632 | 618 |
|
802 | 619 |
resourceSuperclass notNil ifTrue:[ |
620 |
cls := Smalltalk at: resourceSuperclass. |
|
621 |
]. |
|
906 | 622 |
^ cls ? self class treeViewClassHierarchyContents |
632 | 623 |
|
771 | 624 |
! |
625 |
||
626 |
validateDoubleClick: aTreeItem |
|
627 |
"returns whether a class may be selected" |
|
628 |
||
906 | 629 |
^aTreeItem contents ~= '' and: [aTreeItem contents ~~ self treeViewClassHierarchyContents] |
771 | 630 |
|
631 |
||
632 |
||
632 | 633 |
! ! |
634 |
||
635 |
!ResourceSelectionBrowser methodsFor:'callbacks - user'! |
|
425 | 636 |
|
771 | 637 |
classSelected |
638 |
"after a class selection, read the allowed resource methods of the selected class" |
|
730 | 639 |
|
906 | 640 |
ClassPresentation = #'Class Hierarchy' |
641 |
ifTrue: [self selectionOfClassHierarchy value isNil ifTrue: [^nil]] |
|
642 |
ifFalse: [self selectionOfClassCategories value isNil ifTrue: [^nil]]. |
|
643 |
||
425 | 644 |
self withWaitCursorDo: |
645 |
[ |
|
906 | 646 |
|clsName| |
517 | 647 |
resourceTypes isNil ifTrue: [resourceTypes := Method resourceTypes]. |
906 | 648 |
|
649 |
ClassPresentation = #'Class Hierarchy' |
|
650 |
ifTrue: [clsName := (self selectionOfClassHierarchy value name upTo: $ ) asSymbol] |
|
651 |
ifFalse: [clsName := (self selectionOfClassCategories value name upTo: $ ) asSymbol]. |
|
652 |
||
477 | 653 |
self valueOfClassName value: clsName. |
425 | 654 |
self class lastSelection: clsName. |
771 | 655 |
self listOfResourceMethods contents: |
523 | 656 |
((((Smalltalk at: clsName) |
425 | 657 |
class methodDictionary |
658 |
asOrderedCollection select: |
|
523 | 659 |
[:m| m resources notNil and: [resourceTypes includes: m resourceType]])) |
771 | 660 |
collect: [:m| (ResourceMethod new method: m)]). |
425 | 661 |
] |
662 |
! |
|
663 |
||
664 |
resourceDoubleClicked |
|
771 | 665 |
"after a double click on resource method, accept it and close" |
425 | 666 |
|
667 |
accept value: true. |
|
771 | 668 |
|
425 | 669 |
self close |
670 |
! |
|
671 |
||
672 |
resourceSelected |
|
771 | 673 |
"after a click on a resource method, set its selector into the field" |
425 | 674 |
|
771 | 675 |
self selectionOfResourceMethod value notNil |
676 |
ifTrue: [self valueOfResourceSelector value: self selectionOfResourceMethod value selector] |
|
425 | 677 |
! ! |
678 |
||
679 |
!ResourceSelectionBrowser methodsFor:'instance creation'! |
|
680 |
||
681 |
openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withResourceTypes: aResourceTypes |
|
771 | 682 |
"opens a ResourceSelectionBrowser on |
802 | 683 |
aSuperclassOrSymbol, |
684 |
and aClassOrSymbol, |
|
685 |
and aSelector, |
|
686 |
with allowed aResourceTypes" |
|
425 | 687 |
|
733 | 688 |
|clsName| |
771 | 689 |
|
517 | 690 |
resourceMethod := aSelector. |
425 | 691 |
resourceTypes := aResourceTypes. |
692 |
resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol]. |
|
802 | 693 |
resourceClass := nil. |
694 |
||
695 |
aClassOrSymbol isClass |
|
696 |
ifTrue: [resourceClass := aClassOrSymbol name] |
|
697 |
ifFalse: [ |
|
698 |
aClassOrSymbol notNil ifTrue:[ |
|
699 |
(Smalltalk at: aClassOrSymbol) notNil |
|
700 |
ifTrue: [resourceClass := aClassOrSymbol] |
|
701 |
] |
|
702 |
]. |
|
771 | 703 |
self valueOfResourceSelector value:(aSelector ? ''). |
425 | 704 |
|
463 | 705 |
self open. |
706 |
||
906 | 707 |
(clsName := self selectionOfClassHierarchy value) isNil |
708 |
ifTrue: [(clsName := self selectionOfClassCategories value) isNil ifTrue: [^nil]]. |
|
709 |
||
733 | 710 |
clsName := (clsName name upTo: $ ) asSymbol. |
693 | 711 |
|
733 | 712 |
((Smalltalk at: clsName) isClass and: [accept value]) |
632 | 713 |
ifTrue: |
693 | 714 |
[ |
802 | 715 |
^clsName, ' ', self valueOfResourceSelector value |
425 | 716 |
]. |
717 |
^nil |
|
802 | 718 |
|
719 |
"Modified: / 22.4.1998 / 14:51:03 / cg" |
|
425 | 720 |
! ! |
721 |
||
722 |
!ResourceSelectionBrowser methodsFor:'startup / release'! |
|
723 |
||
623 | 724 |
postBuildWith:aBuilder |
771 | 725 |
"after building and before opening, |
906 | 726 |
create a class selection block, an entry completion block for the class name field" |
623 | 727 |
|
771 | 728 |
|classSelection classNameInputField| |
906 | 729 |
|
730 |
allClasses := self treeViewClassHierarchyContents withAllSubclasses reject: [:cls| cls isPrivate]. |
|
689 | 731 |
classSelection := resourceClass. |
802 | 732 |
|
733 |
(classSelection isNil or:[Smalltalk at: classSelection]) isNil |
|
689 | 734 |
ifTrue: [classSelection := self class lastSelection]. |
802 | 735 |
(classSelection isNil or:[Smalltalk at: classSelection]) isNil |
771 | 736 |
ifTrue: [classSelection := self treeViewContents]. |
802 | 737 |
|
623 | 738 |
classSelectionBlock := |
739 |
[:clsPattern| |
|
802 | 740 |
|foundClass classes| |
741 |
||
742 |
clsPattern notNil ifTrue:[ |
|
743 |
foundClass := Smalltalk at:(clsPattern printString asSymbol). |
|
744 |
]. |
|
745 |
(foundClass isClass not or:[foundClass name ~= clsPattern]) |
|
623 | 746 |
ifTrue: |
747 |
[ |
|
748 |
classes := allClasses select: [:cls| cls name size >= clsPattern size]. |
|
749 |
1 to: clsPattern size do: |
|
750 |
[:i| |
|
751 |
classes := classes select: [:cls| (cls name at: i) == (clsPattern at: i)]. |
|
752 |
]. |
|
753 |
foundClass := classes at: 1 ifAbsent: [nil] |
|
771 | 754 |
]. |
623 | 755 |
foundClass notNil |
756 |
ifTrue: |
|
906 | 757 |
[ |
758 |
ClassPresentation = #'Class Hierarchy' |
|
759 |
ifTrue: |
|
760 |
[ |
|
761 |
|searchArgs nonSuperclasses| |
|
762 |
foundClass isPrivate |
|
763 |
ifFalse: [searchArgs := foundClass withAllSuperclasses reverse] |
|
764 |
ifTrue: [searchArgs := foundClass owningClass withAllSuperclasses reverse. searchArgs add: foundClass] |
|
765 |
. |
|
766 |
(nonSuperclasses := self treeViewClassHierarchyContents allSuperclasses) notNil |
|
767 |
ifTrue: [searchArgs := searchArgs reject: [:cls| nonSuperclasses includes: cls]]. |
|
768 |
||
769 |
self selectionOfClassHierarchy value: (self rootOfClassHierarchy detectChild:[:child :arg| child contents == arg] arguments:searchArgs). |
|
770 |
] |
|
771 |
ifFalse: |
|
772 |
[ |
|
773 |
|searchArgs| |
|
774 |
foundClass isPrivate |
|
775 |
ifTrue: [searchArgs := Array with: 'Categories' with: foundClass category with: foundClass owningClass name with: foundClass name] |
|
776 |
ifFalse: [searchArgs := Array with: 'Categories' with: foundClass category with: foundClass name]. |
|
777 |
||
778 |
self selectionOfClassCategories value: (self rootOfClassCategories detectChild:[:child :arg| (child name upTo: $ ) = arg] arguments:searchArgs). |
|
779 |
]. |
|
623 | 780 |
]. |
781 |
self valueOfClassName value: clsPattern |
|
782 |
]. |
|
635 | 783 |
self valueOfClassName value: classSelection. |
771 | 784 |
|
785 |
(classNameInputField := builder componentAt: #classNameInputField) entryCompletionBlock: |
|
623 | 786 |
[:value| |
906 | 787 |
|what oldClassName| |
788 |
oldClassName := classNameInputField contents. |
|
623 | 789 |
what := Smalltalk classnameCompletion: value withoutSpaces. |
771 | 790 |
classNameInputField contents:what first. |
906 | 791 |
oldClassName = classNameInputField contents ifTrue:[classNameInputField flash]. |
771 | 792 |
classSelectionBlock value: classNameInputField contents |
623 | 793 |
]. |
771 | 794 |
|
906 | 795 |
classSelectionBlock value: self valueOfClassName value. |
796 |
self classSelected. |
|
797 |
self selectionOfResourceMethod value: (self listOfResourceMethods detect: [:m| m selector == resourceMethod] ifNone: nil). |
|
909 | 798 |
|
799 |
^super postBuildWith:aBuilder |
|
800 |
||
910 | 801 |
! |
802 |
||
803 |
postOpenWith:aBuilder |
|
804 |
"after opening and if turned on make hierarchy view visible" |
|
805 |
||
806 |
ClassPresentation = #'Class Hierarchy' |
|
807 |
ifTrue: [(builder componentAt: #listOfClassHierarchyView) raise]. |
|
808 |
||
809 |
^super postOpenWith:aBuilder |
|
810 |
||
425 | 811 |
! ! |
812 |
||
771 | 813 |
!ResourceSelectionBrowser::ResourceMethod methodsFor:'accessing'! |
523 | 814 |
|
815 |
iconOn:aGC |
|
771 | 816 |
"registers and returns an icon indicating the resource type" |
523 | 817 |
|
730 | 818 |
self resourceType isNil ifTrue: [^nil]. |
819 |
icon isNil |
|
820 |
ifTrue: |
|
821 |
[ |
|
771 | 822 |
|cls sel image imageKey| |
823 |
((self resourceType = #image) or: [resourceType = #fileImage]) |
|
824 |
ifTrue: |
|
825 |
[ |
|
826 |
cls := method who methodClass soleInstance. |
|
827 |
sel := method who methodSelector. |
|
828 |
] |
|
829 |
ifFalse: |
|
830 |
[ |
|
831 |
cls := BrowserView. |
|
832 |
sel := (resourceType, 'Icon') asSymbol. |
|
833 |
]. |
|
834 |
imageKey := (cls name, sel) asSymbol. |
|
835 |
(icon := aGC registeredImageAt: imageKey) isNil |
|
836 |
ifTrue: |
|
837 |
[ |
|
838 |
image := cls perform: sel. |
|
839 |
image extent y > 18 |
|
840 |
ifTrue: |
|
841 |
[ |
|
842 |
image := image magnifiedBy: 18/image extent y |
|
843 |
]. |
|
844 |
aGC registerImage: image key: imageKey. |
|
845 |
icon := aGC registeredImageAt: imageKey. |
|
846 |
]. |
|
730 | 847 |
]. |
523 | 848 |
^icon |
849 |
! |
|
850 |
||
851 |
method: aMethod |
|
771 | 852 |
"sets aMethod" |
523 | 853 |
|
854 |
method := aMethod |
|
855 |
! |
|
856 |
||
857 |
resourceType |
|
771 | 858 |
"returns resourceType" |
523 | 859 |
|
860 |
resourceType isNil ifTrue: [resourceType := method resourceType]. |
|
861 |
^resourceType |
|
862 |
! |
|
863 |
||
864 |
selector |
|
771 | 865 |
"returns selector" |
523 | 866 |
|
867 |
selector isNil ifTrue: [selector := method who methodSelector]. |
|
868 |
^selector |
|
869 |
! ! |
|
870 |
||
425 | 871 |
!ResourceSelectionBrowser class methodsFor:'documentation'! |
872 |
||
873 |
version |
|
874 |
^ '$Header$' |
|
875 |
! ! |