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