author | fm |
Thu, 27 Mar 2008 10:09:28 +0100 | |
changeset 2325 | 51599f6d8013 |
parent 1979 | 7b14d02e8ed1 |
child 3305 | 6cfecdd561c1 |
permissions | -rw-r--r-- |
646 | 1 |
" |
771 | 2 |
COPYRIGHT (c) 1997-1998 by eXept Software AG |
646 | 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 |
||
1979 | 15 |
"{ Package: 'stx:libtool2' }" |
16 |
||
646 | 17 |
ResourceSelectionBrowser subclass:#MethodSelectionBrowser |
18 |
instanceVariableNames:'' |
|
19 |
classVariableNames:'' |
|
20 |
poolDictionaries:'' |
|
21 |
category:'Interface-Dialogs' |
|
22 |
! |
|
23 |
||
771 | 24 |
Object subclass:#Method |
665 | 25 |
instanceVariableNames:'selector protocol' |
646 | 26 |
classVariableNames:'' |
27 |
poolDictionaries:'' |
|
28 |
privateIn:MethodSelectionBrowser |
|
29 |
! |
|
30 |
||
31 |
!MethodSelectionBrowser class methodsFor:'documentation'! |
|
32 |
||
33 |
copyright |
|
34 |
" |
|
771 | 35 |
COPYRIGHT (c) 1997-1998 by eXept Software AG |
646 | 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 |
||
49 |
documentation |
|
50 |
" |
|
771 | 51 |
The MethodSelectionBrowser allows you to browse in class hierarchies |
52 |
for selecting methods for you purposes. |
|
53 |
||
646 | 54 |
[start with:] |
55 |
MethodSelectionBrowser open |
|
56 |
||
57 |
[author:] |
|
58 |
Thomas Zwick |
|
59 |
" |
|
60 |
||
61 |
! ! |
|
62 |
||
63 |
!MethodSelectionBrowser class methodsFor:'instance creation'! |
|
64 |
||
771 | 65 |
request: aTitle onSuperclass: aSuperclass andClass: aClass andSelector: aSelector withTypes: protocolTypes |
66 |
"opens a MethodSelectionBrowser on |
|
908 | 67 |
aSuperclassOrSymbol, |
68 |
and aClassOrSymbol, |
|
69 |
and aSelector, |
|
70 |
with allowed protocolTypes" |
|
646 | 71 |
|
1979 | 72 |
^ self new |
73 |
title: aTitle; |
|
74 |
openOnSuperclass: aSuperclass |
|
75 |
andClass: aClass |
|
76 |
andSelector: aSelector |
|
77 |
withTypes: protocolTypes |
|
78 |
||
650
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
79 |
" |
1979 | 80 |
MethodSelectionBrowser |
908 | 81 |
request: 'Select a Method' |
82 |
onSuperclass: #ApplicationModel |
|
83 |
andClass: #MenuEditor |
|
84 |
andSelector: #menuItemImage |
|
85 |
withTypes: #(class) |
|
646 | 86 |
" |
87 |
! ! |
|
88 |
||
89 |
!MethodSelectionBrowser class methodsFor:'list specs'! |
|
90 |
||
823 | 91 |
tableColumnsForResourceMethodAttributes |
821 | 92 |
"This resource specification was automatically generated |
93 |
by the DataSetBuilder of ST/X." |
|
646 | 94 |
|
821 | 95 |
"Do not manually edit this!! If it is corrupted, |
96 |
the DataSetBuilder may not be able to read the specification." |
|
97 |
||
98 |
" |
|
823 | 99 |
DataSetBuilder new openOnClass:MethodSelectionBrowser andSelector:#tableColumnsForResourceMethodAttributes |
821 | 100 |
" |
101 |
||
102 |
<resource: #tableColumns> |
|
646 | 103 |
|
104 |
||
821 | 105 |
^ #( |
106 |
#(#DataSetColumnSpec |
|
107 |
#label: ' Selector' |
|
108 |
#labelAlignment: #left |
|
109 |
#model: #selector |
|
110 |
#canSelect: false |
|
111 |
) |
|
112 |
#(#DataSetColumnSpec |
|
113 |
#label: ' Protocol' |
|
114 |
#labelAlignment: #left |
|
115 |
#model: #protocol |
|
116 |
#canSelect: false |
|
117 |
) |
|
118 |
) |
|
646 | 119 |
! ! |
120 |
||
773 | 121 |
!MethodSelectionBrowser methodsFor:'aspects'! |
122 |
||
123 |
helpEnabled |
|
124 |
"returns whether there is a documentation file" |
|
125 |
||
126 |
^false |
|
127 |
||
128 |
! ! |
|
129 |
||
646 | 130 |
!MethodSelectionBrowser methodsFor:'callbacks - user'! |
131 |
||
771 | 132 |
classSelected |
133 |
"after a class selection, read the class or/and instance methods of the selected class" |
|
646 | 134 |
|
908 | 135 |
ClassPresentation = #'Class Hierarchy' |
136 |
ifTrue: [self selectionOfClassHierarchy value isNil ifTrue: [^nil]] |
|
137 |
ifFalse: [self selectionOfClassCategories value isNil ifTrue: [^nil]]. |
|
138 |
||
646 | 139 |
self withWaitCursorDo: |
140 |
[ |
|
771 | 141 |
|clsName contentsBlock| |
646 | 142 |
resourceTypes isNil ifTrue: [resourceTypes := #(instance class)]. |
908 | 143 |
ClassPresentation = #'Class Hierarchy' |
144 |
ifTrue: [clsName := (self selectionOfClassHierarchy value name upTo: $ ) asSymbol] |
|
145 |
ifFalse: [clsName := (self selectionOfClassCategories value name upTo: $ ) asSymbol]. |
|
646 | 146 |
self valueOfClassName value: clsName. |
147 |
self class lastSelection: clsName. |
|
771 | 148 |
self listOfResourceMethods removeAll. |
149 |
contentsBlock := |
|
150 |
[:protocol| |
|
151 |
|cls| |
|
152 |
(resourceTypes includes: protocol) |
|
153 |
ifTrue: |
|
154 |
[ |
|
155 |
cls := Smalltalk at: clsName. |
|
156 |
cls := (protocol = #instance) ifTrue: [cls] ifFalse: [cls class]. |
|
157 |
self listOfResourceMethods addAll: |
|
158 |
(cls selectors asOrderedCollection |
|
159 |
collect: [:sel| Method new selector: sel; protocol: protocol asString]) |
|
160 |
] |
|
161 |
]. |
|
162 |
contentsBlock value: #instance. |
|
163 |
contentsBlock value: #class. |
|
646 | 164 |
] |
165 |
||
166 |
||
167 |
! ! |
|
168 |
||
169 |
!MethodSelectionBrowser methodsFor:'instance creation'! |
|
170 |
||
771 | 171 |
openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withTypes: protocolTypes |
172 |
"opens a MethodSelectionBrowser on |
|
1979 | 173 |
aSuperclassOrSymbol, |
174 |
and aClassOrSymbol, |
|
175 |
and aSelector, |
|
176 |
with allowed protocolTypes" |
|
646 | 177 |
|
650
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
178 |
|message type row| |
771 | 179 |
|
1979 | 180 |
message := self |
181 |
openOnSuperclass: aSuperclassOrSymbol |
|
182 |
andClass: aClassOrSymbol |
|
183 |
andSelector: aSelector |
|
184 |
withResourceTypes: protocolTypes. |
|
650
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
185 |
|
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
186 |
(message notNil and: |
771 | 187 |
[((row := self selectionOfResourceMethod value) notNil and: |
188 |
[(type := row protocol) = 'class'])]) |
|
650
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
189 |
ifTrue: |
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
190 |
[ |
1979 | 191 |
message := message replChar:$ withString: ' class ' |
650
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
192 |
]. |
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
193 |
^message |
646 | 194 |
! ! |
195 |
||
196 |
!MethodSelectionBrowser methodsFor:'startup / release'! |
|
197 |
||
198 |
postBuildWith:aBuilder |
|
771 | 199 |
"sets the correct title" |
646 | 200 |
|
201 |
title := 'Method Selection Browser'. |
|
202 |
||
203 |
^super postBuildWith:aBuilder |
|
204 |
||
205 |
! ! |
|
206 |
||
771 | 207 |
!MethodSelectionBrowser::Method methodsFor:'accessing'! |
646 | 208 |
|
665 | 209 |
protocol |
773 | 210 |
"returns the protocol of the method (#instance or #class)" |
665 | 211 |
|
212 |
^protocol |
|
213 |
||
214 |
||
215 |
! |
|
216 |
||
773 | 217 |
protocol: aSymbol |
218 |
"sets the protocol of the method (#instance or #class)" |
|
665 | 219 |
|
773 | 220 |
protocol := aSymbol |
665 | 221 |
|
222 |
||
223 |
! |
|
224 |
||
646 | 225 |
selector |
773 | 226 |
"returns the selector of the method" |
646 | 227 |
|
228 |
^selector |
|
229 |
||
230 |
! |
|
231 |
||
232 |
selector: aSymbol |
|
773 | 233 |
"sets the selector of the method" |
646 | 234 |
|
235 |
selector := aSymbol |
|
236 |
||
237 |
! ! |
|
238 |
||
239 |
!MethodSelectionBrowser class methodsFor:'documentation'! |
|
240 |
||
241 |
version |
|
242 |
^ '$Header$' |
|
243 |
! ! |