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