MethodFinderWindow.st
author Claus Gittinger <cg@exept.de>
Sat, 21 Jul 2012 18:58:03 +0200
changeset 2898 c7f6c498df6a
parent 2892 a1349bc5e2fe
child 2927 558cd901ebce
permissions -rw-r--r--
category of:15 methods
james@1522
     1
"{ Package: 'stx:libtool2' }"
james@1522
     2
james@1522
     3
ApplicationModel subclass:#MethodFinderWindow
james@1522
     4
	instanceVariableNames:'argumentsEditor messageAnswerEditor receiverEditor receiver
james@1522
     5
		resultSelectors arg2BoxVisible arg1BoxVisible arg4BoxVisible
james@1522
     6
		arg3BoxVisible argCountHolder argCountList argument1Editor
james@1522
     7
		argument2Editor argument3Editor argument4Editor resultSelected
cg@2891
     8
		lookAtResultEditor codeHolder searchProcess'
james@1522
     9
	classVariableNames:''
james@1522
    10
	poolDictionaries:''
cg@1538
    11
	category:'Interface-MethodFinder'
james@1522
    12
!
james@1522
    13
cg@1530
    14
!MethodFinderWindow class methodsFor:'documentation'!
cg@1530
    15
cg@1530
    16
documentation
cg@1530
    17
"
cg@1531
    18
  [author:]
cg@1531
    19
    ported from Squeak and GUI enhanced by James Hayes james@exept.de
cg@1530
    20
"
cg@1530
    21
! !
james@1522
    22
cg@1532
    23
!MethodFinderWindow class methodsFor:'constants'!
cg@1532
    24
cg@2890
    25
defaultIcon
cg@2890
    26
    ^ ToolbarIconLibrary methodFinder24x24Icon
cg@2890
    27
cg@2890
    28
    "Created: / 01-06-2012 / 13:05:11 / cg"
cg@2890
    29
!
cg@2890
    30
cg@1532
    31
markerForImplementingClass
cg@1532
    32
    ^ '=> '.
cg@1532
    33
    ^ '*'
cg@1532
    34
cg@1532
    35
    "Created: / 13.11.2001 / 12:09:52 / cg"
cg@1532
    36
    "Modified: / 13.11.2001 / 12:11:57 / cg"
cg@1532
    37
! !
cg@1532
    38
james@1522
    39
!MethodFinderWindow class methodsFor:'interface specs'!
james@1522
    40
james@1522
    41
windowSpec
james@1522
    42
    "This resource specification was automatically generated
james@1522
    43
     by the UIPainter of ST/X."
james@1522
    44
james@1522
    45
    "Do not manually edit this!! If it is corrupted,
james@1522
    46
     the UIPainter may not be able to read the specification."
james@1522
    47
james@1522
    48
    "
james@1522
    49
     UIPainter new openOnClass:MethodFinderWindow andSelector:#windowSpec
james@1522
    50
     MethodFinderWindow new openInterface:#windowSpec
james@1522
    51
     MethodFinderWindow open
james@1522
    52
    "
james@1522
    53
james@1522
    54
    <resource: #canvas>
james@1522
    55
james@1522
    56
    ^ 
cg@2886
    57
     #(FullSpec
cg@2886
    58
        name: windowSpec
cg@2886
    59
        window: 
cg@2886
    60
       (WindowSpec
cg@2886
    61
          label: 'MethodFinder'
cg@2886
    62
          name: 'MethodFinder'
cg@2890
    63
          bounds: (Rectangle 0 0 798 595)
cg@2886
    64
          menu: menu
cg@2890
    65
          icon: defaultIcon
james@1522
    66
        )
cg@2886
    67
        component: 
