author | Claus Gittinger <cg@exept.de> |
Sat, 18 Feb 2017 00:50:14 +0100 | |
changeset 3411 | fd6472405fd0 |
parent 3198 | d0f01dc022bb |
child 3528 | f697558c47cd |
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 |
" |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
12 |
"{ Package: 'stx:libtool2' }" |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
13 |
|
3198
d0f01dc022bb
class: ResourceSelectionBrowser
Claus Gittinger <cg@exept.de>
parents:
3117
diff
changeset
|
14 |
"{ NameSpace: Smalltalk }" |
d0f01dc022bb
class: ResourceSelectionBrowser
Claus Gittinger <cg@exept.de>
parents:
3117
diff
changeset
|
15 |
|
425 | 16 |
SelectionBrowser subclass:#ResourceSelectionBrowser |
477 | 17 |
instanceVariableNames:'resourceMethod resourceClass resourceSuperclass resourceTypes |
906 | 18 |
allClasses classSelectionBlock' |
19 |
classVariableNames:'ClassPresentation' |
|
425 | 20 |
poolDictionaries:'' |
619 | 21 |
category:'Interface-Dialogs' |
425 | 22 |
! |
23 |
||
771 | 24 |
Object subclass:#ResourceMethod |
523 | 25 |
instanceVariableNames:'method icon resourceType selector' |
26 |
classVariableNames:'' |
|
27 |
poolDictionaries:'' |
|
28 |
privateIn:ResourceSelectionBrowser |
|
29 |
! |
|
30 |
||
425 | 31 |
!ResourceSelectionBrowser class methodsFor:'documentation'! |
32 |
||
33 |
copyright |
|
34 |
" |
|
771 | 35 |
COPYRIGHT (c) 1997-1998 by eXept Software AG |
425 | 36 |
All Rights Reserved |
37 |
||
38 |
This software is furnished under a license and may be used |
|
39 |
only in accordance with the terms of that license and with the |
|
40 |
inclusion of the above copyright notice. This software may not |
|
41 |
be provided or otherwise made available to, or used by, any |
|
42 |
other person. No title to or ownership of the software is |
|
43 |
hereby transferred. |
|
44 |
" |
|
45 |
||
46 |
! |
|
47 |
||
48 |
documentation |
|
49 |
" |
|
746 | 50 |
The ResourceSelectionBrowser allows you to browse in class hierarchies |
771 | 51 |
and to select resource methods for loading or to saving resource |
52 |
specifications (#canvas, #menu, etc.). |
|
53 |
||
54 |
[instance variables:] |
|
907 | 55 |
resourceMethod <Symbol> selector of the resource spec |
56 |
resourceClass <Symbol> class of the resource spec |
|
57 |
resourceSuperclass <Symbol> root class of the tree list |
|
58 |
resourceTypes <Array> allowed resource types |
|
59 |
allClasses <Array> list of the subclasses of resourceSuperclass |
|
60 |
classSelectionBlock <Block> by evaluating this block the class selection is done |
|
746 | 61 |
|
504 | 62 |
[start with:] |
907 | 63 |
ResourceSelectionBrowser open |
504 | 64 |
|
65 |
[author:] |
|
907 | 66 |
Thomas Zwick, eXept Software AG |
425 | 67 |
" |
68 |
! ! |
|
69 |
||
70 |
!ResourceSelectionBrowser class methodsFor:'instance creation'! |
|
71 |
||
1978 | 72 |
request:aTitle onSuperclass:aSuperclass andClass:aClassOrClassName andSelector:aSelector withResourceTypes:resourceTypes |
73 |
"opens a ResourceSelectionBrowser; return a Message-object or nil." |
|
74 |
||
75 |
^ (self new |
|
76 |
title: aTitle) |
|
77 |
openOnSuperclass:aSuperclass |
|
78 |
andClass:aClassOrClassName |
|
79 |
andSelector:aSelector |
|
80 |
withResourceTypes:resourceTypes |
|
81 |
||
649 | 82 |
" |
1978 | 83 |
ResourceSelectionBrowser |
906 | 84 |
request: 'Select a Resource Selector' |
85 |
onSuperclass: #ApplicationModel |
|
1978 | 86 |
andClassNamed: #MenuEditor |
906 | 87 |
andSelector: #menuItemImage |
88 |
withResourceTypes: #(image) |
|
425 | 89 |
" |
90 |
! ! |
|
91 |
||
1725 | 92 |
!ResourceSelectionBrowser class methodsFor:'callbacks-default'! |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
93 |
|
906 | 94 |
treeViewClassHierarchyChildren |
771 | 95 |
"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
|
96 |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
97 |
"/ cg: tz's algorithm was very-very slow, |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
98 |
"/ (it enumerated classes hundreds of times, |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
99 |
"/ leading to a square runtime behavior |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
100 |
"/ - i.e. very slow scrolling ) |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
101 |
"/ Speed up things by caching facts while enumerating |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
102 |
"/ classes once only. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
103 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
104 |
|subclassesAndPrivateClassesPerClass| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
105 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
106 |
subclassesAndPrivateClassesPerClass := IdentityDictionary new. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
107 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
108 |
Smalltalk allClassesDo:[:cls | |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
109 |
|owner superclass info| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
110 |
|
1732 | 111 |
"/ (owner := cls owningClass) notNil ifTrue:[ |
112 |
"/ info := subclassesAndPrivateClassesPerClass at:owner ifAbsent:nil. |
|
113 |
"/ info isNil ifTrue:[ |
|
114 |
"/ subclassesAndPrivateClassesPerClass at:owner put:(info := Array with:IdentitySet new |
|
115 |
"/ with:IdentitySet new). |
|
116 |
"/ ]. |
|
117 |
"/ (info at:2) add:cls |
|
118 |
"/ ] ifFalse:[ |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
119 |
superclass := cls superclass. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
120 |
superclass notNil ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
121 |
info := subclassesAndPrivateClassesPerClass at:superclass ifAbsent:nil. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
122 |
info isNil ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
123 |
subclassesAndPrivateClassesPerClass at:superclass put:(info := Array with:IdentitySet new |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
124 |
with:IdentitySet new). |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
125 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
126 |
(info at:1) add:cls |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
127 |
] |
1732 | 128 |
"/ ] |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
129 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
130 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
131 |
^ [:aTreeItem| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
132 |
|classes itemClass info| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
133 |
|
906 | 134 |
classes := OrderedCollection new. |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
135 |
itemClass := aTreeItem contents. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
136 |
info := subclassesAndPrivateClassesPerClass at:itemClass ifAbsent:nil. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
137 |
info notNil ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
138 |
classes addAll:((info at:1) asSortedCollection: [:cls1 :cls2| cls1 name < cls2 name]). |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
139 |
classes addAll:((info at:2) asSortedCollection: [:cls1 :cls2| cls1 name < cls2 name]). |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
140 |
]. |
906 | 141 |
classes |
718 | 142 |
] |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
143 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
144 |
|
906 | 145 |
treeViewClassHierarchyContents |
771 | 146 |
"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
|
147 |
|
802 | 148 |
^ Object |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
149 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
150 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
151 |
|
906 | 152 |
treeViewClassHierarchyIcon |
771 | 153 |
"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
|
154 |
|
718 | 155 |
^[:aTreeItem| |
906 | 156 |
|icon| |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
157 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
158 |
aTreeItem contents isClass ifTrue:[ |
906 | 159 |
icon := self iconClass. |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
160 |
aTreeItem contents isPrivate ifTrue:[ |
906 | 161 |
icon := self iconPrivateClass |
162 |
]. |
|
163 |
icon |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
164 |
] ifFalse:[ |
906 | 165 |
self iconCategory |
166 |
] |
|
771 | 167 |
] |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
168 |
|
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
169 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
170 |
|
906 | 171 |
treeViewClassHierarchyLabel |
771 | 172 |
"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
|
173 |
|
718 | 174 |
^[:aTreeItem| |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
175 |
|label superCls itemContents| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
176 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
177 |
itemContents := aTreeItem contents. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
178 |
label := itemContents name. |
1732 | 179 |
"/ (itemContents isPrivate |
180 |
"/ and:[aTreeItem parent contents ~~ (superCls := itemContents superclass)]) |
|
181 |
"/ ifTrue: [label := label, ' (', superCls name, ')']. |
|
906 | 182 |
label |
718 | 183 |
] |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
184 |
! ! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
185 |
|
730 | 186 |
!ResourceSelectionBrowser class methodsFor:'image specs'! |
187 |
||
906 | 188 |
iconCategory |
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
189 |
<resource: #image> |
906 | 190 |
"This resource specification was automatically generated |
191 |
by the ImageEditor of ST/X." |
|
192 |
"Do not manually edit this!! If it is corrupted, |
|
193 |
the ImageEditor may not be able to read the specification." |
|
194 |
" |
|
195 |
self iconCategory inspect |
|
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
196 |
ImageEditor openOnClass:self andSelector:#iconCategory" |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
197 |
|
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
198 |
^ Icon constantNamed:#'ResourceSelectionBrowser class iconCategory' |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
199 |
ifAbsentPut:[ |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
200 |
(Depth4Image new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
201 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
202 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
203 |
photometric:(#palette); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
204 |
bitsPerSample:(#( 4 )); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
205 |
samplesPerPixel:(1); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
206 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
207 |
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'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
208 |
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 ]; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
209 |
mask:((ImageMask new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
210 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
211 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
212 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
213 |
fromPackedString:'<@O@8@G@3?3@7?;@7?;@7?;@7?;@7?;@7?;@7?;@7?;@7?;@7?;@3?3@8@G@<@O@'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
214 |
yourself); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
215 |
yourself |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
216 |
] |
1493 | 217 |
! |
906 | 218 |
|
730 | 219 |
iconClass |
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
220 |
<resource: #image> |
746 | 221 |
"This resource specification was automatically generated |
222 |
by the ImageEditor of ST/X." |
|
223 |
"Do not manually edit this!! If it is corrupted, |
|
224 |
the ImageEditor may not be able to read the specification." |
|
730 | 225 |
" |
1404 | 226 |
self iconClass inspect |
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
227 |
ImageEditor openOnClass:self andSelector:#iconClass" |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
228 |
|
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
229 |
^ Icon constantNamed:#'ResourceSelectionBrowser class iconClass' |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
230 |
ifAbsentPut:[ |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
231 |
(Depth2Image new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
232 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
233 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
234 |
photometric:(#palette); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
235 |
bitsPerSample:(#( 2 )); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
236 |
samplesPerPixel:(1); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
237 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
238 |
fromPackedString:'@@@@@@@*****ABUUUUT@IUUUUP@%UUUU@BUUUUT@IUUUUP@%UUUU@BUUUUT@IUUUUP@%UUUU@BUUUUT@IUUUUP@%UUUU@A@@@@@@@@@@@@@b'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
239 |
colorMapFromArray:#[ 0 0 0 170 170 170 255 255 255 ]; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
240 |
mask:((ImageMask new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
241 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
242 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
243 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
244 |
fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
245 |
yourself); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
246 |
yourself |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
247 |
] |
1493 | 248 |
! |
730 | 249 |
|
250 |
iconPrivateClass |
|
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
251 |
<resource: #image> |
746 | 252 |
"This resource specification was automatically generated |
253 |
by the ImageEditor of ST/X." |
|
254 |
"Do not manually edit this!! If it is corrupted, |
|
255 |
the ImageEditor may not be able to read the specification." |
|
730 | 256 |
" |
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
257 |
ImageEditor openOnClass:self andSelector:#iconPrivateClass" |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
258 |
|
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
259 |
^ Icon constantNamed:#'ResourceSelectionBrowser class iconPrivateClass' |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
260 |
ifAbsentPut:[ |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
261 |
(Depth2Image new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
262 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
263 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
264 |
photometric:(#palette); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
265 |
bitsPerSample:(#( 2 )); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
266 |
samplesPerPixel:(1); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
267 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
268 |
fromPackedString:'@@@@@@PUUUUU A****(@F*??* @Z+??*@A*/*>(OF*>+: @Z+??*@A*/?:(DF*>** @Z+:**@A*/**(@F*>** @Z****C2@@@@@@@@@@@@@b'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
269 |
colorMapFromArray:#[ 0 0 0 255 255 255 170 170 170 255 0 0 ]; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
270 |
mask:((ImageMask new) |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
271 |
width:18; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
272 |
height:16; |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
273 |
bits:(ByteArray |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
274 |
fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@'); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
275 |
yourself); |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
276 |
yourself |
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
277 |
] |
1493 | 278 |
! ! |
730 | 279 |
|
425 | 280 |
!ResourceSelectionBrowser class methodsFor:'interface specs'! |
281 |
||
282 |
windowSpec |
|
746 | 283 |
"This resource specification was automatically generated |
284 |
by the UIPainter of ST/X." |
|
425 | 285 |
|
746 | 286 |
"Do not manually edit this!! If it is corrupted, |
287 |
the UIPainter may not be able to read the specification." |
|
425 | 288 |
|
289 |
" |
|
290 |
UIPainter new openOnClass:ResourceSelectionBrowser andSelector:#windowSpec |
|
291 |
ResourceSelectionBrowser new openInterface:#windowSpec |
|
746 | 292 |
ResourceSelectionBrowser open |
425 | 293 |
" |
294 |
||
295 |
<resource: #canvas> |
|
296 |
||
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
297 |
^ |
1751 | 298 |
#(FullSpec |
299 |
name: windowSpec |
|
300 |
window: |
|
301 |
(WindowSpec |
|
302 |
label: 'Resource Selection Browser' |
|
303 |
name: 'Resource Selection Browser' |
|
304 |
min: (Point 400 300) |
|
305 |
bounds: (Rectangle 12 22 612 372) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
306 |
) |
1751 | 307 |
component: |
308 |
(SpecCollection |
|
309 |
collection: ( |
|
310 |
(VariableHorizontalPanelSpec |
|
311 |
name: 'VariableHorizontalPanel' |
|
312 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -36 1.0) |
|
313 |
component: |
|
314 |
(SpecCollection |
|
315 |
collection: ( |
|
316 |
(ViewSpec |
|
317 |
name: 'Box1' |
|
318 |
component: |
|
319 |
(SpecCollection |
|
320 |
collection: ( |
|
321 |
(HorizontalPanelViewSpec |
|
322 |
name: 'HorizontalPanel2' |
|
323 |
layout: (LayoutFrame 0 0 2 0 297 0 23 0) |
|
324 |
horizontalLayout: leftSpace |
|
325 |
verticalLayout: fit |
|
326 |
horizontalSpace: 3 |
|
327 |
verticalSpace: 3 |
|
328 |
component: |
|
329 |
(SpecCollection |
|
330 |
collection: ( |
|
331 |
(RadioButtonSpec |
|
332 |
label: 'Categories' |
|
333 |
name: 'ClassCategoriesRadioButton' |
|
334 |
translateLabel: true |
|
335 |
model: selectionOfClassPresentation |
|
336 |
isTriggerOnDown: true |
|
337 |
lampColor: (Color 0.0 0.0 0.0) |
|
338 |
select: #'Class Categories' |
|
339 |
extent: (Point 124 21) |
|
773 | 340 |
) |
1751 | 341 |
(RadioButtonSpec |
342 |
label: 'Hierarchy' |
|
343 |
name: 'ClassHierarchyRadioButton' |
|
344 |
translateLabel: true |
|
345 |
model: selectionOfClassPresentation |
|
346 |
isTriggerOnDown: true |
|
347 |
lampColor: (Color 0.0 0.0 0.0) |
|
348 |
select: #'Class Hierarchy' |
|
349 |
extent: (Point 145 21) |
|
773 | 350 |
) |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
351 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
352 |
|
773 | 353 |
) |
354 |
) |
|
1751 | 355 |
(SelectionInTreeViewSpec |
356 |
name: 'listOfClassHierarchyView' |
|
357 |
layout: (LayoutFrame 0 0.0 23 0.0 0 1.0 -24 1.0) |
|
358 |
tabable: true |
|
359 |
model: selectionOfClassHierarchy |
|
360 |
hasHorizontalScrollBar: true |
|
361 |
hasVerticalScrollBar: true |
|
362 |
miniScrollerHorizontal: true |
|
363 |
showDirectoryIndicatorForRoot: false |
|
364 |
showDirectoryIndicator: true |
|
365 |
valueChangeSelector: classSelected |
|
366 |
hierarchicalList: rootOfClassHierarchy |
|
367 |
validateDoubleClickSelector: validateDoubleClick: |
|
368 |
contentsSelector: treeViewClassHierarchyContents |
|
369 |
labelSelector: treeViewClassHierarchyLabel |
|
370 |
childrenSelector: treeViewClassHierarchyChildren |
|
371 |
iconSelector: treeViewClassHierarchyIcon |
|
372 |
highlightMode: line |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
373 |
) |
1751 | 374 |
(SelectionInTreeViewSpec |
375 |
name: 'listOfClassCategoriesView' |
|
376 |
layout: (LayoutFrame 0 0.0 23 0.0 0 1.0 -24 1.0) |
|
377 |
tabable: true |
|
378 |
model: selectionOfClassCategories |
|
379 |
hasHorizontalScrollBar: true |
|
380 |
hasVerticalScrollBar: true |
|
381 |
miniScrollerHorizontal: true |
|
382 |
showRoot: false |
|
383 |
showDirectoryIndicator: true |
|
384 |
valueChangeSelector: classSelected |
|
385 |
hierarchicalList: rootOfClassCategories |
|
386 |
validateDoubleClickSelector: validateDoubleClick: |
|
387 |
childrenSelector: treeViewClassCategoryChildren |
|
388 |
iconSelector: treeViewClassCategoryIcon |
|
389 |
highlightMode: line |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
390 |
) |
1751 | 391 |
(InputFieldSpec |
392 |
name: 'classNameInputField' |
|
393 |
layout: (LayoutFrame 2 0.0 -22 1 -1 1.0 0 1) |
|
394 |
tabable: true |
|
1986 | 395 |
model: classNameHolder |
1751 | 396 |
acceptOnLeave: true |
397 |
acceptOnLostFocus: true |
|
398 |
acceptOnPointerLeave: true |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
399 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
400 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
401 |
|
773 | 402 |
) |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
403 |
) |
1751 | 404 |
(ViewSpec |
405 |
name: 'Box2' |
|
406 |
component: |
|
407 |
(SpecCollection |
|
408 |
collection: ( |
|
409 |
(DataSetSpec |
|
410 |
name: 'resourcesDataSetView' |
|
411 |
layout: (LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0) |
|
412 |
model: selectionOfResourceMethod |
|
413 |
hasHorizontalScrollBar: true |
|
414 |
hasVerticalScrollBar: true |
|
415 |
miniScrollerHorizontal: true |
|
416 |
rowClassName: 'ResourceSelectionBrowser::Row' |
|
417 |
dataList: listOfResourceMethods |
|
418 |
useIndex: false |
|
419 |
has3Dsepartors: true |
|
420 |
has3Dseparators: true |
|
421 |
doubleClickSelector: resourceDoubleClicked |
|
422 |
columnHolder: resourceMethodColumns |
|
423 |
valueChangeSelector: resourceSelected |
|
424 |
verticalSpacing: 1 |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
425 |
) |
1751 | 426 |
(InputFieldSpec |
427 |
name: 'selectorInputField' |
|
428 |
layout: (LayoutFrame 2 0.0 -22 1 -2 1.0 0 1) |
|
429 |
tabable: true |
|
1986 | 430 |
model: resourceSelectorHolder |
1751 | 431 |
acceptOnLeave: true |
432 |
acceptOnLostFocus: true |
|
433 |
acceptOnPointerLeave: true |
|
906 | 434 |
) |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
435 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
436 |
|
906 | 437 |
) |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
438 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
439 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
440 |
|
773 | 441 |
) |
1751 | 442 |
handles: (Any 0.5 1.0) |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
443 |
) |
1751 | 444 |
(HorizontalPanelViewSpec |
445 |
name: 'ButtonPanel' |
|
446 |
layout: (LayoutFrame 2 0.0 -30 1 -2 1.0 -4 1.0) |
|
447 |
horizontalLayout: fit |
|
448 |
verticalLayout: fit |
|
449 |
reverseOrderIfOKAtLeft: true |
|
450 |
component: |
|
451 |
(SpecCollection |
|
452 |
collection: ( |
|
453 |
(ActionButtonSpec |
|
454 |
label: 'Help' |
|
455 |
name: 'HelpButton' |
|
456 |
activeHelpKey: dss |
|
457 |
model: openHTMLDocument: |
|
458 |
initiallyDisabled: true |
|
459 |
enableChannel: helpEnabled |
|
460 |
actionValue: 'tools/uipainter/ResourceSelectionBrowser.html' |
|
461 |
extent: (Point 196 26) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
462 |
) |
1751 | 463 |
(ActionButtonSpec |
464 |
label: 'Cancel' |
|
465 |
name: 'cancelButton' |
|
466 |
activeHelpKey: commitCancel |
|
467 |
tabable: true |
|
468 |
model: cancel |
|
469 |
extent: (Point 197 26) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
470 |
) |
1751 | 471 |
(ActionButtonSpec |
472 |
label: 'OK' |
|
473 |
name: 'okButton' |
|
474 |
activeHelpKey: commitOK |
|
475 |
tabable: true |
|
476 |
model: accept |
|
477 |
isDefault: true |
|
478 |
extent: (Point 197 26) |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
479 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
480 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
481 |
|
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
482 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
483 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
484 |
) |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
485 |
|
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
486 |
) |
425 | 487 |
) |
488 |
! ! |
|
489 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
490 |
!ResourceSelectionBrowser class methodsFor:'list specs'! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
491 |
|
822 | 492 |
tableColumnsForResourceMethodAttributes |
821 | 493 |
"This resource specification was automatically generated |
494 |
by the DataSetBuilder of ST/X." |
|
495 |
||
496 |
"Do not manually edit this!! If it is corrupted, |
|
497 |
the DataSetBuilder may not be able to read the specification." |
|
498 |
||
499 |
" |
|
822 | 500 |
DataSetBuilder new openOnClass:ResourceSelectionBrowser andSelector:#tableColumnsForResourceMethodAttributes |
821 | 501 |
" |
502 |
||
503 |
<resource: #tableColumns> |
|
504 |
||
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
505 |
|
821 | 506 |
^ #( |
507 |
#(#DataSetColumnSpec |
|
508 |
#width: 20 |
|
509 |
#height: 20 |
|
510 |
#printSelector: #iconOn: |
|
511 |
#canSelect: false |
|
512 |
) |
|
513 |
#(#DataSetColumnSpec |
|
514 |
#label: ' Selector' |
|
515 |
#labelAlignment: #left |
|
516 |
#model: #selector |
|
517 |
#canSelect: false |
|
518 |
) |
|
519 |
#(#DataSetColumnSpec |
|
520 |
#label: ' Resource Type' |
|
521 |
#labelAlignment: #left |
|
522 |
#model: #resourceType |
|
523 |
#canSelect: false |
|
524 |
) |
|
525 |
) |
|
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
526 |
! ! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
527 |
|
425 | 528 |
!ResourceSelectionBrowser methodsFor:'aspects'! |
529 |
||
1986 | 530 |
classNameHolder |
531 |
"returns the value holder for the name of the class" |
|
532 |
||
533 |
|holder| |
|
534 |
||
535 |
(holder := builder bindingAt:#valueOfClassName) isNil ifTrue:[ |
|
536 |
builder aspectAt:#valueOfClassName put:(holder := '' asValue). |
|
537 |
holder onChangeEvaluate:[self classSelectionUpdate:holder value]. |
|
538 |
]. |
|
539 |
^ holder |
|
540 |
! |
|
541 |
||
773 | 542 |
helpEnabled |
543 |
"returns whether there is a documentation file" |
|
544 |
||
545 |
^true |
|
546 |
! |
|
547 |
||
771 | 548 |
listOfResourceMethods |
549 |
"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
|
550 |
|
1184 | 551 |
^ builder listAspectFor:#listOfResourceMethods |
648
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
552 |
! |
d0724edba450
some changes for the lib builder and for its new subclass
tz
parents:
641
diff
changeset
|
553 |
|
771 | 554 |
resourceMethodColumns |
555 |
"returns the columns for the table of the resource methods as value holder" |
|
425 | 556 |
|
557 |
|holder| |
|
771 | 558 |
(holder := builder bindingAt:#resourceMethodColumns) isNil ifTrue:[ |
821 | 559 |
builder aspectAt:#resourceMethodColumns put:(holder := List new). |
822 | 560 |
holder addAll: (self class tableColumnsForResourceMethodAttributes collect: [:i| i decodeAsLiteralArray]). |
771 | 561 |
]. |
562 |
^ holder |
|
563 |
! |
|
564 |
||
1986 | 565 |
resourceSelectorHolder |
566 |
"returns the value holder for the name of the selector" |
|
567 |
||
568 |
|holder| |
|
569 |
(holder := builder bindingAt:#valueOfResourceSelector) isNil ifTrue:[ |
|
570 |
builder aspectAt:#valueOfResourceSelector put:(holder := '' asValue). |
|
571 |
]. |
|
572 |
^ holder |
|
573 |
! |
|
574 |
||
906 | 575 |
rootOfClassCategories |
576 |
"returns the value holder for the root of the class tree list" |
|
577 |
||
578 |
|holder| |
|
579 |
||
580 |
(holder := builder bindingAt:#rootOfClassCategories) isNil ifTrue:[ |
|
581 |
ClassPresentation = #'Class Categories' ifTrue: [ |
|
582 |
builder aspectAt:#rootOfClassCategories put: (holder := TreeItem name: 'Categories')]. |
|
583 |
]. |
|
584 |
^ holder |
|
585 |
||
586 |
||
587 |
! |
|
588 |
||
589 |
rootOfClassHierarchy |
|
771 | 590 |
"returns the value holder for the root of the class tree list" |
591 |
||
592 |
|holder| |
|
906 | 593 |
|
594 |
||
595 |
(holder := builder bindingAt:#rootOfClassHierarchy) isNil ifTrue:[ |
|
596 |
ClassPresentation = #'Class Hierarchy' ifTrue: [ |
|
597 |
builder aspectAt:#rootOfClassHierarchy put: (holder := TreeItem new)] |
|
425 | 598 |
]. |
599 |
^ holder |
|
600 |
||
601 |
||
602 |
! |
|
603 |
||
906 | 604 |
selectionOfClassCategories |
605 |
"returns the value holder for the selected class of the class tree list" |
|
606 |
||
607 |
|holder| |
|
608 |
(holder := builder bindingAt:#selectionOfClassCategories) isNil ifTrue:[ |
|
609 |
builder aspectAt:#selectionOfClassCategories put:(holder := ValueHolder new). |
|
610 |
]. |
|
611 |
^ holder |
|
612 |
! |
|
613 |
||
614 |
selectionOfClassHierarchy |
|
771 | 615 |
"returns the value holder for the selected class of the class tree list" |
425 | 616 |
|
906 | 617 |
|holder| |
618 |
(holder := builder bindingAt:#selectionOfClassHierarchy) isNil ifTrue:[ |
|
619 |
builder aspectAt:#selectionOfClassHierarchy put:(holder := ValueHolder new). |
|
620 |
]. |
|
621 |
^ holder |
|
622 |
! |
|
623 |
||
624 |
selectionOfClassPresentation |
|
625 |
"returns the value holder for the selected class presentation" |
|
626 |
||
425 | 627 |
|holder| |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
628 |
|
906 | 629 |
(holder := builder bindingAt:#selectionOfClassPresentation) isNil ifTrue:[ |
630 |
builder aspectAt:#selectionOfClassPresentation put:(holder := RadioButtonGroup with: (ClassPresentation := ClassPresentation ? #'Class Categories')). |
|
1329 | 631 |
holder onChangeEvaluate: |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
632 |
[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
633 |
|hv comp newRoot| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
634 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
635 |
hv := holder value. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
636 |
ClassPresentation := hv. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
637 |
hv = #'Class Hierarchy' ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
638 |
comp := builder componentAt: #listOfClassHierarchyView. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
639 |
newRoot := self rootOfClassHierarchy. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
640 |
] ifFalse: [ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
641 |
comp := builder componentAt: #listOfClassCategoriesView. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
642 |
newRoot := self rootOfClassCategories. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
643 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
644 |
comp root:newRoot. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
645 |
comp raise. |
1986 | 646 |
classSelectionBlock value: self classNameHolder value |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
647 |
] |
425 | 648 |
]. |
649 |
^ holder |
|
650 |
! |
|
651 |
||
771 | 652 |
selectionOfResourceMethod |
653 |
"returns the value holder for the selected resource method of the resource method list" |
|
425 | 654 |
|
655 |
|holder| |
|
771 | 656 |
(holder := builder bindingAt:#selectionOfResourceMethod) isNil ifTrue:[ |
657 |
builder aspectAt:#selectionOfResourceMethod put:(holder := '' asValue). |
|
425 | 658 |
]. |
659 |
^ holder |
|
660 |
! |
|
661 |
||
467 | 662 |
valueOfClassName |
2309 | 663 |
<resource: #obsolete> |
771 | 664 |
"returns the value holder for the name of the class" |
467 | 665 |
|
1986 | 666 |
self obsoleteMethodWarning:'stupid name - use #classNameHolder'. |
667 |
^ self classNameHolder |
|
467 | 668 |
! |
669 |
||
771 | 670 |
valueOfResourceSelector |
2309 | 671 |
<resource: #obsolete> |
771 | 672 |
"returns the value holder for the name of the selector" |
425 | 673 |
|
1986 | 674 |
self obsoleteMethodWarning:'stupid name - use #resourceSelectorHolder'. |
675 |
^ self resourceSelectorHolder |
|
425 | 676 |
! ! |
677 |
||
1720 | 678 |
!ResourceSelectionBrowser methodsFor:'callbacks-class list'! |
632 | 679 |
|
906 | 680 |
treeViewClassCategoryChildren |
681 |
"returns the children for the contents (class) of aTreeItem as a block" |
|
682 |
||
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
683 |
"/ cg: tz's algorithm was very-very slow, |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
684 |
"/ (it enumerated classes hundreds of times, |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
685 |
"/ leading to a square runtime behavior |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
686 |
"/ - i.e. very slow scrolling ) |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
687 |
"/ Speed up things by caching facts while enumerating |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
688 |
"/ classes once only. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
689 |
|
2760
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
690 |
|topClass childrenPerCategory privateClasses| |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
691 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
692 |
topClass := self treeViewClassHierarchyContents. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
693 |
privateClasses := IdentitySet new. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
694 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
695 |
childrenPerCategory := Dictionary new. |
2760
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
696 |
|
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
697 |
topClass withAllSubclassesDo:[:cls | |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
698 |
|cat set| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
699 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
700 |
cls isPrivate ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
701 |
cat := cls category. |
2908
178288821f0a
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
702 |
cat notNil ifTrue:[ |
178288821f0a
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
703 |
set := childrenPerCategory at:cat ifAbsent:nil. |
178288821f0a
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
704 |
set isNil ifTrue:[ |
178288821f0a
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
705 |
childrenPerCategory at:cat put:(set := IdentitySet new). |
178288821f0a
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
706 |
]. |
178288821f0a
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
707 |
set add:cls |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
708 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
709 |
] ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
710 |
privateClasses add:cls |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
711 |
] |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
712 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
713 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
714 |
^ [:aTreeItem| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
715 |
|cont children initialContents setOfCategories itemCategory setOfClasses| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
716 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
717 |
(cont := aTreeItem contents) isBehavior ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
718 |
children := privateClasses select:[:cls | cls owningClass == aTreeItem contents]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
719 |
children := children asSortedCollection: [:c1 :c2| c1 name <= c2 name]. |
1732 | 720 |
"/ children := children collect: [:child| TreeItem name: child name , ' (', child superclass name, ')' contents: child] |
721 |
children := children collect: [:child| TreeItem name:(child name) contents: child] |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
722 |
] ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
723 |
cont size == 0 ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
724 |
setOfCategories := childrenPerCategory keys. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
725 |
children := setOfCategories asSortedCollection. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
726 |
children := children collect: [:nm | TreeItem name:nm contents:#Category] |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
727 |
] ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
728 |
cont == #Category ifTrue:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
729 |
itemCategory := aTreeItem name. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
730 |
setOfClasses := childrenPerCategory at:itemCategory ifAbsent:[Set new]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
731 |
children := setOfClasses asOrderedCollection sort:[:c1 :c2 | c1 name <= c2 name]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
732 |
children := children collect:[:child | TreeItem name:child name contents:child]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
733 |
] ifFalse:[ |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
734 |
"/ huh ? |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
735 |
children := OrderedCollection new. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
736 |
] |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
737 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
738 |
]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
739 |
children |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
740 |
] |
2908
178288821f0a
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
741 |
|
178288821f0a
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
742 |
"Modified: / 22-08-2012 / 19:44:59 / cg" |
906 | 743 |
! |
744 |
||
745 |
treeViewClassCategoryIcon |
|
746 |
"returns the icon for aTreeItem as a block" |
|
747 |
||
748 |
^self class treeViewClassHierarchyIcon |
|
749 |
||
750 |
||
751 |
! |
|
752 |
||
753 |
treeViewClassHierarchyContents |
|
771 | 754 |
"returns the contents of the root of the class tree list" |
632 | 755 |
|
802 | 756 |
|cls| |
632 | 757 |
|
802 | 758 |
resourceSuperclass notNil ifTrue:[ |
1978 | 759 |
cls := Smalltalk classNamed: resourceSuperclass. |
802 | 760 |
]. |
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
761 |
cls notNil ifTrue:[^ cls]. |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
762 |
^ self class treeViewClassHierarchyContents |
771 | 763 |
! |
764 |
||
765 |
validateDoubleClick: aTreeItem |
|
766 |
"returns whether a class may be selected" |
|
767 |
||
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
768 |
|cont| |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
769 |
|
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
770 |
^ (cont := aTreeItem contents) ~= '' |
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
771 |
and: [cont ~~ self treeViewClassHierarchyContents] |
771 | 772 |
|
773 |
||
774 |
||
632 | 775 |
! ! |
776 |
||
1720 | 777 |
!ResourceSelectionBrowser methodsFor:'callbacks-user'! |
425 | 778 |
|
771 | 779 |
classSelected |
780 |
"after a class selection, read the allowed resource methods of the selected class" |
|
730 | 781 |
|
1732 | 782 |
|sel| |
906 | 783 |
|
1919 | 784 |
ClassPresentation = #'Class Hierarchy' |
1732 | 785 |
"/ ifTrue: [sel := self selectionOfClassHierarchy value] |
1919 | 786 |
ifFalse: [sel := self selectionOfClassCategories value]. |
787 |
||
788 |
sel notNil ifTrue:[ |
|
1978 | 789 |
resourceClass := sel. |
1919 | 790 |
]. |
1732 | 791 |
self updateResourceMethodList. |
425 | 792 |
! |
793 |
||
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
794 |
classSelectionUpdate:clsPattern |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
795 |
|foundClass classes| |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
796 |
|
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
797 |
clsPattern notNil ifTrue:[ |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
798 |
foundClass := Smalltalk at:(clsPattern printString asSymbol). |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
799 |
]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
800 |
(foundClass isClass not or:[foundClass name ~= clsPattern]) |
1732 | 801 |
ifTrue: [ |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
802 |
classes := allClasses select: [:cls| cls name size >= clsPattern size]. |
1732 | 803 |
1 to: clsPattern size do: [:i| |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
804 |
classes := classes select: [:cls| (cls name at: i) == (clsPattern at: i)]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
805 |
]. |
1835 | 806 |
foundClass := classes at: 1 ifAbsent:[]. |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
807 |
]. |
1732 | 808 |
|
809 |
foundClass notNil ifTrue: [ |
|
1835 | 810 |
foundClass := foundClass autoload. |
1978 | 811 |
resourceClass := foundClass. |
1732 | 812 |
|
813 |
ClassPresentation = #'Class Hierarchy' ifTrue: [ |
|
814 |
|searchArgs nonSuperclasses hierItem| |
|
815 |
||
816 |
false "foundClass isPrivate" |
|
3198
d0f01dc022bb
class: ResourceSelectionBrowser
Claus Gittinger <cg@exept.de>
parents:
3117
diff
changeset
|
817 |
ifFalse: [searchArgs := foundClass withAllSuperclasses reversed] |
d0f01dc022bb
class: ResourceSelectionBrowser
Claus Gittinger <cg@exept.de>
parents:
3117
diff
changeset
|
818 |
ifTrue: [searchArgs := foundClass owningClass withAllSuperclasses reversed. |
1978 | 819 |
searchArgs add: foundClass]. |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
820 |
(nonSuperclasses := self treeViewClassHierarchyContents allSuperclasses) notNil |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
821 |
ifTrue: [searchArgs := searchArgs reject: [:cls| nonSuperclasses includes: cls]]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
822 |
|
1732 | 823 |
hierItem := self rootOfClassHierarchy detectChild:[:child :arg| child contents == arg] arguments:searchArgs. |
824 |
hierItem notNil ifTrue:[ |
|
825 |
self selectionOfClassHierarchy value:hierItem. |
|
826 |
]. |
|
1835 | 827 |
] ifFalse: [ |
1732 | 828 |
|searchArgs hierItem| |
829 |
||
830 |
false "foundClass isPrivate" |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
831 |
ifTrue: [searchArgs := Array with: 'Categories' with: foundClass category with: foundClass owningClass name with: foundClass name] |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
832 |
ifFalse: [searchArgs := Array with: 'Categories' with: foundClass category with: foundClass name]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
833 |
|
1732 | 834 |
hierItem := self rootOfClassCategories detectChild:[:child :arg| (child name upTo: $ ) = arg] arguments:searchArgs. |
835 |
hierItem notNil ifTrue:[ |
|
836 |
self selectionOfClassCategories value: hierItem. |
|
837 |
]. |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
838 |
]. |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
839 |
]. |
1986 | 840 |
self classNameHolder value: clsPattern. |
1919 | 841 |
self updateResourceMethodList. |
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
842 |
! |
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
843 |
|
425 | 844 |
resourceDoubleClicked |
771 | 845 |
"after a double click on resource method, accept it and close" |
425 | 846 |
|
847 |
accept value: true. |
|
1034
3cb196044804
fixed stupid class-enumeration code.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
848 |
self closeRequest |
425 | 849 |
! |
850 |
||
851 |
resourceSelected |
|
771 | 852 |
"after a click on a resource method, set its selector into the field" |
425 | 853 |
|
771 | 854 |
self selectionOfResourceMethod value notNil |
1986 | 855 |
ifTrue: [self resourceSelectorHolder value: self selectionOfResourceMethod value selector] |
1732 | 856 |
! |
857 |
||
858 |
updateResourceMethodList |
|
859 |
"read the allowed resource methods of the selected class" |
|
860 |
||
861 |
|class className item| |
|
862 |
||
1978 | 863 |
(class := resourceClass) isNil ifTrue:[ |
1732 | 864 |
ClassPresentation = #'Class Hierarchy' |
865 |
ifTrue: [item := self selectionOfClassHierarchy value ] |
|
866 |
ifFalse: [item := self selectionOfClassCategories value ]. |
|
1978 | 867 |
|
1732 | 868 |
item notNil ifTrue:[ |
869 |
className := item name. |
|
870 |
class := Smalltalk at:className asSymbol |
|
871 |
]. |
|
872 |
]. |
|
873 |
||
874 |
class isNil ifTrue: [^self]. |
|
875 |
||
2038 | 876 |
className := class name."/class theNonMetaclass name |
1732 | 877 |
|
1920 | 878 |
self withWaitCursorDo:[ |
1732 | 879 |
|newContents| |
880 |
||
881 |
resourceTypes isNil ifTrue: [resourceTypes := Method resourceTypes]. |
|
882 |
||
1986 | 883 |
self classNameHolder value: className. |
1732 | 884 |
self class lastSelection: className. |
885 |
||
886 |
newContents := class class methodDictionary asOrderedCollection |
|
887 |
select: [:m | m resources notNil |
|
888 |
and: [resourceTypes includes: m resourceType] |
|
889 |
]. |
|
890 |
newContents := newContents sort:[:m1 :m2 | m1 selector < m2 selector]. |
|
891 |
newContents := newContents collect:[:m| (ResourceMethod new method:m)]. |
|
892 |
||
893 |
self listOfResourceMethods contents:newContents |
|
894 |
. |
|
895 |
] |
|
425 | 896 |
! ! |
897 |
||
898 |
!ResourceSelectionBrowser methodsFor:'instance creation'! |
|
899 |
||
1978 | 900 |
openOnSuperclass: aSuperclassOrSymbol andClass:aClassOrClassName andSelector: aSelector withResourceTypes: aResourceTypes |
901 |
"opens a ResourceSelectionBrowser; return a Message-object or nil" |
|
425 | 902 |
|
1978 | 903 |
|selectedClass enteredClassName className cls| |
771 | 904 |
|
517 | 905 |
resourceMethod := aSelector. |
425 | 906 |
resourceTypes := aResourceTypes. |
907 |
resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol]. |
|
802 | 908 |
resourceClass := nil. |
909 |
||
1978 | 910 |
aClassOrClassName notNil ifTrue:[ |
911 |
aClassOrClassName isClass ifTrue: [ |
|
912 |
cls := aClassOrClassName. |
|
913 |
resourceClass := aClassOrClassName |
|
914 |
] ifFalse: [ |
|
915 |
cls := Smalltalk classNamed: aClassOrClassName. |
|
916 |
cls notNil ifTrue:[ |
|
917 |
resourceClass := cls |
|
802 | 918 |
] |
1978 | 919 |
] |
920 |
]. |
|
1986 | 921 |
self resourceSelectorHolder value:(aSelector ? ''). |
463 | 922 |
self open. |
923 |
||
1978 | 924 |
(selectedClass := self selectionOfClassHierarchy value) isNil ifTrue:[ |
925 |
(selectedClass := self selectionOfClassCategories value) isNil ifTrue:[ |
|
1986 | 926 |
(enteredClassName := self classNameHolder value) isNil ifTrue:[ |
1086
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
927 |
accept value ifTrue:[ |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
928 |
self warn:'No valid class selected/entered'. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
929 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
930 |
^ nil |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
931 |
] |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
932 |
] |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
933 |
]. |
693 | 934 |
|
1978 | 935 |
className := enteredClassName. |
936 |
className isNil ifTrue:[ |
|
937 |
className := selectedClass name |
|
425 | 938 |
]. |
1978 | 939 |
cls := Smalltalk classNamed:className. |
940 |
(cls isClass and:[accept value]) ifTrue:[ |
|
1986 | 941 |
^ Method::MethodWhoInfo class:cls selector:(self resourceSelectorHolder value) |
1086
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
942 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
943 |
|
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
944 |
accept value ifTrue:[ |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
945 |
self warn:'No valid class selected/entered'. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
946 |
]. |
592f0177687e
did not look at className in enterField
Claus Gittinger <cg@exept.de>
parents:
1034
diff
changeset
|
947 |
^ nil |
802 | 948 |
|
949 |
"Modified: / 22.4.1998 / 14:51:03 / cg" |
|
425 | 950 |
! ! |
951 |
||
1716 | 952 |
!ResourceSelectionBrowser methodsFor:'startup & release'! |
425 | 953 |
|
623 | 954 |
postBuildWith:aBuilder |
771 | 955 |
"after building and before opening, |
906 | 956 |
create a class selection block, an entry completion block for the class name field" |
623 | 957 |
|
771 | 958 |
|classSelection classNameInputField| |
906 | 959 |
|
960 |
allClasses := self treeViewClassHierarchyContents withAllSubclasses reject: [:cls| cls isPrivate]. |
|
1978 | 961 |
classSelection := resourceClass isNil ifTrue:[nil] ifFalse:[resourceClass name]. |
802 | 962 |
|
1978 | 963 |
(classSelection isNil or:[ (Smalltalk classNamed: classSelection) isNil]) |
689 | 964 |
ifTrue: [classSelection := self class lastSelection]. |
1732 | 965 |
"/ (classSelection isNil or:[Smalltalk at: classSelection]) isNil |
966 |
"/ ifTrue: [classSelection := self treeViewContents]. |
|
802 | 967 |
|
1384
ff417bf5f8d8
bug fix - update tree-selection when entering a className
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
968 |
classSelectionBlock := [:clsPattern | self classSelectionUpdate:clsPattern]. |
1986 | 969 |
self classNameHolder value:classSelection. |
771 | 970 |
|
1920 | 971 |
(classNameInputField := builder componentAt: #classNameInputField) |
972 |
entryCompletionBlock: |
|
973 |
[:value| |
|
974 |
|s what m| |
|
975 |
||
976 |
s := classNameInputField contents withoutSpaces. |
|
977 |
what := Smalltalk classnameCompletion:s inEnvironment:Smalltalk. |
|
978 |
classNameInputField contents:what first. |
|
979 |
(what at:2) size ~~ 1 ifTrue:[ |
|
980 |
classNameInputField device beep |
|
981 |
] |
|
982 |
"/ |what oldClassName| |
|
983 |
"/ oldClassName := classNameInputField contents. |
|
984 |
"/ what := Smalltalk classnameCompletion: value withoutSpaces. |
|
985 |
"/ classNameInputField contents:what first. |
|
986 |
"/ oldClassName = classNameInputField contents ifTrue:[classNameInputField flash]. |
|
987 |
"/ classSelectionBlock value: classNameInputField contents |
|
988 |
]. |
|
771 | 989 |
|
1986 | 990 |
classSelectionBlock value: self classNameHolder value. |
1732 | 991 |
self updateResourceMethodList. |
906 | 992 |
self selectionOfResourceMethod value: (self listOfResourceMethods detect: [:m| m selector == resourceMethod] ifNone: nil). |
909 | 993 |
|
994 |
^super postBuildWith:aBuilder |
|
910 | 995 |
! |
996 |
||
997 |
postOpenWith:aBuilder |
|
998 |
"after opening and if turned on make hierarchy view visible" |
|
999 |
||
1000 |
ClassPresentation = #'Class Hierarchy' |
|
1001 |
ifTrue: [(builder componentAt: #listOfClassHierarchyView) raise]. |
|
1002 |
||
2026 | 1003 |
super postOpenWith:aBuilder |
425 | 1004 |
! ! |
1005 |
||
771 | 1006 |
!ResourceSelectionBrowser::ResourceMethod methodsFor:'accessing'! |
523 | 1007 |
|
1008 |
iconOn:aGC |
|
771 | 1009 |
"registers and returns an icon indicating the resource type" |
523 | 1010 |
|
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1011 |
|cls sel image imageKey| |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1012 |
|
730 | 1013 |
self resourceType isNil ifTrue: [^nil]. |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1014 |
|
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1015 |
icon isNil ifTrue:[ |
1412 | 1016 |
((self resourceType = #image) or: [resourceType = #fileImage]) |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1017 |
ifTrue:[ |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1018 |
cls := method mclass theNonMetaclass. |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1019 |
sel := method selector. |
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1020 |
] ifFalse: [ |
1412 | 1021 |
cls := SystemBrowser. |
1022 |
sel := (resourceType, 'Icon') asSymbol. |
|
1023 |
]. |
|
1024 |
imageKey := (cls name, sel) asSymbol. |
|
1025 |
(icon := aGC registeredImageAt: imageKey) isNil |
|
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1026 |
ifTrue: [ |
1412 | 1027 |
image := cls perform: sel. |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1028 |
(image extent y > 18) ifTrue: [ |
1412 | 1029 |
image := image magnifiedBy: 18/image extent y |
1030 |
]. |
|
1031 |
aGC registerImage: image key: imageKey. |
|
1032 |
icon := aGC registeredImageAt: imageKey. |
|
1033 |
]. |
|
730 | 1034 |
]. |
523 | 1035 |
^icon |
1524
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1036 |
|
4efbd088b787
isMeta/soleInstance -> theNonMetaclass
Claus Gittinger <cg@exept.de>
parents:
1493
diff
changeset
|
1037 |
"Modified: / 5.11.2001 / 16:48:35 / cg" |
523 | 1038 |
! |
1039 |
||
1040 |
method: aMethod |
|
771 | 1041 |
"sets aMethod" |
523 | 1042 |
|
1043 |
method := aMethod |
|
1044 |
! |
|
1045 |
||
1046 |
resourceType |
|
771 | 1047 |
"returns resourceType" |
523 | 1048 |
|
1049 |
resourceType isNil ifTrue: [resourceType := method resourceType]. |
|
1050 |
^resourceType |
|
1051 |
! |
|
1052 |
||
1053 |
selector |
|
771 | 1054 |
"returns selector" |
523 | 1055 |
|
1056 |
selector isNil ifTrue: [selector := method who methodSelector]. |
|
1057 |
^selector |
|
1058 |
! ! |
|
1059 |
||
425 | 1060 |
!ResourceSelectionBrowser class methodsFor:'documentation'! |
1061 |
||
1062 |
version |
|
1063 |
^ '$Header$' |
|
2760
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
1064 |
! |
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
1065 |
|
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
1066 |
version_CVS |
11963b80d72c
changed: #treeViewClassCategoryChildren
Claus Gittinger <cg@exept.de>
parents:
2441
diff
changeset
|
1067 |
^ '$Header$' |
425 | 1068 |
! ! |
3117
ee3f64a07e16
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
2908
diff
changeset
|
1069 |