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