cg@2886
    68
       (SpecCollection
cg@2886
    69
          collection: (
cg@2886
    70
           (VariableHorizontalPanelSpec
cg@2886
    71
              name: 'VariableHorizontalPanel1'
cg@2886
    72
              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
cg@2886
    73
              snapMode: both
cg@2886
    74
              component: 
cg@2886
    75
             (SpecCollection
cg@2886
    76
                collection: (
cg@2886
    77
                 (ViewSpec
cg@2886
    78
                    name: 'LeftBox'
cg@2886
    79
                    level: 1
cg@2886
    80
                    component: 
cg@2886
    81
                   (SpecCollection
cg@2886
    82
                      collection: (
cg@2886
    83
                       (ViewSpec
cg@2886
    84
                          name: 'ReceiverArgBox'
cg@2887
    85
                          layout: (LayoutFrame 0 0 0 0 0 1 -100 0.5)
cg@2886
    86
                          component: 
cg@2886
    87
                         (SpecCollection
cg@2886
    88
                            collection: (
cg@2886
    89
                             (LabelSpec
cg@2886
    90
                                label: 'Receiver'
cg@2886
    91
                                name: 'ReceiverLabel'
cg@2886
    92
                                layout: (LayoutFrame 0 0 0 0 0 0.34 24 0)
cg@2886
    93
                                translateLabel: true
cg@1530
    94
                              )
cg@2886
    95
                             (ComboListSpec
cg@2886
    96
                                name: 'allowedArgments'
cg@2886
    97
                                layout: (LayoutFrame 0 0.34 1 0 0 0.64 23 0)
cg@2886
    98
                                model: argCountHolder
cg@2886
    99
                                comboList: argCountList
cg@2886
   100
                                useIndex: true
cg@1532
   101
                              )
cg@2886
   102
                             (LabelSpec
cg@2886
   103
                                label: 'Answer'
cg@2886
   104
                                name: 'MessageAnswerLabel'
cg@2886
   105
                                layout: (LayoutFrame 0 0.64 0 0 0 1 24 0)
cg@2886
   106
                                translateLabel: true
cg@1532
   107
                              )
cg@2886
   108
                             (HorizontalPanelViewSpec
cg@2886
   109
                                name: 'HorizontalPanel1'
cg@2886
   110
                                layout: (LayoutFrame 0 0 25 0 0 1 0 1)
cg@2886
   111
                                horizontalLayout: fit
cg@2886
   112
                                verticalLayout: fit
cg@2886
   113
                                horizontalSpace: 3
cg@2886
   114
                                verticalSpace: 3
cg@2886
   115
                                component: 
cg@2886
   116
                               (SpecCollection
cg@2886
   117
                                  collection: (
cg@2886
   118
                                   (WorkspaceSpec
cg@2886
   119
                                      name: 'ReceiverEditor'
cg@2886
   120
                                      tabable: true
cg@2886
   121
                                      hasHorizontalScrollBar: true
cg@2886
   122
                                      hasVerticalScrollBar: true
cg@2886
   123
                                      miniScrollerHorizontal: true
cg@2886
   124
                                      miniScrollerVertical: true
cg@2886
   125
                                      autoHideScrollBars: true
cg@2886
   126
                                      hasKeyboardFocusInitially: false
cg@2890
   127
                                      extent: (Point 113 172)
cg@2886
   128
                                      postBuildCallback: receiverWidgetCreated:
cg@1532
   129
                                    )
cg@2886
   130
                                   (VerticalPanelViewSpec
cg@2886
   131
                                      name: 'VerticalPanel1'
cg@2886
   132
                                      horizontalLayout: fit
cg@2886
   133
                                      verticalLayout: fit
cg@2886
   134
                                      horizontalSpace: 3
cg@2886
   135
                                      verticalSpace: 3
cg@2886
   136
                                      component: 
cg@2886
   137
                                     (SpecCollection
cg@2886
   138
                                        collection: (
cg@2886
   139
                                         (ViewSpec
cg@2886
   140
                                            name: 'Box1'
cg@2886
   141
                                            visibilityChannel: arg1BoxVisible
cg@2886
   142
                                            component: 
cg@2886
   143
                                           (SpecCollection
cg@2886
   144
                                              collection: (
cg@2886
   145
                                               (WorkspaceSpec
cg@2886
   146
                                                  name: 'Arg1Editor'
cg@2886
   147
                                                  layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
cg@2886
   148
                                                  tabable: true
cg@2886
   149
                                                  hasHorizontalScrollBar: true
cg@2886
   150
                                                  hasVerticalScrollBar: true
cg@2886
   151
                                                  miniScrollerHorizontal: true
cg@2886
   152
                                                  miniScrollerVertical: true
cg@2886
   153
                                                  autoHideScrollBars: true
cg@2886
   154
                                                  hasKeyboardFocusInitially: false
cg@2886
   155
                                                  postBuildCallback: argument1WidgetCreated:
cg@1532
   156
                                                )
cg@1532
   157
                                               )
cg@1532
   158
                                             
cg@1532
   159
                                            )
cg@2890
   160
                                            extent: (Point 114 55)
cg@1532
   161
                                          )
cg@2886
   162
                                         (ViewSpec
cg@2886
   163
                                            name: 'Box2'
cg@2886
   164
                                            visibilityChannel: arg2BoxVisible
cg@2886
   165
                                            component: 
cg@2886
   166
                                           (SpecCollection
cg@2886
   167
                                              collection: (
cg@2886
   168
                                               (WorkspaceSpec
cg@2886
   169
                                                  name: 'TextEditor5'
cg@2886
   170
                                                  layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
cg@2886
   171
                                                  tabable: true
cg@2886
   172
                                                  hasHorizontalScrollBar: true
cg@2886
   173
                                                  hasVerticalScrollBar: true
cg@2886
   174
                                                  miniScrollerHorizontal: true
cg@2886
   175
                                                  miniScrollerVertical: true
cg@2886
   176
                                                  autoHideScrollBars: true
cg@2886
   177
                                                  hasKeyboardFocusInitially: false
cg@2886
   178
                                                  postBuildCallback: argument2WidgetCreated:
cg@1532
   179
                                                )
cg@1532
   180
                                               )
cg@1532
   181
                                             
cg@1532
   182
                                            )
cg@2890
   183
                                            extent: (Point 114 56)
cg@1532
   184
                                          )
cg@2886
   185
                                         (ViewSpec
cg@2886
   186
                                            name: 'Box3'
cg@2886
   187
                                            visibilityChannel: arg3BoxVisible
cg@2886
   188
                                            component: 
cg@2886
   189
                                           (SpecCollection
cg@2886
   190
                                              collection: (
cg@2886
   191
                                               (WorkspaceSpec
cg@2886
   192
                                                  name: 'TextEditor6'
cg@2886
   193
                                                  layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
cg@2886
   194
                                                  tabable: true
cg@2886
   195
                                                  hasHorizontalScrollBar: true
cg@2886
   196
                                                  hasVerticalScrollBar: true
cg@2886
   197
                                                  miniScrollerHorizontal: true
cg@2886
   198
                                                  miniScrollerVertical: true
cg@2886
   199
                                                  autoHideScrollBars: true
cg@2886
   200
                                                  hasKeyboardFocusInitially: false
cg@2886
   201
                                                  postBuildCallback: argument3WidgetCreated:
cg@1532
   202
                                                )
cg@1532
   203
                                               )
cg@1532
   204
                                             
cg@1532
   205
                                            )
cg@2890
   206
                                            extent: (Point 114 55)
cg@1530
   207
                                          )
cg@1530
   208
                                         )
cg@1530
   209
                                       
cg@1530
   210
                                      )
cg@2890
   211
                                      extent: (Point 114 172)
cg@1530
   212
                                    )
cg@2886
   213
                                   (WorkspaceSpec
cg@2886
   214
                                      name: 'AnswerEditor'
cg@2886
   215
                                      tabable: true
cg@2886
   216
                                      hasHorizontalScrollBar: true
cg@2886
   217
                                      hasVerticalScrollBar: true
cg@2886
   218
                                      miniScrollerHorizontal: true
cg@2886
   219
                                      miniScrollerVertical: true
cg@2886
   220
                                      autoHideScrollBars: true
cg@2886
   221
                                      hasKeyboardFocusInitially: false
cg@2890
   222
                                      extent: (Point 114 172)
cg@2886
   223
                                      postBuildCallback: messageAnswerWidgetCreated:
james@1525
   224
                                    )
james@1525
   225
                                   )
james@1525
   226
                                 
james@1525
   227
                                )
james@1525
   228
                              )
cg@1532
   229
                             )
cg@1532
   230
                           
cg@1532
   231
                          )
cg@1532
   232
                        )
cg@2886
   233
                       (ViewSpec
cg@2886
   234
                          name: 'ReceiverArgBoxActionBox'
cg@2887
   235
                          layout: (LayoutFrame 0 0 -98 0.5 0 1 -75 0.5)
cg@2886
   236
                          component: 
cg@2886
   237
                         (SpecCollection
cg@2886
   238
                            collection: (
cg@2886
   239
                             (ActionButtonSpec
cg@2886
   240
                                label: 'Clear'
cg@2886
   241
                                name: 'Button2'
cg@2886
   242
                                layout: (LayoutFrame 5 0 0 0 -5 0.5 0 1)
cg@2886
   243
                                translateLabel: true
cg@2886
   244
                                model: clear
cg@1532
   245
                              )
cg@2886
   246
                             (ActionButtonSpec
cg@2886
   247
                                label: 'Search'
cg@2886
   248
                                name: 'Button1'
cg@2886
   249
                                layout: (LayoutFrame 5 0.5 0 0 -5 1 0 1)
cg@2886
   250
                                translateLabel: true
cg@2886
   251
                                tabable: true
cg@2886
   252
                                model: search
james@1522
   253
                              )
james@1522
   254
                             )
james@1522
   255
                           
james@1522
   256
                          )
james@1522
   257
                        )
cg@2886
   258
                       (ViewSpec
cg@2886
   259
                          name: 'MatchActionBox'
cg@2887
   260
                          layout: (LayoutFrame 0 0 -70 0.5 0 1 -20 0.5)
cg@2886
   261
                          component: 
cg@2886
   262
                         (SpecCollection
cg@2886
   263
                            collection: (
cg@2886
   264
                             (LabelSpec
cg@2886
   265
                                label: 'Selector Pattern:'
cg@2886
   266
                                name: 'Label1'
cg@2887
   267
                                layout: (LayoutFrame 0 0 0 0 0 0.5 25 0)
cg@2886
   268
                                translateLabel: true
cg@2886
   269
                                adjust: left
cg@2886
   270
                              )
cg@2886
   271
                             (InputFieldSpec
cg@2886
   272
                                name: 'EntryField1'
cg@2887
   273
                                layout: (LayoutFrame 0 0 -25 1 0 0.5 -5 1)
cg@2886
   274
                                model: selectorPattern
cg@2886
   275
                                immediateAccept: true
cg@2886
   276
                                acceptOnReturn: true
cg@2886
   277
                                acceptOnTab: true
cg@2886
   278
                                acceptOnPointerLeave: true
cg@2886
   279
                              )
cg@2886
   280
                             (ActionButtonSpec
cg@2886
   281
                                label: 'Search'
cg@2886
   282
                                name: 'Button4'
cg@2886
   283
                                layout: (LayoutFrame 5 0.5 -25 1 -5 1 0 1)
cg@2886
   284
                                translateLabel: true
cg@2886
   285
                                tabable: true
cg@2886
   286
                                model: searchPatternMatches
cg@2886
   287
                              )
cg@2886
   288
                             )
cg@2886
   289
                           
cg@2886
   290
                          )
cg@2886
   291
                        )
cg@2886
   292
                       (SequenceViewSpec
cg@2886
   293
                          name: 'ResultList'
cg@2887
   294
                          layout: (LayoutFrame 0 0 -15 0.5 0 1 0 1)
cg@2886
   295
                          hasHorizontalScrollBar: true
cg@2886
   296
                          hasVerticalScrollBar: true
cg@2886
   297
                          autoHideScrollBars: true
cg@2886
   298
                          valueChangeSelector: updateImplementorsOf:
cg@2886
   299
                          useIndex: true
cg@2886
   300
                          sequenceList: resultHolder
cg@2886
   301
                        )
cg@1530
   302
                       )
cg@1530
   303
                     
cg@1530
   304
                    )
cg@1530
   305
                  )
cg@2886
   306
                 (VariableVerticalPanelSpec
cg@2886
   307
                    name: 'VariableVerticalPanel1'
cg@2886
   308
                    component: 
cg@2886
   309
                   (SpecCollection
cg@2886
   310
                      collection: (
cg@2886
   311
                       (SequenceViewSpec
cg@2886
   312
                          name: 'List2'
cg@2886
   313
                          model: selectedClassOfResultHolder
cg@2886
   314
                          menu: implementorListMenu
cg@2886
   315
                          hasHorizontalScrollBar: true
cg@2886
   316
                          hasVerticalScrollBar: true
cg@2886
   317
                          autoHideScrollBars: true
cg@2886
   318
                          doubleClickSelector: openBrowserOn:
cg@2886
   319
                          valueChangeSelector: selectedClassOfResultHolderChanged
cg@2886
   320
                          useIndex: false
cg@2886
   321
                          sequenceList: classOfResultHolder
cg@1530
   322
                        )
cg@2886
   323
                       (CodeViewSpec
cg@2886
   324
                          name: 'CodeView'
cg@2886
   325
                          model: codeHolder
cg@2886
   326
                          hasHorizontalScrollBar: true
cg@2886
   327
                          hasVerticalScrollBar: true
cg@2886
   328
                          autoHideScrollBars: true
cg@2886
   329
                          hasKeyboardFocusInitially: false
cg@2886
   330
                          postBuildCallback: sourceCodeWidgetCreated:
james@1522
   331
                        )
james@1522
   332
                       )
james@1522
   333
                     
james@1522
   334
                    )
cg@2886
   335
                    handles: (Any 0.5 1.0)
james@1522
   336
                  )
james@1522
   337
                 )
james@1522
   338
               
james@1522
   339
              )
cg@2890
   340
              handles: (Any 0.443786982248521 1.0)
james@1522
   341
            )
james@1522
   342
           )
james@1522
   343
         
james@1522
   344
        )
