author | tz |
Mon, 30 Mar 1998 14:42:21 +0200 | |
changeset 752 | 2dc82cdfdd90 |
parent 746 | 8b3532f50ea9 |
child 769 | bb413a70f479 |
permissions | -rw-r--r-- |
425 | 1 |
" |
504 | 2 |
COPYRIGHT (c) 1997 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 |
733 | 16 |
allClasses classSelectionBlock classAndResourceSelectionProcess' |
425 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
619 | 19 |
category:'Interface-Dialogs' |
425 | 20 |
! |
21 |
||
523 | 22 |
Object subclass:#Row |
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 |
" |
|
504 | 33 |
COPYRIGHT (c) 1997 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 |
49 |
and to select resource methods in order to load method contents or to save |
|
50 |
something to methods. |
|
51 |
||
504 | 52 |
[start with:] |
53 |
ResourceSelectionBrowser open |
|
54 |
||
55 |
[author:] |
|
746 | 56 |
Thomas Zwick, eXept Software AG |
425 | 57 |
" |
58 |
! ! |
|
59 |
||
60 |
!ResourceSelectionBrowser class methodsFor:'instance creation'! |
|
61 |
||
649 | 62 |
request: aTitle onSuperclass: aSuperclass andClass: aClass andSelector: aSelector withResourceTypes: resourceTypes |
425 | 63 |
|
649 | 64 |
" |
65 |
ResourceSelectionBrowser |
|
66 |
request: 'Select a Resource Selector' |
|
425 | 67 |
onSuperclass: #ApplicationModel |
68 |
andClass: #ToolApplicationModel |
|
69 |
andSelector: #saveIcon |
|
517 | 70 |
withResourceTypes: #(image) |
425 | 71 |
" |
72 |
||
73 |
^self new |
|
74 |
title: aTitle; |
|
75 |
openOnSuperclass: aSuperclass |
|
76 |
andClass: aClass |
|
77 |
andSelector: aSelector |
|
649 | 78 |
withResourceTypes: resourceTypes |
425 | 79 |
! ! |
80 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
81 |
!ResourceSelectionBrowser class methodsFor:'callbacks - default'! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
82 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
83 |
treeViewChildren |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
84 |
|
680 | 85 |
^[:aTreeItem| |
86 |
|classes| |
|
87 |
classes := OrderedCollection new. |
|
718 | 88 |
classes addAll: ((aTreeItem contents subclasses reject: [:cls| cls isPrivate]) asSortedCollection: [:i1 :i2| i1 name < i2 name]). |
89 |
classes addAll: (aTreeItem contents privateClasses asSortedCollection: [:i1 :i2| i1 name < i2 name]). |
|
90 |
classes |
|
91 |
] |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
92 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
93 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
94 |
treeViewContents |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
95 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
96 |
^Smalltalk at: #Object |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
97 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
98 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
99 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
100 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
101 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
102 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
103 |
treeViewIcon |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
104 |
|
718 | 105 |
^[:aTreeItem| |
106 |
|icon| |
|
107 |
icon := self iconClass. |
|
108 |
aTreeItem contents isPrivate |
|
109 |
ifTrue: |
|
110 |
[ |
|
111 |
icon := self iconPrivateClass |
|
112 |
]. |
|
113 |
icon] |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
114 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
115 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
116 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
117 |
treeViewLabel |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
118 |
|
718 | 119 |
^[:aTreeItem| |
120 |
|label superCls| |
|
121 |
label := aTreeItem contents name. |
|
122 |
(aTreeItem contents isPrivate and: [aTreeItem parent contents ~~ (superCls := aTreeItem contents superclass)]) |
|
123 |
ifTrue: [label := label, ' (', superCls name, ')']. |
|
124 |
label |
|
125 |
] |
|
126 |
||
127 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
128 |
! ! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
129 |
|
730 | 130 |
!ResourceSelectionBrowser class methodsFor:'image specs'! |
131 |
||
132 |
iconClass |
|
746 | 133 |
"This resource specification was automatically generated |
134 |
by the ImageEditor of ST/X." |
|
135 |
||
136 |
"Do not manually edit this!! If it is corrupted, |
|
137 |
the ImageEditor may not be able to read the specification." |
|
138 |
||
730 | 139 |
" |
746 | 140 |
ImageEditor openOnClass:self andSelector:#iconClass |
730 | 141 |
" |
142 |
||
143 |
<resource: #image> |
|
144 |
||
145 |
^Icon |
|
146 |
constantNamed:#'ResourceSelectionBrowser iconClass' |
|
147 |
ifAbsentPut:[(Depth2Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@UUUUUAQ****(@F**** @Z****@A****(@F**** @Z****@A****(LF**** TZ****@A****(@F**** @Z****@@@@@@@@@@@@@@@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]! |
|
148 |
||
149 |
iconPrivateClass |
|
746 | 150 |
"This resource specification was automatically generated |
151 |
by the ImageEditor of ST/X." |
|
152 |
||
153 |
"Do not manually edit this!! If it is corrupted, |
|
154 |
the ImageEditor may not be able to read the specification." |
|
155 |
||
730 | 156 |
" |
746 | 157 |
ImageEditor openOnClass:self andSelector:#iconPrivateClass |
730 | 158 |
" |
159 |
||
160 |
<resource: #image> |
|
161 |
||
162 |
^Icon |
|
163 |
constantNamed:#'ResourceSelectionBrowser iconPrivateClass' |
|
164 |
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****C0@@@@@@@@@@@@@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]! ! |
|
165 |
||
425 | 166 |
!ResourceSelectionBrowser class methodsFor:'interface specs'! |
167 |
||
168 |
windowSpec |
|
746 | 169 |
"This resource specification was automatically generated |
170 |
by the UIPainter of ST/X." |
|
425 | 171 |
|
746 | 172 |
"Do not manually edit this!! If it is corrupted, |
173 |
the UIPainter may not be able to read the specification." |
|
425 | 174 |
|
175 |
" |
|
176 |
UIPainter new openOnClass:ResourceSelectionBrowser andSelector:#windowSpec |
|
177 |
ResourceSelectionBrowser new openInterface:#windowSpec |
|
746 | 178 |
ResourceSelectionBrowser open |
425 | 179 |
" |
180 |
||
181 |
<resource: #canvas> |
|
182 |
||
183 |
^ |
|
468 | 184 |
|
425 | 185 |
#(#FullSpec |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
186 |
#window: |
425 | 187 |
#(#WindowSpec |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
188 |
#name: 'Resource Selection Browser' |
746 | 189 |
#layout: #(#LayoutFrame 433 0 242 0 1032 0 591 0) |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
190 |
#label: 'Resource Selection Browser' |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
191 |
#min: #(#Point 400 300) |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
192 |
#max: #(#Point 1152 864) |
746 | 193 |
#bounds: #(#Rectangle 433 242 1033 592) |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
194 |
#usePreferredExtent: false |
425 | 195 |
) |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
196 |
#component: |
425 | 197 |
#(#SpecCollection |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
198 |
#collection: |
425 | 199 |
#( |
200 |
#(#VariableHorizontalPanelSpec |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
201 |
#name: 'variableHorizontalPanel' |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
202 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -40 1.0) |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
203 |
#component: |
425 | 204 |
#(#SpecCollection |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
205 |
#collection: |
425 | 206 |
#( |
207 |
#(#ViewSpec |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
208 |
#name: 'view1' |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
209 |
#component: |
425 | 210 |
#(#SpecCollection |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
211 |
#collection: |
425 | 212 |
#( |
213 |
#(#SelectionInTreeViewSpec |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
214 |
#name: 'listOfClassesView' |
680 | 215 |
#layout: #(#LayoutFrame 0 0.0 23 0.0 0 1.0 -22 1.0) |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
216 |
#model: #selectionOfClass |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
217 |
#hasHorizontalScrollBar: true |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
218 |
#hasVerticalScrollBar: true |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
219 |
#miniScrollerHorizontal: true |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
220 |
#showDirectoryIndicatorForRoot: false |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
221 |
#showDirectoryIndicator: true |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
222 |
#valueChangeSelector: #classSelected: |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
223 |
#hierarchicalList: #listOfClasses |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
224 |
#contentsSelector: #treeViewContents |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
225 |
#labelSelector: #treeViewLabel |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
226 |
#childrenSelector: #treeViewChildren |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
227 |
#iconSelector: #treeViewIcon |
425 | 228 |
) |
467 | 229 |
#(#InputFieldSpec |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
230 |
#name: 'classNameInputField' |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
231 |
#layout: #(#LayoutFrame 2 0.0 -22 1 -1 1.0 0 1) |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
232 |
#model: #valueOfClassName |
467 | 233 |
) |
664 | 234 |
#(#LabelSpec |
680 | 235 |
#name: 'ClassHierarchyLabel' |
236 |
#layout: #(#LayoutFrame 0 0 2 0 297 0 23 0) |
|
664 | 237 |
#label: ' Class Hierarchy' |
238 |
#level: 1 |
|
239 |
#adjust: #left |
|
240 |
) |
|
425 | 241 |
) |
242 |
) |
|
243 |
) |
|
244 |
#(#ViewSpec |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
245 |
#name: 'view2' |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
246 |
#component: |
425 | 247 |
#(#SpecCollection |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
248 |
#collection: |
425 | 249 |
#( |
250 |
#(#DataSetSpec |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
251 |
#name: 'resourcesDataSetView' |
680 | 252 |
#layout: #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -22 1.0) |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
253 |
#model: #selectionOfResource |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
254 |
#hasHorizontalScrollBar: true |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
255 |
#hasVerticalScrollBar: true |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
256 |
#miniScrollerHorizontal: true |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
257 |
#rowClassName: 'ResourceSelectionBrowser::Row' |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
258 |
#dataList: #listOfResources |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
259 |
#useIndex: false |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
260 |
#has3Dsepartors: true |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
261 |
#doubleClickSelector: #resourceDoubleClicked |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
262 |
#columnHolder: #columnsOfDataSetView |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
263 |
#valueChangeSelector: #resourceSelected |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
264 |
#verticalSpacing: 1 |
425 | 265 |
) |
266 |
#(#InputFieldSpec |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
267 |
#name: 'selectorInputField' |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
268 |
#layout: #(#LayoutFrame 2 0.0 -22 1 -2 1.0 0 1) |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
269 |
#model: #valueOfSelector |
425 | 270 |
) |
271 |
) |
|
272 |
) |
|
273 |
) |
|
274 |
) |
|
275 |
) |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
276 |
#handles: #(#Any 0.5 1.0) |
425 | 277 |
) |
436 | 278 |
#(#UISubSpecification |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
279 |
#name: 'SubSpecification' |
680 | 280 |
#layout: #(#LayoutFrame 301 0.0 -32 1 -2 1.0 -8 1.0) |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
281 |
#majorKey: #ToolApplicationModel |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
282 |
#minorKey: #windowSpecForCommitWithoutChannels |
425 | 283 |
) |
680 | 284 |
#(#HorizontalPanelViewSpec |
285 |
#name: 'HorizontalPanelView1' |
|
286 |
#layout: #(#LayoutFrame 3 0 76 0.691429 300 0 0 0.977143) |
|
287 |
#component: |
|
288 |
#(#SpecCollection |
|
289 |
#collection: |
|
290 |
#( |
|
291 |
#(#LabelSpec |
|
292 |
#name: 'Label2' |
|
293 |
#label: 'Create: ' |
|
294 |
#adjust: #right |
|
746 | 295 |
#extent: #(#Point 72 24) |
680 | 296 |
) |
297 |
#(#ActionButtonSpec |
|
298 |
#name: 'CreateClassButton' |
|
299 |
#activeHelpKey: #dss |
|
300 |
#label: 'Class' |
|
301 |
#model: #createClass: |
|
302 |
#actionValue: 'class' |
|
303 |
#extent: #(#Point 72 24) |
|
304 |
) |
|
305 |
#(#ActionButtonSpec |
|
306 |
#name: 'CreateSubclassButton' |
|
307 |
#activeHelpKey: #dss |
|
308 |
#label: 'Subclass' |
|
309 |
#model: #createClass: |
|
310 |
#actionValue: 'subclass' |
|
311 |
#extent: #(#Point 72 24) |
|
312 |
) |
|
313 |
#(#ActionButtonSpec |
|
314 |
#name: 'CreatePrivateClassButton' |
|
315 |
#activeHelpKey: #dss |
|
316 |
#label: 'Private' |
|
317 |
#model: #createClass: |
|
318 |
#actionValue: 'private' |
|
319 |
#extent: #(#Point 72 24) |
|
320 |
) |
|
321 |
) |
|
322 |
) |
|
323 |
#horizontalLayout: #fit |
|
324 |
#verticalLayout: #fit |
|
325 |
) |
|
425 | 326 |
) |
327 |
) |
|
328 |
) |
|
329 |
! ! |
|
330 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
331 |
!ResourceSelectionBrowser class methodsFor:'list specs'! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
332 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
333 |
columnsOfDataSetView |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
334 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
335 |
^ #(#(#DataSetColumnSpec |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
336 |
#width: 20 |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
337 |
#height: 20 |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
338 |
#printSelector: #iconOn: |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
339 |
#canSelect: false |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
340 |
) |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
341 |
#(#DataSetColumnSpec |
649 | 342 |
#label: ' Selector' |
343 |
#'labelAlignment:' #left |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
344 |
#model: #selector |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
345 |
#canSelect: false |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
346 |
) |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
347 |
(#DataSetColumnSpec |
649 | 348 |
#label: ' Resource Type' |
349 |
#'labelAlignment:' #left |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
350 |
#model: #resourceType |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
351 |
#canSelect: false |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
352 |
)) |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
353 |
! ! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
354 |
|
425 | 355 |
!ResourceSelectionBrowser methodsFor:'accessing - views'! |
356 |
||
467 | 357 |
classNameInputField |
358 |
||
359 |
^builder componentAt: #classNameInputField |
|
360 |
! |
|
361 |
||
425 | 362 |
listOfClassesView |
363 |
||
364 |
^builder componentAt: #listOfClassesView |
|
365 |
! ! |
|
366 |
||
367 |
!ResourceSelectionBrowser methodsFor:'aspects'! |
|
368 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
369 |
columnsOfDataSetView |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
370 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
371 |
|holder| |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
372 |
(holder := builder bindingAt:#columnsOfDataSetView) isNil ifTrue:[ |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
373 |
builder aspectAt:#columnsOfDataSetView put:(holder := List new). |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
374 |
holder addAll: (self class columnsOfDataSetView collect: [:i| i decodeAsLiteralArray]). |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
375 |
]. |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
376 |
^ holder |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
377 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
378 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
379 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
380 |
|
425 | 381 |
listOfClasses |
382 |
||
383 |
|holder| |
|
384 |
(holder := builder bindingAt:#listOfClasses) isNil ifTrue:[ |
|
632 | 385 |
builder aspectAt:#listOfClasses put: (holder := TreeItem new) |
425 | 386 |
]. |
387 |
^ holder |
|
388 |
||
389 |
||
390 |
! |
|
391 |
||
392 |
listOfResources |
|
393 |
||
394 |
|holder| |
|
395 |
(holder := builder bindingAt:#listOfResources) isNil ifTrue:[ |
|
396 |
builder aspectAt:#listOfResources put:(holder := List new). |
|
397 |
]. |
|
398 |
^ holder |
|
399 |
! |
|
400 |
||
401 |
selectionOfClass |
|
402 |
||
403 |
|holder| |
|
404 |
(holder := builder bindingAt:#selectionOfClass) isNil ifTrue:[ |
|
405 |
builder aspectAt:#selectionOfClass put:(holder := ValueHolder new). |
|
406 |
]. |
|
407 |
^ holder |
|
408 |
! |
|
409 |
||
410 |
selectionOfResource |
|
411 |
||
412 |
|holder| |
|
413 |
(holder := builder bindingAt:#selectionOfResource) isNil ifTrue:[ |
|
414 |
builder aspectAt:#selectionOfResource put:(holder := '' asValue). |
|
415 |
]. |
|
416 |
^ holder |
|
417 |
! |
|
418 |
||
467 | 419 |
valueOfClassName |
420 |
||
421 |
|holder| |
|
422 |
(holder := builder bindingAt:#valueOfClassName) isNil ifTrue:[ |
|
423 |
builder aspectAt:#valueOfClassName put:(holder := '' asValue). |
|
424 |
]. |
|
425 |
^ holder |
|
426 |
! |
|
427 |
||
425 | 428 |
valueOfSelector |
429 |
||
430 |
|holder| |
|
431 |
(holder := builder bindingAt:#valueOfSelector) isNil ifTrue:[ |
|
432 |
builder aspectAt:#valueOfSelector put:(holder := '' asValue). |
|
433 |
]. |
|
434 |
^ holder |
|
435 |
! ! |
|
436 |
||
632 | 437 |
!ResourceSelectionBrowser methodsFor:'callbacks - tree view'! |
438 |
||
439 |
treeViewContents |
|
440 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
441 |
^(Smalltalk at: resourceSuperclass) ? self class treeViewContents |
632 | 442 |
|
443 |
||
444 |
! ! |
|
445 |
||
446 |
!ResourceSelectionBrowser methodsFor:'callbacks - user'! |
|
425 | 447 |
|
448 |
classSelected: anIndex |
|
730 | 449 |
|
425 | 450 |
self selectionOfClass value isNil ifTrue: [^nil]. |
451 |
self withWaitCursorDo: |
|
452 |
[ |
|
453 |
|clsName| |
|
517 | 454 |
resourceTypes isNil ifTrue: [resourceTypes := Method resourceTypes]. |
680 | 455 |
clsName := ((self listOfClassesView list at: anIndex) upTo: $ ) asSymbol. |
477 | 456 |
self valueOfClassName value: clsName. |
425 | 457 |
self class lastSelection: clsName. |
458 |
self listOfResources contents: |
|
523 | 459 |
((((Smalltalk at: clsName) |
425 | 460 |
class methodDictionary |
461 |
asOrderedCollection select: |
|
523 | 462 |
[:m| m resources notNil and: [resourceTypes includes: m resourceType]])) |
463 |
collect: [:m| Row new method: m]). |
|
425 | 464 |
] |
465 |
! |
|
466 |
||
680 | 467 |
createClass: what |
468 |
||
469 |
|clsCandidat cls| |
|
470 |
clsCandidat := self valueOfClassName value asSymbol. |
|
471 |
||
472 |
(Smalltalk at: clsCandidat) notNil |
|
473 |
ifTrue: [^self warn: 'Cannot create class ', clsCandidat asBoldText, |
|
474 |
'!!\Key with that name in dictionary ' withCRs, 'Smalltalk' asBoldText, ' detected.']. |
|
475 |
||
476 |
cls := self selectionOfClass value contents. |
|
477 |
what = 'class' ifTrue: [cls := cls superclass]. |
|
478 |
||
479 |
cls isNil ifTrue: [^self warn: 'May not create class with superclass ', 'nil' asBoldText, '!!']. |
|
480 |
||
481 |
what = 'private' |
|
693 | 482 |
ifFalse: |
483 |
[ |
|
484 |
cls subclass: clsCandidat |
|
485 |
instanceVariableNames:'' |
|
486 |
classVariableNames:'' |
|
487 |
poolDictionaries:'' |
|
488 |
category: cls category |
|
489 |
] |
|
680 | 490 |
ifTrue: |
491 |
[ |
|
492 |
|superClsCandidate| |
|
493 |
superClsCandidate := (Dialog |
|
494 |
request: 'Enter name of superclass of private class.' |
|
495 |
initialAnswer: 'Object') asSymbol. |
|
730 | 496 |
(Smalltalk at: superClsCandidate) isNil ifTrue: [^self warn: 'Class ', superClsCandidate asBoldText, ' does not exist!!']. |
680 | 497 |
|
730 | 498 |
((superClsCandidate := Smalltalk at: superClsCandidate) isClass and: [superClsCandidate isPrivate not]) |
680 | 499 |
ifFalse: [^self warn: 'May not create private class with superclass ', superClsCandidate asBoldText, '!!']. |
500 |
superClsCandidate subclass: clsCandidat |
|
501 |
instanceVariableNames:'' |
|
502 |
classVariableNames:'' |
|
503 |
poolDictionaries:'' |
|
504 |
privateIn: cls |
|
505 |
]. |
|
506 |
||
507 |
allClasses := Object withAllSubclasses. |
|
508 |
||
509 |
what = 'class' |
|
510 |
ifTrue: [self selectionOfClass value parent changed: #children] |
|
511 |
ifFalse: [self selectionOfClass value changed: #children]. |
|
512 |
||
693 | 513 |
classSelectionBlock value: self valueOfClassName value |
680 | 514 |
! |
515 |
||
425 | 516 |
resourceDoubleClicked |
517 |
||
518 |
resourceMethod := self selectionOfResource value. |
|
519 |
accept value: true. |
|
520 |
self close |
|
521 |
! |
|
522 |
||
523 |
resourceSelected |
|
524 |
||
525 |
resourceMethod := self selectionOfResource value. |
|
649 | 526 |
self selectionOfResource value notNil |
527 |
ifTrue: [self valueOfSelector value: self selectionOfResource value selector] |
|
425 | 528 |
! ! |
529 |
||
530 |
!ResourceSelectionBrowser methodsFor:'instance creation'! |
|
531 |
||
532 |
openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withResourceTypes: aResourceTypes |
|
533 |
||
733 | 534 |
|clsName| |
517 | 535 |
resourceMethod := aSelector. |
425 | 536 |
resourceTypes := aResourceTypes. |
537 |
resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol]. |
|
689 | 538 |
resourceClass := aClassOrSymbol isClass |
539 |
ifTrue: [aClassOrSymbol name] |
|
727 | 540 |
ifFalse: [(Smalltalk at: aClassOrSymbol) notNil |
541 |
ifTrue: [aClassOrSymbol] |
|
689 | 542 |
ifFalse: [nil]]. |
481
e2e1ea013229
Take care of nil selectors in #openOnSuperClass:andClass:andSelector:
Stefan Vogel <sv@exept.de>
parents:
477
diff
changeset
|
543 |
self valueOfSelector value:(aSelector ? ''). |
425 | 544 |
|
463 | 545 |
self open. |
546 |
||
733 | 547 |
(clsName := self selectionOfClass value) isNil ifTrue: [^nil]. |
548 |
clsName := (clsName name upTo: $ ) asSymbol. |
|
693 | 549 |
|
733 | 550 |
((Smalltalk at: clsName) isClass and: [accept value]) |
632 | 551 |
ifTrue: |
693 | 552 |
[ |
553 |
^clsName, ' ', self valueOfSelector value |
|
425 | 554 |
]. |
555 |
^nil |
|
556 |
! ! |
|
557 |
||
558 |
!ResourceSelectionBrowser methodsFor:'startup / release'! |
|
559 |
||
560 |
closeCancel |
|
561 |
||
562 |
resourceMethod := nil. |
|
733 | 563 |
classAndResourceSelectionProcess notNil ifTrue: [classAndResourceSelectionProcess terminate]. |
425 | 564 |
super closeCancel |
565 |
||
566 |
||
567 |
||
623 | 568 |
! |
569 |
||
570 |
postBuildWith:aBuilder |
|
571 |
||
680 | 572 |
|classSelection| |
623 | 573 |
allClasses := Object withAllSubclasses. |
689 | 574 |
classSelection := resourceClass. |
575 |
(Smalltalk at: classSelection) isNil |
|
576 |
ifTrue: [classSelection := self class lastSelection]. |
|
577 |
(Smalltalk at: classSelection) isNil |
|
578 |
ifTrue: [classSelection := #Object]. |
|
623 | 579 |
classSelectionBlock := |
580 |
[:clsPattern| |
|
581 |
|foundClass classes| |
|
582 |
((foundClass := Smalltalk at: clsPattern printString asSymbol) isClass not or: |
|
583 |
[foundClass name ~= clsPattern]) |
|
584 |
ifTrue: |
|
585 |
[ |
|
586 |
classes := allClasses select: [:cls| cls name size >= clsPattern size]. |
|
587 |
1 to: clsPattern size do: |
|
588 |
[:i| |
|
589 |
classes := classes select: [:cls| (cls name at: i) == (clsPattern at: i)]. |
|
590 |
]. |
|
591 |
foundClass := classes at: 1 ifAbsent: [nil] |
|
592 |
]. |
|
593 |
foundClass notNil |
|
594 |
ifTrue: |
|
595 |
[ |
|
596 |
self listOfClassesView |
|
597 |
selectFromListOfNames: (foundClass |
|
598 |
withAllSuperclasses reverse collect: [:cls| cls name asString]); |
|
599 |
selectedNodeExpand: true |
|
600 |
]. |
|
601 |
self valueOfClassName value: clsPattern |
|
602 |
]. |
|
635 | 603 |
self valueOfClassName value: classSelection. |
623 | 604 |
self classNameInputField entryCompletionBlock: |
605 |
[:value| |
|
606 |
|what| |
|
607 |
what := Smalltalk classnameCompletion: value withoutSpaces. |
|
608 |
self classNameInputField contents:what first. |
|
609 |
(what at:2) size ~~ 1 ifTrue:[Display beep]. |
|
610 |
classSelectionBlock value: self classNameInputField contents |
|
611 |
]. |
|
632 | 612 |
self listOfClassesView validateDoubleClickBlock: [:aTreeItem | aTreeItem contents ~~ self treeViewContents]. |
613 |
self listOfClassesView selectedNodeExpand: true. |
|
623 | 614 |
|
733 | 615 |
classAndResourceSelectionProcess := |
680 | 616 |
[ |
617 |
[classSelectionBlock value: classSelection] value. |
|
733 | 618 |
self selectionOfResource value: (self listOfResources detect: [:m| m selector == resourceMethod] ifNone: nil). |
619 |
classAndResourceSelectionProcess := nil |
|
680 | 620 |
] |
635 | 621 |
forkAt: 4. |
623 | 622 |
|
623 |
^super postBuildWith:aBuilder |
|
624 |
||
425 | 625 |
! ! |
626 |
||
523 | 627 |
!ResourceSelectionBrowser::Row methodsFor:'accessing'! |
628 |
||
629 |
iconOn:aGC |
|
730 | 630 |
"register and answer an icon indicating the resource type." |
523 | 631 |
|
730 | 632 |
self resourceType isNil ifTrue: [^nil]. |
633 |
icon isNil |
|
634 |
ifTrue: |
|
635 |
[ |
|
636 |
|cls sel image imageKey| |
|
637 |
((self resourceType = #image) or: [resourceType = #fileImage]) |
|
638 |
ifTrue: |
|
639 |
[ |
|
640 |
cls := method who methodClass soleInstance. |
|
641 |
sel := method who methodSelector. |
|
642 |
] |
|
643 |
ifFalse: |
|
644 |
[ |
|
645 |
cls := BrowserView. |
|
646 |
sel := (resourceType, 'Icon') asSymbol. |
|
647 |
]. |
|
648 |
imageKey := (cls name, sel) asSymbol. |
|
649 |
(icon := aGC registeredImageAt: imageKey) isNil |
|
650 |
ifTrue: |
|
651 |
[ |
|
652 |
image := cls perform: sel. |
|
653 |
image extent y > 18 |
|
654 |
ifTrue: |
|
655 |
[ |
|
656 |
image := image magnifiedBy: 18/image extent y |
|
657 |
]. |
|
658 |
aGC registerImage: image key: imageKey. |
|
659 |
icon := aGC registeredImageAt: imageKey. |
|
660 |
]. |
|
661 |
]. |
|
523 | 662 |
^icon |
663 |
! |
|
664 |
||
665 |
method: aMethod |
|
666 |
||
667 |
method := aMethod |
|
668 |
! |
|
669 |
||
670 |
resourceType |
|
671 |
||
672 |
resourceType isNil ifTrue: [resourceType := method resourceType]. |
|
673 |
^resourceType |
|
674 |
! |
|
675 |
||
676 |
selector |
|
677 |
||
678 |
selector isNil ifTrue: [selector := method who methodSelector]. |
|
679 |
^selector |
|
680 |
! ! |
|
681 |
||
425 | 682 |
!ResourceSelectionBrowser class methodsFor:'documentation'! |
683 |
||
684 |
version |
|
685 |
^ '$Header$' |
|
686 |
! ! |