author | Claus Gittinger <cg@exept.de> |
Tue, 01 Oct 2019 09:54:00 +0200 | |
changeset 3771 | 33d35c030113 |
parent 3770 | 3f324e812f60 |
child 3772 | 33679accc619 |
permissions | -rw-r--r-- |
3770 | 1 |
"{ Encoding: utf8 }" |
2 |
||
3292 | 3 |
" |
4 |
Copyright (C) Original Authors (Kaehler, Scott Wallace and Dan Ingalls) |
|
5 |
Copyright (C) 2001 eXept Software AG |
|
6 |
||
7 |
Permission is hereby granted, free of charge, to any |
|
8 |
person obtaining a copy of this software and associated |
|
9 |
documentation files (the 'Software'), to deal in the |
|
10 |
Software without restriction, including without limitation |
|
11 |
the rights to use, copy, modify, merge, publish, distribute, |
|
12 |
sublicense, and/or sell copies of the Software, and to |
|
13 |
permit persons to whom the Software is furnished to do so, |
|
14 |
subject to the following conditions: |
|
15 |
||
16 |
The above copyright notice and this permission notice shall |
|
17 |
be included in all copies or substantial portions of the Software. |
|
18 |
||
19 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
20 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
21 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
22 |
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|
23 |
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
24 |
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
|
25 |
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
26 |
" |
|
1522 | 27 |
"{ Package: 'stx:libtool2' }" |
28 |
||
3193 | 29 |
"{ NameSpace: Smalltalk }" |
30 |
||
1522 | 31 |
ApplicationModel subclass:#MethodFinderWindow |
3292 | 32 |
instanceVariableNames:'resultHolder selectorPatternHolder classOfResultHolder |
33 |
selectedClassOfResultHolder selectedImplementorsHolder |
|
34 |
argumentsEditor messageAnswerEditor receiverEditor receiver |
|
1522 | 35 |
resultSelectors arg2BoxVisible arg1BoxVisible arg4BoxVisible |
36 |
arg3BoxVisible argCountHolder argCountList argument1Editor |
|
37 |
argument2Editor argument3Editor argument4Editor resultSelected |
|
2891 | 38 |
lookAtResultEditor codeHolder searchProcess' |
1522 | 39 |
classVariableNames:'' |
40 |
poolDictionaries:'' |
|
3215 | 41 |
category:'Interface-Tools' |
1522 | 42 |
! |
43 |
||
1530 | 44 |
!MethodFinderWindow class methodsFor:'documentation'! |
45 |
||
3292 | 46 |
copyright |
47 |
" |
|
48 |
Copyright (C) Original Authors (Kaehler, Scott Wallace and Dan Ingalls) |
|
49 |
Copyright (C) 2001 eXept Software AG |
|
50 |
||
51 |
Permission is hereby granted, free of charge, to any |
|
52 |
person obtaining a copy of this software and associated |
|
53 |
documentation files (the 'Software'), to deal in the |
|
54 |
Software without restriction, including without limitation |
|
55 |
the rights to use, copy, modify, merge, publish, distribute, |
|
56 |
sublicense, and/or sell copies of the Software, and to |
|
57 |
permit persons to whom the Software is furnished to do so, |
|
58 |
subject to the following conditions: |
|
59 |
||
60 |
The above copyright notice and this permission notice shall |
|
61 |
be included in all copies or substantial portions of the Software. |
|
62 |
||
63 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
64 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
65 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
66 |
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|
67 |
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
68 |
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
|
69 |
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
70 |
" |
|
71 |
! |
|
72 |
||
1530 | 73 |
documentation |
74 |
" |
|
3292 | 75 |
a tool to find implementing methods by example. |
76 |
Give it values for a receiver, optional arguments and a desired result, |
|
77 |
and it will find methods which do that for you. |
|
78 |
Please read the online documentation for details (open via the tool's help menu). |
|
79 |
||
1531 | 80 |
[author:] |
3292 | 81 |
original squeak version by Ted Kaehler, Scott Wallace and Dan Ingalls. |
82 |
ported from Squeak and GUI enhanced 2001 by James Hayes james@exept.de. |
|
83 |
improved by Claus Gittinger. |
|
1530 | 84 |
" |
85 |
! ! |
|
1522 | 86 |
|
1532 | 87 |
!MethodFinderWindow class methodsFor:'constants'! |
88 |
||
2890 | 89 |
defaultIcon |
3109
92920c76aae3
Mark program icons with resource
Stefan Vogel <sv@exept.de>
parents:
3090
diff
changeset
|
90 |
<resource: #programImage> |
92920c76aae3
Mark program icons with resource
Stefan Vogel <sv@exept.de>
parents:
3090
diff
changeset
|
91 |
|
2890 | 92 |
^ ToolbarIconLibrary methodFinder24x24Icon |
93 |
||
94 |
"Created: / 01-06-2012 / 13:05:11 / cg" |
|
95 |
! |
|
96 |
||
1532 | 97 |
markerForImplementingClass |
98 |
^ '=> '. |
|
99 |
^ '*' |
|
100 |
||
101 |
"Created: / 13.11.2001 / 12:09:52 / cg" |
|
102 |
"Modified: / 13.11.2001 / 12:11:57 / cg" |
|
103 |
! ! |
|
104 |
||
3292 | 105 |
!MethodFinderWindow class methodsFor:'help specs'! |
106 |
||
3514 | 107 |
helpSpec |
3292 | 108 |
"This resource specification was automatically generated |
109 |
by the UIHelpTool of ST/X." |
|
110 |
||
111 |
"Do not manually edit this!! If it is corrupted, |
|
112 |
the UIHelpTool may not be able to read the specification." |
|
113 |
||
114 |
" |
|
3675 | 115 |
UIHelpTool openOnClass:MethodFinderWindow |
3292 | 116 |
" |
117 |
||
118 |
<resource: #help> |
|
119 |
||
3514 | 120 |
^ super helpSpec addPairsFrom:#( |
3292 | 121 |
|
3675 | 122 |
#'*' |
123 |
'as in GLOB patterns (i.e. like filename patterns)' |
|
3292 | 124 |
|
125 |
#answerValue |
|
3771 | 126 |
'Enter result value here.\Can be a constant like $a or ''hello'' or #(10 20 30)\or a Smalltalk expression, such as "10@20" or "Rectangle new".' |
3292 | 127 |
|
128 |
#arg1Value |
|
3771 | 129 |
'Enter a value for the first argument here.\Can be a constant like $a or ''hello'' or #(10 20 30)\or a Smalltalk expression, such as "10@20" or "Rectangle new".' |
3292 | 130 |
|
131 |
#arg2Value |
|
3770 | 132 |
'Enter a value for the second argument here.\Can be a constant or a Smalltalk expression.' |
3292 | 133 |
|
134 |
#arg3Value |
|
3770 | 135 |
'Enter a value for the third argument here.\Can be a constant or a Smalltalk expression.' |
3292 | 136 |
|
137 |
#argumentCount |
|
138 |
'Specify the number of arguments here.' |
|
139 |
||
140 |
#clearButton |
|
141 |
'Clear all sample value fields.' |
|
142 |
||
3675 | 143 |
#implementorsFound |
144 |
'Shows a list of messages which deliver the result or match the selector pattern' |
|
145 |
||
146 |
#receiverValue |
|
3770 | 147 |
'Enter a receiver value here.\Can be a constant (like ''hello'')\or a Smalltalk expression, such as "Rectangle basicNew".' |
3675 | 148 |
|
149 |
#selectorPattern |
|
150 |
'Enter a pattern to search by message name' |
|
151 |
||
152 |
#selectorPatternSearch |
|
153 |
'Search by name.\You can use match characters' |
|
154 |
||
3292 | 155 |
#startSearchButton |
156 |
'Search for methods which answer the desired value,\given the concrete arguments' |
|
157 |
||
3675 | 158 |
#startSearchPatternButton |
159 |
'Search for methods whose name matches the pattern' |
|
3292 | 160 |
|
161 |
) |
|
3675 | 162 |
|
163 |
"Modified: / 08-06-2019 / 16:06:17 / Claus Gittinger" |
|
3292 | 164 |
! ! |
165 |
||
1522 | 166 |
!MethodFinderWindow class methodsFor:'interface specs'! |
167 |
||
168 |
windowSpec |
|
169 |
"This resource specification was automatically generated |
|
170 |
by the UIPainter of ST/X." |
|
171 |
||
172 |
"Do not manually edit this!! If it is corrupted, |
|
173 |
the UIPainter may not be able to read the specification." |
|
174 |
||
175 |
" |
|
176 |
UIPainter new openOnClass:MethodFinderWindow andSelector:#windowSpec |
|
177 |
MethodFinderWindow new openInterface:#windowSpec |
|
178 |
MethodFinderWindow open |
|
179 |
" |
|
180 |
||
181 |
<resource: #canvas> |
|
182 |
||
183 |
^ |
|
3289 | 184 |
#(FullSpec |
185 |
name: windowSpec |
|
3710 | 186 |
uuid: '1871401e-aa2d-11e9-8c78-b8f6b1108e05' |
3289 | 187 |
window: |
188 |
(WindowSpec |
|
189 |
label: 'MethodFinder' |
|
190 |
name: 'MethodFinder' |
|
3675 | 191 |
uuid: '5fb0c87a-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 192 |
bounds: (Rectangle 0 0 816 738) |
193 |
menu: menu |
|
194 |
icon: defaultIcon |
|
195 |
) |
|
196 |
component: |
|
197 |
(SpecCollection |
|
198 |
collection: ( |
|
199 |
(VariableHorizontalPanelSpec |
|
200 |
name: 'VariableHorizontalPanel1' |
|
201 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
3675 | 202 |
uuid: '5fb0cd98-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 203 |
showHandle: true |
204 |
snapMode: both |
|
205 |
component: |
|
206 |
(SpecCollection |
|
207 |
collection: ( |
|
208 |
(VariableVerticalPanelSpec |
|
209 |
name: 'LeftBox' |
|
3675 | 210 |
uuid: '5fb0d1a8-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 211 |
showHandle: true |
212 |
component: |
|
213 |
(SpecCollection |
|
214 |
collection: ( |
|
215 |
(ViewSpec |
|
216 |
name: 'MethodFinderBox' |
|
3675 | 217 |
uuid: '5fb0d36a-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 218 |
component: |
219 |
(SpecCollection |
|
220 |
collection: ( |
|
221 |
(ViewSpec |
|
222 |
name: 'ReceiverArgBox' |
|
223 |
layout: (LayoutFrame 0 0 0 0 0 1 -30 1) |
|
3675 | 224 |
uuid: '5fb0d4f0-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 225 |
component: |
226 |
(SpecCollection |
|
227 |
collection: ( |
|
228 |
(LabelSpec |
|
229 |
label: 'Receiver' |
|
230 |
name: 'ReceiverLabel' |
|
231 |
layout: (LayoutFrame 0 0 0 0 0 0.34000000000000002 28 0) |
|
3675 | 232 |
uuid: '5fb0d6b2-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 233 |
translateLabel: true |
234 |
) |
|
235 |
(ComboListSpec |
|
3698 | 236 |
name: 'AllowedArguments' |
3301 | 237 |
layout: (LayoutFrame 0 0.34000000000000002 1 0 0 0.64000000000000135 28 0) |
238 |
activeHelpKey: argumentCount |
|
3675 | 239 |
uuid: '5fb0da9a-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 240 |
model: argCountHolder |
241 |
comboList: argCountList |
|
242 |
useIndex: true |
|
243 |
) |
|
244 |
(LabelSpec |
|
245 |
label: 'Answer' |
|
246 |
name: 'MessageAnswerLabel' |
|
247 |
layout: (LayoutFrame 0 0.64000000000000135 0 0 0 1 28 0) |
|
248 |
activeHelpKey: arg1Value |
|
3675 | 249 |
uuid: '5fb0dd60-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 250 |
translateLabel: true |
251 |
) |
|
252 |
(HorizontalPanelViewSpec |
|
253 |
name: 'HorizontalPanel1' |
|
254 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
|
3675 | 255 |
uuid: '5fb0dee6-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 256 |
horizontalLayout: fit |
257 |
verticalLayout: fit |
|
258 |
horizontalSpace: 3 |
|
259 |
verticalSpace: 3 |
|
260 |
component: |
|
261 |
(SpecCollection |
|
262 |
collection: ( |
|
263 |
(WorkspaceSpec |
|
264 |
name: 'ReceiverEditor' |
|
265 |
activeHelpKey: receiverValue |
|
3675 | 266 |
uuid: '5fb0e152-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 267 |
tabable: true |
268 |
hasHorizontalScrollBar: true |
|
269 |
hasVerticalScrollBar: true |
|
270 |
miniScrollerHorizontal: true |
|
271 |
miniScrollerVertical: true |
|
272 |
autoHideScrollBars: true |
|
273 |
hasKeyboardFocusInitially: false |
|
3675 | 274 |
extent: (Point 86 142) |
3301 | 275 |
postBuildCallback: receiverWidgetCreated: |
276 |
) |
|
277 |
(VerticalPanelViewSpec |
|
278 |
name: 'VerticalPanel1' |
|
3675 | 279 |
uuid: '5fb0e51c-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 280 |
horizontalLayout: fit |
281 |
verticalLayout: fit |
|
282 |
horizontalSpace: 3 |
|
283 |
verticalSpace: 3 |
|
284 |
component: |
|
285 |
(SpecCollection |
|
286 |
collection: ( |
|
287 |
(ViewSpec |
|
288 |
name: 'Box1' |
|
3675 | 289 |
uuid: '5fb0e6d4-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 290 |
visibilityChannel: arg1BoxVisible |
291 |
component: |
|
292 |
(SpecCollection |
|
293 |
collection: ( |
|
294 |
(WorkspaceSpec |
|
295 |
name: 'Arg1Editor' |
|
296 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
297 |
activeHelpKey: arg1Value |
|
3675 | 298 |
uuid: '5fb0e7ce-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 299 |
tabable: true |
300 |
hasHorizontalScrollBar: true |
|
301 |
hasVerticalScrollBar: true |
|
302 |
miniScrollerHorizontal: true |
|
303 |
miniScrollerVertical: true |
|
304 |
autoHideScrollBars: true |
|
305 |
hasKeyboardFocusInitially: false |
|
306 |
postBuildCallback: argument1WidgetCreated: |
|
307 |
) |
|
308 |
) |
|
309 |
||
310 |
) |
|
3675 | 311 |
extent: (Point 87 45) |
3301 | 312 |
) |
313 |
(ViewSpec |
|
314 |
name: 'Box2' |
|
3675 | 315 |
uuid: '5fb0e9b8-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 316 |
visibilityChannel: arg2BoxVisible |
317 |
component: |
|
318 |
(SpecCollection |
|
319 |
collection: ( |
|
320 |
(WorkspaceSpec |
|
321 |
name: 'TextEditor5' |
|
322 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
323 |
activeHelpKey: arg2Value |
|
3675 | 324 |
uuid: '5fb0eabc-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 325 |
tabable: true |
326 |
hasHorizontalScrollBar: true |
|
327 |
hasVerticalScrollBar: true |
|
328 |
miniScrollerHorizontal: true |
|
329 |
miniScrollerVertical: true |
|
330 |
autoHideScrollBars: true |
|
331 |
hasKeyboardFocusInitially: false |
|
332 |
postBuildCallback: argument2WidgetCreated: |
|
333 |
) |
|
334 |
) |
|
335 |
||
336 |
) |
|
3675 | 337 |
extent: (Point 87 46) |
3301 | 338 |
) |
339 |
(ViewSpec |
|
340 |
name: 'Box3' |
|
3675 | 341 |
uuid: '5fb0ec74-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 342 |
visibilityChannel: arg3BoxVisible |
343 |
component: |
|
344 |
(SpecCollection |
|
345 |
collection: ( |
|
346 |
(WorkspaceSpec |
|
347 |
name: 'TextEditor6' |
|
348 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
349 |
activeHelpKey: arg3Value |
|
3675 | 350 |
uuid: '5fb0ed64-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 351 |
tabable: true |
352 |
hasHorizontalScrollBar: true |
|
353 |
hasVerticalScrollBar: true |
|
354 |
miniScrollerHorizontal: true |
|
355 |
miniScrollerVertical: true |
|
356 |
autoHideScrollBars: true |
|
357 |
hasKeyboardFocusInitially: false |
|
358 |
postBuildCallback: argument3WidgetCreated: |
|
359 |
) |
|
360 |
) |
|
361 |
||
362 |
) |
|
3675 | 363 |
extent: (Point 87 45) |
3301 | 364 |
) |
365 |
) |
|
366 |
||
367 |
) |
|
3675 | 368 |
extent: (Point 87 142) |
3301 | 369 |
) |
370 |
(WorkspaceSpec |
|
371 |
name: 'AnswerEditor' |
|
372 |
activeHelpKey: answerValue |
|
3675 | 373 |
uuid: '5fb0ef30-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 374 |
tabable: true |
375 |
hasHorizontalScrollBar: true |
|
376 |
hasVerticalScrollBar: true |
|
377 |
miniScrollerHorizontal: true |
|
378 |
miniScrollerVertical: true |
|
379 |
autoHideScrollBars: true |
|
380 |
hasKeyboardFocusInitially: false |
|
3675 | 381 |
extent: (Point 87 142) |
3301 | 382 |
postBuildCallback: messageAnswerWidgetCreated: |
383 |
) |
|
384 |
) |
|
385 |
||
386 |
) |
|
387 |
) |
|
388 |
) |
|
389 |
||
390 |
) |
|
391 |
) |
|
392 |
(ViewSpec |
|
393 |
name: 'ReceiverArgBoxActionBox' |
|
394 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
3675 | 395 |
uuid: '5fb0f0fc-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 396 |
component: |
397 |
(SpecCollection |
|
398 |
collection: ( |
|
399 |
(ActionButtonSpec |
|
400 |
label: 'Clear' |
|
3708 | 401 |
name: 'ClearButton' |
3301 | 402 |
layout: (LayoutFrame 5 0 0 0 -5 0.5 0 1) |
403 |
activeHelpKey: clearButton |
|
3675 | 404 |
uuid: '5fb0f214-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 405 |
translateLabel: true |
406 |
model: clear |
|
407 |
) |
|
408 |
(ActionButtonSpec |
|
409 |
label: 'Search' |
|
3708 | 410 |
name: 'SearchButton' |
3301 | 411 |
layout: (LayoutFrame 5 0.5 0 0 -5 1 0 1) |
412 |
activeHelpKey: startSearchButton |
|
3675 | 413 |
uuid: '5fb0f52a-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 414 |
translateLabel: true |
415 |
tabable: true |
|
416 |
model: search |
|
417 |
) |
|
418 |
) |
|
419 |
||
420 |
) |
|
421 |
) |
|
422 |
) |
|
423 |
||
424 |
) |
|
425 |
) |
|
426 |
(ViewSpec |
|
427 |
name: 'SelectorFinderBox' |
|
3675 | 428 |
uuid: '5fb0f714-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 429 |
component: |
430 |
(SpecCollection |
|
431 |
collection: ( |
|
432 |
(ViewSpec |
|
433 |
name: 'MatchActionBox' |
|
434 |
layout: (LayoutFrame 0 0 0 0 0 1 90 0) |
|
3675 | 435 |
uuid: '5fb0f818-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 436 |
component: |
437 |
(SpecCollection |
|
438 |
collection: ( |
|
439 |
(LabelSpec |
|
440 |
label: 'Selector Pattern:' |
|
3708 | 441 |
name: 'SelectorPatternLabel' |
3699 | 442 |
layout: (LayoutFrame 0 0 0 0 0 1 25 0) |
3675 | 443 |
uuid: '5fb0f908-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 444 |
translateLabel: true |
445 |
adjust: left |
|
446 |
) |
|
447 |
(InputFieldSpec |
|
3708 | 448 |
name: 'SelectorPattern' |
3301 | 449 |
layout: (LayoutFrame 2 0 -54 1 -2 1 -29 1) |
3675 | 450 |
activeHelpKey: selectorPattern |
451 |
uuid: '5fb0fa70-89f6-11e9-8df0-b8f6b1108e05' |
|
3301 | 452 |
model: selectorPatternHolder |
453 |
immediateAccept: true |
|
454 |
acceptOnReturn: true |
|
455 |
acceptOnTab: true |
|
456 |
acceptOnPointerLeave: true |
|
457 |
) |
|
458 |
(ActionButtonSpec |
|
459 |
label: 'Search' |
|
3708 | 460 |
name: 'SearchPatternButton' |
3301 | 461 |
layout: (LayoutFrame 5 0.5 -25 1 -5 1 0 1) |
3675 | 462 |
activeHelpKey: startSearchPatternButton |
463 |
uuid: '5fb0fea8-89f6-11e9-8df0-b8f6b1108e05' |
|
3301 | 464 |
translateLabel: true |
465 |
tabable: true |
|
466 |
model: searchPatternMatchesInBackground |
|
467 |
) |
|
468 |
) |
|
469 |
||
470 |
) |
|
471 |
) |
|
472 |
(SequenceViewSpec |
|
473 |
name: 'ResultList' |
|
474 |
layout: (LayoutFrame 0 0 94 0 0 1 0 1) |
|
3675 | 475 |
activeHelpKey: implementorsFound |
476 |
uuid: '5fb1009c-89f6-11e9-8df0-b8f6b1108e05' |
|
3301 | 477 |
model: selectedImplementorsHolder |
478 |
menu: resultListMenu |
|
479 |
hasHorizontalScrollBar: true |
|
480 |
hasVerticalScrollBar: true |
|
481 |
autoHideScrollBars: true |
|
482 |
useIndex: true |
|
483 |
sequenceList: resultHolder |
|
484 |
) |
|
485 |
) |
|
486 |
||
487 |
) |
|
488 |
) |
|
489 |
) |
|
490 |
||
491 |
) |
|
492 |
handles: (Any 0.28000000000000003 1.0) |
|
493 |
) |
|
494 |
(VariableVerticalPanelSpec |
|
495 |
name: 'RightBox' |
|
3675 | 496 |
uuid: '5fb103c6-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 497 |
component: |
498 |
(SpecCollection |
|
499 |
collection: ( |
|
500 |
(SequenceViewSpec |
|
3710 | 501 |
name: 'ImplementorsList' |
3675 | 502 |
uuid: '5fb10524-89f6-11e9-8df0-b8f6b1108e05' |
3301 | 503 |
model: selectedClassOfResultHolder |
504 |
menu: implementorListMenu |
|
505 |
hasHorizontalScrollBar: true |
|
506 |
hasVerticalScrollBar: true |
|
507 |
autoHideScrollBars: true |
|
508 |
doubleClickSelector: openBrowserOn: |
|
509 |
valueChangeSelector: selectedClassOfResultHolderChanged |
|
510 |
useIndex: false |
|
511 |
sequenceList: classOfResultHolder |
|
512 |
) |
|
3695 | 513 |
(ViewSpec |
514 |
name: 'Box4' |
|
515 |
uuid: '4698d744-a993-11e9-b8a4-b8f6b1108e05' |
|
516 |
component: |
|
517 |
(SpecCollection |
|
518 |
collection: ( |
|
519 |
(CodeViewSpec |
|
3710 | 520 |
name: 'CodeView' |
3695 | 521 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
522 |
uuid: '5fb106dc-89f6-11e9-8df0-b8f6b1108e05' |
|
523 |
model: codeHolder |
|
524 |
hasHorizontalScrollBar: true |
|
525 |
hasVerticalScrollBar: true |
|
526 |
autoHideScrollBars: true |
|
527 |
hasKeyboardFocusInitially: false |
|
528 |
viewClassName: 'codeViewClass' |
|
529 |
postBuildCallback: sourceCodeWidgetCreated: |
|
530 |
) |
|
531 |
) |
|
532 |
||
533 |
) |
|
3301 | 534 |
) |
535 |
) |
|
536 |
||
537 |
) |
|
3695 | 538 |
handles: (Any 0.5 1.0) |
3301 | 539 |
) |
540 |
) |
|
541 |
||
542 |
) |
|
543 |
handles: (Any 0.33000000000000002 1.0) |
|
544 |
) |
|
545 |
) |
|
546 |
||
547 |
) |
|
548 |
) |
|
549 |
! |
|
550 |
||
551 |
windowSpec_old |
|
552 |
"This resource specification was automatically generated |
|
553 |
by the UIPainter of ST/X." |
|
554 |
||
555 |
"Do not manually edit this!! If it is corrupted, |
|
556 |
the UIPainter may not be able to read the specification." |
|
557 |
||
558 |
" |
|
559 |
UIPainter new openOnClass:MethodFinderWindow andSelector:#windowSpec |
|
560 |
MethodFinderWindow new openInterface:#windowSpec |
|
561 |
MethodFinderWindow open |
|
562 |
" |
|
563 |
||
564 |
<resource: #canvas> |
|
565 |
||
566 |
^ |
|
567 |
#(FullSpec |
|
568 |
name: windowSpec |
|
569 |
window: |
|
570 |
(WindowSpec |
|
571 |
label: 'MethodFinder' |
|
572 |
name: 'MethodFinder' |
|
3289 | 573 |
bounds: (Rectangle 0 0 920 690) |
574 |
menu: menu |
|
575 |
icon: defaultIcon |
|
576 |
) |
|
577 |
component: |
|
578 |
(SpecCollection |
|
579 |
collection: ( |
|
580 |
(VariableHorizontalPanelSpec |
|
581 |
name: 'VariableHorizontalPanel1' |
|
582 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
583 |
snapMode: both |
|
584 |
component: |
|
585 |
(SpecCollection |
|
586 |
collection: ( |
|
587 |
(ViewSpec |
|
588 |
name: 'LeftBox' |
|
589 |
level: 1 |
|
590 |
component: |
|
591 |
(SpecCollection |
|
592 |
collection: ( |
|
593 |
(ViewSpec |
|
594 |
name: 'ReceiverArgBox' |
|
595 |
layout: (LayoutFrame 0 0 0 0 0 1 -100 0.5) |
|
596 |
component: |
|
597 |
(SpecCollection |
|
598 |
collection: ( |
|
599 |
(LabelSpec |
|
600 |
label: 'Receiver' |
|
601 |
name: 'ReceiverLabel' |
|
602 |
layout: (LayoutFrame 0 0 0 0 0 0.34000000000000002 28 0) |
|
603 |
translateLabel: true |
|
604 |
) |
|
605 |
(ComboListSpec |
|
3698 | 606 |
name: 'AllowedArguments' |
3292 | 607 |
layout: (LayoutFrame 0 0.34000000000000002 1 0 0 0.64000000000000046 28 0) |
608 |
activeHelpKey: argumentCount |
|
3289 | 609 |
model: argCountHolder |
610 |
comboList: argCountList |
|
611 |
useIndex: true |
|
612 |
) |
|
613 |
(LabelSpec |
|
614 |
label: 'Answer' |
|
615 |
name: 'MessageAnswerLabel' |
|
3292 | 616 |
layout: (LayoutFrame 0 0.64000000000000046 0 0 0 1 28 0) |
617 |
activeHelpKey: arg1Value |
|
3289 | 618 |
translateLabel: true |
619 |
) |
|
620 |
(HorizontalPanelViewSpec |
|
621 |
name: 'HorizontalPanel1' |
|
622 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
|
623 |
horizontalLayout: fit |
|
624 |
verticalLayout: fit |
|
625 |
horizontalSpace: 3 |
|
626 |
verticalSpace: 3 |
|
627 |
component: |
|
628 |
(SpecCollection |
|
629 |
collection: ( |
|
630 |
(WorkspaceSpec |
|
631 |
name: 'ReceiverEditor' |
|
3292 | 632 |
activeHelpKey: receiverValue |
3289 | 633 |
tabable: true |
634 |
hasHorizontalScrollBar: true |
|
635 |
hasVerticalScrollBar: true |
|
636 |
miniScrollerHorizontal: true |
|
637 |
miniScrollerVertical: true |
|
638 |
autoHideScrollBars: true |
|
639 |
hasKeyboardFocusInitially: false |
|
640 |
extent: (Point 110 214) |
|
641 |
postBuildCallback: receiverWidgetCreated: |
|
642 |
) |
|
643 |
(VerticalPanelViewSpec |
|
644 |
name: 'VerticalPanel1' |
|
645 |
horizontalLayout: fit |
|
646 |
verticalLayout: fit |
|
647 |
horizontalSpace: 3 |
|
648 |
verticalSpace: 3 |
|
649 |
component: |
|
650 |
(SpecCollection |
|
651 |
collection: ( |
|
652 |
(ViewSpec |
|
653 |
name: 'Box1' |
|
654 |
visibilityChannel: arg1BoxVisible |
|
655 |
component: |
|
656 |
(SpecCollection |
|
657 |
collection: ( |
|
658 |
(WorkspaceSpec |
|
659 |
name: 'Arg1Editor' |
|
660 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
3292 | 661 |
activeHelpKey: arg1Value |
3289 | 662 |
tabable: true |
663 |
hasHorizontalScrollBar: true |
|
664 |
hasVerticalScrollBar: true |
|
665 |
miniScrollerHorizontal: true |
|
666 |
miniScrollerVertical: true |
|
667 |
autoHideScrollBars: true |
|
668 |
hasKeyboardFocusInitially: false |
|
669 |
postBuildCallback: argument1WidgetCreated: |
|
1532 | 670 |
) |
3289 | 671 |
) |
672 |
||
673 |
) |
|
674 |
extent: (Point 110 69) |
|
675 |
) |
|
676 |
(ViewSpec |
|
677 |
name: 'Box2' |
|
678 |
visibilityChannel: arg2BoxVisible |
|
679 |
component: |
|
680 |
(SpecCollection |
|
681 |
collection: ( |
|
682 |
(WorkspaceSpec |
|
683 |
name: 'TextEditor5' |
|
684 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
3292 | 685 |
activeHelpKey: arg2Value |
3289 | 686 |
tabable: true |
687 |
hasHorizontalScrollBar: true |
|
688 |
hasVerticalScrollBar: true |
|
689 |
miniScrollerHorizontal: true |
|
690 |
miniScrollerVertical: true |
|
691 |
autoHideScrollBars: true |
|
692 |
hasKeyboardFocusInitially: false |
|
693 |
postBuildCallback: argument2WidgetCreated: |
|
1532 | 694 |
) |
3289 | 695 |
) |
696 |
||
697 |
) |
|
698 |
extent: (Point 110 70) |
|
699 |
) |
|
700 |
(ViewSpec |
|
701 |
name: 'Box3' |
|
702 |
visibilityChannel: arg3BoxVisible |
|
703 |
component: |
|
704 |
(SpecCollection |
|
705 |
collection: ( |
|
706 |
(WorkspaceSpec |
|
707 |
name: 'TextEditor6' |
|
708 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
3292 | 709 |
activeHelpKey: arg3Value |
3289 | 710 |
tabable: true |
711 |
hasHorizontalScrollBar: true |
|
712 |
hasVerticalScrollBar: true |
|
713 |
miniScrollerHorizontal: true |
|
714 |
miniScrollerVertical: true |
|
715 |
autoHideScrollBars: true |
|
716 |
hasKeyboardFocusInitially: false |
|
717 |
postBuildCallback: argument3WidgetCreated: |
|
1532 | 718 |
) |
3289 | 719 |
) |
720 |
||
721 |
) |
|
722 |
extent: (Point 110 69) |
|
1530 | 723 |
) |
3289 | 724 |
) |
725 |
||
726 |
) |
|
727 |
extent: (Point 110 214) |
|
728 |
) |
|
729 |
(WorkspaceSpec |
|
730 |
name: 'AnswerEditor' |
|
3292 | 731 |
activeHelpKey: answerValue |
3289 | 732 |
tabable: true |
733 |
hasHorizontalScrollBar: true |
|
734 |
hasVerticalScrollBar: true |
|
735 |
miniScrollerHorizontal: true |
|
736 |
miniScrollerVertical: true |
|
737 |
autoHideScrollBars: true |
|
738 |
hasKeyboardFocusInitially: false |
|
739 |
extent: (Point 110 214) |
|
740 |
postBuildCallback: messageAnswerWidgetCreated: |
|
1525 | 741 |
) |
3289 | 742 |
) |
743 |
||
744 |
) |
|
745 |
) |
|
746 |
) |
|
747 |
||
748 |
) |
|
749 |
) |
|
750 |
(ViewSpec |
|
751 |
name: 'ReceiverArgBoxActionBox' |
|
752 |
layout: (LayoutFrame 0 0 -98 0.5 0 1 -75 0.5) |
|
753 |
component: |
|
754 |
(SpecCollection |
|
755 |
collection: ( |
|
756 |
(ActionButtonSpec |
|
3292 | 757 |
activeHelpKey: clearButton |
3289 | 758 |
label: 'Clear' |
759 |
name: 'Button2' |
|
760 |
layout: (LayoutFrame 5 0 0 0 -5 0.5 0 1) |
|
761 |
translateLabel: true |
|
762 |
model: clear |
|
1532 | 763 |
) |
3289 | 764 |
(ActionButtonSpec |
3292 | 765 |
activeHelpKey: startSearchButton |
3289 | 766 |
label: 'Search' |
767 |
name: 'Button1' |
|
768 |
layout: (LayoutFrame 5 0.5 0 0 -5 1 0 1) |
|
769 |
translateLabel: true |
|
770 |
tabable: true |
|
771 |
model: search |
|
772 |
) |
|
773 |
) |
|
774 |
||
775 |
) |
|
776 |
) |
|
777 |
(ViewSpec |
|
778 |
name: 'MatchActionBox' |
|
3290 | 779 |
layout: (LayoutFrame 0 0 -70 0.5 0 1 10 0.5) |
3289 | 780 |
component: |
781 |
(SpecCollection |
|
782 |
collection: ( |
|
783 |
(LabelSpec |
|
784 |
label: 'Selector Pattern:' |
|
785 |
name: 'Label1' |
|
786 |
layout: (LayoutFrame 0 0 0 0 0 0.5 25 0) |
|
787 |
translateLabel: true |
|
788 |
adjust: left |
|
1522 | 789 |
) |
3289 | 790 |
(InputFieldSpec |
791 |
name: 'EntryField1' |
|
3290 | 792 |
layout: (LayoutFrame 2 0 -54 1 -2 1 -29 1) |
3292 | 793 |
model: selectorPatternHolder |
3289 | 794 |
immediateAccept: true |
795 |
acceptOnReturn: true |
|
796 |
acceptOnTab: true |
|
797 |
acceptOnPointerLeave: true |
|
798 |
) |
|
799 |
(ActionButtonSpec |
|
800 |
label: 'Search' |
|
801 |
name: 'Button4' |
|
802 |
layout: (LayoutFrame 5 0.5 -25 1 -5 1 0 1) |
|
803 |
translateLabel: true |
|
804 |
tabable: true |
|
805 |
model: searchPatternMatchesInBackground |
|
2886 | 806 |
) |
3289 | 807 |
) |
808 |
||
809 |
) |
|
810 |
) |
|
811 |
(SequenceViewSpec |
|
812 |
name: 'ResultList' |
|
3290 | 813 |
layout: (LayoutFrame 0 0 15 0.5 0 1 0 1) |
3289 | 814 |
model: selectedImplementorsHolder |
815 |
menu: resultListMenu |
|
816 |
hasHorizontalScrollBar: true |
|
817 |
hasVerticalScrollBar: true |
|
818 |
autoHideScrollBars: true |
|
819 |
useIndex: true |
|
820 |
sequenceList: resultHolder |
|
1530 | 821 |
) |
3289 | 822 |
) |
823 |
||
824 |
) |
|
825 |
) |
|
826 |
(VariableVerticalPanelSpec |
|
827 |
name: 'VariableVerticalPanel1' |
|
828 |
component: |
|
829 |
(SpecCollection |
|
830 |
collection: ( |
|
831 |
(SequenceViewSpec |
|
832 |
name: 'List2' |
|
833 |
model: selectedClassOfResultHolder |
|
834 |
menu: implementorListMenu |
|
835 |
hasHorizontalScrollBar: true |
|
836 |
hasVerticalScrollBar: true |
|
837 |
autoHideScrollBars: true |
|
838 |
doubleClickSelector: openBrowserOn: |
|
839 |
valueChangeSelector: selectedClassOfResultHolderChanged |
|
840 |
useIndex: false |
|
841 |
sequenceList: classOfResultHolder |
|
1522 | 842 |
) |
3289 | 843 |
(CodeViewSpec |
844 |
name: 'CodeView' |
|
845 |
model: codeHolder |
|
846 |
hasHorizontalScrollBar: true |
|
847 |
hasVerticalScrollBar: true |
|
848 |
autoHideScrollBars: true |
|
849 |
hasKeyboardFocusInitially: false |
|
850 |
postBuildCallback: sourceCodeWidgetCreated: |
|
3292 | 851 |
viewClassName: 'codeViewClass' |
3289 | 852 |
) |
853 |
) |
|
854 |
||
855 |
) |
|
856 |
handles: (Any 0.5 1.0) |
|
1522 | 857 |
) |
3289 | 858 |
) |
859 |
||
860 |
) |
|
3292 | 861 |
handles: (Any 0.37391304347826104 1.0) |
1522 | 862 |
) |
3289 | 863 |
) |
864 |
||
865 |
) |
|
866 |
) |
|
3698 | 867 |
|
868 |
"Modified: / 19-07-2019 / 12:01:12 / Claus Gittinger" |
|
1522 | 869 |
! ! |
870 |
||
1525 | 871 |
!MethodFinderWindow class methodsFor:'menu specs'! |
872 |
||
3768 | 873 |
helpMenu |
874 |
"This resource specification was automatically generated |
|
875 |
by the MenuEditor of ST/X." |
|
876 |
||
877 |
"Do not manually edit this!! If it is corrupted, |
|
878 |
the MenuEditor may not be able to read the specification." |
|
879 |
||
880 |
||
881 |
" |
|
882 |
MenuEditor new openOnClass:MethodFinderWindow andSelector:#helpMenu |
|
883 |
(Menu new fromLiteralArrayEncoding:(MethodFinderWindow helpMenu)) startUp |
|
884 |
" |
|
885 |
||
886 |
<resource: #menu> |
|
887 |
||
888 |
^ |
|
889 |
#(Menu |
|
890 |
(MenuItem |
|
891 |
activeHelpKey: helpTutorial |
|
892 |
label: 'Documentation' |
|
893 |
itemValue: openHTMLDocumentation |
|
894 |
) |
|
895 |
(MenuItem |
|
896 |
label: '-' |
|
897 |
) |
|
898 |
(MenuItem |
|
899 |
label: 'Show Me How it Works' |
|
900 |
itemValue: showMeHowItWorks |
|
901 |
) |
|
902 |
(MenuItem |
|
903 |
label: '-' |
|
904 |
) |
|
905 |
(MenuItem |
|
906 |
activeHelpKey: aboutThisAppliaction |
|
907 |
label: 'About MethodFinder...' |
|
908 |
itemValue: openAboutThisApplication |
|
909 |
) |
|
910 |
) |
|
911 |
! |
|
912 |
||
1529 | 913 |
implementorListMenu |
914 |
"This resource specification was automatically generated |
|
915 |
by the MenuEditor of ST/X." |
|
916 |
||
917 |
"Do not manually edit this!! If it is corrupted, |
|
918 |
the MenuEditor may not be able to read the specification." |
|
919 |
||
3768 | 920 |
|
1529 | 921 |
" |
922 |
MenuEditor new openOnClass:MethodFinderWindow andSelector:#implementorListMenu |
|
923 |
(Menu new fromLiteralArrayEncoding:(MethodFinderWindow implementorListMenu)) startUp |
|
924 |
" |
|
925 |
||
926 |
<resource: #menu> |
|
927 |
||
928 |
^ |
|
3768 | 929 |
#(Menu |
930 |
(MenuItem |
|
931 |
label: 'Browse' |
|
932 |
itemValue: openBrowserOnSelectedItem |
|
933 |
) |
|
934 |
) |
|
1529 | 935 |
! |
936 |
||
1525 | 937 |
menu |
938 |
"This resource specification was automatically generated |
|
939 |
by the MenuEditor of ST/X." |
|
940 |
||
941 |
"Do not manually edit this!! If it is corrupted, |
|
942 |
the MenuEditor may not be able to read the specification." |
|
943 |
||
3685 | 944 |
|
1525 | 945 |
" |
946 |
MenuEditor new openOnClass:MethodFinderWindow andSelector:#menu |
|
947 |
(Menu new fromLiteralArrayEncoding:(MethodFinderWindow menu)) startUp |
|
948 |
" |
|
949 |
||
950 |
<resource: #menu> |
|
951 |
||
952 |
^ |
|
3768 | 953 |
#(Menu |
954 |
(MenuItem |
|
955 |
activeHelpKey: file |
|
956 |
label: '&File' |
|
957 |
submenu: |
|
958 |
(Menu |
|
959 |
(MenuItem |
|
960 |
activeHelpKey: fileExit |
|
961 |
label: 'Exit' |
|
962 |
itemValue: closeRequest |
|
963 |
) |
|
1525 | 964 |
) |
3768 | 965 |
) |
966 |
(MenuItem |
|
967 |
label: 'MENU_Help' |
|
968 |
startGroup: conditionalRight |
|
969 |
submenuChannel: helpMenu |
|
970 |
) |
|
971 |
) |
|
2927 | 972 |
! |
973 |
||
974 |
resultListMenu |
|
975 |
"This resource specification was automatically generated |
|
976 |
by the MenuEditor of ST/X." |
|
977 |
||
978 |
"Do not manually edit this!! If it is corrupted, |
|
979 |
the MenuEditor may not be able to read the specification." |
|
980 |
||
3768 | 981 |
|
2927 | 982 |
" |
3768 | 983 |
MenuEditor new openOnClass:MethodFinderWindow andSelector:#resultListMenu |
984 |
(Menu new fromLiteralArrayEncoding:(MethodFinderWindow resultListMenu)) startUp |
|
2927 | 985 |
" |
986 |
||
987 |
<resource: #menu> |
|
988 |
||
989 |
^ |
|
3768 | 990 |
#(Menu |
991 |
(MenuItem |
|
992 |
label: 'Browse Senders' |
|
993 |
itemValue: openBrowserOnSenderOfSelectedResultItem |
|
994 |
) |
|
995 |
(MenuItem |
|
996 |
label: 'Browse Implementors' |
|
997 |
itemValue: openBrowserOnSelectedResultItem |
|
998 |
) |
|
999 |
) |
|
1525 | 1000 |
! ! |
1001 |
||
3289 | 1002 |
!MethodFinderWindow class methodsFor:'startup'! |
1003 |
||
1004 |
openOnSelectorPattern:selector |
|
1005 |
|app| |
|
1006 |
||
1007 |
app := self new. |
|
1008 |
app allButOpen. |
|
3292 | 1009 |
app selectorPatternHolder value:selector. |
3289 | 1010 |
app openWindow. |
3290 | 1011 |
"/ app waitForBackgroundSearchFinished. |
1012 |
||
3289 | 1013 |
^ app |
1014 |
||
1015 |
" |
|
1016 |
self openOnSelectorPattern:'asLowercase' |
|
1017 |
" |
|
1018 |
! ! |
|
1019 |
||
1522 | 1020 |
!MethodFinderWindow methodsFor:'accessing'! |
1021 |
||
1022 |
receiver |
|
1525 | 1023 |
"Return a copy of the value of the instance variable 'receiver' " |
1522 | 1024 |
|
1025 |
^ receiver copy |
|
1026 |
! ! |
|
1027 |
||
1028 |
!MethodFinderWindow methodsFor:'actions'! |
|
1029 |
||
1030 |
clear |
|
3292 | 1031 |
"Reset the contents of all the outputs." |
1522 | 1032 |
|
1033 |
receiverEditor contents:nil. |
|
1034 |
argument1Editor contents:nil. |
|
1035 |
argument2Editor contents:nil. |
|
1036 |
argument3Editor contents:nil. |
|
1037 |
messageAnswerEditor contents:nil. |
|
1038 |
self resultHolder value:nil. |
|
1525 | 1039 |
self classOfResultHolder value: nil. |
2730 | 1040 |
codeHolder value:nil. |
1522 | 1041 |
! |
1042 |
||
1043 |
messageAnswerEditorContents |
|
3024 | 1044 |
"Return a cleaned up version of message answer taken from the messageAnswerEditor |
1045 |
as an association. The association has cleanedAnswerString as a key and the |
|
1046 |
compiledAnswer as value." |
|
1047 |
||
1048 |
|aCleanedAnswerString compiledAnswer| |
|
1522 | 1049 |
|
3024 | 1050 |
aCleanedAnswerString := self cleanInputs:(messageAnswerEditor contents). |
1051 |
compiledAnswer := Compiler evaluate:aCleanedAnswerString. |
|
1052 |
((self isExpression:aCleanedAnswerString) or:[ compiledAnswer isNil ]) ifTrue:[ |
|
1053 |
aCleanedAnswerString := compiledAnswer printString |
|
1054 |
]. |
|
1055 |
^ aCleanedAnswerString -> compiledAnswer. |
|
1522 | 1056 |
! |
1057 |
||
1058 |
openBrowserOn:anArgument |
|
1059 |
"Opens browser on theArgument of a specific class. anArgument being a string with the |
|
1525 | 1060 |
Class and the selector upon which the browser is to be opened. Return the receiver." |
1522 | 1061 |
|
1532 | 1062 |
|classAndSelector| |
1522 | 1063 |
|
1532 | 1064 |
classAndSelector := self extractClassAndSelectorFrom:anArgument. |
1065 |
classAndSelector isNil ifTrue:[ |
|
1525 | 1066 |
^ self |
1522 | 1067 |
]. |
3482 | 1068 |
SystemBrowser default |
2459 | 1069 |
openInClass:classAndSelector key |
1070 |
selector:classAndSelector value |
|
1525 | 1071 |
|
1072 |
" |
|
1073 |
MethodFinderWindow new openBrowserOn: '*SmallInteger +' |
|
1074 |
MethodFinderWindow new openBrowserOn: 'String ,' |
|
1075 |
MethodFinderWindow new openBrowserOn: 'Number detentBy:atMultiplesOf:snap:' |
|
1076 |
||
1077 |
||
1078 |
" |
|
1532 | 1079 |
|
3482 | 1080 |
"Modified: / 01-09-2017 / 14:21:18 / cg" |
1522 | 1081 |
! |
1082 |
||
1529 | 1083 |
openBrowserOnSelectedItem |
2927 | 1084 |
"on the selected implementor" |
1085 |
||
1529 | 1086 |
|sel| |
1087 |
||
1088 |
sel := self selectedClassOfResultHolder value. |
|
1089 |
self openBrowserOn:sel |
|
1532 | 1090 |
|
2927 | 1091 |
"Modified: / 13-11-2001 / 12:47:39 / cg" |
1092 |
"Modified (comment): / 21-09-2012 / 11:08:33 / cg" |
|
1093 |
! |
|
1094 |
||
1095 |
openBrowserOnSelectedResultItem |
|
1096 |
"on an item in the lower left list, |
|
1097 |
on all implementors of that message" |
|
1098 |
||
1099 |
|selIndex selector| |
|
1100 |
||
1101 |
selIndex := self selectedImplementorsHolder value. |
|
1102 |
selIndex isNil ifTrue:[^ self]. |
|
1103 |
||
1104 |
selector := resultSelectors at:selIndex. |
|
1105 |
UserPreferences browserClass browseImplementorsOf:selector. |
|
1106 |
||
1107 |
"Created: / 21-09-2012 / 11:05:46 / cg" |
|
1529 | 1108 |
! |
1109 |
||
3024 | 1110 |
openBrowserOnSenderOfSelectedResultItem |
1111 |
"on an item in the lower left list, |
|
1112 |
on all implementors of that message" |
|
1113 |
||
1114 |
|selIndex selector| |
|
1525 | 1115 |
|
3024 | 1116 |
selIndex := self selectedImplementorsHolder value. |
1117 |
selIndex isNil ifTrue:[^ self]. |
|
1118 |
||
1119 |
selector := resultSelectors at:selIndex. |
|
1120 |
UserPreferences browserClass browseSendersOf:selector. |
|
1121 |
! |
|
1522 | 1122 |
|
1123 |
search |
|
3024 | 1124 |
"Do a search based on the input in the various text editors. Return the receiver." |
3322 | 1125 |
|
3024 | 1126 |
|tempReceiver tempAnswer tempArguments anArray resultArray receiverWithArgument mf| |
1522 | 1127 |
|
3024 | 1128 |
self resultHolder value:nil. |
1129 |
self classOfResultHolder value:nil. |
|
1130 |
self codeHolder value:nil. |
|
1131 |
tempArguments := self argumentEditorsContents. |
|
1132 |
tempReceiver := self receiverEditorContents. |
|
1133 |
tempAnswer := self messageAnswerEditorContents. |
|
3768 | 1134 |
|
1135 |
"self cleanInputRec:tempReceiver arg:tempArguments ans:tempAnswer." |
|
3741 | 1136 |
receiverWithArgument := self mergeReceiver:(tempReceiver value) withArgument:(tempArguments values). |
3768 | 1137 |
anArray := Array |
1138 |
with:receiverWithArgument |
|
1139 |
with:tempAnswer value. |
|
1140 |
||
1141 |
"an array now holds the following array #(#(receiver argument) answer) or #(#(receiver) answer). |
|
1142 |
which should be suitable input for the method finder." |
|
3767 | 1143 |
self withCursor:(Cursor execute) do:[ |
1144 |
mf := MethodFinder new. |
|
3768 | 1145 |
mf load:anArray. |
1146 |
resultArray := mf findMessage. |
|
3767 | 1147 |
]. |
3768 | 1148 |
|
1149 |
(resultArray isString "(resultArray at:1) includesSubString:'no single'") ifTrue:[ |
|
3695 | 1150 |
false ifTrue:[ |
1151 |
(self confirm:(c'%1\nTry a more exhaustive search (may take long)?' bindWith:(resultArray at:1))) |
|
1152 |
ifTrue:[ |
|
1153 |
self search2Levels. |
|
1154 |
]. |
|
1155 |
] ifFalse:[ |
|
1156 |
self warn:(resultArray at:1). |
|
1157 |
]. |
|
3024 | 1158 |
^ self |
1159 |
]. |
|
3695 | 1160 |
|
1161 |
"the following then replaces data1 and data2 created by the method finder to the appropriate arguments" |
|
3322 | 1162 |
resultArray |
1163 |
keysAndValuesDo:[:key :value | |
|
3024 | 1164 |
|newValue| |
1522 | 1165 |
|
3675 | 1166 |
newValue := value copyReplaceString:'data1' |
1167 |
withString:(tempReceiver value storeString). "/ was: "tempReceiver key" |
|
3024 | 1168 |
(tempArguments size) >= 1 ifTrue:[ |
3675 | 1169 |
newValue := newValue copyReplaceString:'data2' |
1170 |
withString:(tempArguments valueAt:1) storeString "/ was "keyAt:1" |
|
3024 | 1171 |
]. |
1172 |
(tempArguments size) > 1 ifTrue:[ |
|
3544 | 1173 |
newValue := newValue copyReplaceString:'data3' |
3675 | 1174 |
withString:(tempArguments valueAt:2) storeString. "/ was "keyAt:2" |
3024 | 1175 |
]. |
1176 |
(tempArguments size) > 2 ifTrue:[ |
|
3544 | 1177 |
newValue := newValue copyReplaceString:'data4' |
3675 | 1178 |
withString:(tempArguments valueAt:3) storeString. "/ was: keyAt:3 |
3024 | 1179 |
]. |
1180 |
(tempArguments size) > 3 ifTrue:[ |
|
1181 |
self halt:'unimplemented'. |
|
1182 |
]. |
|
3544 | 1183 |
" newValue:= value copyReplaceString: 'data3' withString:(self messageAnswer key). " |
3024 | 1184 |
newValue := newValue , ' --> ' , (tempAnswer key). |
1185 |
newValue replaceAll:Character cr with:Character space. |
|
1186 |
resultArray at:key put:newValue. |
|
1187 |
]. |
|
1188 |
self resultHolder value:resultArray. |
|
1189 |
resultSelectors := mf selectors. |
|
1190 |
receiver := tempReceiver |
|
1532 | 1191 |
|
2859 | 1192 |
"Modified: / 26-09-2011 / 12:42:28 / cg" |
3544 | 1193 |
"Modified: / 27-02-2018 / 11:37:58 / stefan" |
3695 | 1194 |
"Modified: / 18-07-2019 / 21:57:12 / Claus Gittinger" |
1195 |
! |
|
1196 |
||
1197 |
search2Levels |
|
1198 |
"Do an exhaustive search. |
|
1199 |
Given the original message, |
|
1200 |
try applying all unary messages first to the receiver, |
|
1201 |
then to each argument. |
|
3770 | 1202 |
This takes O(N²) time - so be prepared" |
3695 | 1203 |
|
1204 |
|tempReceiver tempAnswer tempArguments anArray resultArray receiverWithArgument mf| |
|
1205 |
||
1206 |
tempArguments := self argumentEditorsContents. |
|
1207 |
tempReceiver := self receiverEditorContents. |
|
1208 |
tempAnswer := self messageAnswerEditorContents. |
|
1209 |
||
1210 |
receiverWithArgument := self mergeReceiver:(tempReceiver value) |
|
1211 |
withArgument:(tempArguments values). |
|
3768 | 1212 |
anArray := Array |
1213 |
with:receiverWithArgument; |
|
1214 |
with:tempAnswer value. |
|
1215 |
||
3695 | 1216 |
"an array now holds the following array #(#(receiver argument) answer) or #(#(receiver) answer). |
1217 |
which should be suitable input for the method finder." |
|
1218 |
self withCursor:Cursor execute do:[ |
|
1219 |
mf := MethodFinder new. |
|
3768 | 1220 |
mf load:anArray. |
1221 |
resultArray := mf findMessage. |
|
3695 | 1222 |
]. |
1223 |
||
3768 | 1224 |
(resultArray isString "(resultArray at:1) includesSubString:'no single'") ifTrue:[ |
3695 | 1225 |
(self confirm:(c'%1\nTry a more exhaustive search (may take long)?' bindWith:(resultArray at:1))) |
1226 |
ifTrue:[ |
|
1227 |
self search2Levels. |
|
1228 |
]. |
|
1229 |
^ self |
|
1230 |
]. |
|
1231 |
||
1232 |
"the following then replaces data1 and data2 created by the method finder to the appropriate arguments" |
|
1233 |
resultArray |
|
1234 |
keysAndValuesDo:[:key :value | |
|
1235 |
|newValue| |
|
1236 |
||
1237 |
newValue := value copyReplaceString:'data1' |
|
1238 |
withString:(tempReceiver value storeString). "/ was: "tempReceiver key" |
|
1239 |
(tempArguments size) >= 1 ifTrue:[ |
|
1240 |
newValue := newValue copyReplaceString:'data2' |
|
1241 |
withString:(tempArguments valueAt:1) storeString "/ was "keyAt:1" |
|
1242 |
]. |
|
1243 |
(tempArguments size) > 1 ifTrue:[ |
|
1244 |
newValue := newValue copyReplaceString:'data3' |
|
1245 |
withString:(tempArguments valueAt:2) storeString. "/ was "keyAt:2" |
|
1246 |
]. |
|
1247 |
(tempArguments size) > 2 ifTrue:[ |
|
1248 |
newValue := newValue copyReplaceString:'data4' |
|
1249 |
withString:(tempArguments valueAt:3) storeString. "/ was: keyAt:3 |
|
1250 |
]. |
|
1251 |
(tempArguments size) > 3 ifTrue:[ |
|
1252 |
self halt:'unimplemented'. |
|
1253 |
]. |
|
1254 |
" newValue:= value copyReplaceString: 'data3' withString:(self messageAnswer key). " |
|
1255 |
newValue := newValue , ' --> ' , (tempAnswer key). |
|
1256 |
newValue replaceAll:Character cr with:Character space. |
|
1257 |
resultArray at:key put:newValue. |
|
1258 |
]. |
|
1259 |
self resultHolder value:resultArray. |
|
1260 |
resultSelectors := mf selectors. |
|
1261 |
receiver := tempReceiver |
|
1262 |
||
1263 |
"Created: / 18-07-2019 / 21:22:47 / Claus Gittinger" |
|
1532 | 1264 |
! |
1265 |
||
3768 | 1266 |
searchPatternMatches:pattern |
1267 |
"Do a search based on the pattern match" |
|
1268 |
||
1269 |
|list counts firsts seconds selectors resultList idx match| |
|
1270 |
||
1271 |
self withCursor:Cursor execute do:[ |
|
1272 |
pattern includesMatchCharacters ifFalse:[ |
|
1273 |
list := SystemBrowser findImplementorsOf:pattern in:Smalltalk allClasses ignoreCase:true. |
|
1274 |
list isEmptyOrNil ifTrue:[ |
|
1275 |
match := pattern,'*'. |
|
1276 |
list := SystemBrowser findImplementorsMatching:match in:Smalltalk allClasses ignoreCase:true. |
|
1277 |
]. |
|
1278 |
] ifTrue:[ |
|
1279 |
match := pattern. |
|
1280 |
list := SystemBrowser findImplementorsMatching:match in:Smalltalk allClasses ignoreCase:true. |
|
1281 |
]. |
|
1282 |
]. |
|
1283 |
||
1284 |
counts := IdentityDictionary new. |
|
1285 |
firsts := IdentityDictionary new. |
|
1286 |
seconds := IdentityDictionary new. |
|
1287 |
selectors := IdentitySet new. |
|
1288 |
list do:[:eachMethod | |
|
1289 |
|msel| |
|
1290 |
||
1291 |
msel := eachMethod selector. |
|
1292 |
selectors add:msel. |
|
1293 |
(counts at:msel ifAbsentPut:[ 0 asValue ]) increment. |
|
1294 |
(firsts includesKey:msel) ifTrue:[ |
|
1295 |
(seconds includesKey:msel) ifFalse:[ |
|
1296 |
seconds at:msel ifAbsentPut:[ eachMethod mclass ]. |
|
1297 |
]. |
|
1298 |
] ifFalse:[ |
|
1299 |
firsts at:msel ifAbsentPut:[ eachMethod mclass ]. |
|
1300 |
]. |
|
1301 |
]. |
|
1302 |
resultSelectors := selectors asOrderedCollection sort. |
|
1303 |
resultList := resultSelectors |
|
1304 |
collect:[:sel | |
|
1305 |
|cnt s| |
|
1306 |
||
1307 |
s := sel allBold , ' --> '. |
|
1308 |
cnt := (counts at:sel) value. |
|
1309 |
cnt == 1 ifTrue:[ |
|
1310 |
s , (firsts at:sel) name |
|
1311 |
] ifFalse:[ |
|
1312 |
cnt == 2 ifTrue:[ |
|
1313 |
s , (firsts at:sel) name , ' and ' , (seconds at:sel) name |
|
1314 |
] ifFalse:[ |
|
1315 |
s , cnt printString , ' implementor(s)' |
|
1316 |
] |
|
1317 |
]. |
|
1318 |
]. |
|
1319 |
||
1320 |
self enqueueDelayedAction:[ self updateListAfterPatternSearch: resultList ]. |
|
1321 |
||
1322 |
"Created: / 01-06-2012 / 13:16:54 / cg" |
|
1323 |
! |
|
1324 |
||
3023 | 1325 |
searchPatternMatchesInBackground |
1326 |
"Do a search based on the pattern match as a background task" |
|
2886 | 1327 |
|
3023 | 1328 |
| p pattern| |
2891 | 1329 |
|
1330 |
(p := searchProcess) notNil ifTrue:[ |
|
1331 |
searchProcess := nil. |
|
1332 |
p terminate. |
|
1333 |
]. |
|
1334 |
||
3292 | 1335 |
pattern := self selectorPatternHolder value. |
3023 | 1336 |
pattern isEmptyOrNil ifTrue:[ |
1337 |
self resultHolder value:self resultInfoText. |
|
1338 |
self classOfResultHolder value:nil. |
|
1339 |
self codeHolder value:nil. |
|
1340 |
^ self |
|
1341 |
]. |
|
1342 |
||
2891 | 1343 |
searchProcess := |
1344 |
[ |
|
3768 | 1345 |
self searchPatternMatches:pattern. |
2891 | 1346 |
] fork. |
1347 |
||
1348 |
"Created: / 01-06-2012 / 13:16:54 / cg" |
|
1349 |
! |
|
1350 |
||
3766 | 1351 |
selectedImplementorChanged |
1352 |
self updateImplementorsOf:selectedImplementorsHolder value |
|
1353 |
! |
|
1354 |
||
1522 | 1355 |
updateImplementorsOf:anInteger |
1525 | 1356 |
"Request the implementors of the selected argument provided by aNumber. |
2892 | 1357 |
Return the receiver." |
1358 |
||
1359 |
|methods classList aNumber| |
|
1525 | 1360 |
|
2892 | 1361 |
(anInteger isNil) ifTrue:[ |
1362 |
^ self |
|
1363 |
]. |
|
3646 | 1364 |
aNumber := anInteger ? 1. |
2892 | 1365 |
methods := SystemBrowser |
1366 |
findImplementorsOf:(resultSelectors at:aNumber) |
|
1367 |
in:Smalltalk allClasses |
|
1368 |
ignoreCase:false. |
|
3675 | 1369 |
methods := methods asOrderedCollection. |
1370 |
classList := methods collect:[:m | m mclass name , ' ' , m selector ]. |
|
1371 |
classList := self markMatchingClasses:(resultSelectors at:aNumber) |
|
1372 |
classesWithSelector:classList. |
|
1373 |
"/ now classList contains a list of <className> <selector>, |
|
1374 |
"/ where the one which is responsible for the selected result is marked (bold) |
|
2892 | 1375 |
self classOfResultHolder value:classList. |
3675 | 1376 |
|
1377 |
"/ initially select the bold one |
|
1378 |
classList notEmptyOrNil ifTrue:[ |
|
1379 |
|receiversMethodEntryInClass| |
|
1380 |
||
1381 |
receiversMethodEntryInClass := classList detect:#isText ifNone:nil. |
|
1382 |
receiversMethodEntryInClass notNil ifTrue:[ |
|
1383 |
self selectedClassOfResultHolder value:receiversMethodEntryInClass. |
|
1384 |
] ifFalse:[ |
|
1385 |
self selectedClassOfResultHolder value:(classList first). |
|
1386 |
]. |
|
2892 | 1387 |
self selectedClassOfResultHolderChanged. |
1388 |
] ifFalse:[ |
|
1389 |
self selectedClassOfResultHolder value:nil. |
|
1390 |
]. |
|
1522 | 1391 |
|
2892 | 1392 |
"Modified (comment): / 24-06-2012 / 18:41:45 / cg" |
3675 | 1393 |
"Modified: / 08-06-2019 / 15:39:49 / Claus Gittinger" |
2891 | 1394 |
! |
1395 |
||
3292 | 1396 |
updateListAfterPatternSearch:resultList |
1397 |
|searchPattern idx| |
|
1398 |
||
2892 | 1399 |
self classOfResultHolder value:nil. |
1400 |
self codeHolder value:nil. |
|
3023 | 1401 |
self resultHolder value:resultList. |
2891 | 1402 |
|
3292 | 1403 |
searchPattern := self selectorPatternHolder value. |
1404 |
"/ is the search pattern in the list (i.e. a perfect match)? |
|
1405 |
"/ Then select it. |
|
3769 | 1406 |
idx := resultSelectors indexOf:searchPattern. |
3292 | 1407 |
idx ~~ 0 ifTrue:[ |
1408 |
self selectedImplementorsHolder setValue:idx; changed |
|
1409 |
]. |
|
1522 | 1410 |
! ! |
1411 |
||
1412 |
!MethodFinderWindow methodsFor:'aspects'! |
|
1413 |
||
1414 |
arg1BoxVisible |
|
3292 | 1415 |
"Determines if the box should be visible or not. |
1416 |
Return a holder providing true or false" |
|
1417 |
||
1522 | 1418 |
arg1BoxVisible isNil ifTrue:[ |
1419 |
arg1BoxVisible := BlockValue |
|
3665 | 1420 |
with:[:vh | vh >= 2 ] |
1522 | 1421 |
argument:(self argCountHolder) |
1422 |
]. |
|
1423 |
^ arg1BoxVisible. |
|
3665 | 1424 |
|
1425 |
"Modified: / 17-05-2019 / 16:16:59 / Stefan Vogel" |
|
1522 | 1426 |
! |
1427 |
||
1428 |
arg2BoxVisible |
|
3292 | 1429 |
"Determines if the box should be visible or not. |
1430 |
Return a holder providing true or false" |
|
1431 |
||
1522 | 1432 |
arg2BoxVisible isNil ifTrue:[ |
1433 |
arg2BoxVisible := BlockValue |
|
3665 | 1434 |
with:[:vh | vh >= 3 ] |
1522 | 1435 |
argument:(self argCountHolder) |
1436 |
]. |
|
1437 |
^ arg2BoxVisible. |
|
3665 | 1438 |
|
1439 |
"Modified: / 17-05-2019 / 16:16:54 / Stefan Vogel" |
|
1522 | 1440 |
! |
1441 |
||
1442 |
arg3BoxVisible |
|
3292 | 1443 |
"Determines if the box should be visible or not. |
1444 |
Return a holder providing true or false" |
|
1445 |
||
1522 | 1446 |
arg3BoxVisible isNil ifTrue:[ |
1447 |
arg3BoxVisible := BlockValue |
|
3665 | 1448 |
with:[:vh | vh >= 4 ] |
1522 | 1449 |
argument:(self argCountHolder) |
1450 |
]. |
|
1451 |
^ arg3BoxVisible. |
|
3665 | 1452 |
|
1453 |
"Modified: / 17-05-2019 / 16:16:48 / Stefan Vogel" |
|
1522 | 1454 |
! |
1455 |
||
1456 |
arg4BoxVisible |
|
3292 | 1457 |
"Determines if the box should be visible or not. |
1458 |
Return a holder providing true or false" |
|
1459 |
||
1522 | 1460 |
arg4BoxVisible isNil ifTrue:[ |
1461 |
arg4BoxVisible := BlockValue |
|
3665 | 1462 |
with:[:vh | vh >= 5 ] |
1522 | 1463 |
argument:(self argCountHolder) |
1464 |
]. |
|
1465 |
^ arg4BoxVisible. |
|
3665 | 1466 |
|
1467 |
"Modified: / 17-05-2019 / 16:16:43 / Stefan Vogel" |
|
1522 | 1468 |
! |
1469 |
||
1470 |
argCountHolder |
|
3292 | 1471 |
"Return an argCounterHolder which is initialized at 2." |
1472 |
||
1522 | 1473 |
argCountHolder isNil ifTrue:[ |
1474 |
argCountHolder := 2 asValue. |
|
1475 |
]. |
|
1476 |
^ argCountHolder. |
|
1477 |
! |
|
1478 |
||
1479 |
argCountList |
|
3292 | 1480 |
"Return the argCountList (shown in the combo)" |
1481 |
||
1522 | 1482 |
argCountList isNil ifTrue:[ |
1483 |
argCountList := #('0 arguments' '1 argument' '2 arguments' '3 arguments') asValue |
|
1484 |
]. |
|
1485 |
^ argCountList. |
|
1486 |
! |
|
1487 |
||
1488 |
classOfResultHolder |
|
1525 | 1489 |
"Return a valueHolder which contains a collection with the names of the |
1490 |
implementors of a specific message. " |
|
1522 | 1491 |
|
3292 | 1492 |
classOfResultHolder isNil ifTrue:[ |
1493 |
classOfResultHolder := ValueHolder new. |
|
1522 | 1494 |
]. |
3292 | 1495 |
^ classOfResultHolder |
1522 | 1496 |
! |
1497 |
||
1532 | 1498 |
codeHolder |
1499 |
codeHolder isNil ifTrue:[ |
|
1500 |
codeHolder := '' asValue. |
|
1501 |
]. |
|
1502 |
^ codeHolder. |
|
1503 |
||
1504 |
"Created: / 13.11.2001 / 12:44:11 / cg" |
|
1505 |
! |
|
1506 |
||
3292 | 1507 |
codeViewClass |
1508 |
"the species of view to be created as codeview" |
|
1509 |
||
1510 |
^ Tools::CodeView2 ? CodeView |
|
1511 |
! |
|
1512 |
||
1522 | 1513 |
resultHolder |
1525 | 1514 |
"Return a value holder which contains the results of a search as a collection." |
1522 | 1515 |
|
3292 | 1516 |
resultHolder isNil ifTrue:[ |
1517 |
resultHolder := ValueHolder new. |
|
1518 |
resultHolder value:(self resultInfoText collect:[:l | l withColor:Color darkGrey]). |
|
1522 | 1519 |
]. |
3292 | 1520 |
^ resultHolder. |
2886 | 1521 |
|
2890 | 1522 |
"Modified: / 01-06-2012 / 13:06:02 / cg" |
1529 | 1523 |
! |
1524 |
||
3023 | 1525 |
resultInfoText |
1526 |
^ { |
|
1527 |
'Please enter combination of' . |
|
1528 |
' ',('receiver, arg and result' allBold) . |
|
1529 |
'or a'. |
|
1530 |
' ',('selector search pattern' allBold) . |
|
3289 | 1531 |
'into the above fields.' . |
1532 |
'Then click on either ',('"search"' allBold),'-button.' |
|
3023 | 1533 |
} |
1534 |
! |
|
1535 |
||
1529 | 1536 |
selectedClassOfResultHolder |
2927 | 1537 |
"valueHolder which contains the index of the selected result class (right list)" |
1529 | 1538 |
|
3292 | 1539 |
selectedClassOfResultHolder isNil ifTrue:[ |
1540 |
selectedClassOfResultHolder := ValueHolder new. |
|
1529 | 1541 |
]. |
3292 | 1542 |
^ selectedClassOfResultHolder |
2927 | 1543 |
|
1544 |
"Modified (comment): / 21-09-2012 / 11:10:29 / cg" |
|
1545 |
! |
|
1546 |
||
1547 |
selectedImplementorsHolder |
|
1548 |
"valueHolder which contains the index of the selected implementors list (left list)" |
|
1549 |
||
3292 | 1550 |
selectedImplementorsHolder isNil ifTrue:[ |
1551 |
selectedImplementorsHolder := ValueHolder new. |
|
3766 | 1552 |
selectedImplementorsHolder onChangeSend:#selectedImplementorChanged to:self. |
2927 | 1553 |
]. |
3292 | 1554 |
^ selectedImplementorsHolder |
2927 | 1555 |
|
1556 |
"Created: / 21-09-2012 / 11:10:13 / cg" |
|
2886 | 1557 |
! |
1558 |
||
3292 | 1559 |
selectorPatternHolder |
1560 |
selectorPatternHolder isNil ifTrue:[ |
|
1561 |
selectorPatternHolder := ValueHolder new. |
|
1562 |
selectorPatternHolder onChangeSend:#selectorPatternChanged to:self. |
|
2886 | 1563 |
]. |
3292 | 1564 |
^ selectorPatternHolder |
2886 | 1565 |
|
1566 |
"Created: / 27-04-2012 / 14:44:01 / cg" |
|
1522 | 1567 |
! ! |
1568 |
||
1569 |
!MethodFinderWindow methodsFor:'controlInput'! |
|
1570 |
||
3090 | 1571 |
cleanInputs:aDirtyString |
1572 |
"Find and remove common mistakes made by the user. Return the |
|
1525 | 1573 |
'aStringToBeCleaned' variable" |
3090 | 1574 |
|
1575 |
|aStringToBeCleaned rs position| |
|
1522 | 1576 |
|
3090 | 1577 |
aStringToBeCleaned := aDirtyString. |
1578 |
(aStringToBeCleaned endsWith:(Character cr)) ifTrue:[ |
|
1579 |
aStringToBeCleaned := aStringToBeCleaned copyFrom:1 to:(aStringToBeCleaned size - 1). |
|
1580 |
]. |
|
1581 |
aStringToBeCleaned := aStringToBeCleaned withoutSeparators. |
|
1582 |
rs := ReadStream on:aStringToBeCleaned. |
|
1583 |
[ |
|
1584 |
rs upToAll_positionBefore:'#true'. |
|
1585 |
rs atEnd |
|
1586 |
] whileFalse:[ |
|
1587 |
position := rs position. |
|
1588 |
aStringToBeCleaned := aStringToBeCleaned |
|
1589 |
copyReplaceFrom:position |
|
1590 |
to:position |
|
1591 |
with:''. |
|
1592 |
rs := ReadStream on:aStringToBeCleaned. |
|
1593 |
]. |
|
1594 |
rs := ReadStream on:aStringToBeCleaned. |
|
1595 |
[ |
|
1596 |
rs upToAll_positionBefore:'#false'. |
|
1597 |
rs atEnd |
|
1598 |
] whileFalse:[ |
|
1599 |
position := rs position. |
|
1600 |
aStringToBeCleaned := aStringToBeCleaned |
|
1601 |
copyReplaceFrom:position |
|
1602 |
to:position |
|
1603 |
with:''. |
|
1604 |
rs := ReadStream on:aStringToBeCleaned. |
|
1605 |
]. |
|
1606 |
[ |
|
1607 |
rs upToAll_positionBefore:'#nil'. |
|
1608 |
rs atEnd |
|
1609 |
] whileFalse:[ |
|
1610 |
position := rs position. |
|
1611 |
aStringToBeCleaned := aStringToBeCleaned |
|
1612 |
copyReplaceFrom:position |
|
1613 |
to:position |
|
1614 |
with:''. |
|
1615 |
rs := ReadStream on:aStringToBeCleaned. |
|
1616 |
]. |
|
1617 |
^ aStringToBeCleaned |
|
1522 | 1618 |
! |
1619 |
||
3315 | 1620 |
markMatchingClasses:aSelector classesWithSelector:anOrderedCollection |
3090 | 1621 |
" Matches the class of the receiver with all the elements in anOrderedCollection |
1622 |
(which are classes with selectors). If a match is found it is marked with an asterisk. |
|
3315 | 1623 |
The classes are then sorted so the asterisk appears first. Return the |
3090 | 1624 |
markedClassList." |
1625 |
||
3675 | 1626 |
|marker recClass unmarkedClassList markedClassList toMark| |
1522 | 1627 |
|
3090 | 1628 |
marker := self class markerForImplementingClass. |
1629 |
recClass := receiver value class. |
|
3675 | 1630 |
|
1631 |
toMark := OrderedCollection new. |
|
1632 |
||
3090 | 1633 |
unmarkedClassList := anOrderedCollection copy. |
3315 | 1634 |
unmarkedClassList do:[:classAndMethod | |
3290 | 1635 |
|className class sel| |
1532 | 1636 |
|
3675 | 1637 |
className := (classAndMethod copyButLast:aSelector size) withoutSeparators. |
3290 | 1638 |
class := Smalltalk classNamed:className. "/ Compiler evaluate:className. |
3315 | 1639 |
|
3090 | 1640 |
"/ (recClass == class) |
3315 | 1641 |
|
3090 | 1642 |
(recClass whichClassImplements:aSelector) == class ifTrue:[ |
3675 | 1643 |
toMark add:classAndMethod. |
1532 | 1644 |
]. |
3090 | 1645 |
]. |
3675 | 1646 |
unmarkedClassList removeAll:toMark. |
1647 |
unmarkedClassList addAll:(toMark collect:#allBold). |
|
1648 |
||
3315 | 1649 |
unmarkedClassList |
1650 |
sort:[:a :b | |
|
3090 | 1651 |
|rawA rawB| |
1522 | 1652 |
|
3090 | 1653 |
rawA := a string withoutPrefix:marker. |
1654 |
rawB := b string withoutPrefix:marker. |
|
1655 |
rawA < rawB. |
|
1656 |
]. |
|
1657 |
markedClassList := unmarkedClassList. |
|
1658 |
^ markedClassList |
|
1532 | 1659 |
|
3675 | 1660 |
"Modified: / 13-11-2001 / 12:16:05 / cg" |
1661 |
"Modified: / 08-06-2019 / 15:36:30 / Claus Gittinger" |
|
1522 | 1662 |
! |
1663 |
||
3292 | 1664 |
mergeReceiver: aReceiver withArgument: arguments |
1522 | 1665 |
|
3763 | 1666 |
"Puts the receiver and arguments into an array so it can be of a suitable input for the |
1667 |
MethodFinder. Return an array." |
|
1525 | 1668 |
|
3763 | 1669 |
| tempReceiver tempArguments nTempArgs | |
1522 | 1670 |
|
3763 | 1671 |
tempReceiver:= aReceiver. |
1672 |
tempArguments := arguments. |
|
1673 |
nTempArgs := tempArguments size. |
|
1522 | 1674 |
|
3763 | 1675 |
nTempArgs == 0 ifTrue:[ |
1676 |
^ { tempReceiver } |
|
1677 |
]. |
|
1678 |
(nTempArgs == 1) ifTrue:[ |
|
1679 |
^ { tempReceiver . (tempArguments at:1) } "a receiver with an argument" |
|
1680 |
]. |
|
1681 |
(nTempArgs == 2) ifTrue:[ |
|
1682 |
^ { tempReceiver . (tempArguments at:1) . (tempArguments at:2) } "a receiver with 2 arguments" |
|
1683 |
]. |
|
1684 |
(nTempArgs == 3) ifTrue:[ |
|
1685 |
^ { tempReceiver . (tempArguments at:1) . (tempArguments at:2) . (tempArguments at:3) } " 3 args" |
|
1686 |
]. |
|
1687 |
^ nil |
|
1522 | 1688 |
! ! |
1689 |
||
3292 | 1690 |
!MethodFinderWindow methodsFor:'initialization'! |
1691 |
||
1692 |
argument1WidgetCreated: aWidget |
|
1693 |
"UI post creation hook. remember the widget as an instance variable." |
|
1694 |
||
1695 |
argument1Editor := aWidget scrolledView. |
|
1696 |
aWidget tabMeansNextField:true. |
|
1697 |
||
1698 |
"Modified: / 13.11.2001 / 12:21:41 / cg" |
|
1699 |
! |
|
1700 |
||
1701 |
argument2WidgetCreated: aWidget |
|
1702 |
"UI post creation hook. remember the widget as an instance variable." |
|
1703 |
||
1704 |
argument2Editor := aWidget scrolledView. |
|
1705 |
aWidget tabMeansNextField:true. |
|
1706 |
||
1707 |
"Modified: / 13.11.2001 / 12:21:45 / cg" |
|
1708 |
! |
|
1709 |
||
1710 |
argument3WidgetCreated: aWidget |
|
1711 |
"UI post creation hook. remember the widget as an instance variable" |
|
1712 |
||
1713 |
argument3Editor := aWidget scrolledView. |
|
1714 |
aWidget tabMeansNextField:true. |
|
1715 |
||
1716 |
"Modified: / 13.11.2001 / 12:21:49 / cg" |
|
1717 |
! |
|
1718 |
||
1719 |
messageAnswerWidgetCreated: aWidget |
|
1720 |
"UI post creation hook. remember the widget as an instance variable." |
|
1721 |
||
1722 |
messageAnswerEditor := aWidget scrolledView. |
|
1723 |
aWidget tabMeansNextField:true. |
|
1724 |
||
1725 |
"Modified: / 13.11.2001 / 12:24:55 / cg" |
|
1726 |
! |
|
1727 |
||
1728 |
receiverWidgetCreated: aWidget |
|
1729 |
"UI post creation hook. remember the widget as an instance variable." |
|
1730 |
||
1731 |
receiverEditor := aWidget scrolledView. |
|
1732 |
aWidget tabMeansNextField:true. |
|
1733 |
||
1734 |
"Modified: / 13.11.2001 / 12:24:49 / cg" |
|
1735 |
! |
|
1736 |
||
1737 |
sourceCodeWidgetCreated: aWidget |
|
1738 |
"UI post creation hook. make the codeView readonly" |
|
1739 |
||
1740 |
aWidget acceptAction:nil. |
|
1741 |
aWidget readOnly:true |
|
1742 |
||
1743 |
"Created: / 13.11.2001 / 12:50:27 / cg" |
|
1744 |
"Modified: / 13.11.2001 / 12:51:23 / cg" |
|
1745 |
! ! |
|
1746 |
||
3697 | 1747 |
!MethodFinderWindow methodsFor:'menu actions - help'! |
1532 | 1748 |
|
1749 |
aboutThisApplicationText |
|
1750 |
|msg| |
|
1751 |
||
1752 |
msg := super aboutThisApplicationText. |
|
3768 | 1753 |
msg := msg , self aboutThisApplicationText2. |
1754 |
^msg withCRs. |
|
1755 |
||
1756 |
"Modified: / 13.11.2001 / 12:56:44 / cg" |
|
1757 |
! |
|
1758 |
||
1759 |
aboutThisApplicationText2 |
|
1760 |
^ '\\Original written by Ted Kaehler, Scott Wallace and Dan Ingalls. |
|
3292 | 1761 |
Ported from Squeak to ST/X by James Hayes (2001 james@exept.de). |
1762 |
Improved by Claus Gittinger. |
|
1763 |
'. |
|
3768 | 1764 |
|
3292 | 1765 |
! |
1766 |
||
1767 |
openHTMLDocumentation |
|
1768 |
"about/help menu action" |
|
1769 |
||
1770 |
HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#METHODFINDER' |
|
1771 |
! ! |
|
1772 |
||
1773 |
!MethodFinderWindow methodsFor:'private'! |
|
1774 |
||
1775 |
argumentEditorsContents |
|
3766 | 1776 |
"Determine how many text editors of the arguments are used and store the result |
1777 |
as argCounter. The result being the minimum between how many editors have |
|
1778 |
expressions in and how many are displayed. |
|
3292 | 1779 |
|
3766 | 1780 |
Add each argument string (key)and the evaluated version (value) to an Ordered Dictionary |
1781 |
from each of the text editors. |
|
3292 | 1782 |
|
3766 | 1783 |
Return the OrderedDictionary with the expressions from all the text editors. " |
3292 | 1784 |
|
1785 |
| tempArguments argCounter tempArgument1Editor tempArgument2Editor tempArgument3Editor |
|
3766 | 1786 |
associationKey associationValue| |
1787 |
||
1788 |
argCounter:=0. |
|
3292 | 1789 |
|
3766 | 1790 |
tempArgument1Editor:= (self cleanInputs: argument1Editor contents). |
1791 |
tempArgument2Editor:= (self cleanInputs: argument2Editor contents). |
|
1792 |
tempArgument3Editor:= (self cleanInputs: argument3Editor contents). |
|
1793 |
||
1794 |
tempArgument1Editor = '' ifFalse:[argCounter:=argCounter +1]. |
|
1795 |
tempArgument2Editor = '' ifFalse:[argCounter:=argCounter +1]. |
|
1796 |
tempArgument3Editor = '' ifFalse:[argCounter:=argCounter +1]. |
|
1797 |
||
1798 |
argCounter:= (argCounter min: (self argCountHolder value -1)). |
|
1799 |
tempArguments:= OrderedDictionary new:argCounter. |
|
3292 | 1800 |
|
3766 | 1801 |
(argCounter value >= 1) ifTrue:[ |
1802 |
associationValue:= (Compiler evaluate: tempArgument1Editor). |
|
1803 |
((self isExpression:tempArgument1Editor) or:[ associationValue isNil]) ifTrue:[ |
|
1804 |
"looks if an expression is typed in" |
|
1805 |
associationKey:=associationValue printString |
|
1806 |
] ifFalse:[ |
|
1807 |
associationKey:=tempArgument1Editor |
|
1808 |
]. |
|
1809 |
tempArguments add: associationKey-> associationValue. |
|
1810 |
]. |
|
1811 |
(argCounter value >= 2) ifTrue:[ |
|
1812 |
associationValue:= (Compiler evaluate: tempArgument2Editor). |
|
1813 |
(((self isExpression:tempArgument2Editor) or:[ associationValue isNil])) ifTrue:[ |
|
1814 |
"looks if an expression is typed in" |
|
1815 |
associationKey:=associationValue printString |
|
1816 |
] ifFalse:[ |
|
1817 |
associationKey:=tempArgument2Editor |
|
1818 |
]. |
|
1819 |
tempArguments add: associationKey-> associationValue |
|
1820 |
]. |
|
3292 | 1821 |
|
3766 | 1822 |
(argCounter value >= 3) ifTrue:[ |
1823 |
associationValue:= (Compiler evaluate: tempArgument3Editor). |
|
1824 |
((self isExpression:tempArgument3Editor) or:[ associationValue isNil]) ifTrue:[ |
|
1825 |
"looks if an expression is typed in" |
|
1826 |
associationKey:=associationValue printString |
|
1827 |
] ifFalse:[ |
|
1828 |
associationKey:=tempArgument3Editor |
|
1829 |
]. |
|
1830 |
tempArguments add: associationKey-> associationValue |
|
1831 |
]. |
|
3292 | 1832 |
|
1833 |
||
3766 | 1834 |
^tempArguments |
3292 | 1835 |
! |
1836 |
||
1837 |
extractClassAndSelectorFrom:anArgument |
|
1838 |
"Opens browser on theArgument of a specific class. anArgument being a string with the |
|
1839 |
Class and the selector upon which the browser is to be opened. Return the receiver." |
|
1840 |
||
1841 |
|aClass aSelector x theArgument marker| |
|
1842 |
||
1843 |
anArgument isNil ifTrue:[ |
|
1844 |
^ nil |
|
1845 |
]. |
|
1846 |
marker := self class markerForImplementingClass. |
|
1847 |
||
1848 |
theArgument := anArgument string withoutPrefix:marker. |
|
1849 |
aClass := theArgument copyUpTo:(Character space). |
|
1850 |
x := aClass size + 2. |
|
1851 |
aSelector := theArgument copyFrom:x. |
|
1852 |
aClass := Smalltalk classNamed:aClass. |
|
1853 |
(aSelector startsWith:'class ') ifTrue:[ |
|
1854 |
aSelector := aSelector withoutPrefix:'class '. |
|
1855 |
aClass := aClass class. |
|
1856 |
]. |
|
1857 |
^ aClass -> aSelector asSymbol |
|
1858 |
||
1859 |
" |
|
1860 |
MethodFinderWindow new extractClassAndSelectorFrom: '*SmallInteger +' |
|
1861 |
MethodFinderWindow new extractClassAndSelectorFrom: 'String ,' |
|
1862 |
MethodFinderWindow new extractClassAndSelectorFrom: 'Number detentBy:atMultiplesOf:snap:' |
|
1863 |
||
1864 |
||
1865 |
" |
|
1866 |
||
1867 |
"Modified: / 27-04-2012 / 15:05:53 / cg" |
|
1868 |
! |
|
1869 |
||
1870 |
isExpression:aString |
|
1871 |
"Return true or false depending on if the subString includes certain characters" |
|
1872 |
||
1873 |
"/ cg: this is naive - why not ask the parser, if it is a literal? |
|
1874 |
(aString includesSubString:': ') ifTrue:[ |
|
1875 |
^ true |
|
1876 |
]. |
|
1877 |
(aString includes:$+) ifTrue:[ |
|
1878 |
^ true |
|
1879 |
]. |
|
1880 |
(aString includes:$-) ifTrue:[ |
|
1881 |
^ true |
|
1882 |
]. |
|
1883 |
(aString includes:$*) ifTrue:[ |
|
1884 |
^ true |
|
1885 |
]. |
|
1886 |
(aString includes:$/) ifTrue:[ |
|
1887 |
^ true |
|
1888 |
]. |
|
1889 |
(aString includes:$>) ifTrue:[ |
|
1890 |
^ true |
|
1891 |
]. |
|
1892 |
(aString includes:$<) ifTrue:[ |
|
1893 |
^ true |
|
1894 |
]. |
|
1895 |
(aString includesSubString:' new') ifTrue:[ |
|
1896 |
^ true |
|
1897 |
]. |
|
1898 |
(aString includes:$[) |
|
1899 |
& (aString includes:$]) |
|
1900 |
& (aString includes:$.) ifTrue:[ ^ false ]. |
|
1901 |
||
1902 |
(aString includes:$.) ifTrue:[ |
|
1903 |
^ true |
|
1904 |
]. |
|
1905 |
^ false |
|
1906 |
! |
|
1907 |
||
1908 |
receiverEditorContents |
|
1909 |
"Return a cleaned up version of receiver taken from the receiverEditor |
|
3322 | 1910 |
as an association. The association has aCleanedReceiverString as a key and the |
3292 | 1911 |
compiledReceiver as value." |
3322 | 1912 |
|
1913 |
|aCleanedReceiverString compiledReceiver| |
|
3292 | 1914 |
|
3322 | 1915 |
aCleanedReceiverString := self cleanInputs:(receiverEditor contents). |
3742 | 1916 |
"/ allow C-style integers |
1917 |
(aCleanedReceiverString startsWith:'0b') ifTrue:[ |
|
1918 |
aCleanedReceiverString := '2r',(aCleanedReceiverString withoutPrefix:'0b') |
|
1919 |
] ifFalse:[ |
|
1920 |
(aCleanedReceiverString startsWith:'0x') ifTrue:[ |
|
1921 |
aCleanedReceiverString := '16r',(aCleanedReceiverString withoutPrefix:'0x') |
|
1922 |
] ifFalse:[ |
|
1923 |
(aCleanedReceiverString startsWith:'0o') ifTrue:[ |
|
1924 |
aCleanedReceiverString := '8r',(aCleanedReceiverString withoutPrefix:'0o') |
|
1925 |
]. |
|
1926 |
]. |
|
1927 |
]. |
|
3322 | 1928 |
compiledReceiver := Compiler evaluate:aCleanedReceiverString. |
1929 |
((self isExpression:aCleanedReceiverString) or:[ compiledReceiver isNil ]) ifTrue:[ |
|
1930 |
aCleanedReceiverString := compiledReceiver printString |
|
3292 | 1931 |
]. |
3322 | 1932 |
^ aCleanedReceiverString -> compiledReceiver. |
3292 | 1933 |
! |
1934 |
||
1935 |
waitForBackgroundSearchFinished |
|
1936 |
| p | |
|
1937 |
||
1938 |
(p := searchProcess) isNil ifTrue:[^ self]. |
|
1939 |
p isDead ifTrue:[^ self]. |
|
1940 |
p waitUntilTerminated |
|
1941 |
! ! |
|
1942 |
||
1943 |
!MethodFinderWindow methodsFor:'user actions'! |
|
1944 |
||
1945 |
selectedClassOfResultHolderChanged |
|
1946 |
|sel classAndSelector mthd| |
|
1947 |
||
1948 |
sel := self selectedClassOfResultHolder value. |
|
1949 |
||
1950 |
classAndSelector := self extractClassAndSelectorFrom:sel. |
|
1951 |
classAndSelector isNil ifTrue:[ |
|
1952 |
^ self |
|
1953 |
]. |
|
1954 |
mthd := classAndSelector key >> classAndSelector value. |
|
1955 |
mthd notNil ifTrue:[ |
|
1956 |
self withWaitCursorDo:[ |
|
1957 |
self codeHolder value:mthd source |
|
1958 |
] |
|
1959 |
] ifFalse:[ |
|
1960 |
self codeHolder value:nil |
|
1961 |
]. |
|
1962 |
||
1963 |
"Created: / 13.11.2001 / 12:43:43 / cg" |
|
1964 |
"Modified: / 13.11.2001 / 12:48:56 / cg" |
|
1965 |
! |
|
1966 |
||
1967 |
selectorPatternChanged |
|
1968 |
self searchPatternMatchesInBackground |
|
1969 |
||
1970 |
"Created: / 01-06-2012 / 13:18:16 / cg" |
|
1532 | 1971 |
! ! |
1972 |
||
1522 | 1973 |
!MethodFinderWindow class methodsFor:'documentation'! |
1974 |
||
1975 |
version |
|
1976 |
^ '$Header$' |
|
2730 | 1977 |
! |
1978 |
||
1979 |
version_CVS |
|
1980 |
^ '$Header$' |
|
1522 | 1981 |
! ! |
3003 | 1982 |