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