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