author | Stefan Vogel <sv@exept.de> |
Fri, 09 May 2014 14:56:57 +0200 | |
changeset 3109 | 92920c76aae3 |
parent 3090 | ef71554ea9e9 |
child 3193 | 4ab685b49b91 |
permissions | -rw-r--r-- |
1522 | 1 |
"{ Package: 'stx:libtool2' }" |
2 |
||
3 |
ApplicationModel subclass:#MethodFinderWindow |
|
4 |
instanceVariableNames:'argumentsEditor messageAnswerEditor receiverEditor receiver |
|
5 |
resultSelectors arg2BoxVisible arg1BoxVisible arg4BoxVisible |
|
6 |
arg3BoxVisible argCountHolder argCountList argument1Editor |
|
7 |
argument2Editor argument3Editor argument4Editor resultSelected |
|
2891 | 8 |
lookAtResultEditor codeHolder searchProcess' |
1522 | 9 |
classVariableNames:'' |
10 |
poolDictionaries:'' |
|
1538 | 11 |
category:'Interface-MethodFinder' |
1522 | 12 |
! |
13 |
||
1530 | 14 |
!MethodFinderWindow class methodsFor:'documentation'! |
15 |
||
16 |
documentation |
|
17 |
" |
|
1531 | 18 |
[author:] |
19 |
ported from Squeak and GUI enhanced by James Hayes james@exept.de |
|
1530 | 20 |
" |
21 |
! ! |
|
1522 | 22 |
|
1532 | 23 |
!MethodFinderWindow class methodsFor:'constants'! |
24 |
||
2890 | 25 |
defaultIcon |
3109
92920c76aae3
Mark program icons with resource
Stefan Vogel <sv@exept.de>
parents:
3090
diff
changeset
|
26 |
<resource: #programImage> |
92920c76aae3
Mark program icons with resource
Stefan Vogel <sv@exept.de>
parents:
3090
diff
changeset
|
27 |
|
2890 | 28 |
^ ToolbarIconLibrary methodFinder24x24Icon |
29 |
||
30 |
"Created: / 01-06-2012 / 13:05:11 / cg" |
|
31 |
! |
|
32 |
||
1532 | 33 |
markerForImplementingClass |
34 |
^ '=> '. |
|
35 |
^ '*' |
|
36 |
||
37 |
"Created: / 13.11.2001 / 12:09:52 / cg" |
|
38 |
"Modified: / 13.11.2001 / 12:11:57 / cg" |
|
39 |
! ! |
|
40 |
||
1522 | 41 |
!MethodFinderWindow class methodsFor:'interface specs'! |
42 |
||
43 |
windowSpec |
|
44 |
"This resource specification was automatically generated |
|
45 |
by the UIPainter of ST/X." |
|
46 |
||
47 |
"Do not manually edit this!! If it is corrupted, |
|
48 |
the UIPainter may not be able to read the specification." |
|
49 |
||
50 |
" |
|
51 |
UIPainter new openOnClass:MethodFinderWindow andSelector:#windowSpec |
|
52 |
MethodFinderWindow new openInterface:#windowSpec |
|
53 |
MethodFinderWindow open |
|
54 |
" |
|
55 |
||
56 |
<resource: #canvas> |
|
57 |
||
58 |
^ |
|
2886 | 59 |
#(FullSpec |
60 |
name: windowSpec |
|
61 |
window: |
|
62 |
(WindowSpec |
|
63 |
label: 'MethodFinder' |
|
64 |
name: 'MethodFinder' |
|
2890 | 65 |
bounds: (Rectangle 0 0 798 595) |
2886 | 66 |
menu: menu |
2890 | 67 |
icon: defaultIcon |
1522 | 68 |
) |
2886 | 69 |
component: |
70 |
(SpecCollection |
|
71 |
collection: ( |
|
72 |
(VariableHorizontalPanelSpec |
|
73 |
name: 'VariableHorizontalPanel1' |
|
74 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
75 |
snapMode: both |
|
76 |
component: |
|
77 |
(SpecCollection |
|
78 |
collection: ( |
|
79 |
(ViewSpec |
|
80 |
name: 'LeftBox' |
|
81 |
level: 1 |
|
82 |
component: |
|
83 |
(SpecCollection |
|
84 |
collection: ( |
|
85 |
(ViewSpec |
|
86 |
name: 'ReceiverArgBox' |
|
2887 | 87 |
layout: (LayoutFrame 0 0 0 0 0 1 -100 0.5) |
2886 | 88 |
component: |
89 |
(SpecCollection |
|
90 |
collection: ( |
|
91 |
(LabelSpec |
|
92 |
label: 'Receiver' |
|
93 |
name: 'ReceiverLabel' |
|
94 |
layout: (LayoutFrame 0 0 0 0 0 0.34 24 0) |
|
95 |
translateLabel: true |
|
96 |
) |
|
97 |
(ComboListSpec |
|
98 |
name: 'allowedArgments' |
|
99 |
layout: (LayoutFrame 0 0.34 1 0 0 0.64 23 0) |
|
100 |
model: argCountHolder |
|
101 |
comboList: argCountList |
|
102 |
useIndex: true |
|
1530 | 103 |
) |
2886 | 104 |
(LabelSpec |
105 |
label: 'Answer' |
|
106 |
name: 'MessageAnswerLabel' |
|
107 |
layout: (LayoutFrame 0 0.64 0 0 0 1 24 0) |
|
108 |
translateLabel: true |
|
1532 | 109 |
) |
2886 | 110 |
(HorizontalPanelViewSpec |
111 |
name: 'HorizontalPanel1' |
|
112 |
layout: (LayoutFrame 0 0 25 0 0 1 0 1) |
|
113 |
horizontalLayout: fit |
|
114 |
verticalLayout: fit |
|
115 |
horizontalSpace: 3 |
|
116 |
verticalSpace: 3 |
|
117 |
component: |
|
118 |
(SpecCollection |
|
119 |
collection: ( |
|
120 |
(WorkspaceSpec |
|
121 |
name: 'ReceiverEditor' |
|
122 |
tabable: true |
|
123 |
hasHorizontalScrollBar: true |
|
124 |
hasVerticalScrollBar: true |
|
125 |
miniScrollerHorizontal: true |
|
126 |
miniScrollerVertical: true |
|
127 |
autoHideScrollBars: true |
|
128 |
hasKeyboardFocusInitially: false |
|
2890 | 129 |
extent: (Point 113 172) |
2886 | 130 |
postBuildCallback: receiverWidgetCreated: |
1532 | 131 |
) |
2886 | 132 |
(VerticalPanelViewSpec |
133 |
name: 'VerticalPanel1' |
|
134 |
horizontalLayout: fit |
|
135 |
verticalLayout: fit |
|
136 |
horizontalSpace: 3 |
|
137 |
verticalSpace: 3 |
|
138 |
component: |
|
139 |
(SpecCollection |
|
140 |
collection: ( |
|
141 |
(ViewSpec |
|
142 |
name: 'Box1' |
|
143 |
visibilityChannel: arg1BoxVisible |
|
144 |
component: |
|
145 |
(SpecCollection |
|
146 |
collection: ( |
|
147 |
(WorkspaceSpec |
|
148 |
name: 'Arg1Editor' |
|
149 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
150 |
tabable: true |
|
151 |
hasHorizontalScrollBar: true |
|
152 |
hasVerticalScrollBar: true |
|
153 |
miniScrollerHorizontal: true |
|
154 |
miniScrollerVertical: true |
|
155 |
autoHideScrollBars: true |
|
156 |
hasKeyboardFocusInitially: false |
|
157 |
postBuildCallback: argument1WidgetCreated: |
|
1532 | 158 |
) |
159 |
) |
|
160 |
||
161 |
) |
|
2890 | 162 |
extent: (Point 114 55) |
1532 | 163 |
) |
2886 | 164 |
(ViewSpec |
165 |
name: 'Box2' |
|
166 |
visibilityChannel: arg2BoxVisible |
|
167 |
component: |
|
168 |
(SpecCollection |
|
169 |
collection: ( |
|
170 |
(WorkspaceSpec |
|
171 |
name: 'TextEditor5' |
|
172 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
173 |
tabable: true |
|
174 |
hasHorizontalScrollBar: true |
|
175 |
hasVerticalScrollBar: true |
|
176 |
miniScrollerHorizontal: true |
|
177 |
miniScrollerVertical: true |
|
178 |
autoHideScrollBars: true |
|
179 |
hasKeyboardFocusInitially: false |
|
180 |
postBuildCallback: argument2WidgetCreated: |
|
1532 | 181 |
) |
182 |
) |
|
183 |
||
184 |
) |
|
2890 | 185 |
extent: (Point 114 56) |
1532 | 186 |
) |
2886 | 187 |
(ViewSpec |
188 |
name: 'Box3' |
|
189 |
visibilityChannel: arg3BoxVisible |
|
190 |
component: |
|
191 |
(SpecCollection |
|
192 |
collection: ( |
|
193 |
(WorkspaceSpec |
|
194 |
name: 'TextEditor6' |
|
195 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
196 |
tabable: true |
|
197 |
hasHorizontalScrollBar: true |
|
198 |
hasVerticalScrollBar: true |
|
199 |
miniScrollerHorizontal: true |
|
200 |
miniScrollerVertical: true |
|
201 |
autoHideScrollBars: true |
|
202 |
hasKeyboardFocusInitially: false |
|
203 |
postBuildCallback: argument3WidgetCreated: |
|
1532 | 204 |
) |
205 |
) |
|
206 |
||
207 |
) |
|
2890 | 208 |
extent: (Point 114 55) |
1530 | 209 |
) |
210 |
) |
|
211 |
||
212 |
) |
|
2890 | 213 |
extent: (Point 114 172) |
1530 | 214 |
) |
2886 | 215 |
(WorkspaceSpec |
216 |
name: 'AnswerEditor' |
|
217 |
tabable: true |
|
218 |
hasHorizontalScrollBar: true |
|
219 |
hasVerticalScrollBar: true |
|
220 |
miniScrollerHorizontal: true |
|
221 |
miniScrollerVertical: true |
|
222 |
autoHideScrollBars: true |
|
223 |
hasKeyboardFocusInitially: false |
|
2890 | 224 |
extent: (Point 114 172) |
2886 | 225 |
postBuildCallback: messageAnswerWidgetCreated: |
1525 | 226 |
) |
227 |
) |
|
228 |
||
229 |
) |
|
230 |
) |
|
1532 | 231 |
) |
232 |
||
233 |
) |
|
234 |
) |
|
2886 | 235 |
(ViewSpec |
236 |
name: 'ReceiverArgBoxActionBox' |
|
2887 | 237 |
layout: (LayoutFrame 0 0 -98 0.5 0 1 -75 0.5) |
2886 | 238 |
component: |
239 |
(SpecCollection |
|
240 |
collection: ( |
|
241 |
(ActionButtonSpec |
|
242 |
label: 'Clear' |
|
243 |
name: 'Button2' |
|
244 |
layout: (LayoutFrame 5 0 0 0 -5 0.5 0 1) |
|
245 |
translateLabel: true |
|
246 |
model: clear |
|
1532 | 247 |
) |
2886 | 248 |
(ActionButtonSpec |
249 |
label: 'Search' |
|
250 |
name: 'Button1' |
|
251 |
layout: (LayoutFrame 5 0.5 0 0 -5 1 0 1) |
|
252 |
translateLabel: true |
|
253 |
tabable: true |
|
254 |
model: search |
|
1522 | 255 |
) |
256 |
) |
|
257 |
||
258 |
) |
|
259 |
) |
|
2886 | 260 |
(ViewSpec |
261 |
name: 'MatchActionBox' |
|
2887 | 262 |
layout: (LayoutFrame 0 0 -70 0.5 0 1 -20 0.5) |
2886 | 263 |
component: |
264 |
(SpecCollection |
|
265 |
collection: ( |
|
266 |
(LabelSpec |
|
267 |
label: 'Selector Pattern:' |
|
268 |
name: 'Label1' |
|
2887 | 269 |
layout: (LayoutFrame 0 0 0 0 0 0.5 25 0) |
2886 | 270 |
translateLabel: true |
271 |
adjust: left |
|
272 |
) |
|
273 |
(InputFieldSpec |
|
274 |
name: 'EntryField1' |
|
2887 | 275 |
layout: (LayoutFrame 0 0 -25 1 0 0.5 -5 1) |
2886 | 276 |
model: selectorPattern |
277 |
immediateAccept: true |
|
278 |
acceptOnReturn: true |
|
279 |
acceptOnTab: true |
|
280 |
acceptOnPointerLeave: true |
|
281 |
) |
|
282 |
(ActionButtonSpec |
|
283 |
label: 'Search' |
|
284 |
name: 'Button4' |
|
285 |
layout: (LayoutFrame 5 0.5 -25 1 -5 1 0 1) |
|
286 |
translateLabel: true |
|
287 |
tabable: true |
|
3023 | 288 |
model: searchPatternMatchesInBackground |
2886 | 289 |
) |
290 |
) |
|
291 |
||
292 |
) |
|
293 |
) |
|
294 |
(SequenceViewSpec |
|
295 |
name: 'ResultList' |
|
2887 | 296 |
layout: (LayoutFrame 0 0 -15 0.5 0 1 0 1) |
2927 | 297 |
model: selectedImplementorsHolder |
298 |
menu: resultListMenu |
|
2886 | 299 |
hasHorizontalScrollBar: true |
300 |
hasVerticalScrollBar: true |
|
301 |
autoHideScrollBars: true |
|
302 |
valueChangeSelector: updateImplementorsOf: |
|
303 |
useIndex: true |
|
304 |
sequenceList: resultHolder |
|
305 |
) |
|
1530 | 306 |
) |
307 |
||
308 |
) |
|
309 |
) |
|
2886 | 310 |
(VariableVerticalPanelSpec |
311 |
name: 'VariableVerticalPanel1' |
|
312 |
component: |
|
313 |
(SpecCollection |
|
314 |
collection: ( |
|
315 |
(SequenceViewSpec |
|
316 |
name: 'List2' |
|
317 |
model: selectedClassOfResultHolder |
|
318 |
menu: implementorListMenu |
|
319 |
hasHorizontalScrollBar: true |
|
320 |
hasVerticalScrollBar: true |
|
321 |
autoHideScrollBars: true |
|
322 |
doubleClickSelector: openBrowserOn: |
|
323 |
valueChangeSelector: selectedClassOfResultHolderChanged |
|
324 |
useIndex: false |
|
325 |
sequenceList: classOfResultHolder |
|
1530 | 326 |
) |
2886 | 327 |
(CodeViewSpec |
328 |
name: 'CodeView' |
|
329 |
model: codeHolder |
|
330 |
hasHorizontalScrollBar: true |
|
331 |
hasVerticalScrollBar: true |
|
332 |
autoHideScrollBars: true |
|
333 |
hasKeyboardFocusInitially: false |
|
334 |
postBuildCallback: sourceCodeWidgetCreated: |
|
1522 | 335 |
) |
336 |
) |
|
337 |
||
338 |
) |
|
2886 | 339 |
handles: (Any 0.5 1.0) |
1522 | 340 |
) |
341 |
) |
|
342 |
||
343 |
) |
|
2890 | 344 |
handles: (Any 0.443786982248521 1.0) |
1522 | 345 |
) |
346 |
) |
|
347 |
||
348 |
) |
|
349 |
) |
|
2927 | 350 |
|
351 |
"Modified: / 21-09-2012 / 11:09:44 / cg" |
|
1522 | 352 |
! ! |
353 |
||
1525 | 354 |
!MethodFinderWindow class methodsFor:'menu specs'! |
355 |
||
1529 | 356 |
implementorListMenu |
357 |
"This resource specification was automatically generated |
|
358 |
by the MenuEditor of ST/X." |
|
359 |
||
360 |
"Do not manually edit this!! If it is corrupted, |
|
361 |
the MenuEditor may not be able to read the specification." |
|
362 |
||
363 |
" |
|
364 |
MenuEditor new openOnClass:MethodFinderWindow andSelector:#implementorListMenu |
|
365 |
(Menu new fromLiteralArrayEncoding:(MethodFinderWindow implementorListMenu)) startUp |
|
366 |
" |
|
367 |
||
368 |
<resource: #menu> |
|
369 |
||
370 |
^ |
|
371 |
#(#Menu |
|
372 |
#( |
|
373 |
#(#MenuItem |
|
374 |
#label: 'Browse' |
|
375 |
#translateLabel: true |
|
376 |
#value: #openBrowserOnSelectedItem |
|
377 |
) |
|
378 |
) |
|
379 |
nil |
|
380 |
nil |
|
381 |
) |
|
382 |
! |
|
383 |
||
1525 | 384 |
menu |
385 |
"This resource specification was automatically generated |
|
386 |
by the MenuEditor of ST/X." |
|
387 |
||
388 |
"Do not manually edit this!! If it is corrupted, |
|
389 |
the MenuEditor may not be able to read the specification." |
|
390 |
||
391 |
" |
|
392 |
MenuEditor new openOnClass:MethodFinderWindow andSelector:#menu |
|
393 |
(Menu new fromLiteralArrayEncoding:(MethodFinderWindow menu)) startUp |
|
394 |
" |
|
395 |
||
396 |
<resource: #menu> |
|
397 |
||
398 |
^ |
|
399 |
#(#Menu |
|
400 |
#( |
|
401 |
#(#MenuItem |
|
402 |
#label: '&File' |
|
403 |
#activeHelpKey: #file |
|
404 |
#submenu: |
|
405 |
#(#Menu |
|
406 |
#( |
|
407 |
#(#MenuItem |
|
408 |
#label: 'Exit' |
|
409 |
#value: #closeRequest |
|
410 |
#activeHelpKey: #fileExit |
|
411 |
) |
|
412 |
) |
|
413 |
nil |
|
414 |
nil |
|
415 |
) |
|
416 |
) |
|
417 |
#(#MenuItem |
|
418 |
#label: 'Help' |
|
419 |
#startGroup: #right |
|
420 |
#submenu: |
|
421 |
#(#Menu |
|
422 |
#( |
|
423 |
#(#MenuItem |
|
424 |
#label: 'Documentation' |
|
425 |
#value: #openHTMLDocumentation |
|
426 |
#activeHelpKey: #helpTutorial |
|
427 |
) |
|
428 |
#(#MenuItem |
|
1532 | 429 |
#label: 'About MethodFinder...' |
1525 | 430 |
#value: #openAboutThisApplication |
431 |
#activeHelpKey: #aboutThisAppliaction |
|
432 |
) |
|
433 |
) |
|
434 |
nil |
|
435 |
nil |
|
436 |
) |
|
437 |
) |
|
438 |
) |
|
439 |
nil |
|
440 |
nil |
|
441 |
) |
|
1532 | 442 |
|
443 |
"Modified: / 13.11.2001 / 12:36:39 / cg" |
|
2927 | 444 |
! |
445 |
||
446 |
resultListMenu |
|
447 |
"This resource specification was automatically generated |
|
448 |
by the MenuEditor of ST/X." |
|
449 |
||
450 |
"Do not manually edit this!! If it is corrupted, |
|
451 |
the MenuEditor may not be able to read the specification." |
|
452 |
||
453 |
" |
|
454 |
MenuEditor new openOnClass:MethodFinderWindow andSelector:#implementorListMenu |
|
455 |
(Menu new fromLiteralArrayEncoding:(MethodFinderWindow implementorListMenu)) startUp |
|
456 |
" |
|
457 |
||
458 |
<resource: #menu> |
|
459 |
||
460 |
^ |
|
461 |
#(#Menu |
|
462 |
#( |
|
463 |
#(#MenuItem |
|
3024 | 464 |
#label: 'Browse Senders' |
465 |
#translateLabel: true |
|
466 |
#value: #openBrowserOnSenderOfSelectedResultItem |
|
467 |
) |
|
468 |
#(#MenuItem |
|
2927 | 469 |
#label: 'Browse Implementors' |
470 |
#translateLabel: true |
|
471 |
#value: #openBrowserOnSelectedResultItem |
|
472 |
) |
|
473 |
) |
|
474 |
nil |
|
475 |
nil |
|
476 |
) |
|
477 |
||
478 |
"Created: / 21-09-2012 / 11:05:15 / cg" |
|
1525 | 479 |
! ! |
480 |
||
1522 | 481 |
!MethodFinderWindow methodsFor:'accessing'! |
482 |
||
483 |
receiver |
|
1525 | 484 |
"Return a copy of the value of the instance variable 'receiver' " |
1522 | 485 |
|
486 |
^ receiver copy |
|
487 |
! ! |
|
488 |
||
489 |
!MethodFinderWindow methodsFor:'actions'! |
|
490 |
||
491 |
argumentEditorsContents |
|
1525 | 492 |
|
493 |
"Determine how many text editors of the arguments are used and store the result |
|
494 |
as argCounter. The result being the minimum between how many editors have |
|
495 |
expressions in and how many are displayed. |
|
496 |
||
497 |
Add each argument string (key)and the evaluated version (value) to an Ordered Dictionary |
|
498 |
from each of the text editors. |
|
499 |
||
500 |
Return the OrderedDictionary with the expressions from all the text editors. " |
|
501 |
||
2165 | 502 |
| tempArguments argCounter tempArgument1Editor tempArgument2Editor tempArgument3Editor |
1522 | 503 |
associationKey associationValue| |
504 |
||
505 |
argCounter:=0. |
|
506 |
||
507 |
tempArgument1Editor:= (self cleanInputs: argument1Editor contents). |
|
508 |
tempArgument2Editor:= (self cleanInputs: argument2Editor contents). |
|
509 |
tempArgument3Editor:= (self cleanInputs: argument3Editor contents). |
|
510 |
||
511 |
tempArgument1Editor = '' ifFalse:[argCounter:=argCounter +1]. |
|
512 |
tempArgument2Editor = '' ifFalse:[argCounter:=argCounter +1]. |
|
513 |
tempArgument3Editor = '' ifFalse:[argCounter:=argCounter +1]. |
|
514 |
||
515 |
||
516 |
argCounter:= (argCounter min: (self argCountHolder value -1)). |
|
517 |
tempArguments:= OrderedDictionary new:argCounter. |
|
518 |
||
519 |
(argCounter value >= 1) |
|
520 |
ifTrue:[associationValue:= (Compiler evaluate: tempArgument1Editor). |
|
521 |
((self isExpression:tempArgument1Editor) or:[ associationValue isNil]) ifTrue:[ "looks if an expression is typed in" |
|
522 |
associationKey:=associationValue printString] |
|
523 |
ifFalse:[ |
|
524 |
associationKey:=tempArgument1Editor]. |
|
525 |
||
526 |
tempArguments add: associationKey-> associationValue. |
|
527 |
]. |
|
528 |
(argCounter value >= 2) |
|
529 |
ifTrue:[ associationValue:= (Compiler evaluate: tempArgument2Editor). |
|
530 |
(((self isExpression:tempArgument2Editor) or:[ associationValue isNil])) ifTrue:[ "looks if an expression is typed in" |
|
531 |
associationKey:=associationValue printString] |
|
532 |
ifFalse:[ |
|
533 |
associationKey:=tempArgument2Editor]. |
|
534 |
||
535 |
tempArguments add: associationKey-> associationValue]. |
|
536 |
||
537 |
(argCounter value >= 3) |
|
538 |
ifTrue:[ associationValue:= (Compiler evaluate: tempArgument3Editor). |
|
539 |
((self isExpression:tempArgument3Editor) or:[ associationValue isNil]) ifTrue:[ "looks if an expression is typed in" |
|
540 |
associationKey:=associationValue printString] |
|
541 |
ifFalse:[ |
|
542 |
associationKey:=tempArgument3Editor]. |
|
543 |
||
544 |
tempArguments add: associationKey-> associationValue]. |
|
545 |
||
546 |
||
547 |
^tempArguments |
|
548 |
! |
|
549 |
||
550 |
clear |
|
1525 | 551 |
"Reset the contents of all the outputs. Return the receiver." |
1522 | 552 |
|
553 |
receiverEditor contents:nil. |
|
554 |
argument1Editor contents:nil. |
|
555 |
argument2Editor contents:nil. |
|
556 |
argument3Editor contents:nil. |
|
557 |
messageAnswerEditor contents:nil. |
|
558 |
self resultHolder value:nil. |
|
1525 | 559 |
self classOfResultHolder value: nil. |
2730 | 560 |
codeHolder value:nil. |
1522 | 561 |
! |
562 |
||
1532 | 563 |
extractClassAndSelectorFrom:anArgument |
564 |
"Opens browser on theArgument of a specific class. anArgument being a string with the |
|
565 |
Class and the selector upon which the browser is to be opened. Return the receiver." |
|
566 |
||
567 |
|aClass aSelector x theArgument marker| |
|
568 |
||
569 |
anArgument isNil ifTrue:[ |
|
570 |
^ nil |
|
571 |
]. |
|
572 |
marker := self class markerForImplementingClass. |
|
573 |
||
3003 | 574 |
theArgument := anArgument string withoutPrefix:marker. |
1532 | 575 |
aClass := theArgument copyUpTo:(Character space). |
576 |
x := aClass size + 2. |
|
577 |
aSelector := theArgument copyFrom:x. |
|
578 |
aClass := Smalltalk classNamed:aClass. |
|
2886 | 579 |
(aSelector startsWith:'class ') ifTrue:[ |
3003 | 580 |
aSelector := aSelector withoutPrefix:'class '. |
2886 | 581 |
aClass := aClass class. |
582 |
]. |
|
1532 | 583 |
^ aClass -> aSelector asSymbol |
584 |
||
585 |
" |
|
586 |
MethodFinderWindow new extractClassAndSelectorFrom: '*SmallInteger +' |
|
587 |
MethodFinderWindow new extractClassAndSelectorFrom: 'String ,' |
|
588 |
MethodFinderWindow new extractClassAndSelectorFrom: 'Number detentBy:atMultiplesOf:snap:' |
|
589 |
||
590 |
||
591 |
" |
|
592 |
||
2886 | 593 |
"Modified: / 27-04-2012 / 15:05:53 / cg" |
1532 | 594 |
! |
595 |
||
3024 | 596 |
isExpression:aString |
597 |
"Return true or false depending on if the subString includes certain characters" |
|
598 |
||
599 |
(aString includesSubString:': ') ifTrue:[ |
|
600 |
^ true |
|
601 |
]. |
|
602 |
(aString includes:$+) ifTrue:[ |
|
603 |
^ true |
|
604 |
]. |
|
605 |
(aString includes:$-) ifTrue:[ |
|
606 |
^ true |
|
607 |
]. |
|
608 |
(aString includes:$*) ifTrue:[ |
|
609 |
^ true |
|
610 |
]. |
|
611 |
(aString includes:$/) ifTrue:[ |
|
612 |
^ true |
|
613 |
]. |
|
614 |
(aString includes:$>) ifTrue:[ |
|
615 |
^ true |
|
616 |
]. |
|
617 |
(aString includes:$<) ifTrue:[ |
|
618 |
^ true |
|
619 |
]. |
|
620 |
(aString includesSubString:' new') ifTrue:[ |
|
621 |
^ true |
|
622 |
]. |
|
623 |
(aString includes:$[) |
|
624 |
& (aString includes:$]) |
|
625 |
& (aString includes:$.) ifTrue:[ ^ false ]. |
|
1522 | 626 |
|
3024 | 627 |
(aString includes:$.) ifTrue:[ |
628 |
^ true |
|
629 |
]. |
|
630 |
^ false |
|
1522 | 631 |
! |
632 |
||
633 |
messageAnswerEditorContents |
|
3024 | 634 |
"Return a cleaned up version of message answer taken from the messageAnswerEditor |
635 |
as an association. The association has cleanedAnswerString as a key and the |
|
636 |
compiledAnswer as value." |
|
637 |
||
638 |
|aCleanedAnswerString compiledAnswer| |
|
1522 | 639 |
|
3024 | 640 |
aCleanedAnswerString := self cleanInputs:(messageAnswerEditor contents). |
641 |
compiledAnswer := Compiler evaluate:aCleanedAnswerString. |
|
642 |
((self isExpression:aCleanedAnswerString) or:[ compiledAnswer isNil ]) ifTrue:[ |
|
643 |
aCleanedAnswerString := compiledAnswer printString |
|
644 |
]. |
|
645 |
^ aCleanedAnswerString -> compiledAnswer. |
|
1522 | 646 |
! |
647 |
||
648 |
openBrowserOn:anArgument |
|
649 |
"Opens browser on theArgument of a specific class. anArgument being a string with the |
|
1525 | 650 |
Class and the selector upon which the browser is to be opened. Return the receiver." |
1522 | 651 |
|
1532 | 652 |
|classAndSelector| |
1522 | 653 |
|
1532 | 654 |
classAndSelector := self extractClassAndSelectorFrom:anArgument. |
655 |
classAndSelector isNil ifTrue:[ |
|
1525 | 656 |
^ self |
1522 | 657 |
]. |
3024 | 658 |
UserPreferences systemBrowserClass |
2459 | 659 |
openInClass:classAndSelector key |
660 |
selector:classAndSelector value |
|
1525 | 661 |
|
662 |
" |
|
663 |
MethodFinderWindow new openBrowserOn: '*SmallInteger +' |
|
664 |
MethodFinderWindow new openBrowserOn: 'String ,' |
|
665 |
MethodFinderWindow new openBrowserOn: 'Number detentBy:atMultiplesOf:snap:' |
|
666 |
||
667 |
||
668 |
" |
|
1532 | 669 |
|
670 |
"Modified: / 13.11.2001 / 12:46:17 / cg" |
|
1522 | 671 |
! |
672 |
||
1529 | 673 |
openBrowserOnSelectedItem |
2927 | 674 |
"on the selected implementor" |
675 |
||
1529 | 676 |
|sel| |
677 |
||
678 |
sel := self selectedClassOfResultHolder value. |
|
679 |
self openBrowserOn:sel |
|
1532 | 680 |
|
2927 | 681 |
"Modified: / 13-11-2001 / 12:47:39 / cg" |
682 |
"Modified (comment): / 21-09-2012 / 11:08:33 / cg" |
|
683 |
! |
|
684 |
||
685 |
openBrowserOnSelectedResultItem |
|
686 |
"on an item in the lower left list, |
|
687 |
on all implementors of that message" |
|
688 |
||
689 |
|selIndex selector| |
|
690 |
||
691 |
selIndex := self selectedImplementorsHolder value. |
|
692 |
selIndex isNil ifTrue:[^ self]. |
|
693 |
||
694 |
selector := resultSelectors at:selIndex. |
|
695 |
UserPreferences browserClass browseImplementorsOf:selector. |
|
696 |
||
697 |
"Created: / 21-09-2012 / 11:05:46 / cg" |
|
1529 | 698 |
! |
699 |
||
3024 | 700 |
openBrowserOnSenderOfSelectedResultItem |
701 |
"on an item in the lower left list, |
|
702 |
on all implementors of that message" |
|
703 |
||
704 |
|selIndex selector| |
|
1525 | 705 |
|
3024 | 706 |
selIndex := self selectedImplementorsHolder value. |
707 |
selIndex isNil ifTrue:[^ self]. |
|
708 |
||
709 |
selector := resultSelectors at:selIndex. |
|
710 |
UserPreferences browserClass browseSendersOf:selector. |
|
711 |
! |
|
1522 | 712 |
|
3024 | 713 |
receiverEditorContents |
714 |
"Return a cleaned up version of receiver taken from the receiverEditor |
|
715 |
as an association. The association has aCleanedRecieverString as a key and the |
|
716 |
compiledReceiver as value." |
|
717 |
||
718 |
|aCleanedRecieverString compiledReceiver| |
|
1522 | 719 |
|
3024 | 720 |
aCleanedRecieverString := self cleanInputs:(receiverEditor contents). |
721 |
compiledReceiver := Compiler evaluate:aCleanedRecieverString. |
|
722 |
((self isExpression:aCleanedRecieverString) or:[ compiledReceiver isNil ]) ifTrue:[ |
|
723 |
aCleanedRecieverString := compiledReceiver printString |
|
724 |
]. |
|
725 |
^ aCleanedRecieverString -> compiledReceiver. |
|
1522 | 726 |
! |
727 |
||
728 |
search |
|
3024 | 729 |
"Do a search based on the input in the various text editors. Return the receiver." |
730 |
||
731 |
|tempReceiver tempAnswer tempArguments anArray resultArray receiverWithArgument mf| |
|
1522 | 732 |
|
3024 | 733 |
self resultHolder value:nil. |
734 |
self classOfResultHolder value:nil. |
|
735 |
self codeHolder value:nil. |
|
736 |
tempArguments := self argumentEditorsContents. |
|
737 |
tempReceiver := self receiverEditorContents. |
|
738 |
tempAnswer := self messageAnswerEditorContents. |
|
739 |
"self cleanInputRec:tempReceiver arg:tempArguments ans:tempAnswer." |
|
740 |
anArray := Array new:2. |
|
741 |
receiverWithArgument := self mergReciever:(tempReceiver value) |
|
742 |
WithArgument:(tempArguments values). |
|
743 |
anArray |
|
744 |
at:1 put:receiverWithArgument; |
|
745 |
at:2 put:tempAnswer value. |
|
746 |
"an array now holds the following array #(#(receiver argument) answer) or #(#(reciever) answer). which should |
|
747 |
be suitable input for the method finder." |
|
748 |
self withCursor:Cursor execute |
|
749 |
do:[ |
|
750 |
mf := MethodFinder new. |
|
751 |
resultArray := mf |
|
752 |
load:anArray; |
|
753 |
findMessage. |
|
754 |
]. |
|
755 |
((resultArray at:1) includesSubString:'no single') ifTrue:[ |
|
756 |
self warn:(resultArray at:1). |
|
757 |
^ self |
|
758 |
]. |
|
759 |
"the following then replaces data1 and data2 created by the method finder to the appropriate arguments" |
|
760 |
resultArray |
|
761 |
keysAndValuesDo:[:key :value | |
|
762 |
|newValue| |
|
1522 | 763 |
|
3024 | 764 |
newValue := value replString:'data1' withString:(tempReceiver key). |
765 |
(tempArguments size) >= 1 ifTrue:[ |
|
766 |
newValue := newValue replString:'data2' |
|
767 |
withString:(tempArguments keyAt:1) |
|
768 |
]. |
|
769 |
(tempArguments size) > 1 ifTrue:[ |
|
770 |
newValue := newValue replString:'data3' |
|
771 |
withString:(tempArguments keyAt:2). |
|
772 |
]. |
|
773 |
(tempArguments size) > 2 ifTrue:[ |
|
774 |
newValue := newValue replString:'data4' |
|
775 |
withString:(tempArguments keyAt:3). |
|
776 |
]. |
|
777 |
(tempArguments size) > 3 ifTrue:[ |
|
778 |
self halt:'unimplemented'. |
|
779 |
]. |
|
780 |
" newValue:= value replString: 'data3' withString:(self messageAnswer key). " |
|
781 |
newValue := newValue , ' --> ' , (tempAnswer key). |
|
782 |
newValue replaceAll:Character cr with:Character space. |
|
783 |
resultArray at:key put:newValue. |
|
784 |
]. |
|
785 |
self resultHolder value:resultArray. |
|
786 |
resultSelectors := mf selectors. |
|
787 |
receiver := tempReceiver |
|
1532 | 788 |
|
2859 | 789 |
"Modified: / 26-09-2011 / 12:42:28 / cg" |
1532 | 790 |
! |
791 |
||
2891 | 792 |
searchPatternChanged |
793 |
self searchPatternMatchesInBackground |
|
794 |
||
795 |
"Created: / 01-06-2012 / 13:18:16 / cg" |
|
796 |
! |
|
797 |
||
3023 | 798 |
searchPatternMatchesInBackground |
799 |
"Do a search based on the pattern match as a background task" |
|
2886 | 800 |
|
3023 | 801 |
| p pattern| |
2891 | 802 |
|
803 |
(p := searchProcess) notNil ifTrue:[ |
|
804 |
searchProcess := nil. |
|
805 |
p terminate. |
|
806 |
]. |
|
807 |
||
3023 | 808 |
pattern := self selectorPattern value. |
809 |
pattern isEmptyOrNil ifTrue:[ |
|
810 |
self resultHolder value:self resultInfoText. |
|
811 |
self classOfResultHolder value:nil. |
|
812 |
self codeHolder value:nil. |
|
813 |
^ self |
|
814 |
]. |
|
815 |
||
2891 | 816 |
searchProcess := |
817 |
[ |
|
3023 | 818 |
|list counts firsts seconds selectors resultList| |
2891 | 819 |
|
820 |
self withCursor:Cursor execute do:[ |
|
821 |
pattern includesMatchCharacters ifFalse:[ |
|
822 |
pattern := '*',pattern,'*' |
|
823 |
]. |
|
824 |
list := SystemBrowser findImplementorsMatching:pattern in:Smalltalk allClasses ignoreCase:true. |
|
825 |
]. |
|
3023 | 826 |
|
827 |
counts := IdentityDictionary new. |
|
828 |
firsts := IdentityDictionary new. |
|
829 |
seconds := IdentityDictionary new. |
|
830 |
selectors := IdentitySet new. |
|
831 |
list do:[:eachMethod | |
|
832 |
|msel| |
|
833 |
||
834 |
msel := eachMethod selector. |
|
835 |
selectors add:msel. |
|
836 |
(counts at:msel ifAbsentPut:[ 0 asValue ]) increment. |
|
837 |
(firsts includesKey:msel) ifTrue:[ |
|
838 |
(seconds includesKey:msel) ifFalse:[ |
|
839 |
seconds at:msel ifAbsentPut:[ eachMethod mclass ]. |
|
840 |
]. |
|
841 |
] ifFalse:[ |
|
842 |
firsts at:msel ifAbsentPut:[ eachMethod mclass ]. |
|
843 |
]. |
|
844 |
]. |
|
845 |
resultSelectors := selectors asOrderedCollection sort. |
|
846 |
resultList := resultSelectors |
|
847 |
collect:[:sel | |
|
848 |
|cnt s| |
|
849 |
||
850 |
s := sel allBold , ' --> '. |
|
851 |
cnt := (counts at:sel) value. |
|
852 |
cnt == 1 ifTrue:[ |
|
853 |
s , (firsts at:sel) name |
|
854 |
] ifFalse:[ |
|
855 |
cnt == 2 ifTrue:[ |
|
856 |
s , (firsts at:sel) name , ' and ' , (seconds at:sel) name |
|
857 |
] ifFalse:[ |
|
858 |
s , cnt printString , ' implementor(s)' |
|
859 |
] |
|
860 |
]. |
|
861 |
]. |
|
862 |
self enqueueDelayedAction:[ self updateListAfterPatternSearch: resultList ] |
|
2891 | 863 |
] fork. |
864 |
||
865 |
"Created: / 01-06-2012 / 13:16:54 / cg" |
|
866 |
! |
|
867 |
||
1532 | 868 |
selectedClassOfResultHolderChanged |
869 |
|sel classAndSelector mthd| |
|
870 |
||
871 |
sel := self selectedClassOfResultHolder value. |
|
872 |
||
873 |
classAndSelector := self extractClassAndSelectorFrom:sel. |
|
874 |
classAndSelector isNil ifTrue:[ |
|
875 |
^ self |
|
876 |
]. |
|
877 |
mthd := classAndSelector key >> classAndSelector value. |
|
878 |
mthd notNil ifTrue:[ |
|
879 |
self withWaitCursorDo:[ |
|
880 |
self codeHolder value:mthd source |
|
881 |
] |
|
882 |
] ifFalse:[ |
|
883 |
self codeHolder value:nil |
|
884 |
]. |
|
885 |
||
886 |
"Created: / 13.11.2001 / 12:43:43 / cg" |
|
887 |
"Modified: / 13.11.2001 / 12:48:56 / cg" |
|
1522 | 888 |
! |
889 |
||
890 |
updateImplementorsOf:anInteger |
|
1525 | 891 |
"Request the implementors of the selected argument provided by aNumber. |
2892 | 892 |
Return the receiver." |
893 |
||
894 |
|methods classList aNumber| |
|
1525 | 895 |
|
2892 | 896 |
(anInteger isNil) ifTrue:[ |
897 |
^ self |
|
898 |
]. |
|
899 |
anInteger isNil ifTrue:[ |
|
900 |
aNumber := 1 |
|
901 |
] ifFalse:[ |
|
902 |
aNumber := anInteger |
|
903 |
]. |
|
904 |
methods := SystemBrowser |
|
905 |
findImplementorsOf:(resultSelectors at:aNumber) |
|
906 |
in:Smalltalk allClasses |
|
907 |
ignoreCase:false. |
|
908 |
classList := methods asOrderedCollection |
|
909 |
collect:[:m | m mclass name , ' ' , m selector ]. |
|
910 |
classList := (self markMatchingClasses:(resultSelectors at:aNumber) |
|
911 |
classesWithSelector:classList). |
|
912 |
self classOfResultHolder value:classList. |
|
913 |
classList size > 0 ifTrue:[ |
|
914 |
self selectedClassOfResultHolder value:(classList first). |
|
915 |
self selectedClassOfResultHolderChanged. |
|
916 |
] ifFalse:[ |
|
917 |
self selectedClassOfResultHolder value:nil. |
|
918 |
]. |
|
1522 | 919 |
|
2892 | 920 |
"Modified (comment): / 24-06-2012 / 18:41:45 / cg" |
2891 | 921 |
! |
922 |
||
3023 | 923 |
updateListAfterPatternSearch:resultList |
2892 | 924 |
self classOfResultHolder value:nil. |
925 |
self codeHolder value:nil. |
|
3023 | 926 |
self resultHolder value:resultList. |
2891 | 927 |
|
928 |
"Created: / 01-06-2012 / 13:17:34 / cg" |
|
1522 | 929 |
! ! |
930 |
||
931 |
!MethodFinderWindow methodsFor:'aspects'! |
|
932 |
||
933 |
arg1BoxVisible |
|
1525 | 934 |
"Determines if the box should be visble or not. Return true or false" |
1522 | 935 |
arg1BoxVisible isNil ifTrue:[ |
936 |
arg1BoxVisible := BlockValue |
|
937 |
with:[:vh | vh value >= 2 ] |
|
938 |
argument:(self argCountHolder) |
|
939 |
]. |
|
940 |
^ arg1BoxVisible. |
|
941 |
! |
|
942 |
||
943 |
arg2BoxVisible |
|
1525 | 944 |
"Determines if the box should be visble or not. Return true or false" |
1522 | 945 |
arg2BoxVisible isNil ifTrue:[ |
946 |
arg2BoxVisible := BlockValue |
|
947 |
with:[:vh | vh value >= 3 ] |
|
948 |
argument:(self argCountHolder) |
|
949 |
]. |
|
950 |
^ arg2BoxVisible. |
|
951 |
! |
|
952 |
||
953 |
arg3BoxVisible |
|
1525 | 954 |
"Determines if the box should be visble or not. Return true or false" |
1522 | 955 |
arg3BoxVisible isNil ifTrue:[ |
956 |
arg3BoxVisible := BlockValue |
|
957 |
with:[:vh | vh value >= 4 ] |
|
958 |
argument:(self argCountHolder) |
|
959 |
]. |
|
960 |
^ arg3BoxVisible. |
|
961 |
! |
|
962 |
||
963 |
arg4BoxVisible |
|
1525 | 964 |
"Determines if the box should be visble or not. Return true or false" |
1522 | 965 |
arg4BoxVisible isNil ifTrue:[ |
966 |
arg4BoxVisible := BlockValue |
|
967 |
with:[:vh | vh value >= 5 ] |
|
968 |
argument:(self argCountHolder) |
|
969 |
]. |
|
970 |
^ arg4BoxVisible. |
|
971 |
! |
|
972 |
||
973 |
argCountHolder |
|
1525 | 974 |
"Return the value of argCounterHolder which is initialized at 2." |
1522 | 975 |
argCountHolder isNil ifTrue:[ |
976 |
argCountHolder := 2 asValue. |
|
977 |
]. |
|
978 |
^ argCountHolder. |
|
979 |
! |
|
980 |
||
981 |
argCountList |
|
1525 | 982 |
"Return the argCountList" |
1522 | 983 |
argCountList isNil ifTrue:[ |
984 |
argCountList := #('0 arguments' '1 argument' '2 arguments' '3 arguments') asValue |
|
985 |
]. |
|
986 |
^ argCountList. |
|
987 |
! |
|
988 |
||
989 |
classOfResultHolder |
|
1525 | 990 |
"Return a valueHolder which contains a collection with the names of the |
991 |
implementors of a specific message. " |
|
1522 | 992 |
|
993 |
|holder| |
|
994 |
(holder := builder bindingAt:#classOfResultHolder) isNil ifTrue:[ |
|
1525 | 995 |
holder := ValueHolder new. |
996 |
builder aspectAt:#classOfResultHolder put:holder |
|
1522 | 997 |
]. |
998 |
^ holder |
|
999 |
! |
|
1000 |
||
1532 | 1001 |
codeHolder |
1002 |
codeHolder isNil ifTrue:[ |
|
1003 |
codeHolder := '' asValue. |
|
1004 |
]. |
|
1005 |
^ codeHolder. |
|
1006 |
||
1007 |
"Created: / 13.11.2001 / 12:44:11 / cg" |
|
1008 |
! |
|
1009 |
||
1522 | 1010 |
resultHolder |
1525 | 1011 |
"Return a value holder which contains the results of a search as a collection." |
1522 | 1012 |
|
1013 |
|holder| |
|
1014 |
(holder := builder bindingAt:#resultHolder) isNil ifTrue:[ |
|
1525 | 1015 |
holder := ValueHolder new. |
1016 |
builder aspectAt:#resultHolder put:holder. |
|
3023 | 1017 |
holder value:self resultInfoText. |
1522 | 1018 |
]. |
1019 |
^ holder. |
|
2886 | 1020 |
|
2890 | 1021 |
"Modified: / 01-06-2012 / 13:06:02 / cg" |
1529 | 1022 |
! |
1023 |
||
3023 | 1024 |
resultInfoText |
1025 |
^ { |
|
1026 |
'Please enter combination of' . |
|
1027 |
' ',('receiver, arg and result' allBold) . |
|
1028 |
'or a'. |
|
1029 |
' ',('selector search pattern' allBold) . |
|
1030 |
'into the above fields, then click on either ',('"search"' allBold),'-button.' |
|
1031 |
} |
|
1032 |
! |
|
1033 |
||
1529 | 1034 |
selectedClassOfResultHolder |
2927 | 1035 |
"valueHolder which contains the index of the selected result class (right list)" |
1529 | 1036 |
|
1037 |
|holder| |
|
2927 | 1038 |
|
1529 | 1039 |
(holder := builder bindingAt:#selectedClassOfResultHolder) isNil ifTrue:[ |
1040 |
holder := ValueHolder new. |
|
1041 |
builder aspectAt:#selectedClassOfResultHolder put:holder |
|
1042 |
]. |
|
1043 |
^ holder |
|
2927 | 1044 |
|
1045 |
"Modified (comment): / 21-09-2012 / 11:10:29 / cg" |
|
1046 |
! |
|
1047 |
||
1048 |
selectedImplementorsHolder |
|
1049 |
"valueHolder which contains the index of the selected implementors list (left list)" |
|
1050 |
||
1051 |
|holder| |
|
1052 |
||
1053 |
(holder := builder bindingAt:#selectedImplementorsHolder) isNil ifTrue:[ |
|
1054 |
holder := ValueHolder new. |
|
1055 |
builder aspectAt:#selectedImplementorsHolder put:holder |
|
1056 |
]. |
|
1057 |
^ holder |
|
1058 |
||
1059 |
"Created: / 21-09-2012 / 11:10:13 / cg" |
|
2886 | 1060 |
! |
1061 |
||
1062 |
selectorPattern |
|
1063 |
|holder| |
|
1064 |
(holder := builder bindingAt:#selectorPattern) isNil ifTrue:[ |
|
1065 |
holder := ValueHolder new. |
|
1066 |
builder aspectAt:#selectorPattern put:holder. |
|
2891 | 1067 |
holder onChangeSend:#searchPatternChanged to:self. |
2886 | 1068 |
]. |
1069 |
^ holder |
|
1070 |
||
1071 |
"Created: / 27-04-2012 / 14:44:01 / cg" |
|
1522 | 1072 |
! ! |
1073 |
||
1074 |
!MethodFinderWindow methodsFor:'callBacks'! |
|
1075 |
||
1076 |
argument1WidgetCreated: aWidget |
|
1525 | 1077 |
"Store the widget as an instance variable. Return the receiver" |
1078 |
||
1079 |
||
1522 | 1080 |
argument1Editor := aWidget scrolledView. |
1532 | 1081 |
aWidget tabMeansNextField:true. |
1082 |
||
1083 |
"Modified: / 13.11.2001 / 12:21:41 / cg" |
|
1522 | 1084 |
! |
1085 |
||
1086 |
argument2WidgetCreated: aWidget |
|
1525 | 1087 |
"Store the widget as an instance variable. Return the receiver" |
1088 |
||
1522 | 1089 |
|
1090 |
argument2Editor := aWidget scrolledView. |
|
1532 | 1091 |
aWidget tabMeansNextField:true. |
1092 |
||
1093 |
"Modified: / 13.11.2001 / 12:21:45 / cg" |
|
1522 | 1094 |
! |
1095 |
||
1096 |
argument3WidgetCreated: aWidget |
|
1525 | 1097 |
"Store the widget as an instance variable. Return the receiver" |
1098 |
||
1522 | 1099 |
|
1100 |
argument3Editor := aWidget scrolledView. |
|
1532 | 1101 |
aWidget tabMeansNextField:true. |
1102 |
||
1103 |
"Modified: / 13.11.2001 / 12:21:49 / cg" |
|
1522 | 1104 |
! |
1105 |
||
1525 | 1106 |
messageAnswerWidgetCreated: aWidget |
1107 |
"Store the widget as an instance variable. Return the receiver" |
|
1522 | 1108 |
|
1525 | 1109 |
messageAnswerEditor := aWidget scrolledView. |
1532 | 1110 |
aWidget tabMeansNextField:true. |
1111 |
||
1112 |
"Modified: / 13.11.2001 / 12:24:55 / cg" |
|
1522 | 1113 |
! |
1114 |
||
1525 | 1115 |
openHTMLDocumentation |
1116 |
HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#METHODFINDER' |
|
1522 | 1117 |
! |
1118 |
||
1119 |
receiverWidgetCreated: aWidget |
|
1525 | 1120 |
"Store the widget as an instance variable. Return the receiver" |
1522 | 1121 |
|
1122 |
receiverEditor := aWidget scrolledView. |
|
1532 | 1123 |
aWidget tabMeansNextField:true. |
1124 |
||
1125 |
"Modified: / 13.11.2001 / 12:24:49 / cg" |
|
1126 |
! |
|
1127 |
||
1128 |
sourceCodeWidgetCreated: aWidget |
|
1129 |
aWidget acceptAction:nil. |
|
1130 |
aWidget readOnly:true |
|
1131 |
||
1132 |
"Created: / 13.11.2001 / 12:50:27 / cg" |
|
1133 |
"Modified: / 13.11.2001 / 12:51:23 / cg" |
|
1522 | 1134 |
! ! |
1135 |
||
1136 |
!MethodFinderWindow methodsFor:'controlInput'! |
|
1137 |
||
3090 | 1138 |
cleanInputs:aDirtyString |
1139 |
"Find and remove common mistakes made by the user. Return the |
|
1525 | 1140 |
'aStringToBeCleaned' variable" |
3090 | 1141 |
|
1142 |
|aStringToBeCleaned rs position| |
|
1522 | 1143 |
|
3090 | 1144 |
aStringToBeCleaned := aDirtyString. |
1145 |
(aStringToBeCleaned endsWith:(Character cr)) ifTrue:[ |
|
1146 |
aStringToBeCleaned := aStringToBeCleaned copyFrom:1 to:(aStringToBeCleaned size - 1). |
|
1147 |
]. |
|
1148 |
aStringToBeCleaned := aStringToBeCleaned withoutSeparators. |
|
1149 |
rs := ReadStream on:aStringToBeCleaned. |
|
1150 |
[ |
|
1151 |
rs upToAll_positionBefore:'#true'. |
|
1152 |
rs atEnd |
|
1153 |
] whileFalse:[ |
|
1154 |
position := rs position. |
|
1155 |
aStringToBeCleaned := aStringToBeCleaned |
|
1156 |
copyReplaceFrom:position |
|
1157 |
to:position |
|
1158 |
with:''. |
|
1159 |
rs := ReadStream on:aStringToBeCleaned. |
|
1160 |
]. |
|
1161 |
rs := ReadStream on:aStringToBeCleaned. |
|
1162 |
[ |
|
1163 |
rs upToAll_positionBefore:'#false'. |
|
1164 |
rs atEnd |
|
1165 |
] whileFalse:[ |
|
1166 |
position := rs position. |
|
1167 |
aStringToBeCleaned := aStringToBeCleaned |
|
1168 |
copyReplaceFrom:position |
|
1169 |
to:position |
|
1170 |
with:''. |
|
1171 |
rs := ReadStream on:aStringToBeCleaned. |
|
1172 |
]. |
|
1173 |
[ |
|
1174 |
rs upToAll_positionBefore:'#nil'. |
|
1175 |
rs atEnd |
|
1176 |
] whileFalse:[ |
|
1177 |
position := rs position. |
|
1178 |
aStringToBeCleaned := aStringToBeCleaned |
|
1179 |
copyReplaceFrom:position |
|
1180 |
to:position |
|
1181 |
with:''. |
|
1182 |
rs := ReadStream on:aStringToBeCleaned. |
|
1183 |
]. |
|
1184 |
^ aStringToBeCleaned |
|
1522 | 1185 |
! |
1186 |
||
3090 | 1187 |
markMatchingClasses:aSelector classesWithSelector:anOrderedCollection |
1188 |
" Matches the class of the receiver with all the elements in anOrderedCollection |
|
1189 |
(which are classes with selectors). If a match is found it is marked with an asterisk. |
|
1190 |
The classes are then sorted so the the asterisk appears first. Return the |
|
1191 |
markedClassList." |
|
1192 |
||
1193 |
|marker recClass unmarkedClassList markedClassList| |
|
1522 | 1194 |
|
3090 | 1195 |
marker := self class markerForImplementingClass. |
1196 |
recClass := receiver value class. |
|
1197 |
unmarkedClassList := anOrderedCollection copy. |
|
1198 |
unmarkedClassList do:[:classAndMethod | |
|
1199 |
|class| |
|
1532 | 1200 |
|
3090 | 1201 |
class := Compiler |
1202 |
evaluate:(classAndMethod upToAll:aSelector). |
|
1203 |
||
1204 |
"/ (recClass == class) |
|
1205 |
||
1206 |
(recClass whichClassImplements:aSelector) == class ifTrue:[ |
|
1207 |
"/ unmarkedClassList add: marker, classAndMethod. |
|
1208 |
unmarkedClassList add:classAndMethod allBold. |
|
1209 |
unmarkedClassList remove:classAndMethod. |
|
1532 | 1210 |
]. |
3090 | 1211 |
]. |
1212 |
unmarkedClassList |
|
1213 |
sort:[:a :b | |
|
1214 |
|rawA rawB| |
|
1522 | 1215 |
|
3090 | 1216 |
rawA := a string withoutPrefix:marker. |
1217 |
rawB := b string withoutPrefix:marker. |
|
1218 |
rawA < rawB. |
|
1219 |
]. |
|
1220 |
markedClassList := unmarkedClassList. |
|
1221 |
^ markedClassList |
|
1532 | 1222 |
|
1223 |
"Modified: / 13.11.2001 / 12:16:05 / cg" |
|
1522 | 1224 |
! |
1225 |
||
1226 |
mergReciever: aReceiver WithArgument: arguments |
|
1227 |
||
1525 | 1228 |
"Puts the receiver and arguments into an array so it can be of a suitable input for the |
1229 |
MethodFinder. Return an array." |
|
1230 |
||
1522 | 1231 |
| tempReceiver tempArguments receiverWithArgument| |
1232 |
||
1233 |
tempReceiver:= aReceiver. |
|
1234 |
tempArguments := arguments. |
|
1235 |
||
1236 |
(tempArguments isEmpty or:[(tempArguments) isNil]) |
|
1237 |
ifTrue:[ receiverWithArgument:=Array new:1."no argument" |
|
1238 |
receiverWithArgument at:1 put: tempReceiver. |
|
1239 |
] |
|
1240 |
ifFalse:[ |
|
1241 |
(tempArguments size = 1) |
|
1242 |
ifTrue:[ receiverWithArgument:=Array new:2. |
|
1243 |
receiverWithArgument at:1 put: tempReceiver. |
|
1244 |
receiverWithArgument at:2 put: (tempArguments at:1) |
|
1245 |
]. "a receiver with an argument" |
|
1246 |
||
1247 |
(tempArguments size = 2) |
|
1248 |
ifTrue:[ receiverWithArgument:=Array new:3. |
|
1249 |
receiverWithArgument at:1 put: tempReceiver. |
|
1250 |
(receiverWithArgument at:2 put: (tempArguments at:1)). |
|
1251 |
(receiverWithArgument at:3 put: (tempArguments at:2)) |
|
1252 |
]. "a receiver with an argument" |
|
1253 |
(tempArguments size = 3) |
|
1254 |
ifTrue:[ receiverWithArgument:=Array new:4. |
|
1255 |
receiverWithArgument at:1 put: tempReceiver. |
|
1256 |
(receiverWithArgument at:2 put: (tempArguments at:1)). |
|
1257 |
(receiverWithArgument at:3 put: (tempArguments at:2)). |
|
1258 |
(receiverWithArgument at:4 put: (tempArguments at:3)). |
|
1259 |
||
1260 |
]. "a receiver with an argument" |
|
1261 |
||
1262 |
]. |
|
1263 |
^receiverWithArgument |
|
1264 |
! ! |
|
1265 |
||
1532 | 1266 |
!MethodFinderWindow methodsFor:'misc'! |