author | Claus Gittinger <cg@exept.de> |
Tue, 04 Jun 2013 12:31:15 +0200 | |
changeset 3011 | ceaec66469ff |
parent 3003 | a09b88434b56 |
child 3023 | 8298397571eb |
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 |
||
3003 | 567 |
theArgument := anArgument string withoutPrefix:marker. |
1532 | 568 |
aClass := theArgument copyUpTo:(Character space). |
569 |
x := aClass size + 2. |
|
570 |
aSelector := theArgument copyFrom:x. |
|
571 |
aClass := Smalltalk classNamed:aClass. |
|
2886 | 572 |
(aSelector startsWith:'class ') ifTrue:[ |
3003 | 573 |
aSelector := aSelector withoutPrefix:'class '. |
2886 | 574 |
aClass := aClass class. |
575 |
]. |
|
1532 | 576 |
^ aClass -> aSelector asSymbol |
577 |
||
578 |
" |
|
579 |
MethodFinderWindow new extractClassAndSelectorFrom: '*SmallInteger +' |
|
580 |
MethodFinderWindow new extractClassAndSelectorFrom: 'String ,' |
|
581 |
MethodFinderWindow new extractClassAndSelectorFrom: 'Number detentBy:atMultiplesOf:snap:' |
|
582 |
||
583 |
||
584 |
" |
|
585 |
||
2886 | 586 |
"Modified: / 27-04-2012 / 15:05:53 / cg" |
1532 | 587 |
! |
588 |
||
1522 | 589 |
isExpression: aString |
1525 | 590 |
"Return true or false depending on if the subString includes certain characters" |
1522 | 591 |
(aString includesSubString:': ') ifTrue:[^true]. |
592 |
(aString includesSubString:'+') ifTrue:[^true]. |
|
593 |
(aString includesSubString:'-') ifTrue:[^true]. |
|
594 |
(aString includesSubString:'*') ifTrue:[^true]. |
|
595 |
(aString includesSubString:'/') ifTrue:[^true]. |
|
596 |
(aString includesSubString:'>') ifTrue:[^true]. |
|
597 |
(aString includesSubString:'<') ifTrue:[^true]. |
|
598 |
(aString includesSubString:' new') ifTrue:[^true]. |
|
599 |
(aString includesSubString:'[') & (aString includesSubString:']') & (aString includesSubString:'.') |
|
600 |
ifTrue:[^false]. |
|
601 |
(aString includesSubString:'.') ifTrue:[^true]. |
|
602 |
||
603 |
^false |
|
604 |
! |
|
605 |
||
606 |
messageAnswerEditorContents |
|
1525 | 607 |
"Return a cleaned up version of message answer taken from the messageAnswerEditor |
608 |
as an association. The association has cleanedAnswerString as a key and the |
|
609 |
compiledAnswer as value." |
|
1522 | 610 |
|
611 |
| aCleanedAnswerString compiledAnswer | |
|
612 |
||
613 |
aCleanedAnswerString:=self cleanInputs: (messageAnswerEditor contents). |
|
614 |
compiledAnswer:=Compiler evaluate: aCleanedAnswerString. |
|
615 |
((self isExpression:aCleanedAnswerString) or:[compiledAnswer isNil]) ifTrue:[ |
|
616 |
aCleanedAnswerString:=compiledAnswer printString]. |
|
617 |
||
618 |
^aCleanedAnswerString->compiledAnswer. |
|
619 |
! |
|
620 |
||
621 |
openBrowserOn:anArgument |
|
622 |
"Opens browser on theArgument of a specific class. anArgument being a string with the |
|
1525 | 623 |
Class and the selector upon which the browser is to be opened. Return the receiver." |
1522 | 624 |
|
1532 | 625 |
|classAndSelector| |
1522 | 626 |
|
1532 | 627 |
classAndSelector := self extractClassAndSelectorFrom:anArgument. |
628 |
classAndSelector isNil ifTrue:[ |
|
1525 | 629 |
^ self |
1522 | 630 |
]. |
2459 | 631 |
UserPreferences current systemBrowserClass |
632 |
openInClass:classAndSelector key |
|
633 |
selector:classAndSelector value |
|
1525 | 634 |
|
635 |
" |
|
636 |
MethodFinderWindow new openBrowserOn: '*SmallInteger +' |
|
637 |
MethodFinderWindow new openBrowserOn: 'String ,' |
|
638 |
MethodFinderWindow new openBrowserOn: 'Number detentBy:atMultiplesOf:snap:' |
|
639 |
||
640 |
||
641 |
" |
|
1532 | 642 |
|
643 |
"Modified: / 13.11.2001 / 12:46:17 / cg" |
|
1522 | 644 |
! |
645 |
||
1529 | 646 |
openBrowserOnSelectedItem |
2927 | 647 |
"on the selected implementor" |
648 |
||
1529 | 649 |
|sel| |
650 |
||
651 |
sel := self selectedClassOfResultHolder value. |
|
652 |
self openBrowserOn:sel |
|
1532 | 653 |
|
2927 | 654 |
"Modified: / 13-11-2001 / 12:47:39 / cg" |
655 |
"Modified (comment): / 21-09-2012 / 11:08:33 / cg" |
|
656 |
! |
|
657 |
||
658 |
openBrowserOnSelectedResultItem |
|
659 |
"on an item in the lower left list, |
|
660 |
on all implementors of that message" |
|
661 |
||
662 |
|selIndex selector| |
|
663 |
||
664 |
selIndex := self selectedImplementorsHolder value. |
|
665 |
selIndex isNil ifTrue:[^ self]. |
|
666 |
||
667 |
selector := resultSelectors at:selIndex. |
|
668 |
UserPreferences browserClass browseImplementorsOf:selector. |
|
669 |
||
670 |
"Created: / 21-09-2012 / 11:05:46 / cg" |
|
1529 | 671 |
! |
672 |
||
1522 | 673 |
receiverEditorContents |
1525 | 674 |
"Return a cleaned up version of receiver taken from the receiverEditor |
675 |
as an association. The association has aCleanedRecieverString as a key and the |
|
676 |
compiledReceiver as value." |
|
677 |
||
1522 | 678 |
| aCleanedRecieverString compiledReceiver | |
679 |
||
680 |
aCleanedRecieverString:=self cleanInputs: (receiverEditor contents). |
|
681 |
||
682 |
compiledReceiver:=Compiler evaluate: aCleanedRecieverString. |
|
683 |
||
684 |
((self isExpression:aCleanedRecieverString) or:[compiledReceiver isNil]) ifTrue:[ |
|
685 |
aCleanedRecieverString:=compiledReceiver printString]. |
|
686 |
^aCleanedRecieverString->compiledReceiver. |
|
687 |
! |
|
688 |
||
689 |
search |
|
1525 | 690 |
"Do a search based on the input in the various text editors. Return the receiver." |
1522 | 691 |
| tempReceiver tempAnswer tempArguments anArray resultArray receiverWithArgument mf| |
1534 | 692 |
|
693 |
self resultHolder value: nil. "reset the result list" |
|
1522 | 694 |
self classOfResultHolder value: nil. "reset the implementorOf list" |
1534 | 695 |
self codeHolder value: nil. "reset the source" |
1522 | 696 |
|
697 |
tempArguments:=self argumentEditorsContents. |
|
698 |
tempReceiver :=self receiverEditorContents . |
|
699 |
tempAnswer:= self messageAnswerEditorContents. |
|
700 |
||
701 |
"self cleanInputRec:tempReceiver arg:tempArguments ans:tempAnswer." |
|
702 |
||
703 |
||
704 |
anArray:=Array new:2. "creates an array which is to be used as input for the method finder." |
|
705 |
||
706 |
receiverWithArgument:=self mergReciever: (tempReceiver value) WithArgument: (tempArguments values). |
|
707 |
||
708 |
anArray at:1 put:receiverWithArgument; |
|
709 |
at:2 put: tempAnswer value. |
|
710 |
||
711 |
"an array now holds the following array #(#(receiver argument) answer) or #(#(reciever) answer). which should |
|
712 |
be suitable input for the method finder." |
|
1534 | 713 |
self withCursor:Cursor execute do:[ |
714 |
mf:= MethodFinder new. |
|
715 |
resultArray:= mf load: anArray; findMessage. |
|
716 |
]. |
|
1522 | 717 |
|
718 |
((resultArray at: 1 )includesSubString: 'no single') ifTrue:[ |
|
719 |
self warn: (resultArray at: 1 ). |
|
720 |
^self |
|
721 |
]. |
|
722 |
"the following then replaces data1 and data2 created by the method finder to the appropriate arguments" |
|
2859 | 723 |
|
1522 | 724 |
resultArray keysAndValuesDo:[:key :value | | newValue | |
725 |
newValue:= value replString: 'data1' withString:(tempReceiver key). |
|
726 |
(tempArguments size) >= 1 ifTrue:[ |
|
727 |
newValue:= newValue replString: 'data2' withString:(tempArguments keyAt:1)]. |
|
728 |
||
729 |
(tempArguments size) > 1 ifTrue:[ |
|
730 |
newValue:= newValue replString: 'data3' withString:(tempArguments keyAt:2).]. |
|
731 |
||
732 |
(tempArguments size) > 2 ifTrue:[ |
|
733 |
newValue:= newValue replString: 'data4' withString:(tempArguments keyAt:3).]. |
|
734 |
||
2859 | 735 |
(tempArguments size) > 3 ifTrue:[ self halt:'unimplemented'. ]. |
1532 | 736 |
|
1522 | 737 |
|
738 |
" newValue:= value replString: 'data3' withString:(self messageAnswer key). " |
|
739 |
||
740 |
newValue:=newValue, ' --> ', (tempAnswer key). |
|
1532 | 741 |
newValue replaceAll:Character cr with:Character space. |
1522 | 742 |
|
743 |
resultArray at: key put: newValue. |
|
744 |
||
745 |
]. |
|
746 |
||
747 |
self resultHolder value: resultArray. |
|
748 |
resultSelectors:= mf selectors. "used to find implementors so we do not have to " |
|
749 |
receiver:=tempReceiver "search the string for the selector found. Stored as an ordered collection" |
|
1532 | 750 |
|
2859 | 751 |
"Modified: / 26-09-2011 / 12:42:28 / cg" |
1532 | 752 |
! |
753 |
||
2891 | 754 |
searchPatternChanged |
755 |
"/ self searchPatternMatches |
|
756 |
self searchPatternMatchesInBackground |
|
757 |
||
758 |
"Created: / 01-06-2012 / 13:18:16 / cg" |
|
759 |
! |
|
760 |
||
2886 | 761 |
searchPatternMatches |
762 |
"Do a search based on the pattern match" |
|
763 |
||
764 |
| pattern list selectors counts| |
|
765 |
||
766 |
pattern := self selectorPattern value. |
|
767 |
||
768 |
self resultHolder value: nil. "reset the result list" |
|
769 |
self classOfResultHolder value: nil. "reset the implementorOf list" |
|
770 |
self codeHolder value: nil. "reset the source" |
|
771 |
||
772 |
self withCursor:Cursor execute do:[ |
|
2889
e17b2eacfe84
changed: #searchPatternMatches
Claus Gittinger <cg@exept.de>
parents:
2887
diff
changeset
|
773 |
pattern includesMatchCharacters ifFalse:[ |
e17b2eacfe84
changed: #searchPatternMatches
Claus Gittinger <cg@exept.de>
parents:
2887
diff
changeset
|
774 |
pattern := '*',pattern,'*' |
e17b2eacfe84
changed: #searchPatternMatches
Claus Gittinger <cg@exept.de>
parents:
2887
diff
changeset
|
775 |
]. |
2886 | 776 |
list := SystemBrowser findImplementorsMatching:pattern in:Smalltalk allClasses ignoreCase:true. |
777 |
]. |
|
778 |
||
779 |
counts := IdentityDictionary new. |
|
780 |
selectors := IdentitySet new. |
|
781 |
||
782 |
list do:[:eachMethod | |
|
783 |
selectors add: eachMethod selector. |
|
784 |
(counts at:(eachMethod selector) ifAbsentPut:[0 asValue]) increment |
|
785 |
]. |
|
786 |
||
787 |
resultSelectors := selectors asOrderedCollection sort. |
|
788 |
||
789 |
self resultHolder value: (resultSelectors collect:[:sel | sel,' --> ',(counts at:sel) value printString,' implementor(s)']). |
|
790 |
||
791 |
"Created: / 27-04-2012 / 14:46:35 / cg" |
|
792 |
! |
|
793 |
||
2891 | 794 |
searchPatternMatchesInBackground |
795 |
"Do a search based on the pattern match" |
|
796 |
||
797 |
| p pattern list| |
|
798 |
||
799 |
(p := searchProcess) notNil ifTrue:[ |
|
800 |
searchProcess := nil. |
|
801 |
p terminate. |
|
802 |
]. |
|
803 |
||
804 |
searchProcess := |
|
805 |
[ |
|
806 |
pattern := self selectorPattern value. |
|
807 |
||
808 |
self withCursor:Cursor execute do:[ |
|
809 |
pattern includesMatchCharacters ifFalse:[ |
|
810 |
pattern := '*',pattern,'*' |
|
811 |
]. |
|
812 |
list := SystemBrowser findImplementorsMatching:pattern in:Smalltalk allClasses ignoreCase:true. |
|
813 |
]. |
|
814 |
self enqueueDelayedAction:[ self updateListAfterPatternSearch: list ] |
|
815 |
] fork. |
|
816 |
||
817 |
"Created: / 01-06-2012 / 13:16:54 / cg" |
|
818 |
! |
|
819 |
||
1532 | 820 |
selectedClassOfResultHolderChanged |
821 |
|sel classAndSelector mthd| |
|
822 |
||
823 |
sel := self selectedClassOfResultHolder value. |
|
824 |
||
825 |
classAndSelector := self extractClassAndSelectorFrom:sel. |
|
826 |
classAndSelector isNil ifTrue:[ |
|
827 |
^ self |
|
828 |
]. |
|
829 |
mthd := classAndSelector key >> classAndSelector value. |
|
830 |
mthd notNil ifTrue:[ |
|
831 |
self withWaitCursorDo:[ |
|
832 |
self codeHolder value:mthd source |
|
833 |
] |
|
834 |
] ifFalse:[ |
|
835 |
self codeHolder value:nil |
|
836 |
]. |
|
837 |
||
838 |
"Created: / 13.11.2001 / 12:43:43 / cg" |
|
839 |
"Modified: / 13.11.2001 / 12:48:56 / cg" |
|
1522 | 840 |
! |
841 |
||
842 |
updateImplementorsOf:anInteger |
|
1525 | 843 |
"Request the implementors of the selected argument provided by aNumber. |
2892 | 844 |
Return the receiver." |
845 |
||
846 |
|methods classList aNumber| |
|
1525 | 847 |
|
2892 | 848 |
(anInteger isNil) ifTrue:[ |
849 |
^ self |
|
850 |
]. |
|
851 |
anInteger isNil ifTrue:[ |
|
852 |
aNumber := 1 |
|
853 |
] ifFalse:[ |
|
854 |
aNumber := anInteger |
|
855 |
]. |
|
856 |
methods := SystemBrowser |
|
857 |
findImplementorsOf:(resultSelectors at:aNumber) |
|
858 |
in:Smalltalk allClasses |
|
859 |
ignoreCase:false. |
|
860 |
classList := methods asOrderedCollection |
|
861 |
collect:[:m | m mclass name , ' ' , m selector ]. |
|
862 |
classList := (self markMatchingClasses:(resultSelectors at:aNumber) |
|
863 |
classesWithSelector:classList). |
|
864 |
self classOfResultHolder value:classList. |
|
865 |
classList size > 0 ifTrue:[ |
|
866 |
self selectedClassOfResultHolder value:(classList first). |
|
867 |
self selectedClassOfResultHolderChanged. |
|
868 |
] ifFalse:[ |
|
869 |
self selectedClassOfResultHolder value:nil. |
|
870 |
]. |
|
1522 | 871 |
|
2892 | 872 |
"Modified (comment): / 24-06-2012 / 18:41:45 / cg" |
2891 | 873 |
! |
874 |
||
2892 | 875 |
updateListAfterPatternSearch:list |
2891 | 876 |
"Do a search based on the pattern match" |
2892 | 877 |
|
878 |
|selectors counts firsts| |
|
2891 | 879 |
|
2892 | 880 |
self resultHolder value:nil. |
881 |
self classOfResultHolder value:nil. |
|
882 |
self codeHolder value:nil. |
|
2891 | 883 |
counts := IdentityDictionary new. |
2892 | 884 |
firsts := IdentityDictionary new. |
2891 | 885 |
selectors := IdentitySet new. |
2892 | 886 |
list do:[:eachMethod | |
887 |
selectors add:eachMethod selector. |
|
888 |
(counts at:(eachMethod selector) ifAbsentPut:[ 0 asValue ]) increment. |
|
889 |
firsts at:(eachMethod selector) ifAbsentPut:[ eachMethod mclass ]. |
|
890 |
]. |
|
891 |
resultSelectors := selectors asOrderedCollection sort. |
|
892 |
self resultHolder value:(resultSelectors |
|
893 |
collect:[:sel | |
|
894 |
|cnt| |
|
2891 | 895 |
|
2892 | 896 |
cnt := (counts at:sel) value. |
897 |
cnt == 1 ifTrue:[ |
|
898 |
sel , ' --> ' , (firsts at:sel) name |
|
899 |
] ifFalse:[ |
|
900 |
sel , ' --> ' , cnt printString , ' implementor(s)' |
|
901 |
]. |
|
902 |
]). |
|
2891 | 903 |
|
904 |
"Created: / 01-06-2012 / 13:17:34 / cg" |
|
1522 | 905 |
! ! |
906 |
||
907 |
!MethodFinderWindow methodsFor:'aspects'! |
|
908 |
||
909 |
arg1BoxVisible |
|
1525 | 910 |
"Determines if the box should be visble or not. Return true or false" |
1522 | 911 |
arg1BoxVisible isNil ifTrue:[ |
912 |
arg1BoxVisible := BlockValue |
|
913 |
with:[:vh | vh value >= 2 ] |
|
914 |
argument:(self argCountHolder) |
|
915 |
]. |
|
916 |
^ arg1BoxVisible. |
|
917 |
! |
|
918 |
||
919 |
arg2BoxVisible |
|
1525 | 920 |
"Determines if the box should be visble or not. Return true or false" |
1522 | 921 |
arg2BoxVisible isNil ifTrue:[ |
922 |
arg2BoxVisible := BlockValue |
|
923 |
with:[:vh | vh value >= 3 ] |
|
924 |
argument:(self argCountHolder) |
|
925 |
]. |
|
926 |
^ arg2BoxVisible. |
|
927 |
! |
|
928 |
||
929 |
arg3BoxVisible |
|
1525 | 930 |
"Determines if the box should be visble or not. Return true or false" |
1522 | 931 |
arg3BoxVisible isNil ifTrue:[ |
932 |
arg3BoxVisible := BlockValue |
|
933 |
with:[:vh | vh value >= 4 ] |
|
934 |
argument:(self argCountHolder) |
|
935 |
]. |
|
936 |
^ arg3BoxVisible. |
|
937 |
! |
|
938 |
||
939 |
arg4BoxVisible |
|
1525 | 940 |
"Determines if the box should be visble or not. Return true or false" |
1522 | 941 |
arg4BoxVisible isNil ifTrue:[ |
942 |
arg4BoxVisible := BlockValue |
|
943 |
with:[:vh | vh value >= 5 ] |
|
944 |
argument:(self argCountHolder) |
|
945 |
]. |
|
946 |
^ arg4BoxVisible. |
|
947 |
! |
|
948 |
||
949 |
argCountHolder |
|
1525 | 950 |
"Return the value of argCounterHolder which is initialized at 2." |
1522 | 951 |
argCountHolder isNil ifTrue:[ |
952 |
argCountHolder := 2 asValue. |
|
953 |
]. |
|
954 |
^ argCountHolder. |
|
955 |
! |
|
956 |
||
957 |
argCountList |
|
1525 | 958 |
"Return the argCountList" |
1522 | 959 |
argCountList isNil ifTrue:[ |
960 |
argCountList := #('0 arguments' '1 argument' '2 arguments' '3 arguments') asValue |
|
961 |
]. |
|
962 |
^ argCountList. |
|
963 |
! |
|
964 |
||
965 |
classOfResultHolder |
|
1525 | 966 |
"Return a valueHolder which contains a collection with the names of the |
967 |
implementors of a specific message. " |
|
1522 | 968 |
|
969 |
|holder| |
|
970 |
(holder := builder bindingAt:#classOfResultHolder) isNil ifTrue:[ |
|
1525 | 971 |
holder := ValueHolder new. |
972 |
builder aspectAt:#classOfResultHolder put:holder |
|
1522 | 973 |
]. |
974 |
^ holder |
|
975 |
! |
|
976 |
||
1532 | 977 |
codeHolder |
978 |
codeHolder isNil ifTrue:[ |
|
979 |
codeHolder := '' asValue. |
|
980 |
]. |
|
981 |
^ codeHolder. |
|
982 |
||
983 |
"Created: / 13.11.2001 / 12:44:11 / cg" |
|
984 |
! |
|
985 |
||
1522 | 986 |
resultHolder |
1525 | 987 |
"Return a value holder which contains the results of a search as a collection." |
1522 | 988 |
|
989 |
|holder| |
|
990 |
(holder := builder bindingAt:#resultHolder) isNil ifTrue:[ |
|
1525 | 991 |
holder := ValueHolder new. |
992 |
builder aspectAt:#resultHolder put:holder. |
|
2887 | 993 |
holder value:{ |
994 |
'Please enter combination of' . |
|
995 |
' ',('receiver, arg and result' allBold) . |
|
996 |
'or a'. |
|
997 |
' ',('selector search pattern' allBold) . |
|
2890 | 998 |
'into the above fields, then click on either ',('"search"' allBold),'-button.' |
2887 | 999 |
} |
1522 | 1000 |
]. |
1001 |
^ holder. |
|
2886 | 1002 |
|
2890 | 1003 |
"Modified: / 01-06-2012 / 13:06:02 / cg" |
1529 | 1004 |
! |
1005 |
||
1006 |
selectedClassOfResultHolder |
|
2927 | 1007 |
"valueHolder which contains the index of the selected result class (right list)" |
1529 | 1008 |
|
1009 |
|holder| |
|
2927 | 1010 |
|
1529 | 1011 |
(holder := builder bindingAt:#selectedClassOfResultHolder) isNil ifTrue:[ |
1012 |
holder := ValueHolder new. |
|
1013 |
builder aspectAt:#selectedClassOfResultHolder put:holder |
|
1014 |
]. |
|
1015 |
^ holder |
|
2927 | 1016 |
|
1017 |
"Modified (comment): / 21-09-2012 / 11:10:29 / cg" |
|
1018 |
! |
|
1019 |
||
1020 |
selectedImplementorsHolder |
|
1021 |
"valueHolder which contains the index of the selected implementors list (left list)" |
|
1022 |
||
1023 |
|holder| |
|
1024 |
||
1025 |
(holder := builder bindingAt:#selectedImplementorsHolder) isNil ifTrue:[ |
|
1026 |
holder := ValueHolder new. |
|
1027 |
builder aspectAt:#selectedImplementorsHolder put:holder |
|
1028 |
]. |
|
1029 |
^ holder |
|
1030 |
||
1031 |
"Created: / 21-09-2012 / 11:10:13 / cg" |
|
2886 | 1032 |
! |
1033 |
||
1034 |
selectorPattern |
|
1035 |
|holder| |
|
1036 |
(holder := builder bindingAt:#selectorPattern) isNil ifTrue:[ |
|
1037 |
holder := ValueHolder new. |
|
1038 |
builder aspectAt:#selectorPattern put:holder. |
|
2891 | 1039 |
holder onChangeSend:#searchPatternChanged to:self. |
2886 | 1040 |
]. |
1041 |
^ holder |
|
1042 |
||
1043 |
"Created: / 27-04-2012 / 14:44:01 / cg" |
|
1522 | 1044 |
! ! |
1045 |
||
1046 |
!MethodFinderWindow methodsFor:'callBacks'! |
|
1047 |
||
1048 |
argument1WidgetCreated: aWidget |
|
1525 | 1049 |
"Store the widget as an instance variable. Return the receiver" |
1050 |
||
1051 |
||
1522 | 1052 |
argument1Editor := aWidget scrolledView. |
1532 | 1053 |
aWidget tabMeansNextField:true. |
1054 |
||
1055 |
"Modified: / 13.11.2001 / 12:21:41 / cg" |
|
1522 | 1056 |
! |
1057 |
||
1058 |
argument2WidgetCreated: aWidget |
|
1525 | 1059 |
"Store the widget as an instance variable. Return the receiver" |
1060 |
||
1522 | 1061 |
|
1062 |
argument2Editor := aWidget scrolledView. |
|
1532 | 1063 |
aWidget tabMeansNextField:true. |
1064 |
||
1065 |
"Modified: / 13.11.2001 / 12:21:45 / cg" |
|
1522 | 1066 |
! |
1067 |
||
1068 |
argument3WidgetCreated: aWidget |
|
1525 | 1069 |
"Store the widget as an instance variable. Return the receiver" |
1070 |
||
1522 | 1071 |
|
1072 |
argument3Editor := aWidget scrolledView. |
|
1532 | 1073 |
aWidget tabMeansNextField:true. |
1074 |
||
1075 |
"Modified: / 13.11.2001 / 12:21:49 / cg" |
|
1522 | 1076 |
! |
1077 |
||
1525 | 1078 |
messageAnswerWidgetCreated: aWidget |
1079 |
"Store the widget as an instance variable. Return the receiver" |
|
1522 | 1080 |
|
1525 | 1081 |
messageAnswerEditor := aWidget scrolledView. |
1532 | 1082 |
aWidget tabMeansNextField:true. |
1083 |
||
1084 |
"Modified: / 13.11.2001 / 12:24:55 / cg" |
|
1522 | 1085 |
! |
1086 |
||
1525 | 1087 |
openHTMLDocumentation |
1088 |
HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#METHODFINDER' |
|
1522 | 1089 |
! |
1090 |
||
1091 |
receiverWidgetCreated: aWidget |
|
1525 | 1092 |
"Store the widget as an instance variable. Return the receiver" |
1522 | 1093 |
|
1094 |
receiverEditor := aWidget scrolledView. |
|
1532 | 1095 |
aWidget tabMeansNextField:true. |
1096 |
||
1097 |
"Modified: / 13.11.2001 / 12:24:49 / cg" |
|
1098 |
! |
|
1099 |
||
1100 |
sourceCodeWidgetCreated: aWidget |
|
1101 |
aWidget acceptAction:nil. |
|
1102 |
aWidget readOnly:true |
|
1103 |
||
1104 |
"Created: / 13.11.2001 / 12:50:27 / cg" |
|
1105 |
"Modified: / 13.11.2001 / 12:51:23 / cg" |
|
1522 | 1106 |
! ! |
1107 |
||
1108 |
!MethodFinderWindow methodsFor:'controlInput'! |
|
1109 |
||
1110 |
cleanInputs: aDirtyString |
|
1525 | 1111 |
"Find and remove common mistakes made by the user. Return the |
1112 |
'aStringToBeCleaned' variable" |
|
1522 | 1113 |
| aStringToBeCleaned rs position| |
1114 |
||
1115 |
aStringToBeCleaned:=aDirtyString. |
|
1116 |
||
1117 |
(aStringToBeCleaned endsWith:(Character cr)) ifTrue:[ |
|
1118 |
aStringToBeCleaned:=aStringToBeCleaned copyFrom:1 to: (aStringToBeCleaned size -1).]. |
|
1119 |
aStringToBeCleaned:= aStringToBeCleaned withoutSeparators. |
|
1120 |
||
1121 |
||
1122 |
rs:=ReadStream on: aStringToBeCleaned. |
|
1123 |
[rs upToAll: '#true'. rs atEnd] whileFalse: [ |
|
1124 |
position:= rs position. |
|
1125 |
aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #" |
|
1126 |
rs:=ReadStream on: aStringToBeCleaned. |
|
1127 |
]. |
|
1128 |
||
1129 |
rs:=ReadStream on: aStringToBeCleaned. |
|
1130 |
[rs upToAll: '#false'. rs atEnd] whileFalse: [ |
|
1131 |
position:= rs position. |
|
1132 |
aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #" |
|
1133 |
rs:=ReadStream on: aStringToBeCleaned. |
|
1134 |
rs:=ReadStream on: aStringToBeCleaned. ]. |
|
1135 |
||
1136 |
[rs upToAll: '#nil'. rs atEnd] whileFalse: [ |
|
1137 |
position:= rs position. |
|
1138 |
aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #" |
|
1139 |
rs:=ReadStream on: aStringToBeCleaned. ]. |
|
1140 |
^aStringToBeCleaned |
|
1141 |
! |
|
1142 |
||
1525 | 1143 |
markMatchingClasses: aSelector classesWithSelector:anOrderedCollection |
1144 |
" Matches the class of the receiver with all the elements in anOrderedCollection |
|
1145 |
(which are classes with selectors). If a match is found it is marked with an asterisk. |
|
1146 |
The classes are then sorted so the the asterisk appears first. Return the |
|
1147 |
markedClassList." |
|
1522 | 1148 |
|
2165 | 1149 |
| marker recClass unmarkedClassList markedClassList| |
1522 | 1150 |
|
1532 | 1151 |
marker := self class markerForImplementingClass. |
1152 |
||
1153 |
recClass := receiver value class. |
|
1525 | 1154 |
unmarkedClassList:=anOrderedCollection copy. |
1155 |
unmarkedClassList do: |
|
1156 |
[:classAndMethod | | class | |
|
1157 |
class:=Compiler evaluate: |
|
1158 |
((ReadStream on: classAndMethod) upToAll: aSelector). |
|
1532 | 1159 |
"/ (recClass == class) |
1160 |
(recClass whichClassImplements:aSelector) == class |
|
1161 |
ifTrue: |
|
1162 |
["/ unmarkedClassList add: marker, classAndMethod. |
|
1163 |
unmarkedClassList add: classAndMethod allBold. |
|
1164 |
unmarkedClassList remove: classAndMethod. |
|
1165 |
]. |
|
1166 |
]. |
|
1522 | 1167 |
|
1168 |
unmarkedClassList sort:[:a :b | |rawA rawB| |
|
3003 | 1169 |
rawA := a string withoutPrefix:marker. |
1170 |
rawB := b string withoutPrefix:marker. |
|
1532 | 1171 |
rawA < rawB. ]. |
1525 | 1172 |
markedClassList:= unmarkedClassList. |
1173 |
||
1174 |
^markedClassList |
|
1532 | 1175 |
|
1176 |
"Modified: / 13.11.2001 / 12:16:05 / cg" |
|
1522 | 1177 |
! |
1178 |
||
1179 |
mergReciever: aReceiver WithArgument: arguments |
|
1180 |
||
1525 | 1181 |
"Puts the receiver and arguments into an array so it can be of a suitable input for the |
1182 |
MethodFinder. Return an array." |
|
1183 |
||
1522 | 1184 |
| tempReceiver tempArguments receiverWithArgument| |
1185 |
||
1186 |
tempReceiver:= aReceiver. |
|
1187 |
tempArguments := arguments. |
|
1188 |
||
1189 |
(tempArguments isEmpty or:[(tempArguments) isNil]) |
|
1190 |
ifTrue:[ receiverWithArgument:=Array new:1."no argument" |
|
1191 |
receiverWithArgument at:1 put: tempReceiver. |
|
1192 |
] |
|
1193 |
ifFalse:[ |
|
1194 |
(tempArguments size = 1) |
|
1195 |
ifTrue:[ receiverWithArgument:=Array new:2. |
|
1196 |
receiverWithArgument at:1 put: tempReceiver. |
|
1197 |
receiverWithArgument at:2 put: (tempArguments at:1) |
|
1198 |
]. "a receiver with an argument" |
|
1199 |
||
1200 |
(tempArguments size = 2) |
|
1201 |
ifTrue:[ receiverWithArgument:=Array new:3. |
|
1202 |
receiverWithArgument at:1 put: tempReceiver. |
|
1203 |
(receiverWithArgument at:2 put: (tempArguments at:1)). |
|
1204 |
(receiverWithArgument at:3 put: (tempArguments at:2)) |
|
1205 |
]. "a receiver with an argument" |
|
1206 |
(tempArguments size = 3) |
|
1207 |
ifTrue:[ receiverWithArgument:=Array new:4. |
|
1208 |
receiverWithArgument at:1 put: tempReceiver. |
|
1209 |
(receiverWithArgument at:2 put: (tempArguments at:1)). |
|
1210 |
(receiverWithArgument at:3 put: (tempArguments at:2)). |
|
1211 |
(receiverWithArgument at:4 put: (tempArguments at:3)). |
|
1212 |
||
1213 |
]. "a receiver with an argument" |
|
1214 |
||
1215 |
]. |
|
1216 |
^receiverWithArgument |
|
1217 |
! ! |
|
1218 |
||
1532 | 1219 |
!MethodFinderWindow methodsFor:'misc'! |
1220 |
||
1221 |
aboutThisApplicationText |
|
1222 |
|msg| |
|
1223 |
||
1224 |
msg := super aboutThisApplicationText. |
|
2412 | 1225 |
msg := msg , '\\Ported from Squeak to ST/X by James Hayes (james@exept.de). |
1226 |
Original written by Ted Kaehler, Scott Wallace and Dan Ingalls.'. |
|
1532 | 1227 |
^msg withCRs. |
1228 |
||
1229 |
"Modified: / 13.11.2001 / 12:56:44 / cg" |
|
1230 |
! ! |
|
1231 |
||
1522 | 1232 |
!MethodFinderWindow class methodsFor:'documentation'! |
1233 |
||
1234 |
version |
|
1235 |
^ '$Header$' |
|
2730 | 1236 |
! |
1237 |
||
1238 |
version_CVS |
|
1239 |
^ '$Header$' |
|
1522 | 1240 |
! ! |
3003 | 1241 |