james@1522
   345
      )
james@1522
   346
! !
james@1522
   347
james@1525
   348
!MethodFinderWindow class methodsFor:'menu specs'!
james@1525
   349
cg@1529
   350
implementorListMenu
cg@1529
   351
    "This resource specification was automatically generated
cg@1529
   352
     by the MenuEditor of ST/X."
cg@1529
   353
cg@1529
   354
    "Do not manually edit this!! If it is corrupted,
cg@1529
   355
     the MenuEditor may not be able to read the specification."
cg@1529
   356
cg@1529
   357
    "
cg@1529
   358
     MenuEditor new openOnClass:MethodFinderWindow andSelector:#implementorListMenu
cg@1529
   359
     (Menu new fromLiteralArrayEncoding:(MethodFinderWindow implementorListMenu)) startUp
cg@1529
   360
    "
cg@1529
   361
cg@1529
   362
    <resource: #menu>
cg@1529
   363
cg@1529
   364
    ^ 
cg@1529
   365
     #(#Menu
cg@1529
   366
        #(
cg@1529
   367
         #(#MenuItem
cg@1529
   368
            #label: 'Browse'
cg@1529
   369
            #translateLabel: true
cg@1529
   370
            #value: #openBrowserOnSelectedItem
cg@1529
   371
          )
cg@1529
   372
         )
cg@1529
   373
        nil
cg@1529
   374
        nil
cg@1529
   375
      )
cg@1529
   376
!
cg@1529
   377
james@1525
   378
menu
james@1525
   379
    "This resource specification was automatically generated
james@1525
   380
     by the MenuEditor of ST/X."
james@1525
   381
james@1525
   382
    "Do not manually edit this!! If it is corrupted,
james@1525
   383
     the MenuEditor may not be able to read the specification."
james@1525
   384
james@1525
   385
    "
james@1525
   386
     MenuEditor new openOnClass:MethodFinderWindow andSelector:#menu
james@1525
   387
     (Menu new fromLiteralArrayEncoding:(MethodFinderWindow menu)) startUp
james@1525
   388
    "
james@1525
   389
james@1525
   390
    <resource: #menu>
james@1525
   391
james@1525
   392
    ^ 
james@1525
   393
     #(#Menu
james@1525
   394
        #(
james@1525
   395
         #(#MenuItem
james@1525
   396
            #label: '&File'
james@1525
   397
            #activeHelpKey: #file
james@1525
   398
            #submenu: 
james@1525
   399
           #(#Menu
james@1525
   400
              #(
james@1525
   401
               #(#MenuItem
james@1525
   402
                  #label: 'Exit'
james@1525
   403
                  #value: #closeRequest
james@1525
   404
                  #activeHelpKey: #fileExit
james@1525
   405
                )
james@1525
   406
               )
james@1525
   407
              nil
james@1525
   408
              nil
james@1525
   409
            )
james@1525
   410
          )
james@1525
   411
         #(#MenuItem
james@1525
   412
            #label: 'Help'
james@1525
   413
            #startGroup: #right
james@1525
   414
            #submenu: 
james@1525
   415
           #(#Menu
james@1525
   416
              #(
james@1525
   417
               #(#MenuItem
james@1525
   418
                  #label: 'Documentation'
james@1525
   419
                  #value: #openHTMLDocumentation
james@1525
   420
                  #activeHelpKey: #helpTutorial
james@1525
   421
                )
james@1525
   422
               #(#MenuItem
cg@1532
   423
                  #label: 'About MethodFinder...'
james@1525
   424
                  #value: #openAboutThisApplication
james@1525
   425
                  #activeHelpKey: #aboutThisAppliaction
james@1525
   426
                )
james@1525
   427
               )
james@1525
   428
              nil
james@1525
   429
              nil
james@1525
   430
            )
james@1525
   431
          )
james@1525
   432
         )
james@1525
   433
        nil
james@1525
   434
        nil
james@1525
   435
      )
cg@1532
   436
cg@1532
   437
    "Modified: / 13.11.2001 / 12:36:39 / cg"
james@1525
   438
! !
james@1525
   439
james@1522
   440
!MethodFinderWindow methodsFor:'accessing'!
james@1522
   441
james@1522
   442
receiver
james@1525
   443
    "Return a copy of the value of the instance variable 'receiver' "
james@1522
   444
james@1522
   445
    ^ receiver copy
james@1522
   446
! !
james@1522
   447
james@1522
   448
!MethodFinderWindow methodsFor:'actions'!
james@1522
   449
james@1522
   450
argumentEditorsContents
james@1525
   451
james@1525
   452
"Determine how many text editors of the arguments are used and store the result
james@1525
   453
as argCounter. The result being the minimum between how many editors have
james@1525
   454
expressions in and how many are displayed.
james@1525
   455
james@1525
   456
Add each argument string (key)and the evaluated version (value) to an Ordered Dictionary
james@1525
   457
from each of the text editors.
james@1525
   458
james@1525
   459
Return the OrderedDictionary with the expressions from all the text editors. "
james@1525
   460
sr@2165
   461
     | tempArguments argCounter tempArgument1Editor tempArgument2Editor tempArgument3Editor
james@1522
   462
associationKey associationValue|
james@1522
   463
james@1522
   464
argCounter:=0.
james@1522
   465
james@1522
   466
tempArgument1Editor:= (self cleanInputs: argument1Editor contents).
james@1522
   467
