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