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