tempArgument2Editor:=  (self cleanInputs: argument2Editor contents).
james@1522
   468
tempArgument3Editor:= (self cleanInputs: argument3Editor contents).
james@1522
   469
james@1522
   470
tempArgument1Editor = '' ifFalse:[argCounter:=argCounter +1].
james@1522
   471
tempArgument2Editor = '' ifFalse:[argCounter:=argCounter +1].
james@1522
   472
tempArgument3Editor = '' ifFalse:[argCounter:=argCounter +1].
james@1522
   473
james@1522
   474
james@1522
   475
argCounter:= (argCounter min: (self argCountHolder value -1)).
james@1522
   476
tempArguments:= OrderedDictionary new:argCounter. 
james@1522
   477
james@1522
   478
(argCounter value >= 1) 
james@1522
   479
                ifTrue:[associationValue:= (Compiler evaluate: tempArgument1Editor).
james@1522
   480
                        ((self isExpression:tempArgument1Editor) or:[ associationValue isNil]) ifTrue:[                  "looks if an expression is typed in"
james@1522
   481
                                        associationKey:=associationValue printString]
james@1522
   482
                                                          ifFalse:[
james@1522
   483
                                        associationKey:=tempArgument1Editor].
james@1522
   484
james@1522
   485
                        tempArguments add: associationKey-> associationValue.
james@1522
   486
                        ].
james@1522
   487
(argCounter value >= 2) 
james@1522
   488
                ifTrue:[ associationValue:= (Compiler evaluate: tempArgument2Editor).
james@1522
   489
                        (((self isExpression:tempArgument2Editor) or:[ associationValue isNil])) ifTrue:[                  "looks if an expression is typed in"
james@1522
   490
                                        associationKey:=associationValue printString]
james@1522
   491
                                                          ifFalse:[
james@1522
   492
                                        associationKey:=tempArgument2Editor].
james@1522
   493
james@1522
   494
                        tempArguments add: associationKey-> associationValue].
james@1522
   495
james@1522
   496
(argCounter value >= 3)
james@1522
   497
                ifTrue:[ associationValue:= (Compiler evaluate: tempArgument3Editor).
james@1522
   498
                        ((self isExpression:tempArgument3Editor) or:[ associationValue isNil]) ifTrue:[                  "looks if an expression is typed in"
james@1522
   499
                                        associationKey:=associationValue printString]
james@1522
   500
                                                          ifFalse:[
james@1522
   501
                                        associationKey:=tempArgument3Editor].
james@1522
   502
james@1522
   503
                        tempArguments add: associationKey-> associationValue].
james@1522
   504
james@1522
   505
james@1522
   506
^tempArguments
james@1522
   507
!
james@1522
   508
james@1522
   509
clear
james@1525
   510
    "Reset the contents of all the outputs. Return the receiver."
james@1522
   511
james@1522
   512
    receiverEditor contents:nil.
james@1522
   513
    argument1Editor contents:nil.
james@1522
   514
    argument2Editor contents:nil.
james@1522
   515
    argument3Editor contents:nil.
james@1522
   516
    messageAnswerEditor contents:nil.
james@1522
   517
    self resultHolder value:nil.
james@1525
   518
    self classOfResultHolder value: nil.
cg@2730
   519
    codeHolder value:nil.
james@1522
   520
!
james@1522
   521
cg@1532
   522
extractClassAndSelectorFrom:anArgument 
cg@1532
   523
    "Opens browser on theArgument of a specific class. anArgument being a string with the
cg@1532
   524
       Class and the selector upon which the browser is to be opened. Return the receiver."
cg@1532
   525
cg@1532
   526
    |aClass aSelector x theArgument marker|
cg@1532
   527
cg@1532
   528
    anArgument isNil ifTrue:[
cg@1532
   529
        ^ nil
cg@1532
   530
    ].
cg@1532
   531
    marker := self class markerForImplementingClass.
cg@1532
   532
cg@1532
   533
    theArgument := anArgument string.
cg@1532
   534
    (theArgument startsWith:marker) ifTrue:[
cg@1532
   535
        theArgument := theArgument copyFrom:marker size+1
cg@1532
   536
    ].
cg@1532
   537
    aClass := theArgument copyUpTo:(Character space).
cg@1532
   538
    x := aClass size + 2.
cg@1532
   539
    aSelector := theArgument copyFrom:x.
cg@1532
   540
    aClass := Smalltalk classNamed:aClass.
cg@2886
   541
    (aSelector startsWith:'class ') ifTrue:[
cg@2886
   542
        aSelector := aSelector copyFrom:'class 'size+1.
cg@2886
   543
        aClass := aClass class.
cg@2886
   544
    ].
cg@1532
   545
    ^ aClass -> aSelector asSymbol
cg@1532
   546
cg@1532
   547
"
cg@1532
   548
MethodFinderWindow new extractClassAndSelectorFrom: '*SmallInteger +'
cg@1532
   549
MethodFinderWindow new extractClassAndSelectorFrom: 'String ,'       
cg@1532
   550
MethodFinderWindow new extractClassAndSelectorFrom: 'Number detentBy:atMultiplesOf:snap:' 
cg@1532
   551
cg@1532
   552
cg@1532
   553
"
cg@1532
   554
cg@2886
   555
    "Modified: / 27-04-2012 / 15:05:53 / cg"
cg@1532
   556
!
cg@1532
   557
james@1522
   558
isExpression: aString
james@1525
   559
      "Return true or false depending on if the subString includes certain characters"
james@1522
   560
(aString includesSubString:': ') ifTrue:[^true].
james@1522
   561
(aString includesSubString:'+') ifTrue:[^true].
james@1522
   562
(aString includesSubString:'-') ifTrue:[^true].
james@1522
   563
(aString includesSubString:'*') ifTrue:[^true].
james@1522
   564
(aString includesSubString:'/') ifTrue:[^true].
james@1522
   565
(aString includesSubString:'>') ifTrue:[^true].
james@1522
   566
(aString includesSubString:'<') ifTrue:[^true].
james@1522
   567
(aString includesSubString:' new') ifTrue:[^true].
james@1522
   568
(aString includesSubString:'[') &  (aString includesSubString:']') & (aString includesSubString:'.')
james@1522
   569
                                ifTrue:[^false].
james@1522
   570
(aString includesSubString:'.') ifTrue:[^true].
james@1522
   571
james@1522
   572
 ^false
james@1522
   573
!
james@1522
   574
james@1522
   575
messageAnswerEditorContents
james@1525
   576
   "Return a cleaned up version of message answer taken from the messageAnswerEditor
james@1525
   577
    as an association. The association has cleanedAnswerString as a key and the 
james@1525
   578
    compiledAnswer as value."
james@1522
   579
james@1522
   580
    |   aCleanedAnswerString   compiledAnswer  |
james@1522
   581
james@1522
   582
aCleanedAnswerString:=self cleanInputs: (messageAnswerEditor contents). 
james@1522
   583
compiledAnswer:=Compiler evaluate: aCleanedAnswerString.
james@1522
   584
((self isExpression:aCleanedAnswerString) or:[compiledAnswer isNil]) ifTrue:[
james@1522
   585
                        aCleanedAnswerString:=compiledAnswer printString].
james@1522
   586
james@1522
   587
^aCleanedAnswerString->compiledAnswer.
james@1522
   588
!
james@1522
   589
james@1522
   590
openBrowserOn:anArgument 
james@1522
   591
    "Opens browser on theArgument of a specific class. anArgument being a string with the
james@1525
   592
       Class and the selector upon which the browser is to be opened. Return the receiver."
james@1522
   593
cg@1532
   594
    |classAndSelector|
james@1522
   595
cg@1532
   596
    classAndSelector := self extractClassAndSelectorFrom:anArgument.
cg@1532
   597
    classAndSelector isNil ifTrue:[
james@1525
   598
        ^ self
james@1522
   599
    ].
