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