author | tz |
Wed, 22 Jul 1998 16:57:55 +0200 | |
changeset 908 | 6862c9c822a3 |
parent 907 | 393a5860fc7d |
child 909 | c0bd0d9103e3 |
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' |
|
906 | 230 |
#layout: #(#LayoutFrame 361 0 289 0 960 0 638 0) |
773 | 231 |
#label: 'Resource Selection Browser' |
232 |
#min: #(#Point 400 300) |
|
233 |
#max: #(#Point 1152 864) |
|
906 | 234 |
#bounds: #(#Rectangle 361 289 961 639) |
773 | 235 |
#usePreferredExtent: false |
236 |
) |
|
237 |
#component: |
|
238 |
#(#SpecCollection |
|
239 |
#collection: |
|
240 |
#( |
|
241 |
#(#VariableHorizontalPanelSpec |
|
242 |
#name: 'VariableHorizontalPanel' |
|
243 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
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' |
|
263 |
#label: 'Class Categories' |
|
264 |
#translateLabel: true |
|
265 |
#model: #selectionOfClassPresentation |
|
266 |
#isTriggerOnDown: true |
|
267 |
#lampColor: #(#Color 0.0 0.0 0.0) |
|
268 |
#select: #'Class Categories' |
|
269 |
#extent: #(#Point 150 21) |
|
270 |
) |
|
271 |
#(#RadioButtonSpec |
|
272 |
#name: 'ClassHierarchyRadioButton' |
|
273 |
#label: 'Class Hierarchy' |
|
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' |
773 | 290 |
#layout: #(#LayoutFrame 0 0.0 23 0.0 0 1.0 -60 1.0) |
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' |
|
308 |
#layout: #(#LayoutFrame 0 0.0 23 0.0 0 1.0 -60 1.0) |
|
309 |
#tabable: true |
|
310 |
#model: #selectionOfClassCategories |
|
311 |
#hasHorizontalScrollBar: true |
|
312 |
#hasVerticalScrollBar: true |
|
313 |
#miniScrollerHorizontal: true |
|
314 |
#showDirectoryIndicatorForRoot: false |
|
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' |
|
324 |
#layout: #(#LayoutFrame 2 0.0 -58 1 -1 1.0 -36 1) |
|
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' |
|
339 |
#layout: #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -60 1.0) |
|
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' |
|
356 |
#layout: #(#LayoutFrame 2 0.0 -58 1 -2 1.0 -36 1) |
|
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 |
) |
409 |
! ! |
|
410 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
411 |
!ResourceSelectionBrowser class methodsFor:'list specs'! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
412 |
|
822 | 413 |
tableColumnsForResourceMethodAttributes |
821 | 414 |
"This resource specification was automatically generated |
415 |
by the DataSetBuilder of ST/X." |
|
416 |
||
417 |
"Do not manually edit this!! If it is corrupted, |
|
418 |
the DataSetBuilder may not be able to read the specification." |
|
419 |
||
420 |
" |
|
822 | 421 |
DataSetBuilder new openOnClass:ResourceSelectionBrowser andSelector:#tableColumnsForResourceMethodAttributes |
821 | 422 |
" |
423 |
||
424 |
<resource: #tableColumns> |
|
425 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
426 |
|
821 | 427 |
^ #( |
428 |
#(#DataSetColumnSpec |
|
429 |
#width: 20 |
|
430 |
#height: 20 |
|
431 |
#printSelector: #iconOn: |
|
432 |
#canSelect: false |
|
433 |
) |
|
434 |
#(#DataSetColumnSpec |
|
435 |
#label: ' Selector' |
|
436 |
#labelAlignment: #left |
|
437 |
#model: #selector |
|
438 |
#canSelect: false |
|
439 |
) |
|
440 |
#(#DataSetColumnSpec |
|
441 |
#label: ' Resource Type' |
|
442 |
#labelAlignment: #left |
|
443 |
#model: #resourceType |
|
444 |
#canSelect: false |
|
445 |
) |
|
446 |
) |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
447 |
! ! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
448 |
|
425 | 449 |
!ResourceSelectionBrowser methodsFor:'aspects'! |
450 |
||
773 | 451 |
helpEnabled |
452 |
"returns whether there is a documentation file" |
|
453 |
||
454 |
^true |
|
455 |
! |
|
456 |
||
771 | 457 |
listOfResourceMethods |
458 |
"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
|
459 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
460 |
|holder| |
771 | 461 |
(holder := builder bindingAt:#listOfResourceMethods) isNil ifTrue:[ |
462 |
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
|
463 |
]. |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
464 |
^ holder |
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 |
|
771 | 467 |
resourceMethodColumns |
468 |
"returns the columns for the table of the resource methods as value holder" |
|
425 | 469 |
|
470 |
|holder| |
|
771 | 471 |
(holder := builder bindingAt:#resourceMethodColumns) isNil ifTrue:[ |
821 | 472 |
builder aspectAt:#resourceMethodColumns put:(holder := List new). |
822 | 473 |
holder addAll: (self class tableColumnsForResourceMethodAttributes collect: [:i| i decodeAsLiteralArray]). |
771 | 474 |
]. |
475 |
^ holder |
|
476 |
! |
|
477 |
||
906 | 478 |
rootOfClassCategories |
479 |
"returns the value holder for the root of the class tree list" |
|
480 |
||
481 |
|holder| |
|
482 |
||
483 |
(holder := builder bindingAt:#rootOfClassCategories) isNil ifTrue:[ |
|
484 |
ClassPresentation = #'Class Categories' ifTrue: [ |
|
485 |
builder aspectAt:#rootOfClassCategories put: (holder := TreeItem name: 'Categories')]. |
|
486 |
]. |
|
487 |
^ holder |
|
488 |
||
489 |
||
490 |
! |
|
491 |
||
492 |
rootOfClassHierarchy |
|
771 | 493 |
"returns the value holder for the root of the class tree list" |
494 |
||
495 |
|holder| |
|
906 | 496 |
|
497 |
||
498 |
(holder := builder bindingAt:#rootOfClassHierarchy) isNil ifTrue:[ |
|
499 |
ClassPresentation = #'Class Hierarchy' ifTrue: [ |
|
500 |
builder aspectAt:#rootOfClassHierarchy put: (holder := TreeItem new)] |
|
425 | 501 |
]. |
502 |
^ holder |
|
503 |
||
504 |
||
505 |
! |
|
506 |
||
906 | 507 |
selectionOfClassCategories |
508 |
"returns the value holder for the selected class of the class tree list" |
|
509 |
||
510 |
|holder| |
|
511 |
(holder := builder bindingAt:#selectionOfClassCategories) isNil ifTrue:[ |
|
512 |
builder aspectAt:#selectionOfClassCategories put:(holder := ValueHolder new). |
|
513 |
]. |
|
514 |
^ holder |
|
515 |
! |
|
516 |
||
517 |
selectionOfClassHierarchy |
|
771 | 518 |
"returns the value holder for the selected class of the class tree list" |
425 | 519 |
|
906 | 520 |
|holder| |
521 |
(holder := builder bindingAt:#selectionOfClassHierarchy) isNil ifTrue:[ |
|
522 |
builder aspectAt:#selectionOfClassHierarchy put:(holder := ValueHolder new). |
|
523 |
]. |
|
524 |
^ holder |
|
525 |
! |
|
526 |
||
527 |
selectionOfClassPresentation |
|
528 |
"returns the value holder for the selected class presentation" |
|
529 |
||
425 | 530 |
|holder| |
906 | 531 |
(holder := builder bindingAt:#selectionOfClassPresentation) isNil ifTrue:[ |
532 |
builder aspectAt:#selectionOfClassPresentation put:(holder := RadioButtonGroup with: (ClassPresentation := ClassPresentation ? #'Class Categories')). |
|
533 |
holder onChangeSend: #value to: [holder value = #'Class Hierarchy' |
|
534 |
ifTrue: [ClassPresentation := holder value.(builder componentAt: #listOfClassHierarchyView) root: self rootOfClassHierarchy. (builder componentAt: #listOfClassHierarchyView) raise. classSelectionBlock value: self valueOfClassName value] |
|
535 |
ifFalse: [ClassPresentation := holder value.(builder componentAt: #listOfClassCategoriesView) root: self rootOfClassCategories. (builder componentAt: #listOfClassCategoriesView) raise. classSelectionBlock value: self valueOfClassName value]] |
|
425 | 536 |
]. |
537 |
^ holder |
|
538 |
! |
|
539 |
||
771 | 540 |
selectionOfResourceMethod |
541 |
"returns the value holder for the selected resource method of the resource method list" |
|
425 | 542 |
|
543 |
|holder| |
|
771 | 544 |
(holder := builder bindingAt:#selectionOfResourceMethod) isNil ifTrue:[ |
545 |
builder aspectAt:#selectionOfResourceMethod put:(holder := '' asValue). |
|
425 | 546 |
]. |
547 |
^ holder |
|
548 |
! |
|
549 |
||
467 | 550 |
valueOfClassName |
771 | 551 |
"returns the value holder for the name of the class" |
467 | 552 |
|
906 | 553 |
|holder| |
467 | 554 |
(holder := builder bindingAt:#valueOfClassName) isNil ifTrue:[ |
906 | 555 |
builder aspectAt:#valueOfClassName put:(holder := '' asValue). |
467 | 556 |
]. |
557 |
^ holder |
|
558 |
! |
|
559 |
||
771 | 560 |
valueOfResourceSelector |
561 |
"returns the value holder for the name of the selector" |
|
425 | 562 |
|
563 |
|holder| |
|
771 | 564 |
(holder := builder bindingAt:#valueOfResourceSelector) isNil ifTrue:[ |
565 |
builder aspectAt:#valueOfResourceSelector put:(holder := '' asValue). |
|
425 | 566 |
]. |
567 |
^ holder |
|
568 |
! ! |
|
569 |
||
771 | 570 |
!ResourceSelectionBrowser methodsFor:'callbacks - class list'! |
632 | 571 |
|
906 | 572 |
treeViewClassCategoryChildren |
573 |
"returns the children for the contents (class) of aTreeItem as a block" |
|
574 |
||
575 |
^[:aTreeItem| |
|
576 |
|children| |
|
577 |
children := OrderedCollection new. |
|
578 |
aTreeItem contents = '' |
|
579 |
ifTrue: |
|
580 |
[ |
|
581 |
children := (self treeViewClassHierarchyContents withAllSubclasses collect: [:cls| cls category]) asSet asSortedCollection. |
|
582 |
children := children collect: [:child| TreeItem name: child contents: 'Category'] |
|
583 |
]. |
|
584 |
aTreeItem contents = 'Category' |
|
585 |
ifTrue: |
|
586 |
[ |
|
587 |
children := self treeViewClassHierarchyContents withAllSubclasses select: [:cls| cls category = aTreeItem name and: [cls isPrivate not]]. |
|
588 |
children := children asSortedCollection: [:c1 :c2| c1 name <= c2 name]. |
|
589 |
children := children collect: [:child| TreeItem name: child name contents: child] |
|
590 |
]. |
|
591 |
aTreeItem contents isClass |
|
592 |
ifTrue: |
|
593 |
[ |
|
594 |
children := aTreeItem contents privateClasses. |
|
595 |
children := children asSortedCollection: [:c1 :c2| c1 name <= c2 name]. |
|
596 |
children := children collect: [:child| TreeItem name: child name , ' (', child superclass name, ')' contents: child] |
|
597 |
]. |
|
598 |
children |
|
599 |
] |
|
600 |
||
601 |
||
602 |
! |
|
603 |
||
604 |
treeViewClassCategoryIcon |
|
605 |
"returns the icon for aTreeItem as a block" |
|
606 |
||
607 |
^self class treeViewClassHierarchyIcon |
|
608 |
||
609 |
||
610 |
! |
|
611 |
||
612 |
treeViewClassHierarchyContents |
|
771 | 613 |
"returns the contents of the root of the class tree list" |
632 | 614 |
|
802 | 615 |
|cls| |
632 | 616 |
|
802 | 617 |
resourceSuperclass notNil ifTrue:[ |
618 |
cls := Smalltalk at: resourceSuperclass. |
|
619 |
]. |
|
906 | 620 |
^ cls ? self class treeViewClassHierarchyContents |
632 | 621 |
|
802 | 622 |
"Modified: / 22.4.1998 / 14:43:19 / cg" |
771 | 623 |
! |
624 |
||
625 |
validateDoubleClick: aTreeItem |
|
626 |
"returns whether a class may be selected" |
|
627 |
||
906 | 628 |
^aTreeItem contents ~= '' and: [aTreeItem contents ~~ self treeViewClassHierarchyContents] |
771 | 629 |
|
630 |
||
631 |
||
632 | 632 |
! ! |
633 |
||
634 |
!ResourceSelectionBrowser methodsFor:'callbacks - user'! |
|
425 | 635 |
|
771 | 636 |
classSelected |
637 |
"after a class selection, read the allowed resource methods of the selected class" |
|
730 | 638 |
|
906 | 639 |
ClassPresentation = #'Class Hierarchy' |
640 |
ifTrue: [self selectionOfClassHierarchy value isNil ifTrue: [^nil]] |
|
641 |
ifFalse: [self selectionOfClassCategories value isNil ifTrue: [^nil]]. |
|
642 |
||
425 | 643 |
self withWaitCursorDo: |
644 |
[ |
|
906 | 645 |
|clsName| |
517 | 646 |
resourceTypes isNil ifTrue: [resourceTypes := Method resourceTypes]. |
906 | 647 |
|
648 |
ClassPresentation = #'Class Hierarchy' |
|
649 |
ifTrue: [clsName := (self selectionOfClassHierarchy value name upTo: $ ) asSymbol] |
|
650 |
ifFalse: [clsName := (self selectionOfClassCategories value name upTo: $ ) asSymbol]. |
|
651 |
||
477 | 652 |
self valueOfClassName value: clsName. |
425 | 653 |
self class lastSelection: clsName. |
771 | 654 |
self listOfResourceMethods contents: |
523 | 655 |
((((Smalltalk at: clsName) |
425 | 656 |
class methodDictionary |
657 |
asOrderedCollection select: |
|
523 | 658 |
[:m| m resources notNil and: [resourceTypes includes: m resourceType]])) |
771 | 659 |
collect: [:m| (ResourceMethod new method: m)]). |
425 | 660 |
] |
661 |
! |
|
662 |
||
663 |
resourceDoubleClicked |
|
771 | 664 |
"after a double click on resource method, accept it and close" |
425 | 665 |
|
666 |
accept value: true. |
|
771 | 667 |
|
425 | 668 |
self close |
669 |
! |
|
670 |
||
671 |
resourceSelected |
|
771 | 672 |
"after a click on a resource method, set its selector into the field" |
425 | 673 |
|
771 | 674 |
self selectionOfResourceMethod value notNil |
675 |
ifTrue: [self valueOfResourceSelector value: self selectionOfResourceMethod value selector] |
|
425 | 676 |
! ! |
677 |
||
678 |
!ResourceSelectionBrowser methodsFor:'instance creation'! |
|
679 |
||
680 |
openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withResourceTypes: aResourceTypes |
|
771 | 681 |
"opens a ResourceSelectionBrowser on |
802 | 682 |
aSuperclassOrSymbol, |
683 |
and aClassOrSymbol, |
|
684 |
and aSelector, |
|
685 |
with allowed aResourceTypes" |
|
425 | 686 |
|
733 | 687 |
|clsName| |
771 | 688 |
|
517 | 689 |
resourceMethod := aSelector. |
425 | 690 |
resourceTypes := aResourceTypes. |
691 |
resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol]. |
|
802 | 692 |
resourceClass := nil. |
693 |
||
694 |
aClassOrSymbol isClass |
|
695 |
ifTrue: [resourceClass := aClassOrSymbol name] |
|
696 |
ifFalse: [ |
|
697 |
aClassOrSymbol notNil ifTrue:[ |
|
698 |
(Smalltalk at: aClassOrSymbol) notNil |
|
699 |
ifTrue: [resourceClass := aClassOrSymbol] |
|
700 |
] |
|
701 |
]. |
|
771 | 702 |
self valueOfResourceSelector value:(aSelector ? ''). |
425 | 703 |
|
463 | 704 |
self open. |
705 |
||
906 | 706 |
(clsName := self selectionOfClassHierarchy value) isNil |
707 |
ifTrue: [(clsName := self selectionOfClassCategories value) isNil ifTrue: [^nil]]. |
|
708 |
||
733 | 709 |
clsName := (clsName name upTo: $ ) asSymbol. |
693 | 710 |
|
733 | 711 |
((Smalltalk at: clsName) isClass and: [accept value]) |
632 | 712 |
ifTrue: |
693 | 713 |
[ |
802 | 714 |
^clsName, ' ', self valueOfResourceSelector value |
425 | 715 |
]. |
716 |
^nil |
|
802 | 717 |
|
718 |
"Modified: / 22.4.1998 / 14:51:03 / cg" |
|
425 | 719 |
! ! |
720 |
||
721 |
!ResourceSelectionBrowser methodsFor:'startup / release'! |
|
722 |
||
623 | 723 |
postBuildWith:aBuilder |
771 | 724 |
"after building and before opening, |
906 | 725 |
create a class selection block, an entry completion block for the class name field" |
623 | 726 |
|
771 | 727 |
|classSelection classNameInputField| |
906 | 728 |
|
729 |
allClasses := self treeViewClassHierarchyContents withAllSubclasses reject: [:cls| cls isPrivate]. |
|
689 | 730 |
classSelection := resourceClass. |
802 | 731 |
|
732 |
(classSelection isNil or:[Smalltalk at: classSelection]) isNil |
|
689 | 733 |
ifTrue: [classSelection := self class lastSelection]. |
802 | 734 |
(classSelection isNil or:[Smalltalk at: classSelection]) isNil |
771 | 735 |
ifTrue: [classSelection := self treeViewContents]. |
802 | 736 |
|
623 | 737 |
classSelectionBlock := |
738 |
[:clsPattern| |
|
802 | 739 |
|foundClass classes| |
740 |
||
741 |
clsPattern notNil ifTrue:[ |
|
742 |
foundClass := Smalltalk at:(clsPattern printString asSymbol). |
|
743 |
]. |
|
744 |
(foundClass isClass not or:[foundClass name ~= clsPattern]) |
|
623 | 745 |
ifTrue: |
746 |
[ |
|
747 |
classes := allClasses select: [:cls| cls name size >= clsPattern size]. |
|
748 |
1 to: clsPattern size do: |
|
749 |
[:i| |
|
750 |
classes := classes select: [:cls| (cls name at: i) == (clsPattern at: i)]. |
|
751 |
]. |
|
752 |
foundClass := classes at: 1 ifAbsent: [nil] |
|
771 | 753 |
]. |
623 | 754 |
foundClass notNil |
755 |
ifTrue: |
|
906 | 756 |
[ |
757 |
ClassPresentation = #'Class Hierarchy' |
|
758 |
ifTrue: |
|
759 |
[ |
|
760 |
|searchArgs nonSuperclasses| |
|
761 |
foundClass isPrivate |
|
762 |
ifFalse: [searchArgs := foundClass withAllSuperclasses reverse] |
|
763 |
ifTrue: [searchArgs := foundClass owningClass withAllSuperclasses reverse. searchArgs add: foundClass] |
|
764 |
. |
|
765 |
(nonSuperclasses := self treeViewClassHierarchyContents allSuperclasses) notNil |
|
766 |
ifTrue: [searchArgs := searchArgs reject: [:cls| nonSuperclasses includes: cls]]. |
|
767 |
||
768 |
self selectionOfClassHierarchy value: (self rootOfClassHierarchy detectChild:[:child :arg| child contents == arg] arguments:searchArgs). |
|
769 |
] |
|
770 |
ifFalse: |
|
771 |
[ |
|
772 |
|searchArgs| |
|
773 |
foundClass isPrivate |
|
774 |
ifTrue: [searchArgs := Array with: 'Categories' with: foundClass category with: foundClass owningClass name with: foundClass name] |
|
775 |
ifFalse: [searchArgs := Array with: 'Categories' with: foundClass category with: foundClass name]. |
|
776 |
||
777 |
self selectionOfClassCategories value: (self rootOfClassCategories detectChild:[:child :arg| (child name upTo: $ ) = arg] arguments:searchArgs). |
|
778 |
]. |
|
623 | 779 |
]. |
780 |
self valueOfClassName value: clsPattern |
|
781 |
]. |
|
635 | 782 |
self valueOfClassName value: classSelection. |
771 | 783 |
|
784 |
(classNameInputField := builder componentAt: #classNameInputField) entryCompletionBlock: |
|
623 | 785 |
[:value| |
906 | 786 |
|what oldClassName| |
787 |
oldClassName := classNameInputField contents. |
|
623 | 788 |
what := Smalltalk classnameCompletion: value withoutSpaces. |
771 | 789 |
classNameInputField contents:what first. |
906 | 790 |
oldClassName = classNameInputField contents ifTrue:[classNameInputField flash]. |
771 | 791 |
classSelectionBlock value: classNameInputField contents |
623 | 792 |
]. |
771 | 793 |
|
623 | 794 |
^super postBuildWith:aBuilder |
795 |
||
906 | 796 |
! |
797 |
||
798 |
postOpenWith:aBuilder |
|
799 |
"after opening, raise the the view do select class and resource method" |
|
800 |
||
801 |
ClassPresentation = #'Class Hierarchy' |
|
802 |
ifTrue: [(builder componentAt: #listOfClassHierarchyView) raise]. |
|
803 |
||
804 |
classSelectionBlock value: self valueOfClassName value. |
|
805 |
self classSelected. |
|
806 |
self selectionOfResourceMethod value: (self listOfResourceMethods detect: [:m| m selector == resourceMethod] ifNone: nil). |
|
425 | 807 |
! ! |
808 |
||
771 | 809 |
!ResourceSelectionBrowser::ResourceMethod methodsFor:'accessing'! |
523 | 810 |
|
811 |
iconOn:aGC |
|
771 | 812 |
"registers and returns an icon indicating the resource type" |
523 | 813 |
|
730 | 814 |
self resourceType isNil ifTrue: [^nil]. |
815 |
icon isNil |
|
816 |
ifTrue: |
|
817 |
[ |
|
771 | 818 |
|cls sel image imageKey| |
819 |
((self resourceType = #image) or: [resourceType = #fileImage]) |
|
820 |
ifTrue: |
|
821 |
[ |
|
822 |
cls := method who methodClass soleInstance. |
|
823 |
sel := method who methodSelector. |
|
824 |
] |
|
825 |
ifFalse: |
|
826 |
[ |
|
827 |
cls := BrowserView. |
|
828 |
sel := (resourceType, 'Icon') asSymbol. |
|
829 |
]. |
|
830 |
imageKey := (cls name, sel) asSymbol. |
|
831 |
(icon := aGC registeredImageAt: imageKey) isNil |
|
832 |
ifTrue: |
|
833 |
[ |
|
834 |
image := cls perform: sel. |
|
835 |
image extent y > 18 |
|
836 |
ifTrue: |
|
837 |
[ |
|
838 |
image := image magnifiedBy: 18/image extent y |
|
839 |
]. |
|
840 |
aGC registerImage: image key: imageKey. |
|
841 |
icon := aGC registeredImageAt: imageKey. |
|
842 |
]. |
|
730 | 843 |
]. |
523 | 844 |
^icon |
845 |
! |
|
846 |
||
847 |
method: aMethod |
|
771 | 848 |
"sets aMethod" |
523 | 849 |
|
850 |
method := aMethod |
|
851 |
! |
|
852 |
||
853 |
resourceType |
|
771 | 854 |
"returns resourceType" |
523 | 855 |
|
856 |
resourceType isNil ifTrue: [resourceType := method resourceType]. |
|
857 |
^resourceType |
|
858 |
! |
|
859 |
||
860 |
selector |
|
771 | 861 |
"returns selector" |
523 | 862 |
|
863 |
selector isNil ifTrue: [selector := method who methodSelector]. |
|
864 |
^selector |
|
865 |
! ! |
|
866 |
||
425 | 867 |
!ResourceSelectionBrowser class methodsFor:'documentation'! |
868 |
||
869 |
version |
|
870 |
^ '$Header$' |
|
871 |
! ! |