cg@2459
   600
    UserPreferences current systemBrowserClass
cg@2459
   601
        openInClass:classAndSelector key 
cg@2459
   602
        selector:classAndSelector value   
james@1525
   603
james@1525
   604
"
james@1525
   605
MethodFinderWindow new openBrowserOn: '*SmallInteger +'
james@1525
   606
MethodFinderWindow new openBrowserOn: 'String ,'
james@1525
   607
MethodFinderWindow new openBrowserOn: 'Number detentBy:atMultiplesOf:snap:' 
james@1525
   608
james@1525
   609
james@1525
   610
"
cg@1532
   611
cg@1532
   612
    "Modified: / 13.11.2001 / 12:46:17 / cg"
james@1522
   613
!
james@1522
   614
cg@1529
   615
openBrowserOnSelectedItem 
cg@1529
   616
    |sel|
cg@1529
   617
cg@1529
   618
    sel := self selectedClassOfResultHolder value.
cg@1529
   619
    self openBrowserOn:sel
cg@1532
   620
cg@1532
   621
    "Modified: / 13.11.2001 / 12:47:39 / cg"
cg@1529
   622
!
cg@1529
   623
james@1522
   624
receiverEditorContents
james@1525
   625
   "Return a cleaned up version of receiver taken from the receiverEditor
james@1525
   626
    as an association. The association has aCleanedRecieverString as a key and the 
james@1525
   627
    compiledReceiver as value."
james@1525
   628
james@1522
   629
    |   aCleanedRecieverString   compiledReceiver  |
james@1522
   630
james@1522
   631
aCleanedRecieverString:=self cleanInputs: (receiverEditor contents). 
james@1522
   632
james@1522
   633
compiledReceiver:=Compiler evaluate: aCleanedRecieverString.
james@1522
   634
james@1522
   635
((self isExpression:aCleanedRecieverString) or:[compiledReceiver isNil]) ifTrue:[
james@1522
   636
                        aCleanedRecieverString:=compiledReceiver printString].
james@1522
   637
^aCleanedRecieverString->compiledReceiver.
james@1522
   638
!
james@1522
   639
james@1522
   640
search
james@1525
   641
"Do a search based on the input in the various text editors. Return the receiver."
james@1522
   642
| tempReceiver tempAnswer tempArguments anArray resultArray receiverWithArgument mf|
cg@1534
   643
cg@1534
   644
self resultHolder value: nil.                "reset the result list"
james@1522
   645
self classOfResultHolder value: nil.        "reset the implementorOf list"
cg@1534
   646
self codeHolder value: nil.                  "reset the source"
james@1522
   647
james@1522
   648
tempArguments:=self argumentEditorsContents.
james@1522
   649
tempReceiver :=self receiverEditorContents .  
james@1522
   650
tempAnswer:= self messageAnswerEditorContents.   
james@1522
   651
james@1522
   652
"self cleanInputRec:tempReceiver arg:tempArguments ans:tempAnswer."
james@1522
   653
james@1522
   654
james@1522
   655
anArray:=Array new:2.  "creates an array which is to be used as input for the method finder."
james@1522
   656
james@1522
   657
receiverWithArgument:=self mergReciever: (tempReceiver value) WithArgument: (tempArguments values).
james@1522
   658
james@1522
   659
anArray at:1 put:receiverWithArgument;
james@1522
   660
        at:2 put: tempAnswer value.             
james@1522
   661
james@1522
   662
"an array now holds the following array #(#(receiver argument) answer) or #(#(reciever) answer). which should
james@1522
   663
be suitable input for the method finder."
cg@1534
   664
self withCursor:Cursor execute do:[
cg@1534
   665
    mf:= MethodFinder new.
cg@1534
   666
    resultArray:= mf load: anArray; findMessage. 
cg@1534
   667
].
james@1522
   668
james@1522
   669
((resultArray at:  1 )includesSubString: 'no single') ifTrue:[
james@1522
   670
                                self warn: (resultArray at:  1 ).
james@1522
   671
                                ^self
james@1522
   672
                                                              ].  
james@1522
   673
"the following then replaces data1 and data2 created by the method finder to the appropriate arguments"
cg@2859
   674
james@1522
   675
resultArray keysAndValuesDo:[:key :value |   | newValue | 
james@1522
   676
      newValue:= value replString: 'data1' withString:(tempReceiver key).
james@1522
   677
(tempArguments size) >= 1 ifTrue:[
james@1522
   678
      newValue:= newValue replString: 'data2' withString:(tempArguments keyAt:1)].
james@1522
   679
james@1522
   680
(tempArguments size) > 1 ifTrue:[
james@1522
   681
      newValue:= newValue replString: 'data3' withString:(tempArguments keyAt:2).].
james@1522
   682
james@1522
   683
(tempArguments size) > 2 ifTrue:[
james@1522
   684
      newValue:= newValue replString: 'data4' withString:(tempArguments keyAt:3).].
james@1522
   685
cg@2859
   686
(tempArguments size) > 3 ifTrue:[ self halt:'unimplemented'. ].
cg@1532
   687
james@1522
   688
james@1522
   689
                        "    newValue:= value replString: 'data3' withString:(self messageAnswer key). " 
james@1522
   690
james@1522
   691
      newValue:=newValue, ' --> ', (tempAnswer key).
cg@1532
   692
      newValue replaceAll:Character cr with:Character space.
james@1522
   693
james@1522
   694
      resultArray at: key put: newValue.
james@1522
   695
james@1522
   696
              ].
james@1522
   697
james@1522
   698
self resultHolder value: resultArray.
james@1522
   699
resultSelectors:= mf selectors.   "used to find implementors so we do not have to "
james@1522
   700
receiver:=tempReceiver            "search the string for the selector found. Stored as an ordered collection"
cg@1532
   701
cg@2859
   702
    "Modified: / 26-09-2011 / 12:42:28 / cg"
cg@1532
   703
!
cg@1532
   704
cg@2891
   705
searchPatternChanged
cg@2891
   706
    "/ self searchPatternMatches
cg@2891
   707
    self searchPatternMatchesInBackground
cg@2891
   708
cg@2891
   709
    "Created: / 01-06-2012 / 13:18:16 / cg"
cg@2891
   710
!
cg@2891
   711
cg@2886
   712
searchPatternMatches
cg@2886
   713
    "Do a search based on the pattern match"
cg@2886
   714
cg@2886
   715
    | pattern list selectors counts|
cg@2886
   716
cg@2886
   717
    pattern := self selectorPattern value.
cg@2886
   718
cg@2886
   719
    self resultHolder value: nil.                "reset the result list"
cg@2886
   720
    self classOfResultHolder value: nil.        "reset the implementorOf list"
cg@2886
   721
    self codeHolder value: nil.                  "reset the source"
cg@2886
   722
cg@2886
   723
    self withCursor:Cursor execute do:[
cg@2889
   724
        pattern includesMatchCharacters ifFalse:[   
cg@2889
   725
            pattern := '*',pattern,'*'
cg@2889
   726
        ].
cg@2886
   727
        list := SystemBrowser findImplementorsMatching:pattern in:Smalltalk allClasses ignoreCase:true.
cg@2886
   728
    ].
cg@2886
   729
cg@2886
   730
    counts := IdentityDictionary new.
cg@2886
   731
    selectors := IdentitySet new.
cg@2886
   732
cg@2886
   733
    list do:[:eachMethod |
cg@2886
   734
        selectors add: eachMethod selector.
cg@2886
   735
        (counts at:(eachMethod selector) ifAbsentPut:[0 asValue]) increment
cg@2886
   736
    ].
cg@2886
   737
cg@2886
   738
    resultSelectors := selectors asOrderedCollection sort.
cg@2886
   739
cg@2886
   740
    self resultHolder value: (resultSelectors collect:[:sel | sel,' --> ',(counts at:sel) value printString,' implementor(s)']).
