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