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