cg@2886
   741
cg@2886
   742
    "Created: / 27-04-2012 / 14:46:35 / cg"
cg@2886
   743
!
cg@2886
   744
cg@2891
   745
searchPatternMatchesInBackground
cg@2891
   746
    "Do a search based on the pattern match"
cg@2891
   747
cg@2891
   748
    | p pattern list|
cg@2891
   749
cg@2891
   750
    (p := searchProcess) notNil ifTrue:[
cg@2891
   751
        searchProcess := nil.
cg@2891
   752
        p terminate.
cg@2891
   753
    ].
cg@2891
   754
cg@2891
   755
    searchProcess := 
cg@2891
   756
        [
cg@2891
   757
            pattern := self selectorPattern value.
cg@2891
   758
cg@2891
   759
            self withCursor:Cursor execute do:[
cg@2891
   760
                pattern includesMatchCharacters ifFalse:[   
cg@2891
   761
                    pattern := '*',pattern,'*'
cg@2891
   762
                ].
cg@2891
   763
                list := SystemBrowser findImplementorsMatching:pattern in:Smalltalk allClasses ignoreCase:true.
cg@2891
   764
            ].
cg@2891
   765
            self enqueueDelayedAction:[ self updateListAfterPatternSearch: list ]
cg@2891
   766
        ] fork.
cg@2891
   767
cg@2891
   768
    "Created: / 01-06-2012 / 13:16:54 / cg"
cg@2891
   769
!
cg@2891
   770
cg@1532
   771
selectedClassOfResultHolderChanged
cg@1532
   772
    |sel classAndSelector mthd|
cg@1532
   773
cg@1532
   774
    sel := self selectedClassOfResultHolder value.
cg@1532
   775
cg@1532
   776
    classAndSelector := self extractClassAndSelectorFrom:sel.
cg@1532
   777
    classAndSelector isNil ifTrue:[
cg@1532
   778
        ^ self
cg@1532
   779
    ].
cg@1532
   780
    mthd := classAndSelector key >> classAndSelector value.   
cg@1532
   781
    mthd notNil ifTrue:[
cg@1532
   782
        self withWaitCursorDo:[
cg@1532
   783
            self codeHolder value:mthd source
cg@1532
   784
        ]
cg@1532
   785
    ] ifFalse:[
cg@1532
   786
        self codeHolder value:nil
cg@1532
   787
    ].
cg@1532
   788
cg@1532
   789
    "Created: / 13.11.2001 / 12:43:43 / cg"
cg@1532
   790
    "Modified: / 13.11.2001 / 12:48:56 / cg"
james@1522
   791
!
james@1522
   792
james@1522
   793
updateImplementorsOf:anInteger 
james@1525
   794
    "Request the implementors of the selected argument provided by aNumber.
cg@2892
   795
     Return the receiver."
cg@2892
   796
    
cg@2892
   797
    |methods classList aNumber|
james@1522
   798
cg@2892
   799
    (anInteger isNil) ifTrue:[
cg@2892
   800
        ^ self
cg@2892
   801
    ].
cg@2892
   802
    anInteger isNil ifTrue:[
cg@2892
   803
        aNumber := 1
cg@2892
   804
    ] ifFalse:[
cg@2892
   805
        aNumber := anInteger
cg@2892
   806
    ].
cg@2892
   807
    methods := SystemBrowser 
cg@2892
   808
            findImplementorsOf:(resultSelectors at:aNumber)
cg@2892
   809
            in:Smalltalk allClasses
cg@2892
   810
            ignoreCase:false.
cg@2892
   811
    classList := methods asOrderedCollection 
cg@2892
   812
            collect:[:m | m mclass name , ' ' , m selector ].
cg@2892
   813
    classList := (self markMatchingClasses:(resultSelectors at:aNumber)
cg@2892
   814
            classesWithSelector:classList).
cg@2892
   815
    self classOfResultHolder value:classList.
cg@2892
   816
    classList size > 0 ifTrue:[
cg@2892
   817
        self selectedClassOfResultHolder value:(classList first).
cg@2892
   818
        self selectedClassOfResultHolderChanged.
cg@2892
   819
    ] ifFalse:[
cg@2892
   820
        self selectedClassOfResultHolder value:nil.
cg@2892
   821
    ].
james@1525
   822
cg@2892
   823
    "Modified (comment): / 24-06-2012 / 18:41:45 / cg"
cg@2891
   824
!
cg@2891
   825
cg@2892
   826
updateListAfterPatternSearch:list 
cg@2891
   827
    "Do a search based on the pattern match"
cg@2892
   828
    
cg@2892
   829
    |selectors counts firsts|
cg@2891
   830
cg@2892
   831
    self resultHolder value:nil.
cg@2892
   832
    self classOfResultHolder value:nil.
cg@2892
   833
    self codeHolder value:nil.
cg@2892
   834
    counts := IdentityDictionary new.
cg@2892
   835
    firsts := IdentityDictionary new.
cg@2892
   836
    selectors := IdentitySet new.
cg@2892
   837
    list do:[:eachMethod | 
cg@2892
   838
        selectors add:eachMethod selector.
cg@2892
   839
        (counts at:(eachMethod selector) ifAbsentPut:[ 0 asValue ]) increment.
cg@2892
   840
        firsts at:(eachMethod selector) ifAbsentPut:[ eachMethod mclass ].
cg@2892
   841
    ].
cg@2892
   842
    resultSelectors := selectors asOrderedCollection sort.
cg@2892
   843
    self resultHolder value:(resultSelectors 
cg@2892
   844
                collect:[:sel | 
cg@2892
   845
                    |cnt|
cg@2891
   846
cg@2892
   847
                    cnt := (counts at:sel) value.
cg@2892
   848
                    cnt == 1 ifTrue:[
cg@2892
   849
                        sel , ' --> ' , (firsts at:sel) name
cg@2892
   850
                    ] ifFalse:[
cg@2892
   851
                        sel , ' --> ' , cnt printString , ' implementor(s)'
cg@2892
   852
                    ].
cg@2892
   853
                ]).
cg@2891
   854
cg@2891
   855
    "Created: / 01-06-2012 / 13:17:34 / cg"
james@1522
   856
! !
james@1522
   857
james@1522
   858
!MethodFinderWindow methodsFor:'aspects'!
james@1522
   859
james@1522
   860
arg1BoxVisible
james@1525
   861
"Determines if the box should be visble or not. Return true or false"
james@1522
   862
    arg1BoxVisible isNil ifTrue:[
james@1522
   863
        arg1BoxVisible := BlockValue
james@1522
   864
                              with:[:vh | vh value >= 2 ]
james@1522
   865
                              argument:(self argCountHolder)
james@1522
   866
    ].
james@1522
   867
    ^ arg1BoxVisible.
james@1522
   868
!
james@1522
   869
james@1522
   870
arg2BoxVisible
james@1525
   871
"Determines if the box should be visble or not. Return true or false"
james@1522
   872
    arg2BoxVisible isNil ifTrue:[
james@1522
   873
        arg2BoxVisible := BlockValue
james@1522
   874
                              with:[:vh | vh value >= 3 ]
james@1522
   875
                              argument:(self argCountHolder)
james@1522
   876
    ].
james@1522
   877
    ^ arg2BoxVisible.
james@1522
   878
!
james@1522
   879
james@1522
   880
arg3BoxVisible
james@1525
   881
"Determines if the box should be visble or not. Return true or false"
james@1522
   882
    arg3BoxVisible isNil ifTrue:[
james@1522
   883
        arg3BoxVisible := BlockValue
james@1522
   884
                              with:[:vh | vh value >= 4 ]
james@1522
   885
                              argument:(self argCountHolder)
james@1522
   886
    ].
james@1522
   887
    ^ arg3BoxVisible.
james@1522
   888
!
james@1522
   889
