author | Claus Gittinger <cg@exept.de> |
Fri, 07 Jan 2000 13:34:51 +0100 | |
changeset 1288 | 0818e9c108be |
parent 908 | 6862c9c822a3 |
child 1979 | 7b14d02e8ed1 |
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 |
|
908 | 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 |
908 | 72 |
request: 'Select a Method' |
73 |
onSuperclass: #ApplicationModel |
|
74 |
andClass: #MenuEditor |
|
75 |
andSelector: #menuItemImage |
|
76 |
withTypes: #(class) |
|
646 | 77 |
" |
78 |
||
79 |
^self new |
|
908 | 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 |
||
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 |
|
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 |
|
650
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
180 |
message := super openOnSuperclass: aSuperclassOrSymbol |
771 | 181 |
andClass: aClassOrSymbol |
182 |
andSelector: aSelector |
|
183 |
withResourceTypes: protocolTypes. |
|
650
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
184 |
|
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
185 |
(message notNil and: |
771 | 186 |
[((row := self selectionOfResourceMethod value) notNil and: |
187 |
[(type := row protocol) = 'class'])]) |
|
650
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
188 |
ifTrue: |
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
189 |
[ |
771 | 190 |
message := message replChar:$ withString: ' class ' |
650
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
191 |
]. |
495b35593c09
the returning message should contain some info about the method protocol type
tz
parents:
646
diff
changeset
|
192 |
^message |
646 | 193 |
|
194 |
||
195 |
||
196 |
! ! |
|
197 |
||
198 |
!MethodSelectionBrowser methodsFor:'startup / release'! |
|
199 |
||
200 |
postBuildWith:aBuilder |
|
771 | 201 |
"sets the correct title" |
646 | 202 |
|
203 |
title := 'Method Selection Browser'. |
|
204 |
||
205 |
^super postBuildWith:aBuilder |
|
206 |
||
207 |
! ! |
|
208 |
||
771 | 209 |
!MethodSelectionBrowser::Method methodsFor:'accessing'! |
646 | 210 |
|
665 | 211 |
protocol |
773 | 212 |
"returns the protocol of the method (#instance or #class)" |
665 | 213 |
|
214 |
^protocol |
|
215 |
||
216 |
||
217 |
! |
|
218 |
||
773 | 219 |
protocol: aSymbol |
220 |
"sets the protocol of the method (#instance or #class)" |
|
665 | 221 |
|
773 | 222 |
protocol := aSymbol |
665 | 223 |
|
224 |
||
225 |
! |
|
226 |
||
646 | 227 |
selector |
773 | 228 |
"returns the selector of the method" |
646 | 229 |
|
230 |
^selector |
|
231 |
||
232 |
! |
|
233 |
||
234 |
selector: aSymbol |
|
773 | 235 |
"sets the selector of the method" |
646 | 236 |
|
237 |
selector := aSymbol |
|
238 |
||
239 |
! ! |
|
240 |
||
241 |
!MethodSelectionBrowser class methodsFor:'documentation'! |
|
242 |
||
243 |
version |
|
244 |
^ '$Header$' |
|
245 |
! ! |