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