james@1522
   890
arg4BoxVisible
james@1525
   891
"Determines if the box should be visble or not. Return true or false"
james@1522
   892
    arg4BoxVisible isNil ifTrue:[
james@1522
   893
        arg4BoxVisible := BlockValue
james@1522
   894
                              with:[:vh | vh value >= 5 ]
james@1522
   895
                              argument:(self argCountHolder)
james@1522
   896
    ].
james@1522
   897
    ^ arg4BoxVisible.
james@1522
   898
!
james@1522
   899
james@1522
   900
argCountHolder
james@1525
   901
"Return the value of argCounterHolder which is initialized at 2."
james@1522
   902
    argCountHolder isNil ifTrue:[
james@1522
   903
        argCountHolder := 2 asValue.
james@1522
   904
    ].     
james@1522
   905
    ^ argCountHolder.
james@1522
   906
!
james@1522
   907
james@1522
   908
argCountList
james@1525
   909
"Return the argCountList"
james@1522
   910
    argCountList isNil ifTrue:[
james@1522
   911
        argCountList := #('0 arguments' '1 argument' '2 arguments' '3 arguments') asValue  
james@1522
   912
    ].
james@1522
   913
    ^ argCountList.
james@1522
   914
!
james@1522
   915
james@1522
   916
classOfResultHolder
james@1525
   917
    "Return a valueHolder which contains a collection with the names of the 
james@1525
   918
     implementors of a specific message.   "
james@1522
   919
james@1522
   920
    |holder|
james@1522
   921
    (holder := builder bindingAt:#classOfResultHolder) isNil ifTrue:[
james@1525
   922
        holder := ValueHolder new.
james@1525
   923
        builder aspectAt:#classOfResultHolder put:holder
james@1522
   924
    ].
james@1522
   925
    ^ holder
james@1522
   926
!
james@1522
   927
cg@1532
   928
codeHolder
cg@1532
   929
    codeHolder isNil ifTrue:[
cg@1532
   930
        codeHolder := '' asValue.
cg@1532
   931
    ].
cg@1532
   932
    ^ codeHolder.
cg@1532
   933
cg@1532
   934
    "Created: / 13.11.2001 / 12:44:11 / cg"
cg@1532
   935
!
cg@1532
   936
james@1522
   937
resultHolder
james@1525
   938
    "Return a value holder which contains the results of a search as a collection."
james@1522
   939
james@1522
   940
    |holder|
james@1522
   941
    (holder := builder bindingAt:#resultHolder) isNil ifTrue:[
james@1525
   942
        holder := ValueHolder new.
james@1525
   943
        builder aspectAt:#resultHolder put:holder.
cg@2887
   944
        holder value:{
cg@2887
   945
                        'Please enter combination of' .
cg@2887
   946
                        '    ',('receiver, arg and result' allBold) .
cg@2887
   947
                        'or a'.
cg@2887
   948
                        '    ',('selector search pattern' allBold) .
cg@2890
   949
                        'into the above fields, then click on either ',('"search"' allBold),'-button.'
cg@2887
   950
                     }
james@1522
   951
    ].
james@1522
   952
    ^ holder.
cg@2886
   953
cg@2890
   954
    "Modified: / 01-06-2012 / 13:06:02 / cg"
cg@1529
   955
!
cg@1529
   956
cg@1529
   957
selectedClassOfResultHolder
cg@1529
   958
    "Return a valueHolder which contains the index of the selected result class
cg@1529
   959
     (right list)"
cg@1529
   960
cg@1529
   961
    |holder|
cg@1529
   962
    (holder := builder bindingAt:#selectedClassOfResultHolder) isNil ifTrue:[
cg@1529
   963
        holder := ValueHolder new.
cg@1529
   964
        builder aspectAt:#selectedClassOfResultHolder put:holder
cg@1529
   965
    ].
cg@1529
   966
    ^ holder
cg@2886
   967
!
cg@2886
   968
cg@2886
   969
selectorPattern
cg@2886
   970
    |holder|
cg@2886
   971
    (holder := builder bindingAt:#selectorPattern) isNil ifTrue:[
cg@2886
   972
        holder := ValueHolder new.
cg@2886
   973
        builder aspectAt:#selectorPattern put:holder.
cg@2891
   974
        holder onChangeSend:#searchPatternChanged to:self.
cg@2886
   975
    ].
cg@2886
   976
    ^ holder
cg@2886
   977
cg@2886
   978
    "Created: / 27-04-2012 / 14:44:01 / cg"
james@1522
   979
! !
james@1522
   980
james@1522
   981
!MethodFinderWindow methodsFor:'callBacks'!
james@1522
   982
james@1522
   983
argument1WidgetCreated: aWidget
james@1525
   984
"Store the widget as an instance variable. Return the receiver"
james@1525
   985
james@1525
   986
james@1522
   987
        argument1Editor := aWidget scrolledView.
cg@1532
   988
        aWidget tabMeansNextField:true.
cg@1532
   989
cg@1532
   990
    "Modified: / 13.11.2001 / 12:21:41 / cg"
james@1522
   991
!
james@1522
   992
james@1522
   993
argument2WidgetCreated: aWidget
james@1525
   994
"Store the widget as an instance variable. Return the receiver"
james@1525
   995
james@1522
   996
james@1522
   997
        argument2Editor := aWidget scrolledView.
cg@1532
   998
        aWidget tabMeansNextField:true.
cg@1532
   999
cg@1532
  1000
    "Modified: / 13.11.2001 / 12:21:45 / cg"
james@1522
  1001
!
james@1522
  1002
james@1522
  1003
argument3WidgetCreated: aWidget
james@1525
  1004
"Store the widget as an instance variable. Return the receiver"
james@1525
  1005
james@1522
  1006
james@1522
  1007
        argument3Editor := aWidget scrolledView.
cg@1532
  1008
        aWidget tabMeansNextField:true.
cg@1532
  1009
cg@1532
  1010
    "Modified: / 13.11.2001 / 12:21:49 / cg"
james@1522
  1011
!
james@1522
  1012
james@1525
  1013
messageAnswerWidgetCreated: aWidget
james@1525
  1014
"Store the widget as an instance variable. Return the receiver"
james@1522
  1015
james@1525
  1016
        messageAnswerEditor := aWidget scrolledView.
cg@1532
  1017
        aWidget tabMeansNextField:true.
cg@1532
  1018
cg@1532
  1019
    "Modified: / 13.11.2001 / 12:24:55 / cg"
james@1522
  1020
!
james@1522
  1021
james@1525
  1022
openHTMLDocumentation
james@1525
  1023
    HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#METHODFINDER'
james@1522
  1024
!
james@1522
  1025
james@1522
  1026
receiverWidgetCreated: aWidget
james@1525
  1027
"Store the widget as an instance variable. Return the receiver"
james@1522
  1028
james@1522
  1029
        receiverEditor := aWidget scrolledView.
cg@1532
  1030
        aWidget tabMeansNextField:true.
cg@1532
  1031
cg@1532
  1032
    "Modified: / 13.11.2001 / 12:24:49 / cg"
cg@1532
  1033
!
cg@1532
  1034
cg@1532
  1035
sourceCodeWidgetCreated: aWidget
cg@1532
  1036
        aWidget acceptAction:nil.
cg@1532
  1037
        aWidget readOnly:true
cg@1532
  1038
cg@1532
  1039
    "Created: / 13.11.2001 / 12:50:27 / cg"
cg@1532
  1040
    "Modified: / 13.11.2001 / 12:51:23 / cg"
james@1522
  1041
! !
james@1522
  1042
james@1522
  1043
!MethodFinderWindow methodsFor:'controlInput'!
james@1522
  1044
james@1522
  1045
cleanInputs: aDirtyString
james@1525
  1046
     "Find and remove common mistakes made by the user. Return the 
