MethodFinderWindow.st
author Claus Gittinger <cg@exept.de>
Tue, 14 May 2019 09:46:21 +0200
changeset 3663 9d49ecf8661a
parent 3646 41efae926aa9
child 3665 86d311ea68fd
permissions -rw-r--r--
#UI_ENHANCEMENT by cg
class: TabListEditor class
changed:
#canvasSpec
#menu
#windowSpec
     1 "{ Encoding: utf8 }"
     2 
     3 "
     4  Copyright (C) Original Authors (Kaehler, Scott Wallace and Dan Ingalls)
     5  Copyright (C) 2001 eXept Software AG
     6 
     7  Permission is hereby granted, free of charge, to any 
     8  person obtaining a copy of this software and associated 
     9  documentation files (the 'Software'), to deal in the 
    10  Software without restriction, including without limitation 
    11  the rights to use, copy, modify, merge, publish, distribute, 
    12  sublicense, and/or sell copies of the Software, and to 
    13  permit persons to whom the Software is furnished to do so, 
    14  subject to the following conditions:
    15 
    16  The above copyright notice and this permission notice shall 
    17  be included in all copies or substantial portions of the Software.
    18 
    19  THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 
    20  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
    21  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
    22  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
    23  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
    24  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
    25  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    26 "
    27 "{ Package: 'stx:libtool2' }"
    28 
    29 "{ NameSpace: Smalltalk }"
    30 
    31 ApplicationModel subclass:#MethodFinderWindow
    32 	instanceVariableNames:'resultHolder selectorPatternHolder classOfResultHolder
    33 		selectedClassOfResultHolder selectedImplementorsHolder
    34 		argumentsEditor messageAnswerEditor receiverEditor receiver
    35 		resultSelectors arg2BoxVisible arg1BoxVisible arg4BoxVisible
    36 		arg3BoxVisible argCountHolder argCountList argument1Editor
    37 		argument2Editor argument3Editor argument4Editor resultSelected
    38 		lookAtResultEditor codeHolder searchProcess'
    39 	classVariableNames:''
    40 	poolDictionaries:''
    41 	category:'Interface-Tools'
    42 !
    43 
    44 !MethodFinderWindow class methodsFor:'documentation'!
    45 
    46 copyright
    47 "
    48  Copyright (C) Original Authors (Kaehler, Scott Wallace and Dan Ingalls)
    49  Copyright (C) 2001 eXept Software AG
    50 
    51  Permission is hereby granted, free of charge, to any 
    52  person obtaining a copy of this software and associated 
    53  documentation files (the 'Software'), to deal in the 
    54  Software without restriction, including without limitation 
    55  the rights to use, copy, modify, merge, publish, distribute, 
    56  sublicense, and/or sell copies of the Software, and to 
    57  permit persons to whom the Software is furnished to do so, 
    58  subject to the following conditions:
    59 
    60  The above copyright notice and this permission notice shall 
    61  be included in all copies or substantial portions of the Software.
    62 
    63  THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 
    64  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
    65  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
    66  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
    67  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
    68  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
    69  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    70 "
    71 !
    72 
    73 documentation
    74 "
    75   a tool to find implementing methods by example.
    76   Give it values for a receiver, optional arguments and a desired result,
    77   and it will find methods which do that for you.
    78   Please read the online documentation for details (open via the tool's help menu).
    79 
    80   [author:]
    81     original squeak version by Ted Kaehler, Scott Wallace and Dan Ingalls.
    82     ported from Squeak and GUI enhanced 2001 by James Hayes james@exept.de.
    83     improved by Claus Gittinger.
    84 "
    85 ! !
    86 
    87 !MethodFinderWindow class methodsFor:'constants'!
    88 
    89 defaultIcon
    90     <resource: #programImage>
    91 
    92     ^ ToolbarIconLibrary methodFinder24x24Icon
    93 
    94     "Created: / 01-06-2012 / 13:05:11 / cg"
    95 !
    96 
    97 markerForImplementingClass
    98     ^ '=> '.
    99     ^ '*'
   100 
   101     "Created: / 13.11.2001 / 12:09:52 / cg"
   102     "Modified: / 13.11.2001 / 12:11:57 / cg"
   103 ! !
   104 
   105 !MethodFinderWindow class methodsFor:'help specs'!
   106 
   107 helpSpec
   108     "This resource specification was automatically generated
   109      by the UIHelpTool of ST/X."
   110 
   111     "Do not manually edit this!! If it is corrupted,
   112      the UIHelpTool may not be able to read the specification."
   113 
   114     "
   115      UIHelpTool openOnClass:MethodFinderWindow    
   116     "
   117 
   118     <resource: #help>
   119 
   120     ^ super helpSpec addPairsFrom:#(
   121 
   122 #receiverValue
   123 'Enter a receiver value here.\Can be a constant (like ''hello'')\or an expression, such as "Rectangle basicNew".'
   124 
   125 #answerValue
   126 'Enter result value here.\Can be a constant (like ''hello'')\or an expression, such as "Rectangle basicNew".'
   127 
   128 #arg1Value
   129 'Enter a value for the first argument here.\Can be a constant or an expression.'
   130 
   131 #arg2Value
   132 'Enter a value for the second argument here.\Can be a constant or an expression.'
   133 
   134 #arg3Value
   135 'Enter a value for the third argument here.\Can be a constant or an expression.'
   136 
   137 #argumentCount
   138 'Specify the number of arguments here.'
   139 
   140 #clearButton
   141 'Clear all sample value fields.'
   142 
   143 #startSearchButton
   144 'Search for methods which answer the desired value,\given the concrete arguments'
   145 
   146 #selectorPatternSearch
   147 'Search by name.\You can use match characters '*' as in GLOB patterns (i.e. like filename patterns)'
   148 
   149 )
   150 ! !
   151 
   152 !MethodFinderWindow class methodsFor:'interface specs'!
   153 
   154 windowSpec
   155     "This resource specification was automatically generated
   156      by the UIPainter of ST/X."
   157 
   158     "Do not manually edit this!! If it is corrupted,
   159      the UIPainter may not be able to read the specification."
   160 
   161     "
   162      UIPainter new openOnClass:MethodFinderWindow andSelector:#windowSpec
   163      MethodFinderWindow new openInterface:#windowSpec
   164      MethodFinderWindow open
   165     "
   166 
   167     <resource: #canvas>
   168 
   169     ^ 
   170     #(FullSpec
   171        name: windowSpec
   172        window: 
   173       (WindowSpec
   174          label: 'MethodFinder'
   175          name: 'MethodFinder'
   176          bounds: (Rectangle 0 0 816 738)
   177          menu: menu
   178          icon: defaultIcon
   179        )
   180        component: 
   181       (SpecCollection
   182          collection: (
   183           (VariableHorizontalPanelSpec
   184              name: 'VariableHorizontalPanel1'
   185              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   186              showHandle: true
   187              snapMode: both
   188              component: 
   189             (SpecCollection
   190                collection: (
   191                 (VariableVerticalPanelSpec
   192                    name: 'LeftBox'
   193                    showHandle: true
   194                    component: 
   195                   (SpecCollection
   196                      collection: (
   197                       (ViewSpec
   198                          name: 'MethodFinderBox'
   199                          component: 
   200                         (SpecCollection
   201                            collection: (
   202                             (ViewSpec
   203                                name: 'ReceiverArgBox'
   204                                layout: (LayoutFrame 0 0 0 0 0 1 -30 1)
   205                                component: 
   206                               (SpecCollection
   207                                  collection: (
   208                                   (LabelSpec
   209                                      label: 'Receiver'
   210                                      name: 'ReceiverLabel'
   211                                      layout: (LayoutFrame 0 0 0 0 0 0.34000000000000002 28 0)
   212                                      translateLabel: true
   213                                    )
   214                                   (ComboListSpec
   215                                      name: 'allowedArgments'
   216                                      layout: (LayoutFrame 0 0.34000000000000002 1 0 0 0.64000000000000135 28 0)
   217                                      activeHelpKey: argumentCount
   218                                      model: argCountHolder
   219                                      comboList: argCountList
   220                                      useIndex: true
   221                                    )
   222                                   (LabelSpec
   223                                      label: 'Answer'
   224                                      name: 'MessageAnswerLabel'
   225                                      layout: (LayoutFrame 0 0.64000000000000135 0 0 0 1 28 0)
   226                                      activeHelpKey: arg1Value
   227                                      translateLabel: true
   228                                    )
   229                                   (HorizontalPanelViewSpec
   230                                      name: 'HorizontalPanel1'
   231                                      layout: (LayoutFrame 0 0 30 0 0 1 0 1)
   232                                      horizontalLayout: fit
   233                                      verticalLayout: fit
   234                                      horizontalSpace: 3
   235                                      verticalSpace: 3
   236                                      component: 
   237                                     (SpecCollection
   238                                        collection: (
   239                                         (WorkspaceSpec
   240                                            name: 'ReceiverEditor'
   241                                            activeHelpKey: receiverValue
   242                                            tabable: true
   243                                            hasHorizontalScrollBar: true
   244                                            hasVerticalScrollBar: true
   245                                            miniScrollerHorizontal: true
   246                                            miniScrollerVertical: true
   247                                            autoHideScrollBars: true
   248                                            hasKeyboardFocusInitially: false
   249                                            extent: (Point 85 142)
   250                                            postBuildCallback: receiverWidgetCreated:
   251                                          )
   252                                         (VerticalPanelViewSpec
   253                                            name: 'VerticalPanel1'
   254                                            horizontalLayout: fit
   255                                            verticalLayout: fit
   256                                            horizontalSpace: 3
   257                                            verticalSpace: 3
   258                                            component: 
   259                                           (SpecCollection
   260                                              collection: (
   261                                               (ViewSpec
   262                                                  name: 'Box1'
   263                                                  visibilityChannel: arg1BoxVisible
   264                                                  component: 
   265                                                 (SpecCollection
   266                                                    collection: (
   267                                                     (WorkspaceSpec
   268                                                        name: 'Arg1Editor'
   269                                                        layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   270                                                        activeHelpKey: arg1Value
   271                                                        tabable: true
   272                                                        hasHorizontalScrollBar: true
   273                                                        hasVerticalScrollBar: true
   274                                                        miniScrollerHorizontal: true
   275                                                        miniScrollerVertical: true
   276                                                        autoHideScrollBars: true
   277                                                        hasKeyboardFocusInitially: false
   278                                                        postBuildCallback: argument1WidgetCreated:
   279                                                      )
   280                                                     )
   281                                                   
   282                                                  )
   283                                                  extent: (Point 86 45)
   284                                                )
   285                                               (ViewSpec
   286                                                  name: 'Box2'
   287                                                  visibilityChannel: arg2BoxVisible
   288                                                  component: 
   289                                                 (SpecCollection
   290                                                    collection: (
   291                                                     (WorkspaceSpec
   292                                                        name: 'TextEditor5'
   293                                                        layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   294                                                        activeHelpKey: arg2Value
   295                                                        tabable: true
   296                                                        hasHorizontalScrollBar: true
   297                                                        hasVerticalScrollBar: true
   298                                                        miniScrollerHorizontal: true
   299                                                        miniScrollerVertical: true
   300                                                        autoHideScrollBars: true
   301                                                        hasKeyboardFocusInitially: false
   302                                                        postBuildCallback: argument2WidgetCreated:
   303                                                      )
   304                                                     )
   305                                                   
   306                                                  )
   307                                                  extent: (Point 86 46)
   308                                                )
   309                                               (ViewSpec
   310                                                  name: 'Box3'
   311                                                  visibilityChannel: arg3BoxVisible
   312                                                  component: 
   313                                                 (SpecCollection
   314                                                    collection: (
   315                                                     (WorkspaceSpec
   316                                                        name: 'TextEditor6'
   317                                                        layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   318                                                        activeHelpKey: arg3Value
   319                                                        tabable: true
   320                                                        hasHorizontalScrollBar: true
   321                                                        hasVerticalScrollBar: true
   322                                                        miniScrollerHorizontal: true
   323                                                        miniScrollerVertical: true
   324                                                        autoHideScrollBars: true
   325                                                        hasKeyboardFocusInitially: false
   326                                                        postBuildCallback: argument3WidgetCreated:
   327                                                      )
   328                                                     )
   329                                                   
   330                                                  )
   331                                                  extent: (Point 86 45)
   332                                                )
   333                                               )
   334                                             
   335                                            )
   336                                            extent: (Point 86 142)
   337                                          )
   338                                         (WorkspaceSpec
   339                                            name: 'AnswerEditor'
   340                                            activeHelpKey: answerValue
   341                                            tabable: true
   342                                            hasHorizontalScrollBar: true
   343                                            hasVerticalScrollBar: true
   344                                            miniScrollerHorizontal: true
   345                                            miniScrollerVertical: true
   346                                            autoHideScrollBars: true
   347                                            hasKeyboardFocusInitially: false
   348                                            extent: (Point 86 142)
   349                                            postBuildCallback: messageAnswerWidgetCreated:
   350                                          )
   351                                         )
   352                                       
   353                                      )
   354                                    )
   355                                   )
   356                                 
   357                                )
   358                              )
   359                             (ViewSpec
   360                                name: 'ReceiverArgBoxActionBox'
   361                                layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
   362                                component: 
   363                               (SpecCollection
   364                                  collection: (
   365                                   (ActionButtonSpec
   366                                      label: 'Clear'
   367                                      name: 'Button2'
   368                                      layout: (LayoutFrame 5 0 0 0 -5 0.5 0 1)
   369                                      activeHelpKey: clearButton
   370                                      translateLabel: true
   371                                      model: clear
   372                                    )
   373                                   (ActionButtonSpec
   374                                      label: 'Search'
   375                                      name: 'Button1'
   376                                      layout: (LayoutFrame 5 0.5 0 0 -5 1 0 1)
   377                                      activeHelpKey: startSearchButton
   378                                      translateLabel: true
   379                                      tabable: true
   380                                      model: search
   381                                    )
   382                                   )
   383                                 
   384                                )
   385                              )
   386                             )
   387                           
   388                          )
   389                        )
   390                       (ViewSpec
   391                          name: 'SelectorFinderBox'
   392                          component: 
   393                         (SpecCollection
   394                            collection: (
   395                             (ViewSpec
   396                                name: 'MatchActionBox'
   397                                layout: (LayoutFrame 0 0 0 0 0 1 90 0)
   398                                component: 
   399                               (SpecCollection
   400                                  collection: (
   401                                   (LabelSpec
   402                                      label: 'Selector Pattern:'
   403                                      name: 'Label1'
   404                                      layout: (LayoutFrame 0 0 0 0 0 0.5 25 0)
   405                                      translateLabel: true
   406                                      adjust: left
   407                                    )
   408                                   (InputFieldSpec
   409                                      name: 'EntryField1'
   410                                      layout: (LayoutFrame 2 0 -54 1 -2 1 -29 1)
   411                                      model: selectorPatternHolder
   412                                      immediateAccept: true
   413                                      acceptOnReturn: true
   414                                      acceptOnTab: true
   415                                      acceptOnPointerLeave: true
   416                                    )
   417                                   (ActionButtonSpec
   418                                      label: 'Search'
   419                                      name: 'Button4'
   420                                      layout: (LayoutFrame 5 0.5 -25 1 -5 1 0 1)
   421                                      translateLabel: true
   422                                      tabable: true
   423                                      model: searchPatternMatchesInBackground
   424                                    )
   425                                   )
   426                                 
   427                                )
   428                              )
   429                             (SequenceViewSpec
   430                                name: 'ResultList'
   431                                layout: (LayoutFrame 0 0 94 0 0 1 0 1)
   432                                model: selectedImplementorsHolder
   433                                menu: resultListMenu
   434                                hasHorizontalScrollBar: true
   435                                hasVerticalScrollBar: true
   436                                autoHideScrollBars: true
   437                                useIndex: true
   438                                sequenceList: resultHolder
   439                              )
   440                             )
   441                           
   442                          )
   443                        )
   444                       )
   445                     
   446                    )
   447                    handles: (Any 0.28000000000000003 1.0)
   448                  )
   449                 (VariableVerticalPanelSpec
   450                    name: 'RightBox'
   451                    component: 
   452                   (SpecCollection
   453                      collection: (
   454                       (SequenceViewSpec
   455                          name: 'List2'
   456                          model: selectedClassOfResultHolder
   457                          menu: implementorListMenu
   458                          hasHorizontalScrollBar: true
   459                          hasVerticalScrollBar: true
   460                          autoHideScrollBars: true
   461                          doubleClickSelector: openBrowserOn:
   462                          valueChangeSelector: selectedClassOfResultHolderChanged
   463                          useIndex: false
   464                          sequenceList: classOfResultHolder
   465                        )
   466                       (CodeViewSpec
   467                          name: 'CodeView'
   468                          model: codeHolder
   469                          hasHorizontalScrollBar: true
   470                          hasVerticalScrollBar: true
   471                          autoHideScrollBars: true
   472                          hasKeyboardFocusInitially: false
   473                          postBuildCallback: sourceCodeWidgetCreated:
   474                          viewClassName: 'codeViewClass'
   475                        )
   476                       )
   477                     
   478                    )
   479                    handles: (Any 0.23999999999999999 1.0)
   480                  )
   481                 )
   482               
   483              )
   484              handles: (Any 0.33000000000000002 1.0)
   485            )
   486           )
   487         
   488        )
   489      )
   490 !
   491 
   492 windowSpec_old
   493     "This resource specification was automatically generated
   494      by the UIPainter of ST/X."
   495 
   496     "Do not manually edit this!! If it is corrupted,
   497      the UIPainter may not be able to read the specification."
   498 
   499     "
   500      UIPainter new openOnClass:MethodFinderWindow andSelector:#windowSpec
   501      MethodFinderWindow new openInterface:#windowSpec
   502      MethodFinderWindow open
   503     "
   504 
   505     <resource: #canvas>
   506 
   507     ^ 
   508     #(FullSpec
   509        name: windowSpec
   510        window: 
   511       (WindowSpec
   512          label: 'MethodFinder'
   513          name: 'MethodFinder'
   514          bounds: (Rectangle 0 0 920 690)
   515          menu: menu
   516          icon: defaultIcon
   517        )
   518        component: 
   519       (SpecCollection
   520          collection: (
   521           (VariableHorizontalPanelSpec
   522              name: 'VariableHorizontalPanel1'
   523              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   524              snapMode: both
   525              component: 
   526             (SpecCollection
   527                collection: (
   528                 (ViewSpec
   529                    name: 'LeftBox'
   530                    level: 1
   531                    component: 
   532                   (SpecCollection
   533                      collection: (
   534                       (ViewSpec
   535                          name: 'ReceiverArgBox'
   536                          layout: (LayoutFrame 0 0 0 0 0 1 -100 0.5)
   537                          component: 
   538                         (SpecCollection
   539                            collection: (
   540                             (LabelSpec
   541                                label: 'Receiver'
   542                                name: 'ReceiverLabel'
   543                                layout: (LayoutFrame 0 0 0 0 0 0.34000000000000002 28 0)
   544                                translateLabel: true
   545                              )
   546                             (ComboListSpec
   547                                name: 'allowedArgments'
   548                                layout: (LayoutFrame 0 0.34000000000000002 1 0 0 0.64000000000000046 28 0)
   549                                activeHelpKey: argumentCount
   550                                model: argCountHolder
   551                                comboList: argCountList
   552                                useIndex: true
   553                              )
   554                             (LabelSpec
   555                                label: 'Answer'
   556                                name: 'MessageAnswerLabel'
   557                                layout: (LayoutFrame 0 0.64000000000000046 0 0 0 1 28 0)
   558                                activeHelpKey: arg1Value
   559                                translateLabel: true
   560                              )
   561                             (HorizontalPanelViewSpec
   562                                name: 'HorizontalPanel1'
   563                                layout: (LayoutFrame 0 0 30 0 0 1 0 1)
   564                                horizontalLayout: fit
   565                                verticalLayout: fit
   566                                horizontalSpace: 3
   567                                verticalSpace: 3
   568                                component: 
   569                               (SpecCollection
   570                                  collection: (
   571                                   (WorkspaceSpec
   572                                      name: 'ReceiverEditor'
   573                                      activeHelpKey: receiverValue
   574                                      tabable: true
   575                                      hasHorizontalScrollBar: true
   576                                      hasVerticalScrollBar: true
   577                                      miniScrollerHorizontal: true
   578                                      miniScrollerVertical: true
   579                                      autoHideScrollBars: true
   580                                      hasKeyboardFocusInitially: false
   581                                      extent: (Point 110 214)
   582                                      postBuildCallback: receiverWidgetCreated:
   583                                    )
   584                                   (VerticalPanelViewSpec
   585                                      name: 'VerticalPanel1'
   586                                      horizontalLayout: fit
   587                                      verticalLayout: fit
   588                                      horizontalSpace: 3
   589                                      verticalSpace: 3
   590                                      component: 
   591                                     (SpecCollection
   592                                        collection: (
   593                                         (ViewSpec
   594                                            name: 'Box1'
   595                                            visibilityChannel: arg1BoxVisible
   596                                            component: 
   597                                           (SpecCollection
   598                                              collection: (
   599                                               (WorkspaceSpec
   600                                                  name: 'Arg1Editor'
   601                                                  layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   602                                                  activeHelpKey: arg1Value
   603                                                  tabable: true
   604                                                  hasHorizontalScrollBar: true
   605                                                  hasVerticalScrollBar: true
   606                                                  miniScrollerHorizontal: true
   607                                                  miniScrollerVertical: true
   608                                                  autoHideScrollBars: true
   609                                                  hasKeyboardFocusInitially: false
   610                                                  postBuildCallback: argument1WidgetCreated:
   611                                                )
   612                                               )
   613                                             
   614                                            )
   615                                            extent: (Point 110 69)
   616                                          )
   617                                         (ViewSpec
   618                                            name: 'Box2'
   619                                            visibilityChannel: arg2BoxVisible
   620                                            component: 
   621                                           (SpecCollection
   622                                              collection: (
   623                                               (WorkspaceSpec
   624                                                  name: 'TextEditor5'
   625                                                  layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   626                                                  activeHelpKey: arg2Value
   627                                                  tabable: true
   628                                                  hasHorizontalScrollBar: true
   629                                                  hasVerticalScrollBar: true
   630                                                  miniScrollerHorizontal: true
   631                                                  miniScrollerVertical: true
   632                                                  autoHideScrollBars: true
   633                                                  hasKeyboardFocusInitially: false
   634                                                  postBuildCallback: argument2WidgetCreated:
   635                                                )
   636                                               )
   637                                             
   638                                            )
   639                                            extent: (Point 110 70)
   640                                          )
   641                                         (ViewSpec
   642                                            name: 'Box3'
   643                                            visibilityChannel: arg3BoxVisible
   644                                            component: 
   645                                           (SpecCollection
   646                                              collection: (
   647                                               (WorkspaceSpec
   648                                                  name: 'TextEditor6'
   649                                                  layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   650                                                  activeHelpKey: arg3Value
   651                                                  tabable: true
   652                                                  hasHorizontalScrollBar: true
   653                                                  hasVerticalScrollBar: true
   654                                                  miniScrollerHorizontal: true
   655                                                  miniScrollerVertical: true
   656                                                  autoHideScrollBars: true
   657                                                  hasKeyboardFocusInitially: false
   658                                                  postBuildCallback: argument3WidgetCreated:
   659                                                )
   660                                               )
   661                                             
   662                                            )
   663                                            extent: (Point 110 69)
   664                                          )
   665                                         )
   666                                       
   667                                      )
   668                                      extent: (Point 110 214)
   669                                    )
   670                                   (WorkspaceSpec
   671                                      name: 'AnswerEditor'
   672                                      activeHelpKey: answerValue
   673                                      tabable: true
   674                                      hasHorizontalScrollBar: true
   675                                      hasVerticalScrollBar: true
   676                                      miniScrollerHorizontal: true
   677                                      miniScrollerVertical: true
   678                                      autoHideScrollBars: true
   679                                      hasKeyboardFocusInitially: false
   680                                      extent: (Point 110 214)
   681                                      postBuildCallback: messageAnswerWidgetCreated:
   682                                    )
   683                                   )
   684                                 
   685                                )
   686                              )
   687                             )
   688                           
   689                          )
   690                        )
   691                       (ViewSpec
   692                          name: 'ReceiverArgBoxActionBox'
   693                          layout: (LayoutFrame 0 0 -98 0.5 0 1 -75 0.5)
   694                          component: 
   695                         (SpecCollection
   696                            collection: (
   697                             (ActionButtonSpec
   698                                activeHelpKey: clearButton    
   699                                label: 'Clear'
   700                                name: 'Button2'
   701                                layout: (LayoutFrame 5 0 0 0 -5 0.5 0 1)
   702                                translateLabel: true
   703                                model: clear
   704                              )
   705                             (ActionButtonSpec
   706                                activeHelpKey: startSearchButton    
   707                                label: 'Search'
   708                                name: 'Button1'
   709                                layout: (LayoutFrame 5 0.5 0 0 -5 1 0 1)
   710                                translateLabel: true
   711                                tabable: true
   712                                model: search
   713                              )
   714                             )
   715                           
   716                          )
   717                        )
   718                       (ViewSpec
   719                          name: 'MatchActionBox'
   720                          layout: (LayoutFrame 0 0 -70 0.5 0 1 10 0.5)
   721                          component: 
   722                         (SpecCollection
   723                            collection: (
   724                             (LabelSpec
   725                                label: 'Selector Pattern:'
   726                                name: 'Label1'
   727                                layout: (LayoutFrame 0 0 0 0 0 0.5 25 0)
   728                                translateLabel: true
   729                                adjust: left
   730                              )
   731                             (InputFieldSpec
   732                                name: 'EntryField1'
   733                                layout: (LayoutFrame 2 0 -54 1 -2 1 -29 1)
   734                                model: selectorPatternHolder
   735                                immediateAccept: true
   736                                acceptOnReturn: true
   737                                acceptOnTab: true
   738                                acceptOnPointerLeave: true
   739                              )
   740                             (ActionButtonSpec
   741                                label: 'Search'
   742                                name: 'Button4'
   743                                layout: (LayoutFrame 5 0.5 -25 1 -5 1 0 1)
   744                                translateLabel: true
   745                                tabable: true
   746                                model: searchPatternMatchesInBackground
   747                              )
   748                             )
   749                           
   750                          )
   751                        )
   752                       (SequenceViewSpec
   753                          name: 'ResultList'
   754                          layout: (LayoutFrame 0 0 15 0.5 0 1 0 1)
   755                          model: selectedImplementorsHolder
   756                          menu: resultListMenu
   757                          hasHorizontalScrollBar: true
   758                          hasVerticalScrollBar: true
   759                          autoHideScrollBars: true
   760                          useIndex: true
   761                          sequenceList: resultHolder
   762                        )
   763                       )
   764                     
   765                    )
   766                  )
   767                 (VariableVerticalPanelSpec
   768                    name: 'VariableVerticalPanel1'
   769                    component: 
   770                   (SpecCollection
   771                      collection: (
   772                       (SequenceViewSpec
   773                          name: 'List2'
   774                          model: selectedClassOfResultHolder
   775                          menu: implementorListMenu
   776                          hasHorizontalScrollBar: true
   777                          hasVerticalScrollBar: true
   778                          autoHideScrollBars: true
   779                          doubleClickSelector: openBrowserOn:
   780                          valueChangeSelector: selectedClassOfResultHolderChanged
   781                          useIndex: false
   782                          sequenceList: classOfResultHolder
   783                        )
   784                       (CodeViewSpec
   785                          name: 'CodeView'
   786                          model: codeHolder
   787                          hasHorizontalScrollBar: true
   788                          hasVerticalScrollBar: true
   789                          autoHideScrollBars: true
   790                          hasKeyboardFocusInitially: false
   791                          postBuildCallback: sourceCodeWidgetCreated:
   792                          viewClassName: 'codeViewClass'
   793                        )
   794                       )
   795                     
   796                    )
   797                    handles: (Any 0.5 1.0)
   798                  )
   799                 )
   800               
   801              )
   802              handles: (Any 0.37391304347826104 1.0)
   803            )
   804           )
   805         
   806        )
   807      )
   808 ! !
   809 
   810 !MethodFinderWindow class methodsFor:'menu specs'!
   811 
   812 implementorListMenu
   813     "This resource specification was automatically generated
   814      by the MenuEditor of ST/X."
   815 
   816     "Do not manually edit this!! If it is corrupted,
   817      the MenuEditor may not be able to read the specification."
   818 
   819     "
   820      MenuEditor new openOnClass:MethodFinderWindow andSelector:#implementorListMenu
   821      (Menu new fromLiteralArrayEncoding:(MethodFinderWindow implementorListMenu)) startUp
   822     "
   823 
   824     <resource: #menu>
   825 
   826     ^ 
   827      #(#Menu
   828         #(
   829          #(#MenuItem
   830             #label: 'Browse'
   831             #translateLabel: true
   832             #value: #openBrowserOnSelectedItem
   833           )
   834          )
   835         nil
   836         nil
   837       )
   838 !
   839 
   840 menu
   841     "This resource specification was automatically generated
   842      by the MenuEditor of ST/X."
   843 
   844     "Do not manually edit this!! If it is corrupted,
   845      the MenuEditor may not be able to read the specification."
   846 
   847     "
   848      MenuEditor new openOnClass:MethodFinderWindow andSelector:#menu
   849      (Menu new fromLiteralArrayEncoding:(MethodFinderWindow menu)) startUp
   850     "
   851 
   852     <resource: #menu>
   853 
   854     ^ 
   855      #(#Menu
   856         #(
   857          #(#MenuItem
   858             #label: '&File'
   859             #activeHelpKey: #file
   860             #submenu: 
   861            #(#Menu
   862               #(
   863                #(#MenuItem
   864                   #label: 'Exit'
   865                   #value: #closeRequest
   866                   #activeHelpKey: #fileExit
   867                 )
   868                )
   869               nil
   870               nil
   871             )
   872           )
   873          #(#MenuItem
   874             label: 'MENU_Help'
   875             startGroup: conditionalRight
   876             #submenu: 
   877            #(#Menu
   878               #(
   879                #(#MenuItem
   880                   #label: 'Documentation'
   881                   #value: #openHTMLDocumentation
   882                   #activeHelpKey: #helpTutorial
   883                 )
   884                #(#MenuItem
   885                   #label: 'About MethodFinder...'
   886                   #value: #openAboutThisApplication
   887                   #activeHelpKey: #aboutThisAppliaction
   888                 )
   889                )
   890               nil
   891               nil
   892             )
   893           )
   894          )
   895         nil
   896         nil
   897       )
   898 
   899     "Modified: / 13.11.2001 / 12:36:39 / cg"
   900 !
   901 
   902 resultListMenu
   903     "This resource specification was automatically generated
   904      by the MenuEditor of ST/X."
   905 
   906     "Do not manually edit this!! If it is corrupted,
   907      the MenuEditor may not be able to read the specification."
   908 
   909     "
   910      MenuEditor new openOnClass:MethodFinderWindow andSelector:#implementorListMenu
   911      (Menu new fromLiteralArrayEncoding:(MethodFinderWindow implementorListMenu)) startUp
   912     "
   913 
   914     <resource: #menu>
   915 
   916     ^ 
   917      #(#Menu
   918         #(
   919          #(#MenuItem
   920             #label: 'Browse Senders'
   921             #translateLabel: true
   922             #value: #openBrowserOnSenderOfSelectedResultItem
   923           )
   924          #(#MenuItem
   925             #label: 'Browse Implementors'
   926             #translateLabel: true
   927             #value: #openBrowserOnSelectedResultItem
   928           )
   929          )
   930         nil
   931         nil
   932       )
   933 
   934     "Created: / 21-09-2012 / 11:05:15 / cg"
   935 ! !
   936 
   937 !MethodFinderWindow class methodsFor:'startup'!
   938 
   939 openOnSelectorPattern:selector
   940     |app|
   941 
   942     app := self new.
   943     app allButOpen.
   944     app selectorPatternHolder value:selector.
   945     app openWindow.
   946     "/ app waitForBackgroundSearchFinished.
   947     
   948     ^ app
   949 
   950     "
   951      self openOnSelectorPattern:'asLowercase'
   952     "
   953 ! !
   954 
   955 !MethodFinderWindow methodsFor:'accessing'!
   956 
   957 receiver
   958     "Return a copy of the value of the instance variable 'receiver' "
   959 
   960     ^ receiver copy
   961 ! !
   962 
   963 !MethodFinderWindow methodsFor:'actions'!
   964 
   965 clear
   966     "Reset the contents of all the outputs."
   967 
   968     receiverEditor contents:nil.
   969     argument1Editor contents:nil.
   970     argument2Editor contents:nil.
   971     argument3Editor contents:nil.
   972     messageAnswerEditor contents:nil.
   973     self resultHolder value:nil.
   974     self classOfResultHolder value: nil.
   975     codeHolder value:nil.
   976 !
   977 
   978 messageAnswerEditorContents
   979     "Return a cleaned up version of message answer taken from the messageAnswerEditor
   980      as an association. The association has cleanedAnswerString as a key and the
   981      compiledAnswer as value."
   982     
   983     |aCleanedAnswerString compiledAnswer|
   984 
   985     aCleanedAnswerString := self cleanInputs:(messageAnswerEditor contents).
   986     compiledAnswer := Compiler evaluate:aCleanedAnswerString.
   987     ((self isExpression:aCleanedAnswerString) or:[ compiledAnswer isNil ]) ifTrue:[
   988         aCleanedAnswerString := compiledAnswer printString
   989     ].
   990     ^ aCleanedAnswerString -> compiledAnswer.
   991 !
   992 
   993 openBrowserOn:anArgument 
   994     "Opens browser on theArgument of a specific class. anArgument being a string with the
   995        Class and the selector upon which the browser is to be opened. Return the receiver."
   996 
   997     |classAndSelector|
   998 
   999     classAndSelector := self extractClassAndSelectorFrom:anArgument.
  1000     classAndSelector isNil ifTrue:[
  1001         ^ self
  1002     ].
  1003     SystemBrowser default
  1004         openInClass:classAndSelector key 
  1005         selector:classAndSelector value   
  1006 
  1007 "
  1008 MethodFinderWindow new openBrowserOn: '*SmallInteger +'
  1009 MethodFinderWindow new openBrowserOn: 'String ,'
  1010 MethodFinderWindow new openBrowserOn: 'Number detentBy:atMultiplesOf:snap:' 
  1011 
  1012 
  1013 "
  1014 
  1015     "Modified: / 01-09-2017 / 14:21:18 / cg"
  1016 !
  1017 
  1018 openBrowserOnSelectedItem 
  1019     "on the selected implementor"
  1020 
  1021     |sel|
  1022 
  1023     sel := self selectedClassOfResultHolder value.
  1024     self openBrowserOn:sel
  1025 
  1026     "Modified: / 13-11-2001 / 12:47:39 / cg"
  1027     "Modified (comment): / 21-09-2012 / 11:08:33 / cg"
  1028 !
  1029 
  1030 openBrowserOnSelectedResultItem 
  1031     "on an item in the lower left list,
  1032      on all implementors of that message"
  1033 
  1034     |selIndex selector|
  1035 
  1036     selIndex := self selectedImplementorsHolder value.
  1037     selIndex isNil ifTrue:[^ self].
  1038 
  1039     selector := resultSelectors at:selIndex.
  1040     UserPreferences browserClass browseImplementorsOf:selector.
  1041 
  1042     "Created: / 21-09-2012 / 11:05:46 / cg"
  1043 !
  1044 
  1045 openBrowserOnSenderOfSelectedResultItem
  1046     "on an item in the lower left list,
  1047      on all implementors of that message"
  1048 
  1049     |selIndex selector|
  1050 
  1051     selIndex := self selectedImplementorsHolder value.
  1052     selIndex isNil ifTrue:[^ self].
  1053 
  1054     selector := resultSelectors at:selIndex.
  1055     UserPreferences browserClass browseSendersOf:selector.
  1056 !
  1057 
  1058 search
  1059     "Do a search based on the input in the various text editors. Return the receiver."
  1060 
  1061     |tempReceiver tempAnswer tempArguments anArray resultArray receiverWithArgument mf|
  1062 
  1063     self resultHolder value:nil.
  1064     self classOfResultHolder value:nil.
  1065     self codeHolder value:nil.
  1066     tempArguments := self argumentEditorsContents.
  1067     tempReceiver := self receiverEditorContents.
  1068     tempAnswer := self messageAnswerEditorContents.
  1069      "self cleanInputRec:tempReceiver arg:tempArguments ans:tempAnswer."
  1070     anArray := Array new:2.
  1071     receiverWithArgument := self mergeReceiver:(tempReceiver value)
  1072                                  withArgument:(tempArguments values).
  1073     anArray
  1074         at:1 put:receiverWithArgument;
  1075         at:2 put:tempAnswer value.
  1076      "an array now holds the following array #(#(receiver argument) answer) or #(#(receiver) answer). which should
  1077      be suitable input for the method finder."
  1078     self withCursor:Cursor execute
  1079         do:[
  1080             mf := MethodFinder new.
  1081             resultArray := mf
  1082                     load:anArray;
  1083                     findMessage.
  1084         ].
  1085     ((resultArray at:1) includesSubString:'no single') ifTrue:[
  1086         self warn:(resultArray at:1).
  1087         ^ self
  1088     ].
  1089      "the following then replaces data1 and data2 created by the method finder to the appropriate arguments"
  1090     resultArray
  1091         keysAndValuesDo:[:key :value |
  1092             |newValue|
  1093 
  1094             newValue := value copyReplaceString:'data1' withString:(tempReceiver key).
  1095             (tempArguments size) >= 1 ifTrue:[
  1096                 newValue := newValue replString:'data2'
  1097                         withString:(tempArguments keyAt:1)
  1098             ].
  1099             (tempArguments size) > 1 ifTrue:[
  1100                 newValue := newValue copyReplaceString:'data3'
  1101                         withString:(tempArguments keyAt:2).
  1102             ].
  1103             (tempArguments size) > 2 ifTrue:[
  1104                 newValue := newValue copyReplaceString:'data4'
  1105                         withString:(tempArguments keyAt:3).
  1106             ].
  1107             (tempArguments size) > 3 ifTrue:[
  1108                 self halt:'unimplemented'.
  1109             ].
  1110              "    newValue:= value copyReplaceString: 'data3' withString:(self messageAnswer key). "
  1111             newValue := newValue , ' --> ' , (tempAnswer key).
  1112             newValue replaceAll:Character cr with:Character space.
  1113             resultArray at:key put:newValue.
  1114         ].
  1115     self resultHolder value:resultArray.
  1116     resultSelectors := mf selectors.
  1117     receiver := tempReceiver
  1118 
  1119     "Modified: / 26-09-2011 / 12:42:28 / cg"
  1120     "Modified: / 27-02-2018 / 11:37:58 / stefan"
  1121 !
  1122 
  1123 searchPatternMatchesInBackground
  1124     "Do a search based on the pattern match as a background task"
  1125 
  1126     | p pattern|
  1127 
  1128     (p := searchProcess) notNil ifTrue:[
  1129         searchProcess := nil.
  1130         p terminate.
  1131     ].
  1132 
  1133     pattern := self selectorPatternHolder value.
  1134     pattern isEmptyOrNil ifTrue:[
  1135         self resultHolder value:self resultInfoText.
  1136         self classOfResultHolder value:nil.
  1137         self codeHolder value:nil.
  1138         ^ self
  1139     ].
  1140 
  1141     searchProcess := 
  1142         [
  1143             |list counts firsts seconds selectors resultList idx match|
  1144 
  1145             self withCursor:Cursor execute do:[
  1146                 pattern includesMatchCharacters ifFalse:[   
  1147                     list := SystemBrowser findImplementorsOf:pattern in:Smalltalk allClasses ignoreCase:true.
  1148                     list isEmptyOrNil ifTrue:[
  1149                         match := pattern,'*'.
  1150                         list := SystemBrowser findImplementorsMatching:match in:Smalltalk allClasses ignoreCase:true.
  1151                     ].
  1152                 ] ifTrue:[
  1153                     "/ match := '*',pattern,'*'.
  1154                     match := pattern.
  1155                     list := SystemBrowser findImplementorsMatching:match in:Smalltalk allClasses ignoreCase:true.
  1156                 ].
  1157             ].
  1158 
  1159             counts := IdentityDictionary new.
  1160             firsts := IdentityDictionary new.
  1161             seconds := IdentityDictionary new.
  1162             selectors := IdentitySet new.
  1163             list do:[:eachMethod |
  1164                 |msel|
  1165 
  1166                 msel := eachMethod selector.
  1167                 selectors add:msel.
  1168                 (counts at:msel ifAbsentPut:[ 0 asValue ]) increment.
  1169                 (firsts includesKey:msel) ifTrue:[
  1170                     (seconds includesKey:msel) ifFalse:[
  1171                         seconds at:msel ifAbsentPut:[ eachMethod mclass ].
  1172                     ].
  1173                 ] ifFalse:[
  1174                     firsts at:msel ifAbsentPut:[ eachMethod mclass ].
  1175                 ].
  1176             ].
  1177             resultSelectors := selectors asOrderedCollection sort.
  1178             resultList := resultSelectors 
  1179                             collect:[:sel | 
  1180                                 |cnt s|
  1181 
  1182                                 s := sel allBold , ' --> '.
  1183                                 cnt := (counts at:sel) value.
  1184                                 cnt == 1 ifTrue:[
  1185                                     s , (firsts at:sel) name
  1186                                 ] ifFalse:[
  1187                                     cnt == 2 ifTrue:[
  1188                                         s , (firsts at:sel) name , ' and ' , (seconds at:sel) name
  1189                                     ] ifFalse:[
  1190                                         s , cnt printString , ' implementor(s)'
  1191                                     ]
  1192                                 ].
  1193                             ].
  1194                             
  1195             self enqueueDelayedAction:[ self updateListAfterPatternSearch: resultList ].
  1196         ] fork.
  1197 
  1198     "Created: / 01-06-2012 / 13:16:54 / cg"
  1199 !
  1200 
  1201 updateImplementorsOf:anInteger 
  1202     "Request the implementors of the selected argument provided by aNumber.
  1203      Return the receiver."
  1204     
  1205     |methods classList aNumber|
  1206 
  1207     (anInteger isNil) ifTrue:[
  1208         ^ self
  1209     ].
  1210     aNumber := anInteger ? 1.
  1211     methods := SystemBrowser 
  1212             findImplementorsOf:(resultSelectors at:aNumber)
  1213             in:Smalltalk allClasses
  1214             ignoreCase:false.
  1215     classList := methods asOrderedCollection 
  1216             collect:[:m | m mclass name , ' ' , m selector ].
  1217     classList := (self markMatchingClasses:(resultSelectors at:aNumber)
  1218             classesWithSelector:classList).
  1219     self classOfResultHolder value:classList.
  1220     classList size ~~ 0 ifTrue:[
  1221         self selectedClassOfResultHolder value:(classList first).
  1222         self selectedClassOfResultHolderChanged.
  1223     ] ifFalse:[
  1224         self selectedClassOfResultHolder value:nil.
  1225     ].
  1226 
  1227     "Modified (comment): / 24-06-2012 / 18:41:45 / cg"
  1228     "Modified: / 03-03-2019 / 23:13:43 / Claus Gittinger"
  1229 !
  1230 
  1231 updateListAfterPatternSearch:resultList
  1232     |searchPattern idx|
  1233     
  1234     self classOfResultHolder value:nil.
  1235     self codeHolder value:nil.
  1236     self resultHolder value:resultList.
  1237 
  1238     searchPattern := self selectorPatternHolder value.
  1239     "/ is the search pattern in the list (i.e. a perfect match)?
  1240     "/ Then select it.
  1241     idx := resultSelectors indexOf:searchPattern.
  1242     idx ~~ 0 ifTrue:[
  1243         self selectedImplementorsHolder setValue:idx; changed
  1244     ].    
  1245 ! !
  1246 
  1247 !MethodFinderWindow methodsFor:'aspects'!
  1248 
  1249 arg1BoxVisible
  1250     "Determines if the box should be visible or not. 
  1251      Return a holder providing true or false"
  1252 
  1253     arg1BoxVisible isNil ifTrue:[
  1254         arg1BoxVisible := BlockValue
  1255                               with:[:vh | vh value >= 2 ]
  1256                               argument:(self argCountHolder)
  1257     ].
  1258     ^ arg1BoxVisible.
  1259 !
  1260 
  1261 arg2BoxVisible
  1262     "Determines if the box should be visible or not. 
  1263      Return a holder providing true or false"
  1264 
  1265     arg2BoxVisible isNil ifTrue:[
  1266         arg2BoxVisible := BlockValue
  1267                               with:[:vh | vh value >= 3 ]
  1268                               argument:(self argCountHolder)
  1269     ].
  1270     ^ arg2BoxVisible.
  1271 !
  1272 
  1273 arg3BoxVisible
  1274     "Determines if the box should be visible or not. 
  1275      Return a holder providing true or false"
  1276 
  1277     arg3BoxVisible isNil ifTrue:[
  1278         arg3BoxVisible := BlockValue
  1279                               with:[:vh | vh value >= 4 ]
  1280                               argument:(self argCountHolder)
  1281     ].
  1282     ^ arg3BoxVisible.
  1283 !
  1284 
  1285 arg4BoxVisible
  1286     "Determines if the box should be visible or not. 
  1287      Return a holder providing true or false"
  1288 
  1289     arg4BoxVisible isNil ifTrue:[
  1290         arg4BoxVisible := BlockValue
  1291                               with:[:vh | vh value >= 5 ]
  1292                               argument:(self argCountHolder)
  1293     ].
  1294     ^ arg4BoxVisible.
  1295 !
  1296 
  1297 argCountHolder
  1298     "Return an argCounterHolder which is initialized at 2."
  1299     
  1300     argCountHolder isNil ifTrue:[
  1301         argCountHolder := 2 asValue.
  1302     ].     
  1303     ^ argCountHolder.
  1304 !
  1305 
  1306 argCountList
  1307     "Return the argCountList (shown in the combo)"
  1308 
  1309     argCountList isNil ifTrue:[
  1310         argCountList := #('0 arguments' '1 argument' '2 arguments' '3 arguments') asValue  
  1311     ].
  1312     ^ argCountList.
  1313 !
  1314 
  1315 classOfResultHolder
  1316     "Return a valueHolder which contains a collection with the names of the 
  1317      implementors of a specific message.   "
  1318 
  1319     classOfResultHolder isNil ifTrue:[
  1320         classOfResultHolder := ValueHolder new.
  1321     ].
  1322     ^ classOfResultHolder
  1323 !
  1324 
  1325 codeHolder
  1326     codeHolder isNil ifTrue:[
  1327         codeHolder := '' asValue.
  1328     ].
  1329     ^ codeHolder.
  1330 
  1331     "Created: / 13.11.2001 / 12:44:11 / cg"
  1332 !
  1333 
  1334 codeViewClass
  1335     "the species of view to be created as codeview"
  1336     
  1337     ^ Tools::CodeView2 ? CodeView
  1338 !
  1339 
  1340 resultHolder
  1341     "Return a value holder which contains the results of a search as a collection."
  1342 
  1343     resultHolder isNil ifTrue:[
  1344         resultHolder := ValueHolder new.
  1345         resultHolder value:(self resultInfoText collect:[:l | l withColor:Color darkGrey]).
  1346     ].
  1347     ^ resultHolder.
  1348 
  1349     "Modified: / 01-06-2012 / 13:06:02 / cg"
  1350 !
  1351 
  1352 resultInfoText
  1353     ^  {
  1354           'Please enter combination of' .
  1355           '    ',('receiver, arg and result' allBold) .
  1356           'or a'.
  1357           '    ',('selector search pattern' allBold) .
  1358           'into the above fields.' .
  1359           'Then click on either ',('"search"' allBold),'-button.'
  1360        }
  1361 !
  1362 
  1363 selectedClassOfResultHolder
  1364     "valueHolder which contains the index of the selected result class (right list)"
  1365 
  1366     selectedClassOfResultHolder isNil ifTrue:[
  1367         selectedClassOfResultHolder := ValueHolder new.
  1368     ].
  1369     ^ selectedClassOfResultHolder
  1370 
  1371     "Modified (comment): / 21-09-2012 / 11:10:29 / cg"
  1372 !
  1373 
  1374 selectedImplementorsHolder
  1375     "valueHolder which contains the index of the selected implementors list (left list)"
  1376 
  1377     selectedImplementorsHolder isNil ifTrue:[
  1378         selectedImplementorsHolder := ValueHolder new.
  1379         selectedImplementorsHolder onChangeEvaluate:[self updateImplementorsOf:selectedImplementorsHolder value].
  1380     ].
  1381     ^ selectedImplementorsHolder
  1382 
  1383     "Created: / 21-09-2012 / 11:10:13 / cg"
  1384 !
  1385 
  1386 selectorPatternHolder
  1387     selectorPatternHolder isNil ifTrue:[
  1388         selectorPatternHolder := ValueHolder new.
  1389         selectorPatternHolder onChangeSend:#selectorPatternChanged to:self.
  1390     ].
  1391     ^ selectorPatternHolder
  1392 
  1393     "Created: / 27-04-2012 / 14:44:01 / cg"
  1394 ! !
  1395 
  1396 !MethodFinderWindow methodsFor:'controlInput'!
  1397 
  1398 cleanInputs:aDirtyString 
  1399     "Find and remove common mistakes made by the user. Return the 
  1400      'aStringToBeCleaned' variable"
  1401     
  1402     |aStringToBeCleaned rs position|
  1403 
  1404     aStringToBeCleaned := aDirtyString.
  1405     (aStringToBeCleaned endsWith:(Character cr)) ifTrue:[
  1406         aStringToBeCleaned := aStringToBeCleaned copyFrom:1 to:(aStringToBeCleaned size - 1).
  1407     ].
  1408     aStringToBeCleaned := aStringToBeCleaned withoutSeparators.
  1409     rs := ReadStream on:aStringToBeCleaned.
  1410     [
  1411         rs upToAll_positionBefore:'#true'.
  1412         rs atEnd
  1413     ] whileFalse:[
  1414         position := rs position.
  1415         aStringToBeCleaned := aStringToBeCleaned 
  1416                 copyReplaceFrom:position
  1417                 to:position
  1418                 with:''.
  1419         rs := ReadStream on:aStringToBeCleaned.
  1420     ].
  1421     rs := ReadStream on:aStringToBeCleaned.
  1422     [
  1423         rs upToAll_positionBefore:'#false'.
  1424         rs atEnd
  1425     ] whileFalse:[
  1426         position := rs position.
  1427         aStringToBeCleaned := aStringToBeCleaned 
  1428                 copyReplaceFrom:position
  1429                 to:position
  1430                 with:''.
  1431         rs := ReadStream on:aStringToBeCleaned.
  1432     ].
  1433     [
  1434         rs upToAll_positionBefore:'#nil'.
  1435         rs atEnd
  1436     ] whileFalse:[
  1437         position := rs position.
  1438         aStringToBeCleaned := aStringToBeCleaned 
  1439                 copyReplaceFrom:position
  1440                 to:position
  1441                 with:''.
  1442         rs := ReadStream on:aStringToBeCleaned.
  1443     ].
  1444     ^ aStringToBeCleaned
  1445 !
  1446 
  1447 markMatchingClasses:aSelector classesWithSelector:anOrderedCollection
  1448     " Matches the class of the receiver with all the elements in anOrderedCollection
  1449      (which are classes with selectors). If a match is found it is marked with an asterisk.
  1450      The classes are then sorted so the asterisk appears first. Return the
  1451      markedClassList."
  1452     
  1453     |marker recClass unmarkedClassList markedClassList|
  1454 
  1455     marker := self class markerForImplementingClass.
  1456     recClass := receiver value class.
  1457     unmarkedClassList := anOrderedCollection copy.
  1458     unmarkedClassList do:[:classAndMethod |
  1459         |className class sel|
  1460 
  1461         className := classAndMethod copyButLast:aSelector size.
  1462         class := Smalltalk classNamed:className. "/ Compiler evaluate:className.
  1463 
  1464         "/ (recClass == class)
  1465 
  1466         (recClass whichClassImplements:aSelector) == class ifTrue:[
  1467             "/ unmarkedClassList add: marker, classAndMethod.
  1468             unmarkedClassList add:classAndMethod allBold.
  1469             unmarkedClassList remove:classAndMethod.
  1470         ].
  1471     ].
  1472     unmarkedClassList
  1473         sort:[:a :b |
  1474             |rawA rawB|
  1475 
  1476             rawA := a string withoutPrefix:marker.
  1477             rawB := b string withoutPrefix:marker.
  1478             rawA < rawB.
  1479         ].
  1480     markedClassList := unmarkedClassList.
  1481     ^ markedClassList
  1482 
  1483     "Modified: / 13.11.2001 / 12:16:05 / cg"
  1484 !
  1485 
  1486 mergeReceiver: aReceiver withArgument: arguments
  1487 
  1488 "Puts the receiver and arguments into an array so it can be of a suitable input for the
  1489  MethodFinder. Return an array."
  1490 
  1491 | tempReceiver tempArguments receiverWithArgument|
  1492 
  1493   tempReceiver:= aReceiver.
  1494  tempArguments :=  arguments.
  1495 
  1496 (tempArguments isEmpty or:[(tempArguments) isNil])
  1497                 ifTrue:[  receiverWithArgument:=Array new:1."no argument"
  1498                           receiverWithArgument at:1 put: tempReceiver.     
  1499                         ]
  1500                 ifFalse:[
  1501         (tempArguments size = 1)
  1502                         ifTrue:[ receiverWithArgument:=Array new:2.
  1503                                   receiverWithArgument at:1 put: tempReceiver.      
  1504                                   receiverWithArgument at:2 put: (tempArguments at:1)
  1505                                 ].  "a receiver with an argument"
  1506 
  1507         (tempArguments size = 2)
  1508                         ifTrue:[ receiverWithArgument:=Array new:3.
  1509                                   receiverWithArgument at:1 put: tempReceiver.      
  1510                                   (receiverWithArgument at:2 put: (tempArguments at:1)).
  1511                                   (receiverWithArgument at:3 put: (tempArguments at:2))
  1512                                 ].  "a receiver with an argument"
  1513         (tempArguments size = 3)
  1514                         ifTrue:[ receiverWithArgument:=Array new:4.
  1515                                   receiverWithArgument at:1 put: tempReceiver.      
  1516                                   (receiverWithArgument at:2 put: (tempArguments at:1)).
  1517                                   (receiverWithArgument at:3 put: (tempArguments at:2)).
  1518                                   (receiverWithArgument at:4 put: (tempArguments at:3)).
  1519 
  1520                                 ].  "a receiver with an argument"
  1521 
  1522                         ].
  1523 ^receiverWithArgument
  1524 ! !
  1525 
  1526 !MethodFinderWindow methodsFor:'initialization'!
  1527 
  1528 argument1WidgetCreated: aWidget
  1529     "UI post creation hook. remember the widget as an instance variable."
  1530 
  1531     argument1Editor := aWidget scrolledView.
  1532     aWidget tabMeansNextField:true.
  1533 
  1534     "Modified: / 13.11.2001 / 12:21:41 / cg"
  1535 !
  1536 
  1537 argument2WidgetCreated: aWidget
  1538     "UI post creation hook. remember the widget as an instance variable."
  1539 
  1540     argument2Editor := aWidget scrolledView.
  1541     aWidget tabMeansNextField:true.
  1542 
  1543     "Modified: / 13.11.2001 / 12:21:45 / cg"
  1544 !
  1545 
  1546 argument3WidgetCreated: aWidget
  1547     "UI post creation hook. remember the widget as an instance variable"
  1548 
  1549     argument3Editor := aWidget scrolledView.
  1550     aWidget tabMeansNextField:true.
  1551 
  1552     "Modified: / 13.11.2001 / 12:21:49 / cg"
  1553 !
  1554 
  1555 messageAnswerWidgetCreated: aWidget
  1556     "UI post creation hook. remember the widget as an instance variable."
  1557 
  1558     messageAnswerEditor := aWidget scrolledView.
  1559     aWidget tabMeansNextField:true.
  1560 
  1561     "Modified: / 13.11.2001 / 12:24:55 / cg"
  1562 !
  1563 
  1564 receiverWidgetCreated: aWidget
  1565     "UI post creation hook. remember the widget as an instance variable."
  1566 
  1567     receiverEditor := aWidget scrolledView.
  1568     aWidget tabMeansNextField:true.
  1569 
  1570     "Modified: / 13.11.2001 / 12:24:49 / cg"
  1571 !
  1572 
  1573 sourceCodeWidgetCreated: aWidget
  1574     "UI post creation hook. make the codeView readonly"
  1575     
  1576     aWidget acceptAction:nil.
  1577     aWidget readOnly:true
  1578 
  1579     "Created: / 13.11.2001 / 12:50:27 / cg"
  1580     "Modified: / 13.11.2001 / 12:51:23 / cg"
  1581 ! !
  1582 
  1583 !MethodFinderWindow methodsFor:'menu actions'!
  1584 
  1585 aboutThisApplicationText
  1586     |msg|
  1587 
  1588     msg := super aboutThisApplicationText.
  1589     msg := msg , '\\Original written by Ted Kaehler, Scott Wallace and Dan Ingalls.
  1590 Ported from Squeak to ST/X by James Hayes (2001 james@exept.de).
  1591 Improved by Claus Gittinger.    
  1592 '.
  1593     ^msg withCRs.
  1594 
  1595     "Modified: / 13.11.2001 / 12:56:44 / cg"
  1596 !
  1597 
  1598 openHTMLDocumentation
  1599     "about/help menu action"
  1600     
  1601     HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#METHODFINDER'
  1602 ! !
  1603 
  1604 !MethodFinderWindow methodsFor:'private'!
  1605 
  1606 argumentEditorsContents
  1607 
  1608 "Determine how many text editors of the arguments are used and store the result
  1609 as argCounter. The result being the minimum between how many editors have
  1610 expressions in and how many are displayed.
  1611 
  1612 Add each argument string (key)and the evaluated version (value) to an Ordered Dictionary
  1613 from each of the text editors.
  1614 
  1615 Return the OrderedDictionary with the expressions from all the text editors. "
  1616 
  1617      | tempArguments argCounter tempArgument1Editor tempArgument2Editor tempArgument3Editor
  1618 associationKey associationValue|
  1619 
  1620 argCounter:=0.
  1621 
  1622 tempArgument1Editor:= (self cleanInputs: argument1Editor contents).
  1623 tempArgument2Editor:=  (self cleanInputs: argument2Editor contents).
  1624 tempArgument3Editor:= (self cleanInputs: argument3Editor contents).
  1625 
  1626 tempArgument1Editor = '' ifFalse:[argCounter:=argCounter +1].
  1627 tempArgument2Editor = '' ifFalse:[argCounter:=argCounter +1].
  1628 tempArgument3Editor = '' ifFalse:[argCounter:=argCounter +1].
  1629 
  1630 
  1631 argCounter:= (argCounter min: (self argCountHolder value -1)).
  1632 tempArguments:= OrderedDictionary new:argCounter. 
  1633 
  1634 (argCounter value >= 1) 
  1635                 ifTrue:[associationValue:= (Compiler evaluate: tempArgument1Editor).
  1636                         ((self isExpression:tempArgument1Editor) or:[ associationValue isNil]) ifTrue:[                  "looks if an expression is typed in"
  1637                                         associationKey:=associationValue printString]
  1638                                                           ifFalse:[
  1639                                         associationKey:=tempArgument1Editor].
  1640 
  1641                         tempArguments add: associationKey-> associationValue.
  1642                         ].
  1643 (argCounter value >= 2) 
  1644                 ifTrue:[ associationValue:= (Compiler evaluate: tempArgument2Editor).
  1645                         (((self isExpression:tempArgument2Editor) or:[ associationValue isNil])) ifTrue:[                  "looks if an expression is typed in"
  1646                                         associationKey:=associationValue printString]
  1647                                                           ifFalse:[
  1648                                         associationKey:=tempArgument2Editor].
  1649 
  1650                         tempArguments add: associationKey-> associationValue].
  1651 
  1652 (argCounter value >= 3)
  1653                 ifTrue:[ associationValue:= (Compiler evaluate: tempArgument3Editor).
  1654                         ((self isExpression:tempArgument3Editor) or:[ associationValue isNil]) ifTrue:[                  "looks if an expression is typed in"
  1655                                         associationKey:=associationValue printString]
  1656                                                           ifFalse:[
  1657                                         associationKey:=tempArgument3Editor].
  1658 
  1659                         tempArguments add: associationKey-> associationValue].
  1660 
  1661 
  1662 ^tempArguments
  1663 !
  1664 
  1665 extractClassAndSelectorFrom:anArgument 
  1666     "Opens browser on theArgument of a specific class. anArgument being a string with the
  1667        Class and the selector upon which the browser is to be opened. Return the receiver."
  1668 
  1669     |aClass aSelector x theArgument marker|
  1670 
  1671     anArgument isNil ifTrue:[
  1672         ^ nil
  1673     ].
  1674     marker := self class markerForImplementingClass.
  1675 
  1676     theArgument := anArgument string withoutPrefix:marker.
  1677     aClass := theArgument copyUpTo:(Character space).
  1678     x := aClass size + 2.
  1679     aSelector := theArgument copyFrom:x.
  1680     aClass := Smalltalk classNamed:aClass.
  1681     (aSelector startsWith:'class ') ifTrue:[
  1682         aSelector := aSelector withoutPrefix:'class '.
  1683         aClass := aClass class.
  1684     ].
  1685     ^ aClass -> aSelector asSymbol
  1686 
  1687 "
  1688 MethodFinderWindow new extractClassAndSelectorFrom: '*SmallInteger +'
  1689 MethodFinderWindow new extractClassAndSelectorFrom: 'String ,'       
  1690 MethodFinderWindow new extractClassAndSelectorFrom: 'Number detentBy:atMultiplesOf:snap:' 
  1691 
  1692 
  1693 "
  1694 
  1695     "Modified: / 27-04-2012 / 15:05:53 / cg"
  1696 !
  1697 
  1698 isExpression:aString 
  1699     "Return true or false depending on if the subString includes certain characters"
  1700     
  1701     "/ cg: this is naive - why not ask the parser, if it is a literal?
  1702     (aString includesSubString:': ') ifTrue:[
  1703         ^ true
  1704     ].
  1705     (aString includes:$+) ifTrue:[
  1706         ^ true
  1707     ].
  1708     (aString includes:$-) ifTrue:[
  1709         ^ true
  1710     ].
  1711     (aString includes:$*) ifTrue:[
  1712         ^ true
  1713     ].
  1714     (aString includes:$/) ifTrue:[
  1715         ^ true
  1716     ].
  1717     (aString includes:$>) ifTrue:[
  1718         ^ true
  1719     ].
  1720     (aString includes:$<) ifTrue:[
  1721         ^ true
  1722     ].
  1723     (aString includesSubString:' new') ifTrue:[
  1724         ^ true
  1725     ].
  1726     (aString includes:$[) 
  1727         & (aString includes:$]) 
  1728         & (aString includes:$.) ifTrue:[ ^ false ].
  1729 
  1730     (aString includes:$.) ifTrue:[
  1731         ^ true
  1732     ].
  1733     ^ false
  1734 !
  1735 
  1736 receiverEditorContents
  1737     "Return a cleaned up version of receiver taken from the receiverEditor
  1738      as an association. The association has aCleanedReceiverString as a key and the
  1739      compiledReceiver as value."
  1740 
  1741     |aCleanedReceiverString compiledReceiver|
  1742 
  1743     aCleanedReceiverString := self cleanInputs:(receiverEditor contents).
  1744     compiledReceiver := Compiler evaluate:aCleanedReceiverString.
  1745     ((self isExpression:aCleanedReceiverString) or:[ compiledReceiver isNil ]) ifTrue:[
  1746         aCleanedReceiverString := compiledReceiver printString
  1747     ].
  1748     ^ aCleanedReceiverString -> compiledReceiver.
  1749 !
  1750 
  1751 waitForBackgroundSearchFinished
  1752     | p |
  1753 
  1754     (p := searchProcess) isNil ifTrue:[^ self].
  1755     p isDead ifTrue:[^ self].
  1756     p waitUntilTerminated 
  1757 ! !
  1758 
  1759 !MethodFinderWindow methodsFor:'user actions'!
  1760 
  1761 selectedClassOfResultHolderChanged
  1762     |sel classAndSelector mthd|
  1763 
  1764     sel := self selectedClassOfResultHolder value.
  1765 
  1766     classAndSelector := self extractClassAndSelectorFrom:sel.
  1767     classAndSelector isNil ifTrue:[
  1768         ^ self
  1769     ].
  1770     mthd := classAndSelector key >> classAndSelector value.   
  1771     mthd notNil ifTrue:[
  1772         self withWaitCursorDo:[
  1773             self codeHolder value:mthd source
  1774         ]
  1775     ] ifFalse:[
  1776         self codeHolder value:nil
  1777     ].
  1778 
  1779     "Created: / 13.11.2001 / 12:43:43 / cg"
  1780     "Modified: / 13.11.2001 / 12:48:56 / cg"
  1781 !
  1782 
  1783 selectorPatternChanged
  1784     self searchPatternMatchesInBackground
  1785 
  1786     "Created: / 01-06-2012 / 13:18:16 / cg"
  1787 ! !
  1788 
  1789 !MethodFinderWindow class methodsFor:'documentation'!
  1790 
  1791 version
  1792     ^ '$Header$'
  1793 !
  1794 
  1795 version_CVS
  1796     ^ '$Header$'
  1797 ! !
  1798