MethodFinderWindow.st
changeset 1522 f67b97bc683a
child 1525 c91fbd9f8338
equal deleted inserted replaced
1521:2efd2b9419c4 1522:f67b97bc683a
       
     1 "{ Package: 'stx:libtool2' }"
       
     2 
       
     3 ApplicationModel subclass:#MethodFinderWindow
       
     4 	instanceVariableNames:'argumentsEditor messageAnswerEditor receiverEditor receiver
       
     5 		resultSelectors arg2BoxVisible arg1BoxVisible arg4BoxVisible
       
     6 		arg3BoxVisible argCountHolder argCountList argument1Editor
       
     7 		argument2Editor argument3Editor argument4Editor resultSelected
       
     8 		lookAtResultEditor'
       
     9 	classVariableNames:''
       
    10 	poolDictionaries:''
       
    11 	category:'MethodFinder-James'
       
    12 !
       
    13 
       
    14 
       
    15 !MethodFinderWindow class methodsFor:'interface specs'!
       
    16 
       
    17 windowSpec
       
    18     "This resource specification was automatically generated
       
    19      by the UIPainter of ST/X."
       
    20 
       
    21     "Do not manually edit this!! If it is corrupted,
       
    22      the UIPainter may not be able to read the specification."
       
    23 
       
    24     "
       
    25      UIPainter new openOnClass:MethodFinderWindow andSelector:#windowSpec
       
    26      MethodFinderWindow new openInterface:#windowSpec
       
    27      MethodFinderWindow open
       
    28     "
       
    29 
       
    30     <resource: #canvas>
       
    31 
       
    32     ^ 
       
    33      #(#FullSpec
       
    34         #name: #windowSpec
       
    35         #window: 
       
    36        #(#WindowSpec
       
    37           #label: 'MethodFinder'
       
    38           #name: 'MethodFinder'
       
    39           #min: #(#Point 10 10)
       
    40           #max: #(#Point 1280 1024)
       
    41           #bounds: #(#Rectangle 16 47 818 718)
       
    42         )
       
    43         #component: 
       
    44        #(#SpecCollection
       
    45           #collection: #(
       
    46            #(#ComboListSpec
       
    47               #name: 'allowedArgments'
       
    48               #layout: #(#LayoutFrame 0 0.201912 4 0 0 0.364397 22 0)
       
    49               #model: #argCountHolder
       
    50               #comboList: #argCountList
       
    51               #useIndex: true
       
    52             )
       
    53            #(#ActionButtonSpec
       
    54               #label: 'Search'
       
    55               #name: 'Button1'
       
    56               #layout: #(#LayoutFrame 0 0.426523 132 0 0 0.575866 154 0)
       
    57               #translateLabel: true
       
    58               #tabable: true
       
    59               #model: #search
       
    60             )
       
    61            #(#ActionButtonSpec
       
    62               #label: 'Clear'
       
    63               #name: 'Button2'
       
    64               #layout: #(#LayoutFrame 0 0.258065 132 0 0 0.407407 154 0)
       
    65               #translateLabel: true
       
    66               #model: #clear
       
    67             )
       
    68            #(#SequenceViewSpec
       
    69               #name: 'List1'
       
    70               #layout: #(#LayoutFrame 0 0 161 0 0 0.6 0 0.5)
       
    71               #hasHorizontalScrollBar: true
       
    72               #hasVerticalScrollBar: true
       
    73               #autoHideScrollBars: true
       
    74               #valueChangeSelector: #updateImplementorsOf:
       
    75               #useIndex: true
       
    76               #sequenceList: #resultHolder
       
    77             )
       
    78            #(#SequenceViewSpec
       
    79               #name: 'List2'
       
    80               #layout: #(#LayoutFrame 0 0.6 0 0 0 1 0 0.5)
       
    81               #hasHorizontalScrollBar: true
       
    82               #hasVerticalScrollBar: true
       
    83               #autoHideScrollBars: true
       
    84               #doubleClickSelector: #openBrowserOn:
       
    85               #useIndex: false
       
    86               #sequenceList: #classOfResultHolder
       
    87             )
       
    88            #(#HorizontalPanelViewSpec
       
    89               #name: 'HorizontalPanel1'
       
    90               #layout: #(#LayoutFrame 6 0 26 0 0 0.6 129 0)
       
    91               #horizontalLayout: #fit
       
    92               #verticalLayout: #fit
       
    93               #horizontalSpace: 3
       
    94               #verticalSpace: 3
       
    95               #component: 
       
    96              #(#SpecCollection
       
    97                 #collection: #(
       
    98                  #(#WorkspaceSpec
       
    99                     #name: 'ReceiverEditor'
       
   100                     #tabable: true
       
   101                     #hasHorizontalScrollBar: false
       
   102                     #hasVerticalScrollBar: false
       
   103                     #autoHideScrollBars: true
       
   104                     #extent: #(#Point 156 103)
       
   105                     #postBuildCallback: #receiverWidgetCreated:
       
   106                   )
       
   107                  #(#VerticalPanelViewSpec
       
   108                     #name: 'VerticalPanel1'
       
   109                     #horizontalLayout: #fit
       
   110                     #verticalLayout: #fit
       
   111                     #horizontalSpace: 3
       
   112                     #verticalSpace: 3
       
   113                     #component: 
       
   114                    #(#SpecCollection
       
   115                       #collection: #(
       
   116                        #(#ViewSpec
       
   117                           #name: 'Box1'
       
   118                           #visibilityChannel: #arg1BoxVisible
       
   119                           #component: 
       
   120                          #(#SpecCollection
       
   121                             #collection: #(
       
   122                              #(#WorkspaceSpec
       
   123                                 #name: 'Arg1Editor'
       
   124                                 #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   125                                 #tabable: true
       
   126                                 #hasHorizontalScrollBar: false
       
   127                                 #hasVerticalScrollBar: false
       
   128                                 #autoHideScrollBars: true
       
   129                                 #postBuildCallback: #argument1WidgetCreated:
       
   130                               )
       
   131                              )
       
   132                            
       
   133                           )
       
   134                           #extent: #(#Point 156 32)
       
   135                         )
       
   136                        #(#ViewSpec
       
   137                           #name: 'Box2'
       
   138                           #visibilityChannel: #arg2BoxVisible
       
   139                           #component: 
       
   140                          #(#SpecCollection
       
   141                             #collection: #(
       
   142                              #(#WorkspaceSpec
       
   143                                 #name: 'TextEditor5'
       
   144                                 #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   145                                 #tabable: true
       
   146                                 #hasHorizontalScrollBar: false
       
   147                                 #hasVerticalScrollBar: false
       
   148                                 #autoHideScrollBars: true
       
   149                                 #postBuildCallback: #argument2WidgetCreated:
       
   150                               )
       
   151                              )
       
   152                            
       
   153                           )
       
   154                           #extent: #(#Point 156 33)
       
   155                         )
       
   156                        #(#ViewSpec
       
   157                           #name: 'Box3'
       
   158                           #visibilityChannel: #arg3BoxVisible
       
   159                           #component: 
       
   160                          #(#SpecCollection
       
   161                             #collection: #(
       
   162                              #(#WorkspaceSpec
       
   163                                 #name: 'TextEditor6'
       
   164                                 #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   165                                 #tabable: true
       
   166                                 #hasHorizontalScrollBar: false
       
   167                                 #hasVerticalScrollBar: false
       
   168                                 #autoHideScrollBars: true
       
   169                                 #postBuildCallback: #argument3WidgetCreated:
       
   170                               )
       
   171                              )
       
   172                            
       
   173                           )
       
   174                           #extent: #(#Point 156 32)
       
   175                         )
       
   176                        )
       
   177                      
       
   178                     )
       
   179                     #extent: #(#Point 156 103)
       
   180                   )
       
   181                  #(#WorkspaceSpec
       
   182                     #name: 'AnswerEditor'
       
   183                     #tabable: true
       
   184                     #hasHorizontalScrollBar: false
       
   185                     #hasVerticalScrollBar: false
       
   186                     #autoHideScrollBars: true
       
   187                     #extent: #(#Point 157 103)
       
   188                     #postBuildCallback: #messageAnswerWidgetCreated:
       
   189                   )
       
   190                  )
       
   191                
       
   192               )
       
   193             )
       
   194            #(#LabelSpec
       
   195               #label: 'MessageAnswer'
       
   196               #name: 'MessageAnswerLabel'
       
   197               #layout: #(#LayoutFrame 325 0 2 0 475 0 25 0)
       
   198               #translateLabel: true
       
   199               #adjust: #left
       
   200             )
       
   201            #(#LabelSpec
       
   202               #label: 'Reciever'
       
   203               #name: 'RecieverLabel'
       
   204               #layout: #(#LayoutFrame 7 0 3 0 126 0 26 0)
       
   205               #translateLabel: true
       
   206               #adjust: #left
       
   207             )
       
   208            #(#WorkspaceSpec
       
   209               #name: 'TextEditor4'
       
   210               #layout: #(#LayoutFrame 0 0 0 0.5 0 1 0 1)
       
   211               #model: #provideHelpComment
       
   212               #hasHorizontalScrollBar: true
       
   213               #hasVerticalScrollBar: true
       
   214             )
       
   215            #(#WorkspaceSpec
       
   216               #name: 'Workspace1'
       
   217               #layout: #(#LayoutFrame 0 0 0 0.5 0 0.5 0 1)
       
   218               #model: #resultSelected
       
   219               #hasHorizontalScrollBar: true
       
   220               #hasVerticalScrollBar: true
       
   221               #postBuildCallback: #lookAtResultEditor:
       
   222             )
       
   223            )
       
   224          
       
   225         )
       
   226       )
       
   227 ! !
       
   228 
       
   229 !MethodFinderWindow methodsFor:'accessing'!
       
   230 
       
   231 receiver
       
   232     "return the value of the instance variable 'receiver' (automatically generated)"
       
   233 
       
   234     ^ receiver copy
       
   235 ! !
       
   236 
       
   237 !MethodFinderWindow methodsFor:'actions'!
       
   238 
       
   239 argumentEditorsContents
       
   240      | tempArguments argCounter tempArgument1Editor tempArgument2Editor tempArgument3Editor tempArgument4Editor
       
   241 associationKey associationValue|
       
   242 
       
   243 argCounter:=0.
       
   244 
       
   245 tempArgument1Editor:= (self cleanInputs: argument1Editor contents).
       
   246 tempArgument2Editor:=  (self cleanInputs: argument2Editor contents).
       
   247 tempArgument3Editor:= (self cleanInputs: argument3Editor contents).
       
   248 
       
   249 tempArgument1Editor = '' ifFalse:[argCounter:=argCounter +1].
       
   250 tempArgument2Editor = '' ifFalse:[argCounter:=argCounter +1].
       
   251 tempArgument3Editor = '' ifFalse:[argCounter:=argCounter +1].
       
   252 
       
   253 
       
   254 argCounter:= (argCounter min: (self argCountHolder value -1)).
       
   255 tempArguments:= OrderedDictionary new:argCounter. 
       
   256 
       
   257 (argCounter value >= 1) 
       
   258                 ifTrue:[associationValue:= (Compiler evaluate: tempArgument1Editor).
       
   259                         ((self isExpression:tempArgument1Editor) or:[ associationValue isNil]) ifTrue:[                  "looks if an expression is typed in"
       
   260                                         associationKey:=associationValue printString]
       
   261                                                           ifFalse:[
       
   262                                         associationKey:=tempArgument1Editor].
       
   263 
       
   264                         tempArguments add: associationKey-> associationValue.
       
   265                         ].
       
   266 (argCounter value >= 2) 
       
   267                 ifTrue:[ associationValue:= (Compiler evaluate: tempArgument2Editor).
       
   268                         (((self isExpression:tempArgument2Editor) or:[ associationValue isNil])) ifTrue:[                  "looks if an expression is typed in"
       
   269                                         associationKey:=associationValue printString]
       
   270                                                           ifFalse:[
       
   271                                         associationKey:=tempArgument2Editor].
       
   272 
       
   273                         tempArguments add: associationKey-> associationValue].
       
   274 
       
   275 (argCounter value >= 3)
       
   276                 ifTrue:[ associationValue:= (Compiler evaluate: tempArgument3Editor).
       
   277                         ((self isExpression:tempArgument3Editor) or:[ associationValue isNil]) ifTrue:[                  "looks if an expression is typed in"
       
   278                                         associationKey:=associationValue printString]
       
   279                                                           ifFalse:[
       
   280                                         associationKey:=tempArgument3Editor].
       
   281 
       
   282                         tempArguments add: associationKey-> associationValue].
       
   283 
       
   284 
       
   285 ^tempArguments
       
   286 !
       
   287 
       
   288 clear
       
   289     "automatically generated by UIPainter ..."
       
   290 
       
   291     "*** the code below performs no action"
       
   292 
       
   293     "*** (except for some feedback on the Transcript)"
       
   294 
       
   295     "*** Please change as required and accept in the browser."
       
   296 
       
   297     "action to be added ..."
       
   298 
       
   299     receiverEditor contents:nil.
       
   300     argument1Editor contents:nil.
       
   301     argument2Editor contents:nil.
       
   302     argument3Editor contents:nil.
       
   303     messageAnswerEditor contents:nil.
       
   304     self resultHolder value:nil.
       
   305     Transcript showCR:self class name , ': action for reset ...'
       
   306 !
       
   307 
       
   308 isExpression: aString
       
   309 
       
   310 (aString includesSubString:': ') ifTrue:[^true].
       
   311 (aString includesSubString:'+') ifTrue:[^true].
       
   312 (aString includesSubString:'-') ifTrue:[^true].
       
   313 (aString includesSubString:'*') ifTrue:[^true].
       
   314 (aString includesSubString:'/') ifTrue:[^true].
       
   315 (aString includesSubString:'>') ifTrue:[^true].
       
   316 (aString includesSubString:'<') ifTrue:[^true].
       
   317 (aString includesSubString:' new') ifTrue:[^true].
       
   318 (aString includesSubString:'[') &  (aString includesSubString:']') & (aString includesSubString:'.')
       
   319                                 ifTrue:[^false].
       
   320 (aString includesSubString:'.') ifTrue:[^true].
       
   321 
       
   322  ^false
       
   323 !
       
   324 
       
   325 lookAtMessage:  anArgument
       
   326     "Opens browser on theArgument of a specific class. anArgument being a string with the
       
   327        Class and the selector upon which the browser is to be opened."
       
   328 
       
   329     |aClass aSelector x theArgument|
       
   330    self halt.
       
   331 
       
   332 
       
   333 !
       
   334 
       
   335 messageAnswerEditorContents
       
   336 
       
   337     |   aCleanedAnswerString   compiledAnswer  |
       
   338 
       
   339 aCleanedAnswerString:=self cleanInputs: (messageAnswerEditor contents). 
       
   340 
       
   341 compiledAnswer:=Compiler evaluate: aCleanedAnswerString.
       
   342 ((self isExpression:aCleanedAnswerString) or:[compiledAnswer isNil]) ifTrue:[
       
   343                         aCleanedAnswerString:=compiledAnswer printString].
       
   344 
       
   345 ^aCleanedAnswerString->compiledAnswer.
       
   346 !
       
   347 
       
   348 openBrowserOn:anArgument 
       
   349     "Opens browser on theArgument of a specific class. anArgument being a string with the
       
   350        Class and the selector upon which the browser is to be opened."
       
   351 
       
   352     |aClass aSelector x theArgument|
       
   353 
       
   354     anArgument isNil ifTrue:[
       
   355 	^ self
       
   356     ].
       
   357     (anArgument at:1) == $* ifTrue:[
       
   358 	theArgument := anArgument copyFrom:2
       
   359     ] ifFalse:[
       
   360 	theArgument := anArgument
       
   361     ].
       
   362     aClass := theArgument copyUpTo:(Character space).
       
   363     x := aClass size + 2.
       
   364     aSelector := theArgument copyFrom:x.
       
   365     aClass := Smalltalk classNamed:aClass.
       
   366     SystemBrowser openInClass:(aClass) selector:(aSelector asSymbol)    "/ Compiler evaluate: (aClass asSymbol). 
       
   367 !
       
   368 
       
   369 receiverEditorContents
       
   370     |   aCleanedRecieverString   compiledReceiver  |
       
   371 
       
   372 aCleanedRecieverString:=self cleanInputs: (receiverEditor contents). 
       
   373 
       
   374 compiledReceiver:=Compiler evaluate: aCleanedRecieverString.
       
   375 
       
   376 ((self isExpression:aCleanedRecieverString) or:[compiledReceiver isNil]) ifTrue:[
       
   377                         aCleanedRecieverString:=compiledReceiver printString].
       
   378 ^aCleanedRecieverString->compiledReceiver.
       
   379 !
       
   380 
       
   381 search
       
   382 | tempReceiver tempAnswer tempArguments anArray resultArray receiverWithArgument mf|
       
   383 
       
   384 self resultHolder value: nil.               "reset the result list"
       
   385 self classOfResultHolder value: nil.        "reset the implementorOf list"
       
   386 
       
   387 tempArguments:=self argumentEditorsContents.
       
   388 tempReceiver :=self receiverEditorContents .  
       
   389 tempAnswer:= self messageAnswerEditorContents.   
       
   390 
       
   391 "self cleanInputRec:tempReceiver arg:tempArguments ans:tempAnswer."
       
   392 
       
   393 
       
   394 anArray:=Array new:2.  "creates an array which is to be used as input for the method finder."
       
   395 
       
   396 receiverWithArgument:=self mergReciever: (tempReceiver value) WithArgument: (tempArguments values).
       
   397 
       
   398 anArray at:1 put:receiverWithArgument;
       
   399         at:2 put: tempAnswer value.             
       
   400 
       
   401 "an array now holds the following array #(#(receiver argument) answer) or #(#(reciever) answer). which should
       
   402 be suitable input for the method finder."
       
   403 self halt.
       
   404 mf:= MethodFinder new.
       
   405 resultArray:= mf load: anArray; findMessage. 
       
   406 
       
   407 ((resultArray at:  1 )includesSubString: 'no single') ifTrue:[
       
   408                                 self warn: (resultArray at:  1 ).
       
   409                                 ^self
       
   410                                                               ].  
       
   411 
       
   412 "the following then replaces data1 and data2 created by the method finder to the appropriate arguments"
       
   413 resultArray keysAndValuesDo:[:key :value |   | newValue | 
       
   414       newValue:= value replString: 'data1' withString:(tempReceiver key).
       
   415 (tempArguments size) >= 1 ifTrue:[
       
   416       newValue:= newValue replString: 'data2' withString:(tempArguments keyAt:1)].
       
   417 
       
   418 (tempArguments size) > 1 ifTrue:[
       
   419       newValue:= newValue replString: 'data3' withString:(tempArguments keyAt:2).].
       
   420 
       
   421 (tempArguments size) > 2 ifTrue:[
       
   422       newValue:= newValue replString: 'data4' withString:(tempArguments keyAt:3).].
       
   423 
       
   424 
       
   425                         "    newValue:= value replString: 'data3' withString:(self messageAnswer key). " 
       
   426 
       
   427       newValue:=newValue, ' --> ', (tempAnswer key).
       
   428 
       
   429       resultArray at: key put: newValue.
       
   430 
       
   431               ].
       
   432 
       
   433 self resultHolder value: resultArray.
       
   434 resultSelectors:= mf selectors.   "used to find implementors so we do not have to "
       
   435 receiver:=tempReceiver            "search the string for the selector found. Stored as an ordered collection"
       
   436 !
       
   437 
       
   438 updateImplementorsOf:anInteger 
       
   439     "  Request the implementors of the selected arguments "
       
   440       |methods classList aNumber|
       
   441 
       
   442         self updateWorkSpace: anInteger .
       
   443        (anInteger isNil) ifTrue:[^self].
       
   444       anInteger isNil ifTrue:[aNumber:=1]
       
   445                       ifFalse:[aNumber:=anInteger].  
       
   446       methods _ SystemBrowser findImplementorsOf: (resultSelectors at:aNumber) in:Smalltalk allClasses ignoreCase:false.
       
   447       classList _ methods asOrderedCollection collect:[:m | m mclass name , ' ' , m selector].
       
   448 
       
   449       classList:=(self markMatchingClasses:(resultSelectors at:aNumber) classesWithSelector:classList).
       
   450 
       
   451     self classOfResultHolder value: classList.
       
   452 !
       
   453 
       
   454 updateWorkSpace: anInteger
       
   455 
       
   456 
       
   457       anInteger isNil ifTrue:[^self].
       
   458    resultSelected:= (self resultHolder value at:anInteger). 
       
   459         lookAtResultEditor replace:(resultSelected).
       
   460 ! !
       
   461 
       
   462 !MethodFinderWindow methodsFor:'aspects'!
       
   463 
       
   464 arg1BoxVisible
       
   465     arg1BoxVisible isNil ifTrue:[
       
   466         arg1BoxVisible := BlockValue
       
   467                               with:[:vh | vh value >= 2 ]
       
   468                               argument:(self argCountHolder)
       
   469     ].
       
   470     ^ arg1BoxVisible.
       
   471 !
       
   472 
       
   473 arg2BoxVisible
       
   474     arg2BoxVisible isNil ifTrue:[
       
   475         arg2BoxVisible := BlockValue
       
   476                               with:[:vh | vh value >= 3 ]
       
   477                               argument:(self argCountHolder)
       
   478     ].
       
   479     ^ arg2BoxVisible.
       
   480 !
       
   481 
       
   482 arg3BoxVisible
       
   483     arg3BoxVisible isNil ifTrue:[
       
   484         arg3BoxVisible := BlockValue
       
   485                               with:[:vh | vh value >= 4 ]
       
   486                               argument:(self argCountHolder)
       
   487     ].
       
   488     ^ arg3BoxVisible.
       
   489 !
       
   490 
       
   491 arg4BoxVisible
       
   492     arg4BoxVisible isNil ifTrue:[
       
   493         arg4BoxVisible := BlockValue
       
   494                               with:[:vh | vh value >= 5 ]
       
   495                               argument:(self argCountHolder)
       
   496     ].
       
   497     ^ arg4BoxVisible.
       
   498 !
       
   499 
       
   500 argCountHolder
       
   501     argCountHolder isNil ifTrue:[
       
   502         argCountHolder := 2 asValue.
       
   503     ].     
       
   504     ^ argCountHolder.
       
   505 !
       
   506 
       
   507 argCountList
       
   508     argCountList isNil ifTrue:[
       
   509         argCountList := #('0 arguments' '1 argument' '2 arguments' '3 arguments') asValue  
       
   510     ].
       
   511     ^ argCountList.
       
   512 !
       
   513 
       
   514 classOfResultHolder
       
   515     "Stores a valueHolder for "
       
   516 
       
   517     |holder|
       
   518 
       
   519     (holder := builder bindingAt:#classOfResultHolder) isNil ifTrue:[
       
   520 	holder := ValueHolder new.
       
   521 	builder aspectAt:#classOfResultHolder put:holder
       
   522     ].
       
   523     ^ holder
       
   524 !
       
   525 
       
   526 resultHolder
       
   527     "automatically generated by UIPainter ..."
       
   528 
       
   529     "*** the code below creates a default model when invoked."
       
   530     "*** (which may not be the one you wanted)"
       
   531     "*** Please change as required and accept it in the browser."
       
   532     "*** (and replace this comment by something more useful ;-)"
       
   533 
       
   534     |holder|
       
   535 
       
   536     (holder := builder bindingAt:#resultHolder) isNil ifTrue:[
       
   537 	holder := ValueHolder new.
       
   538 	builder aspectAt:#resultHolder put:holder.
       
   539 "/ if your app needs to be notified of changes, uncomment one of the lines below:
       
   540 "/        holder addDependent:self.
       
   541 "/        holder onChangeSend:#resultHolderChanged to:self.
       
   542     ].
       
   543     ^ holder.
       
   544 ! !
       
   545 
       
   546 !MethodFinderWindow methodsFor:'callBacks'!
       
   547 
       
   548 argument1WidgetCreated: aWidget
       
   549         argument1Editor := aWidget scrolledView.
       
   550 !
       
   551 
       
   552 argument2WidgetCreated: aWidget
       
   553 
       
   554         argument2Editor := aWidget scrolledView.
       
   555 !
       
   556 
       
   557 argument3WidgetCreated: aWidget
       
   558 
       
   559         argument3Editor := aWidget scrolledView.
       
   560 !
       
   561 
       
   562 argumentsWidgetCreated: aWidget
       
   563 
       
   564         argumentsEditor := aWidget scrolledView.
       
   565 !
       
   566 
       
   567 lookAtResultEditor: aWidget
       
   568 
       
   569           lookAtResultEditor := aWidget scrolledView.
       
   570 !
       
   571 
       
   572 messageAnswerWidgetCreated: aWidget
       
   573 
       
   574 	messageAnswerEditor := aWidget scrolledView.
       
   575 !
       
   576 
       
   577 provideHelpComment
       
   578  self halt.
       
   579 ^'test'
       
   580 !
       
   581 
       
   582 receiverWidgetCreated: aWidget
       
   583 
       
   584         receiverEditor := aWidget scrolledView.
       
   585 ! !
       
   586 
       
   587 !MethodFinderWindow methodsFor:'controlInput'!
       
   588 
       
   589 cleanInputs: aDirtyString
       
   590         "Find an remove common mistakes.  Complain when ill formed."
       
   591        | aStringToBeCleaned rs position|
       
   592 
       
   593    aStringToBeCleaned:=aDirtyString.
       
   594 
       
   595 (aStringToBeCleaned endsWith:(Character cr)) ifTrue:[
       
   596                         aStringToBeCleaned:=aStringToBeCleaned copyFrom:1 to: (aStringToBeCleaned size -1).].
       
   597 aStringToBeCleaned:= aStringToBeCleaned withoutSeparators.
       
   598 
       
   599 
       
   600 rs:=ReadStream on: aStringToBeCleaned.
       
   601 [rs upToAll: '#true'.  rs atEnd] whileFalse: [
       
   602                         position:= rs position. 
       
   603                         aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #"
       
   604                         rs:=ReadStream on: aStringToBeCleaned.
       
   605                         ].
       
   606 
       
   607 rs:=ReadStream on: aStringToBeCleaned.
       
   608 [rs upToAll: '#false'.  rs atEnd] whileFalse: [
       
   609                         position:= rs position. 
       
   610                         aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #"
       
   611                         rs:=ReadStream on: aStringToBeCleaned.
       
   612                         rs:=ReadStream on: aStringToBeCleaned. ].
       
   613 
       
   614 [rs upToAll: '#nil'.  rs atEnd] whileFalse: [
       
   615                         position:= rs position. 
       
   616                         aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #"
       
   617                         rs:=ReadStream on: aStringToBeCleaned.  ].
       
   618                    ^aStringToBeCleaned    
       
   619 !
       
   620 
       
   621 markMatchingClasses
       
   622 	"If an example is used, mark classes matching the example instance with an asterisk."
       
   623 
       
   624 	| unmarkedClassList firstPartOfSelector receiverString receiver |
       
   625 
       
   626 	"Only 'example' queries can be marked."
       
   627 
       
   628 	unmarkedClassList _ resultSelectors copy.
       
   629 
       
   630 
       
   631 
       
   632 
       
   633 	unmarkedClassList do:
       
   634 		[:classAndMethod | | class |
       
   635 		class _ Compiler evaluate:
       
   636 				((ReadStream on: classAndMethod) upToAll: firstPartOfSelector).
       
   637 		(receiver class == class) ifTrue:
       
   638 			[resultSelectors add: '*', classAndMethod.
       
   639 			resultSelectors remove: classAndMethod]].
       
   640 
       
   641       resultSelectors sort:[:a :b | |rawA rawB|
       
   642 		    rawA := (a startsWith:'*') ifTrue:[a copyFrom:2] ifFalse:[a].
       
   643 		    rawB := (b startsWith:'*') ifTrue:[b copyFrom:2] ifFalse:[b].
       
   644 		    rawA > rawB.  ]
       
   645 !
       
   646 
       
   647 markMatchingClasses: aSelector  classesWithSelector:anOrderedCollection
       
   648 	"If an example is used, mark classes matching the example instance with an asterisk."
       
   649 
       
   650 	| unmarkedClassList firstPartOfSelector |
       
   651 
       
   652 	"Only 'example' queries can be marked."
       
   653 	unmarkedClassList _ anOrderedCollection copy.
       
   654 
       
   655 
       
   656 
       
   657 
       
   658 	unmarkedClassList do:
       
   659 		[:classAndMethod | | class |
       
   660 		class _ Compiler evaluate:
       
   661 				((ReadStream on: classAndMethod) upToAll: aSelector).
       
   662 		(receiver value class == class) ifTrue:
       
   663 			[unmarkedClassList add: '*', classAndMethod.
       
   664 			unmarkedClassList remove: classAndMethod]].
       
   665 
       
   666       unmarkedClassList sort:[:a :b | |rawA rawB|
       
   667 		    rawA := (a startsWith:'*') ifTrue:[a copyFrom:2] ifFalse:[a].
       
   668 		    rawB := (b startsWith:'*') ifTrue:[b copyFrom:2] ifFalse:[b].
       
   669 		    rawA > rawB.  ].
       
   670 	 ^unmarkedClassList
       
   671 !
       
   672 
       
   673 mergReciever: aReceiver WithArgument: arguments
       
   674 
       
   675 | tempReceiver tempArguments receiverWithArgument|
       
   676 
       
   677   tempReceiver:= aReceiver.
       
   678  tempArguments :=  arguments.
       
   679 
       
   680 (tempArguments isEmpty or:[(tempArguments) isNil])
       
   681                 ifTrue:[  receiverWithArgument:=Array new:1."no argument"
       
   682                           receiverWithArgument at:1 put: tempReceiver.     
       
   683                         ]
       
   684                 ifFalse:[
       
   685         (tempArguments size = 1)
       
   686                         ifTrue:[ receiverWithArgument:=Array new:2.
       
   687                                   receiverWithArgument at:1 put: tempReceiver.      
       
   688                                   receiverWithArgument at:2 put: (tempArguments at:1)
       
   689                                 ].  "a receiver with an argument"
       
   690 
       
   691         (tempArguments size = 2)
       
   692                         ifTrue:[ receiverWithArgument:=Array new:3.
       
   693                                   receiverWithArgument at:1 put: tempReceiver.      
       
   694                                   (receiverWithArgument at:2 put: (tempArguments at:1)).
       
   695                                   (receiverWithArgument at:3 put: (tempArguments at:2))
       
   696                                 ].  "a receiver with an argument"
       
   697         (tempArguments size = 3)
       
   698                         ifTrue:[ receiverWithArgument:=Array new:4.
       
   699                                   receiverWithArgument at:1 put: tempReceiver.      
       
   700                                   (receiverWithArgument at:2 put: (tempArguments at:1)).
       
   701                                   (receiverWithArgument at:3 put: (tempArguments at:2)).
       
   702                                   (receiverWithArgument at:4 put: (tempArguments at:3)).
       
   703 
       
   704                                 ].  "a receiver with an argument"
       
   705         (tempArguments size = 4)
       
   706                         ifTrue:[ receiverWithArgument:=Array new:5.
       
   707                                   receiverWithArgument at:1 put: tempReceiver.      
       
   708                                   (receiverWithArgument at:2 put: (tempArguments at:1)).
       
   709                                   (receiverWithArgument at:3 put: (tempArguments at:2)).
       
   710                                   (receiverWithArgument at:4 put: (tempArguments at:3)).
       
   711                                   (receiverWithArgument at:5 put: (tempArguments at:4)).
       
   712 
       
   713                                 ].  "a receiver with an argument"
       
   714 
       
   715                         ].
       
   716 ^receiverWithArgument
       
   717 ! !
       
   718 
       
   719 !MethodFinderWindow class methodsFor:'documentation'!
       
   720 
       
   721 version
       
   722     ^ '$Header$'
       
   723 ! !