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