MethodFinderWindow.st
changeset 1532 318c295490c1
parent 1531 9d4f8cd101fa
child 1533 fbe494613685
equal deleted inserted replaced
1531:9d4f8cd101fa 1532:318c295490c1
     3 ApplicationModel subclass:#MethodFinderWindow
     3 ApplicationModel subclass:#MethodFinderWindow
     4 	instanceVariableNames:'argumentsEditor messageAnswerEditor receiverEditor receiver
     4 	instanceVariableNames:'argumentsEditor messageAnswerEditor receiverEditor receiver
     5 		resultSelectors arg2BoxVisible arg1BoxVisible arg4BoxVisible
     5 		resultSelectors arg2BoxVisible arg1BoxVisible arg4BoxVisible
     6 		arg3BoxVisible argCountHolder argCountList argument1Editor
     6 		arg3BoxVisible argCountHolder argCountList argument1Editor
     7 		argument2Editor argument3Editor argument4Editor resultSelected
     7 		argument2Editor argument3Editor argument4Editor resultSelected
     8 		lookAtResultEditor'
     8 		lookAtResultEditor codeHolder'
     9 	classVariableNames:''
     9 	classVariableNames:''
    10 	poolDictionaries:''
    10 	poolDictionaries:''
    11 	category:'MethodFinder'
    11 	category:'MethodFinder'
    12 !
    12 !
    13 
    13 
    16 documentation
    16 documentation
    17 "
    17 "
    18   [author:]
    18   [author:]
    19     ported from Squeak and GUI enhanced by James Hayes james@exept.de
    19     ported from Squeak and GUI enhanced by James Hayes james@exept.de
    20 "
    20 "
       
    21 ! !
       
    22 
       
    23 !MethodFinderWindow class methodsFor:'constants'!
       
    24 
       
    25 markerForImplementingClass
       
    26     ^ '=> '.
       
    27     ^ '*'
       
    28 
       
    29     "Created: / 13.11.2001 / 12:09:52 / cg"
       
    30     "Modified: / 13.11.2001 / 12:11:57 / cg"
    21 ! !
    31 ! !
    22 
    32 
    23 !MethodFinderWindow class methodsFor:'interface specs'!
    33 !MethodFinderWindow class methodsFor:'interface specs'!
    24 
    34 
    25 windowSpec
    35 windowSpec
    51           #forceRecursiveBackground: false
    61           #forceRecursiveBackground: false
    52         )
    62         )
    53         #component: 
    63         #component: 
    54        #(#SpecCollection
    64        #(#SpecCollection
    55           #collection: #(
    65           #collection: #(
    56            #(#ViewSpec
    66            #(#VariableHorizontalPanelSpec
    57               #name: 'Box6'
    67               #name: 'VariableHorizontalPanel1'
    58               #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
    68               #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
    59               #level: 1
    69               #snapMode: #both
    60               #component: 
    70               #component: 
    61              #(#SpecCollection
    71              #(#SpecCollection
    62                 #collection: #(
    72                 #collection: #(
    63                  #(#SequenceViewSpec
       
    64                     #name: 'List1'
       
    65                     #layout: #(#LayoutFrame 0 0 0 0.5 0 0.65 0 1)
       
    66                     #hasHorizontalScrollBar: true
       
    67                     #hasVerticalScrollBar: true
       
    68                     #autoHideScrollBars: true
       
    69                     #valueChangeSelector: #updateImplementorsOf:
       
    70                     #useIndex: true
       
    71                     #sequenceList: #resultHolder
       
    72                   )
       
    73                  #(#SequenceViewSpec
       
    74                     #name: 'List2'
       
    75                     #layout: #(#LayoutFrame 0 0.65 0 0 0 1 0 1)
       
    76                     #model: #selectedClassOfResultHolder
       
    77                     #menu: #implementorListMenu
       
    78                     #hasHorizontalScrollBar: true
       
    79                     #hasVerticalScrollBar: true
       
    80                     #autoHideScrollBars: true
       
    81                     #doubleClickSelector: #openBrowserOn:
       
    82                     #useIndex: false
       
    83                     #sequenceList: #classOfResultHolder
       
    84                   )
       
    85                  #(#ViewSpec
    73                  #(#ViewSpec
    86                     #name: 'Box4'
    74                     #name: 'Box6'
    87                     #layout: #(#LayoutFrame 0 0 0 0 0 0.65 -25 0.5)
    75                     #level: 1
    88                     #component: 
    76                     #component: 
    89                    #(#SpecCollection
    77                    #(#SpecCollection
    90                       #collection: #(
    78                       #collection: #(
    91                        #(#LabelSpec
    79                        #(#SequenceViewSpec
    92                           #label: 'Receiver'
    80                           #name: 'List1'
    93                           #name: 'ReceiverLabel'
    81                           #layout: #(#LayoutFrame 0 0 0 0.5 0 1 0 1)
    94                           #layout: #(#LayoutFrame -4 0.0162791 0 0 -4 0.293023 24 0)
    82                           #hasHorizontalScrollBar: true
    95                           #translateLabel: true
    83                           #hasVerticalScrollBar: true
    96                           #adjust: #left
    84                           #autoHideScrollBars: true
       
    85                           #valueChangeSelector: #updateImplementorsOf:
       
    86                           #useIndex: true
       
    87                           #sequenceList: #resultHolder
    97                         )
    88                         )
    98                        #(#ComboListSpec
    89                        #(#ViewSpec
    99                           #name: 'allowedArgments'
    90                           #name: 'Box4'
   100                           #layout: #(#LayoutFrame 0 0.339535 1 0 0 0.653488 23 0)
    91                           #layout: #(#LayoutFrame 0 0 0 0 0 1 -25 0.5)
   101                           #model: #argCountHolder
       
   102                           #comboList: #argCountList
       
   103                           #useIndex: true
       
   104                         )
       
   105                        #(#LabelSpec
       
   106                           #label: 'MessageAnswer'
       
   107                           #name: 'MessageAnswerLabel'
       
   108                           #layout: #(#LayoutFrame 0 0.6693 0 0 0 0.99023 24 0)
       
   109                           #translateLabel: true
       
   110                           #adjust: #left
       
   111                         )
       
   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: 
    92                           #component: 
   120                          #(#SpecCollection
    93                          #(#SpecCollection
   121                             #collection: #(
    94                             #collection: #(
   122                              #(#WorkspaceSpec
    95                              #(#LabelSpec
   123                                 #name: 'ReceiverEditor'
    96                                 #label: 'Receiver'
   124                                 #tabable: true
    97                                 #name: 'ReceiverLabel'
   125                                 #hasHorizontalScrollBar: true
    98                                 #layout: #(#LayoutFrame -4 0.0162791 0 0 -4 0.293023 24 0)
   126                                 #hasVerticalScrollBar: true
    99                                 #translateLabel: true
   127                                 #miniScrollerHorizontal: true
   100                                 #adjust: #center
   128                                 #miniScrollerVertical: true
       
   129                                 #autoHideScrollBars: true
       
   130                                 #extent: #(#Point 116 149)
       
   131                                 #postBuildCallback: #receiverWidgetCreated:
       
   132                               )
   101                               )
   133                              #(#VerticalPanelViewSpec
   102                              #(#ComboListSpec
   134                                 #name: 'VerticalPanel1'
   103                                 #name: 'allowedArgments'
       
   104                                 #layout: #(#LayoutFrame 0 0.339535 1 0 0 0.653488 23 0)
       
   105                                 #model: #argCountHolder
       
   106                                 #comboList: #argCountList
       
   107                                 #useIndex: true
       
   108                               )
       
   109                              #(#LabelSpec
       
   110                                 #label: 'Answer'
       
   111                                 #name: 'MessageAnswerLabel'
       
   112                                 #layout: #(#LayoutFrame 0 0.6693 0 0 0 0.99023 24 0)
       
   113                                 #translateLabel: true
       
   114                                 #adjust: #center
       
   115                               )
       
   116                              #(#HorizontalPanelViewSpec
       
   117                                 #name: 'HorizontalPanel1'
       
   118                                 #layout: #(#LayoutFrame 0 0 25 0 0 1 0 1)
   135                                 #horizontalLayout: #fit
   119                                 #horizontalLayout: #fit
   136                                 #verticalLayout: #fit
   120                                 #verticalLayout: #fit
   137                                 #horizontalSpace: 3
   121                                 #horizontalSpace: 3
   138                                 #verticalSpace: 3
   122                                 #verticalSpace: 3
   139                                 #component: 
   123                                 #component: 
   140                                #(#SpecCollection
   124                                #(#SpecCollection
   141                                   #collection: #(
   125                                   #collection: #(
   142                                    #(#ViewSpec
   126                                    #(#WorkspaceSpec
   143                                       #name: 'Box1'
   127                                       #name: 'ReceiverEditor'
   144                                       #visibilityChannel: #arg1BoxVisible
   128                                       #tabable: true
       
   129                                       #hasHorizontalScrollBar: true
       
   130                                       #hasVerticalScrollBar: true
       
   131                                       #miniScrollerHorizontal: true
       
   132                                       #miniScrollerVertical: true
       
   133                                       #autoHideScrollBars: true
       
   134                                       #extent: #(#Point 87 149)
       
   135                                       #postBuildCallback: #receiverWidgetCreated:
       
   136                                     )
       
   137                                    #(#VerticalPanelViewSpec
       
   138                                       #name: 'VerticalPanel1'
       
   139                                       #horizontalLayout: #fit
       
   140                                       #verticalLayout: #fit
       
   141                                       #horizontalSpace: 3
       
   142                                       #verticalSpace: 3
   145                                       #component: 
   143                                       #component: 
   146                                      #(#SpecCollection
   144                                      #(#SpecCollection
   147                                         #collection: #(
   145                                         #collection: #(
   148                                          #(#WorkspaceSpec
   146                                          #(#ViewSpec
   149                                             #name: 'Arg1Editor'
   147                                             #name: 'Box1'
   150                                             #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   148                                             #visibilityChannel: #arg1BoxVisible
   151                                             #tabable: true
   149                                             #component: 
   152                                             #hasHorizontalScrollBar: true
   150                                            #(#SpecCollection
   153                                             #hasVerticalScrollBar: true
   151                                               #collection: #(
   154                                             #miniScrollerHorizontal: true
   152                                                #(#WorkspaceSpec
   155                                             #miniScrollerVertical: true
   153                                                   #name: 'Arg1Editor'
   156                                             #autoHideScrollBars: true
   154                                                   #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   157                                             #postBuildCallback: #argument1WidgetCreated:
   155                                                   #tabable: true
       
   156                                                   #hasHorizontalScrollBar: true
       
   157                                                   #hasVerticalScrollBar: true
       
   158                                                   #miniScrollerHorizontal: true
       
   159                                                   #miniScrollerVertical: true
       
   160                                                   #autoHideScrollBars: true
       
   161                                                   #postBuildCallback: #argument1WidgetCreated:
       
   162                                                 )
       
   163                                                )
       
   164                                              
       
   165                                             )
       
   166                                             #extent: #(#Point 87 48)
       
   167                                           )
       
   168                                          #(#ViewSpec
       
   169                                             #name: 'Box2'
       
   170                                             #visibilityChannel: #arg2BoxVisible
       
   171                                             #component: 
       
   172                                            #(#SpecCollection
       
   173                                               #collection: #(
       
   174                                                #(#WorkspaceSpec
       
   175                                                   #name: 'TextEditor5'
       
   176                                                   #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   177                                                   #tabable: true
       
   178                                                   #hasHorizontalScrollBar: true
       
   179                                                   #hasVerticalScrollBar: true
       
   180                                                   #miniScrollerHorizontal: true
       
   181                                                   #miniScrollerVertical: true
       
   182                                                   #autoHideScrollBars: true
       
   183                                                   #postBuildCallback: #argument2WidgetCreated:
       
   184                                                 )
       
   185                                                )
       
   186                                              
       
   187                                             )
       
   188                                             #extent: #(#Point 87 47)
       
   189                                           )
       
   190                                          #(#ViewSpec
       
   191                                             #name: 'Box3'
       
   192                                             #visibilityChannel: #arg3BoxVisible
       
   193                                             #component: 
       
   194                                            #(#SpecCollection
       
   195                                               #collection: #(
       
   196                                                #(#WorkspaceSpec
       
   197                                                   #name: 'TextEditor6'
       
   198                                                   #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   199                                                   #tabable: true
       
   200                                                   #hasHorizontalScrollBar: true
       
   201                                                   #hasVerticalScrollBar: true
       
   202                                                   #miniScrollerHorizontal: true
       
   203                                                   #miniScrollerVertical: true
       
   204                                                   #autoHideScrollBars: true
       
   205                                                   #postBuildCallback: #argument3WidgetCreated:
       
   206                                                 )
       
   207                                                )
       
   208                                              
       
   209                                             )
       
   210                                             #extent: #(#Point 87 48)
   158                                           )
   211                                           )
   159                                          )
   212                                          )
   160                                        
   213                                        
   161                                       )
   214                                       )
   162                                       #extent: #(#Point 117 48)
   215                                       #extent: #(#Point 87 149)
   163                                     )
   216                                     )
   164                                    #(#ViewSpec
   217                                    #(#WorkspaceSpec
   165                                       #name: 'Box2'
   218                                       #name: 'AnswerEditor'
   166                                       #visibilityChannel: #arg2BoxVisible
   219                                       #tabable: true
   167                                       #component: 
   220                                       #hasHorizontalScrollBar: true
   168                                      #(#SpecCollection
   221                                       #hasVerticalScrollBar: true
   169                                         #collection: #(
   222                                       #miniScrollerHorizontal: true
   170                                          #(#WorkspaceSpec
   223                                       #miniScrollerVertical: true
   171                                             #name: 'TextEditor5'
   224                                       #autoHideScrollBars: true
   172                                             #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   225                                       #extent: #(#Point 88 149)
   173                                             #tabable: true
   226                                       #postBuildCallback: #messageAnswerWidgetCreated:
   174                                             #hasHorizontalScrollBar: true
       
   175                                             #hasVerticalScrollBar: true
       
   176                                             #miniScrollerHorizontal: true
       
   177                                             #miniScrollerVertical: true
       
   178                                             #autoHideScrollBars: true
       
   179                                             #postBuildCallback: #argument2WidgetCreated:
       
   180                                           )
       
   181                                          )
       
   182                                        
       
   183                                       )
       
   184                                       #extent: #(#Point 117 47)
       
   185                                     )
       
   186                                    #(#ViewSpec
       
   187                                       #name: 'Box3'
       
   188                                       #visibilityChannel: #arg3BoxVisible
       
   189                                       #component: 
       
   190                                      #(#SpecCollection
       
   191                                         #collection: #(
       
   192                                          #(#WorkspaceSpec
       
   193                                             #name: 'TextEditor6'
       
   194                                             #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   195                                             #tabable: true
       
   196                                             #hasHorizontalScrollBar: true
       
   197                                             #hasVerticalScrollBar: true
       
   198                                             #miniScrollerHorizontal: true
       
   199                                             #miniScrollerVertical: true
       
   200                                             #autoHideScrollBars: true
       
   201                                             #postBuildCallback: #argument3WidgetCreated:
       
   202                                           )
       
   203                                          )
       
   204                                        
       
   205                                       )
       
   206                                       #extent: #(#Point 117 48)
       
   207                                     )
   227                                     )
   208                                    )
   228                                    )
   209                                  
   229                                  
   210                                 )
   230                                 )
   211                                 #extent: #(#Point 117 149)
       
   212                               )
   231                               )
   213                              #(#WorkspaceSpec
   232                              )
   214                                 #name: 'AnswerEditor'
   233                            
       
   234                           )
       
   235                         )
       
   236                        #(#ViewSpec
       
   237                           #name: 'Box5'
       
   238                           #layout: #(#LayoutFrame 53 0.224737 -23 0.5 0 1 0 0.5)
       
   239                           #component: 
       
   240                          #(#SpecCollection
       
   241                             #collection: #(
       
   242                              #(#ActionButtonSpec
       
   243                                 #label: 'Clear'
       
   244                                 #name: 'Button2'
       
   245                                 #layout: #(#LayoutFrame 0 0 0 0 -5 0.5 0 1)
       
   246                                 #translateLabel: true
       
   247                                 #model: #clear
       
   248                               )
       
   249                              #(#ActionButtonSpec
       
   250                                 #label: 'Search'
       
   251                                 #name: 'Button1'
       
   252                                 #layout: #(#LayoutFrame 5 0.5 0 0 0 1 0 1)
       
   253                                 #translateLabel: true
   215                                 #tabable: true
   254                                 #tabable: true
   216                                 #hasHorizontalScrollBar: true
   255                                 #model: #search
   217                                 #hasVerticalScrollBar: true
       
   218                                 #miniScrollerHorizontal: true
       
   219                                 #miniScrollerVertical: true
       
   220                                 #autoHideScrollBars: true
       
   221                                 #extent: #(#Point 117 149)
       
   222                                 #postBuildCallback: #messageAnswerWidgetCreated:
       
   223                               )
   256                               )
   224                              )
   257                              )
   225                            
   258                            
   226                           )
   259                           )
   227                         )
   260                         )
   228                        )
   261                        )
   229                      
   262                      
   230                     )
   263                     )
   231                   )
   264                   )
   232                  #(#ViewSpec
   265                  #(#VariableVerticalPanelSpec
   233                     #name: 'Box5'
   266                     #name: 'VariableVerticalPanel1'
   234                     #layout: #(#LayoutFrame 53 0.224737 -23 0.5 0 0.65 0 0.5)
       
   235                     #component: 
   267                     #component: 
   236                    #(#SpecCollection
   268                    #(#SpecCollection
   237                       #collection: #(
   269                       #collection: #(
   238                        #(#ActionButtonSpec
   270                        #(#SequenceViewSpec
   239                           #label: 'Clear'
   271                           #name: 'List2'
   240                           #name: 'Button2'
   272                           #model: #selectedClassOfResultHolder
   241                           #layout: #(#LayoutFrame 0 0 0 0 -5 0.5 0 1)
   273                           #menu: #implementorListMenu
   242                           #translateLabel: true
   274                           #hasHorizontalScrollBar: true
   243                           #model: #clear
   275                           #hasVerticalScrollBar: true
       
   276                           #autoHideScrollBars: true
       
   277                           #doubleClickSelector: #openBrowserOn:
       
   278                           #valueChangeSelector: #selectedClassOfResultHolderChanged
       
   279                           #useIndex: false
       
   280                           #sequenceList: #classOfResultHolder
   244                         )
   281                         )
   245                        #(#ActionButtonSpec
   282                        #(#CodeViewSpec
   246                           #label: 'Search'
   283                           #name: 'CodeView'
   247                           #name: 'Button1'
   284                           #model: #codeHolder
   248                           #layout: #(#LayoutFrame 5 0.5 0 0 0 1 0 1)
   285                           #hasHorizontalScrollBar: true
   249                           #translateLabel: true
   286                           #hasVerticalScrollBar: true
   250                           #tabable: true
   287                           #autoHideScrollBars: true
   251                           #model: #search
   288                           #postBuildCallback: #sourceCodeWidgetCreated:
   252                         )
   289                         )
   253                        )
   290                        )
   254                      
   291                      
   255                     )
   292                     )
       
   293                     #handles: #(#Any 0.5 1.0)
   256                   )
   294                   )
   257                  )
   295                  )
   258                
   296                
   259               )
   297               )
       
   298               #handles: #(#Any 0.5 1.0)
   260             )
   299             )
   261            )
   300            )
   262          
   301          
   263         )
   302         )
   264       )
   303       )
   265 
   304 
   266     "Modified: / 9.11.2001 / 08:45:48 / cg"
   305     "Modified: / 13.11.2001 / 12:53:50 / cg"
   267 ! !
   306 ! !
   268 
   307 
   269 !MethodFinderWindow class methodsFor:'menu specs'!
   308 !MethodFinderWindow class methodsFor:'menu specs'!
   270 
   309 
   271 implementorListMenu
   310 implementorListMenu
   339                   #label: 'Documentation'
   378                   #label: 'Documentation'
   340                   #value: #openHTMLDocumentation
   379                   #value: #openHTMLDocumentation
   341                   #activeHelpKey: #helpTutorial
   380                   #activeHelpKey: #helpTutorial
   342                 )
   381                 )
   343                #(#MenuItem
   382                #(#MenuItem
   344                   #label: 'About MenuEditor...'
   383                   #label: 'About MethodFinder...'
   345                   #value: #openAboutThisApplication
   384                   #value: #openAboutThisApplication
   346                   #activeHelpKey: #aboutThisAppliaction
   385                   #activeHelpKey: #aboutThisAppliaction
   347                 )
   386                 )
   348                )
   387                )
   349               nil
   388               nil
   352           )
   391           )
   353          )
   392          )
   354         nil
   393         nil
   355         nil
   394         nil
   356       )
   395       )
       
   396 
       
   397     "Modified: / 13.11.2001 / 12:36:39 / cg"
   357 ! !
   398 ! !
   358 
   399 
   359 !MethodFinderWindow methodsFor:'accessing'!
   400 !MethodFinderWindow methodsFor:'accessing'!
   360 
   401 
   361 receiver
   402 receiver
   433     argument2Editor contents:nil.
   474     argument2Editor contents:nil.
   434     argument3Editor contents:nil.
   475     argument3Editor contents:nil.
   435     messageAnswerEditor contents:nil.
   476     messageAnswerEditor contents:nil.
   436     self resultHolder value:nil.
   477     self resultHolder value:nil.
   437     self classOfResultHolder value: nil.
   478     self classOfResultHolder value: nil.
       
   479 !
       
   480 
       
   481 extractClassAndSelectorFrom:anArgument 
       
   482     "Opens browser on theArgument of a specific class. anArgument being a string with the
       
   483        Class and the selector upon which the browser is to be opened. Return the receiver."
       
   484 
       
   485     |aClass aSelector x theArgument marker|
       
   486 
       
   487     anArgument isNil ifTrue:[
       
   488         ^ nil
       
   489     ].
       
   490     marker := self class markerForImplementingClass.
       
   491 
       
   492     theArgument := anArgument string.
       
   493     (theArgument startsWith:marker) ifTrue:[
       
   494         theArgument := theArgument copyFrom:marker size+1
       
   495     ].
       
   496     aClass := theArgument copyUpTo:(Character space).
       
   497     x := aClass size + 2.
       
   498     aSelector := theArgument copyFrom:x.
       
   499     aClass := Smalltalk classNamed:aClass.
       
   500     ^ aClass -> aSelector asSymbol
       
   501 
       
   502 "
       
   503 MethodFinderWindow new extractClassAndSelectorFrom: '*SmallInteger +'
       
   504 MethodFinderWindow new extractClassAndSelectorFrom: 'String ,'       
       
   505 MethodFinderWindow new extractClassAndSelectorFrom: 'Number detentBy:atMultiplesOf:snap:' 
       
   506 
       
   507 
       
   508 "
       
   509 
       
   510     "Modified: / 13.11.2001 / 12:45:43 / cg"
   438 !
   511 !
   439 
   512 
   440 isExpression: aString
   513 isExpression: aString
   441       "Return true or false depending on if the subString includes certain characters"
   514       "Return true or false depending on if the subString includes certain characters"
   442 (aString includesSubString:': ') ifTrue:[^true].
   515 (aString includesSubString:': ') ifTrue:[^true].
   472 
   545 
   473 openBrowserOn:anArgument 
   546 openBrowserOn:anArgument 
   474     "Opens browser on theArgument of a specific class. anArgument being a string with the
   547     "Opens browser on theArgument of a specific class. anArgument being a string with the
   475        Class and the selector upon which the browser is to be opened. Return the receiver."
   548        Class and the selector upon which the browser is to be opened. Return the receiver."
   476 
   549 
   477     |aClass aSelector x theArgument|
   550     |classAndSelector|
   478 
   551 
   479     anArgument isNil ifTrue:[
   552     classAndSelector := self extractClassAndSelectorFrom:anArgument.
       
   553     classAndSelector isNil ifTrue:[
   480         ^ self
   554         ^ self
   481     ].
   555     ].
   482     (anArgument at:1) == $* ifTrue:[
   556     SystemBrowser openInClass:classAndSelector key selector:classAndSelector value   
   483         theArgument := anArgument copyFrom:2
       
   484     ] ifFalse:[
       
   485         theArgument := anArgument
       
   486     ].
       
   487     aClass := theArgument copyUpTo:(Character space).
       
   488     x := aClass size + 2.
       
   489     aSelector := theArgument copyFrom:x.
       
   490     aClass := Smalltalk classNamed:aClass.
       
   491     SystemBrowser openInClass:(aClass) selector:(aSelector asSymbol)   
       
   492 
   557 
   493 "
   558 "
   494 MethodFinderWindow new openBrowserOn: '*SmallInteger +'
   559 MethodFinderWindow new openBrowserOn: '*SmallInteger +'
   495 MethodFinderWindow new openBrowserOn: 'String ,'
   560 MethodFinderWindow new openBrowserOn: 'String ,'
   496 MethodFinderWindow new openBrowserOn: 'Number detentBy:atMultiplesOf:snap:' 
   561 MethodFinderWindow new openBrowserOn: 'Number detentBy:atMultiplesOf:snap:' 
   497 
   562 
   498 
   563 
   499 "
   564 "
       
   565 
       
   566     "Modified: / 13.11.2001 / 12:46:17 / cg"
   500 !
   567 !
   501 
   568 
   502 openBrowserOnSelectedItem 
   569 openBrowserOnSelectedItem 
   503     |sel|
   570     |sel|
   504 
   571 
   505     sel := self selectedClassOfResultHolder value.
   572     sel := self selectedClassOfResultHolder value.
   506     sel isNil ifTrue:[^ self].
       
   507     self openBrowserOn:sel
   573     self openBrowserOn:sel
       
   574 
       
   575     "Modified: / 13.11.2001 / 12:47:39 / cg"
   508 !
   576 !
   509 
   577 
   510 receiverEditorContents
   578 receiverEditorContents
   511    "Return a cleaned up version of receiver taken from the receiverEditor
   579    "Return a cleaned up version of receiver taken from the receiverEditor
   512     as an association. The association has aCleanedRecieverString as a key and the 
   580     as an association. The association has aCleanedRecieverString as a key and the 
   550 
   618 
   551 ((resultArray at:  1 )includesSubString: 'no single') ifTrue:[
   619 ((resultArray at:  1 )includesSubString: 'no single') ifTrue:[
   552                                 self warn: (resultArray at:  1 ).
   620                                 self warn: (resultArray at:  1 ).
   553                                 ^self
   621                                 ^self
   554                                                               ].  
   622                                                               ].  
   555 
       
   556 "the following then replaces data1 and data2 created by the method finder to the appropriate arguments"
   623 "the following then replaces data1 and data2 created by the method finder to the appropriate arguments"
   557 resultArray keysAndValuesDo:[:key :value |   | newValue | 
   624 resultArray keysAndValuesDo:[:key :value |   | newValue | 
   558       newValue:= value replString: 'data1' withString:(tempReceiver key).
   625       newValue:= value replString: 'data1' withString:(tempReceiver key).
   559 (tempArguments size) >= 1 ifTrue:[
   626 (tempArguments size) >= 1 ifTrue:[
   560       newValue:= newValue replString: 'data2' withString:(tempArguments keyAt:1)].
   627       newValue:= newValue replString: 'data2' withString:(tempArguments keyAt:1)].
   563       newValue:= newValue replString: 'data3' withString:(tempArguments keyAt:2).].
   630       newValue:= newValue replString: 'data3' withString:(tempArguments keyAt:2).].
   564 
   631 
   565 (tempArguments size) > 2 ifTrue:[
   632 (tempArguments size) > 2 ifTrue:[
   566       newValue:= newValue replString: 'data4' withString:(tempArguments keyAt:3).].
   633       newValue:= newValue replString: 'data4' withString:(tempArguments keyAt:3).].
   567 
   634 
       
   635 (tempArguments size) > 3 ifTrue:[ self halt. ].
       
   636 
   568 
   637 
   569                         "    newValue:= value replString: 'data3' withString:(self messageAnswer key). " 
   638                         "    newValue:= value replString: 'data3' withString:(self messageAnswer key). " 
   570 
   639 
   571       newValue:=newValue, ' --> ', (tempAnswer key).
   640       newValue:=newValue, ' --> ', (tempAnswer key).
       
   641       newValue replaceAll:Character cr with:Character space.
   572 
   642 
   573       resultArray at: key put: newValue.
   643       resultArray at: key put: newValue.
   574 
   644 
   575               ].
   645               ].
   576 
   646 
   577 self resultHolder value: resultArray.
   647 self resultHolder value: resultArray.
   578 resultSelectors:= mf selectors.   "used to find implementors so we do not have to "
   648 resultSelectors:= mf selectors.   "used to find implementors so we do not have to "
   579 receiver:=tempReceiver            "search the string for the selector found. Stored as an ordered collection"
   649 receiver:=tempReceiver            "search the string for the selector found. Stored as an ordered collection"
       
   650 
       
   651     "Modified: / 13.11.2001 / 12:01:35 / cg"
       
   652 !
       
   653 
       
   654 selectedClassOfResultHolderChanged
       
   655     |sel classAndSelector mthd|
       
   656 
       
   657     sel := self selectedClassOfResultHolder value.
       
   658 
       
   659     classAndSelector := self extractClassAndSelectorFrom:sel.
       
   660     classAndSelector isNil ifTrue:[
       
   661         ^ self
       
   662     ].
       
   663     mthd := classAndSelector key >> classAndSelector value.   
       
   664     mthd notNil ifTrue:[
       
   665         self withWaitCursorDo:[
       
   666             self codeHolder value:mthd source
       
   667         ]
       
   668     ] ifFalse:[
       
   669         self codeHolder value:nil
       
   670     ].
       
   671 
       
   672     "Created: / 13.11.2001 / 12:43:43 / cg"
       
   673     "Modified: / 13.11.2001 / 12:48:56 / cg"
   580 !
   674 !
   581 
   675 
   582 updateImplementorsOf:anInteger 
   676 updateImplementorsOf:anInteger 
   583     "Request the implementors of the selected argument provided by aNumber.
   677     "Request the implementors of the selected argument provided by aNumber.
   584      Return the receiver. "
   678      Return the receiver. "
   592       classList:=methods asOrderedCollection collect:[:m | m mclass name , ' ' , m selector].
   686       classList:=methods asOrderedCollection collect:[:m | m mclass name , ' ' , m selector].
   593 
   687 
   594       classList:=(self markMatchingClasses:(resultSelectors at:aNumber) classesWithSelector:classList).
   688       classList:=(self markMatchingClasses:(resultSelectors at:aNumber) classesWithSelector:classList).
   595 
   689 
   596     self classOfResultHolder value: classList.
   690     self classOfResultHolder value: classList.
       
   691     self selectedClassOfResultHolder value:nil.
       
   692 
       
   693     "Modified: / 13.11.2001 / 12:07:31 / cg"
   597 ! !
   694 ! !
   598 
   695 
   599 !MethodFinderWindow methodsFor:'aspects'!
   696 !MethodFinderWindow methodsFor:'aspects'!
   600 
   697 
   601 arg1BoxVisible
   698 arg1BoxVisible
   664         builder aspectAt:#classOfResultHolder put:holder
   761         builder aspectAt:#classOfResultHolder put:holder
   665     ].
   762     ].
   666     ^ holder
   763     ^ holder
   667 !
   764 !
   668 
   765 
       
   766 codeHolder
       
   767     codeHolder isNil ifTrue:[
       
   768         codeHolder := '' asValue.
       
   769     ].
       
   770     ^ codeHolder.
       
   771 
       
   772     "Created: / 13.11.2001 / 12:44:11 / cg"
       
   773 !
       
   774 
   669 resultHolder
   775 resultHolder
   670     "Return a value holder which contains the results of a search as a collection."
   776     "Return a value holder which contains the results of a search as a collection."
   671 
   777 
   672     |holder|
   778     |holder|
   673     (holder := builder bindingAt:#resultHolder) isNil ifTrue:[
   779     (holder := builder bindingAt:#resultHolder) isNil ifTrue:[
   694 argument1WidgetCreated: aWidget
   800 argument1WidgetCreated: aWidget
   695 "Store the widget as an instance variable. Return the receiver"
   801 "Store the widget as an instance variable. Return the receiver"
   696 
   802 
   697 
   803 
   698         argument1Editor := aWidget scrolledView.
   804         argument1Editor := aWidget scrolledView.
       
   805         aWidget tabMeansNextField:true.
       
   806 
       
   807     "Modified: / 13.11.2001 / 12:21:41 / cg"
   699 !
   808 !
   700 
   809 
   701 argument2WidgetCreated: aWidget
   810 argument2WidgetCreated: aWidget
   702 "Store the widget as an instance variable. Return the receiver"
   811 "Store the widget as an instance variable. Return the receiver"
   703 
   812 
   704 
   813 
   705         argument2Editor := aWidget scrolledView.
   814         argument2Editor := aWidget scrolledView.
       
   815         aWidget tabMeansNextField:true.
       
   816 
       
   817     "Modified: / 13.11.2001 / 12:21:45 / cg"
   706 !
   818 !
   707 
   819 
   708 argument3WidgetCreated: aWidget
   820 argument3WidgetCreated: aWidget
   709 "Store the widget as an instance variable. Return the receiver"
   821 "Store the widget as an instance variable. Return the receiver"
   710 
   822 
   711 
   823 
   712         argument3Editor := aWidget scrolledView.
   824         argument3Editor := aWidget scrolledView.
       
   825         aWidget tabMeansNextField:true.
       
   826 
       
   827     "Modified: / 13.11.2001 / 12:21:49 / cg"
   713 !
   828 !
   714 
   829 
   715 messageAnswerWidgetCreated: aWidget
   830 messageAnswerWidgetCreated: aWidget
   716 "Store the widget as an instance variable. Return the receiver"
   831 "Store the widget as an instance variable. Return the receiver"
   717 
   832 
   718         messageAnswerEditor := aWidget scrolledView.
   833         messageAnswerEditor := aWidget scrolledView.
       
   834         aWidget tabMeansNextField:true.
       
   835 
       
   836     "Modified: / 13.11.2001 / 12:24:55 / cg"
   719 !
   837 !
   720 
   838 
   721 openHTMLDocumentation
   839 openHTMLDocumentation
   722     HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#METHODFINDER'
   840     HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#METHODFINDER'
   723 !
   841 !
   724 
   842 
   725 receiverWidgetCreated: aWidget
   843 receiverWidgetCreated: aWidget
   726 "Store the widget as an instance variable. Return the receiver"
   844 "Store the widget as an instance variable. Return the receiver"
   727 
   845 
   728         receiverEditor := aWidget scrolledView.
   846         receiverEditor := aWidget scrolledView.
       
   847         aWidget tabMeansNextField:true.
       
   848 
       
   849     "Modified: / 13.11.2001 / 12:24:49 / cg"
       
   850 !
       
   851 
       
   852 sourceCodeWidgetCreated: aWidget
       
   853         aWidget acceptAction:nil.
       
   854         aWidget readOnly:true
       
   855 
       
   856     "Created: / 13.11.2001 / 12:50:27 / cg"
       
   857     "Modified: / 13.11.2001 / 12:51:23 / cg"
   729 ! !
   858 ! !
   730 
   859 
   731 !MethodFinderWindow methodsFor:'controlInput'!
   860 !MethodFinderWindow methodsFor:'controlInput'!
   732 
   861 
   733 cleanInputs: aDirtyString
   862 cleanInputs: aDirtyString
   767    " Matches the class of the receiver with all the elements in anOrderedCollection
   896    " Matches the class of the receiver with all the elements in anOrderedCollection
   768     (which are classes with selectors). If a match is found it is marked with an asterisk. 
   897     (which are classes with selectors). If a match is found it is marked with an asterisk. 
   769     The classes are then sorted so the the asterisk appears first. Return the 
   898     The classes are then sorted so the the asterisk appears first. Return the 
   770     markedClassList."
   899     markedClassList."
   771 
   900 
   772         | unmarkedClassList firstPartOfSelector markedClassList|
   901         | marker recClass unmarkedClassList firstPartOfSelector markedClassList|
   773 
   902 
       
   903         marker := self class markerForImplementingClass.
       
   904 
       
   905         recClass := receiver value class.
   774         unmarkedClassList:=anOrderedCollection copy.
   906         unmarkedClassList:=anOrderedCollection copy.
   775 
       
   776         unmarkedClassList do:
   907         unmarkedClassList do:
   777                 [:classAndMethod | | class |
   908                 [:classAndMethod | | class |
   778                 class:=Compiler evaluate:
   909                 class:=Compiler evaluate:
   779                                 ((ReadStream on: classAndMethod) upToAll: aSelector).
   910                                 ((ReadStream on: classAndMethod) upToAll: aSelector).
   780                 (receiver value class == class) ifTrue:
   911                 "/ (recClass == class)
   781                         [unmarkedClassList add: '*', classAndMethod.
   912                 (recClass whichClassImplements:aSelector) == class
   782                         unmarkedClassList remove: classAndMethod]].
   913                 ifTrue:
       
   914                         ["/ unmarkedClassList add: marker, classAndMethod.
       
   915                         unmarkedClassList add: classAndMethod allBold.
       
   916                         unmarkedClassList remove: classAndMethod.
       
   917                         ].
       
   918         ].
   783 
   919 
   784       unmarkedClassList sort:[:a :b | |rawA rawB|
   920       unmarkedClassList sort:[:a :b | |rawA rawB|
   785                     rawA := (a startsWith:'*') ifTrue:[a copyFrom:2] ifFalse:[a].
   921                     rawA := a string.
   786                     rawB := (b startsWith:'*') ifTrue:[b copyFrom:2] ifFalse:[b].
   922                     (rawA startsWith:marker) ifTrue:[rawA := rawA copyFrom:marker size+1].
   787                     rawA > rawB.  ].
   923                     rawB := b string.
       
   924                     (rawB startsWith:marker) ifTrue:[rawB := rawB copyFrom:marker size+1].
       
   925                     rawA < rawB.  ].
   788       markedClassList:= unmarkedClassList. 
   926       markedClassList:= unmarkedClassList. 
   789 
   927 
   790          ^markedClassList
   928          ^markedClassList
       
   929 
       
   930     "Modified: / 13.11.2001 / 12:16:05 / cg"
   791 !
   931 !
   792 
   932 
   793 mergReciever: aReceiver WithArgument: arguments
   933 mergReciever: aReceiver WithArgument: arguments
   794 
   934 
   795 "Puts the receiver and arguments into an array so it can be of a suitable input for the
   935 "Puts the receiver and arguments into an array so it can be of a suitable input for the
   828 
   968 
   829                         ].
   969                         ].
   830 ^receiverWithArgument
   970 ^receiverWithArgument
   831 ! !
   971 ! !
   832 
   972 
       
   973 !MethodFinderWindow methodsFor:'misc'!
       
   974 
       
   975 aboutThisApplicationText
       
   976     |msg|
       
   977 
       
   978     msg := super aboutThisApplicationText.
       
   979     msg := msg , '\\Ported from Squeak to ST/X by James Hayes (james@exept.de)'.
       
   980     ^msg withCRs.
       
   981 
       
   982     "Modified: / 13.11.2001 / 12:56:44 / cg"
       
   983 ! !
       
   984 
   833 !MethodFinderWindow class methodsFor:'documentation'!
   985 !MethodFinderWindow class methodsFor:'documentation'!
   834 
   986 
   835 version
   987 version
   836     ^ '$Header$'
   988     ^ '$Header$'
   837 ! !
   989 ! !