james@1525
  1047
     'aStringToBeCleaned' variable"
james@1522
  1048
       | aStringToBeCleaned rs position|
james@1522
  1049
james@1522
  1050
   aStringToBeCleaned:=aDirtyString.
james@1522
  1051
james@1522
  1052
(aStringToBeCleaned endsWith:(Character cr)) ifTrue:[
james@1522
  1053
                        aStringToBeCleaned:=aStringToBeCleaned copyFrom:1 to: (aStringToBeCleaned size -1).].
james@1522
  1054
aStringToBeCleaned:= aStringToBeCleaned withoutSeparators.
james@1522
  1055
james@1522
  1056
james@1522
  1057
rs:=ReadStream on: aStringToBeCleaned.
james@1522
  1058
[rs upToAll: '#true'.  rs atEnd] whileFalse: [
james@1522
  1059
                        position:= rs position. 
james@1522
  1060
                        aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #"
james@1522
  1061
                        rs:=ReadStream on: aStringToBeCleaned.
james@1522
  1062
                        ].
james@1522
  1063
james@1522
  1064
rs:=ReadStream on: aStringToBeCleaned.
james@1522
  1065
[rs upToAll: '#false'.  rs atEnd] whileFalse: [
james@1522
  1066
                        position:= rs position. 
james@1522
  1067
                        aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #"
james@1522
  1068
                        rs:=ReadStream on: aStringToBeCleaned.
james@1522
  1069
                        rs:=ReadStream on: aStringToBeCleaned. ].
james@1522
  1070
james@1522
  1071
[rs upToAll: '#nil'.  rs atEnd] whileFalse: [
james@1522
  1072
                        position:= rs position. 
james@1522
  1073
                        aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #"
james@1522
  1074
                        rs:=ReadStream on: aStringToBeCleaned.  ].
james@1522
  1075
                   ^aStringToBeCleaned    
james@1522
  1076
!
james@1522
  1077
james@1525
  1078
markMatchingClasses: aSelector  classesWithSelector:anOrderedCollection
james@1525
  1079
   " Matches the class of the receiver with all the elements in anOrderedCollection
james@1525
  1080
    (which are classes with selectors). If a match is found it is marked with an asterisk. 
james@1525
  1081
    The classes are then sorted so the the asterisk appears first. Return the 
james@1525
  1082
    markedClassList."
james@1522
  1083
sr@2165
  1084
        | marker recClass unmarkedClassList markedClassList|
james@1522
  1085
cg@1532
  1086
        marker := self class markerForImplementingClass.
cg@1532
  1087
cg@1532
  1088
        recClass := receiver value class.
james@1525
  1089
        unmarkedClassList:=anOrderedCollection copy.
james@1525
  1090
        unmarkedClassList do:
james@1525
  1091
                [:classAndMethod | | class |
james@1525
  1092
                class:=Compiler evaluate:
james@1525
  1093
                                ((ReadStream on: classAndMethod) upToAll: aSelector).
cg@1532
  1094
                "/ (recClass == class)
cg@1532
  1095
                (recClass whichClassImplements:aSelector) == class
cg@1532
  1096
                ifTrue:
cg@1532
  1097
                        ["/ unmarkedClassList add: marker, classAndMethod.
cg@1532
  1098
                        unmarkedClassList add: classAndMethod allBold.
cg@1532
  1099
                        unmarkedClassList remove: classAndMethod.
cg@1532
  1100
                        ].
cg@1532
  1101
        ].
james@1522
  1102
james@1522
  1103
      unmarkedClassList sort:[:a :b | |rawA rawB|
cg@1532
  1104
                    rawA := a string.
cg@1532
  1105
                    (rawA startsWith:marker) ifTrue:[rawA := rawA copyFrom:marker size+1].
cg@1532
  1106
                    rawB := b string.
cg@1532
  1107
                    (rawB startsWith:marker) ifTrue:[rawB := rawB copyFrom:marker size+1].
cg@1532
  1108
                    rawA < rawB.  ].
james@1525
  1109
      markedClassList:= unmarkedClassList. 
james@1525
  1110
james@1525
  1111
         ^markedClassList
cg@1532
  1112
cg@1532
  1113
    "Modified: / 13.11.2001 / 12:16:05 / cg"
james@1522
  1114
!
james@1522
  1115
james@1522
  1116
mergReciever: aReceiver WithArgument: arguments
james@1522
  1117
james@1525
  1118
"Puts the receiver and arguments into an array so it can be of a suitable input for the
james@1525
  1119
 MethodFinder. Return an array."
james@1525
  1120
james@1522
  1121
| tempReceiver tempArguments receiverWithArgument|
james@1522
  1122
james@1522
  1123
  tempReceiver:= aReceiver.
james@1522
  1124
 tempArguments :=  arguments.
james@1522
  1125
james@1522
  1126
(tempArguments isEmpty or:[(tempArguments) isNil])
james@1522
  1127
                ifTrue:[  receiverWithArgument:=Array new:1."no argument"
james@1522
  1128
                          receiverWithArgument at:1 put: tempReceiver.     
james@1522
  1129
                        ]
james@1522
  1130
                ifFalse:[
james@1522
  1131
        (tempArguments size = 1)
james@1522
  1132
                        ifTrue:[ receiverWithArgument:=Array new:2.
james@1522
  1133
                                  receiverWithArgument at:1 put: tempReceiver.      
james@1522
  1134
                                  receiverWithArgument at:2 put: (tempArguments at:1)
james@1522
  1135
                                ].  "a receiver with an argument"
james@1522
  1136
james@1522
  1137
        (tempArguments size = 2)
james@1522
  1138
                        ifTrue:[ receiverWithArgument:=Array new:3.
james@1522
  1139
                                  receiverWithArgument at:1 put: tempReceiver.      
james@1522
  1140
                                  (receiverWithArgument at:2 put: (tempArguments at:1)).
james@1522
  1141
                                  (receiverWithArgument at:3 put: (tempArguments at:2))
james@1522
  1142
                                ].  "a receiver with an argument"
james@1522
  1143
        (tempArguments size = 3)
james@1522
  1144
                        ifTrue:[ receiverWithArgument:=Array new:4.
james@1522
  1145
                                  receiverWithArgument at:1 put: tempReceiver.      
james@1522
  1146
                                  (receiverWithArgument at:2 put: (tempArguments at:1)).
james@1522
  1147
                                  (receiverWithArgument at:3 put: (tempArguments at:2)).
james@1522
  1148
                                  (receiverWithArgument at:4 put: (tempArguments at:3)).
james@1522
  1149
james@1522
  1150
                                ].  "a receiver with an argument"
james@1522
  1151
james@1522
  1152
                        ].
james@1522
  1153
^receiverWithArgument
james@1522
  1154
! !
james@1522
  1155
cg@1532
  1156
!MethodFinderWindow methodsFor:'misc'!
cg@1532
  1157
cg@1532
  1158
aboutThisApplicationText
cg@1532
  1159
    |msg|
cg@1532
  1160
cg@1532
  1161
    msg := super aboutThisApplicationText.
cg@2412
  1162
    msg := msg , '\\Ported from Squeak to ST/X by James Hayes (james@exept.de).
cg@2412
  1163
Original written by Ted Kaehler, Scott Wallace and Dan Ingalls.'.
cg@1532
  1164
    ^msg withCRs.
cg@1532
  1165
cg@1532
  1166
    "Modified: / 13.11.2001 / 12:56:44 / cg"
cg@1532
  1167
! !
cg@1532
  1168
james@1522
  1169
!MethodFinderWindow class methodsFor:'documentation'!
james@1522
  1170
james@1522
  1171
version
james@1522
  1172
    ^ '$Header$'
cg@2730
  1173
!
cg@2730
  1174
cg@2730
  1175
version_CVS
cg@2730
  1176
    ^ '$Header$'
james@1522
  1177
! !