#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Sat, 08 Jun 2019 17:24:53 +0200
changeset 3675 caafc519b235
parent 3674 693d13243c07
child 3676 319c68f831df
#FEATURE by cg class: MethodFinderWindow changed: #markMatchingClasses:classesWithSelector: #search #updateImplementorsOf: class: MethodFinderWindow class changed: #helpSpec #windowSpec
MethodFinderWindow.st
--- a/MethodFinderWindow.st	Fri Jun 07 22:51:03 2019 +0200
+++ b/MethodFinderWindow.st	Sat Jun 08 17:24:53 2019 +0200
@@ -112,15 +112,15 @@
      the UIHelpTool may not be able to read the specification."
 
     "
-     UIHelpTool openOnClass:MethodFinderWindow    
+     UIHelpTool openOnClass:MethodFinderWindow
     "
 
     <resource: #help>
 
     ^ super helpSpec addPairsFrom:#(
 
-#receiverValue
-'Enter a receiver value here.\Can be a constant (like ''hello'')\or an expression, such as "Rectangle basicNew".'
+#'*'
+'as in GLOB patterns (i.e. like filename patterns)'
 
 #answerValue
 'Enter result value here.\Can be a constant (like ''hello'')\or an expression, such as "Rectangle basicNew".'
@@ -140,13 +140,27 @@
 #clearButton
 'Clear all sample value fields.'
 
+#implementorsFound
+'Shows a list of messages which deliver the result or match the selector pattern'
+
+#receiverValue
+'Enter a receiver value here.\Can be a constant (like ''hello'')\or an expression, such as "Rectangle basicNew".'
+
+#selectorPattern
+'Enter a pattern to search by message name'
+
+#selectorPatternSearch
+'Search by name.\You can use match characters'
+
 #startSearchButton
 'Search for methods which answer the desired value,\given the concrete arguments'
 
-#selectorPatternSearch
-'Search by name.\You can use match characters '*' as in GLOB patterns (i.e. like filename patterns)'
+#startSearchPatternButton
+'Search for methods whose name matches the pattern'
 
 )
+
+    "Modified: / 08-06-2019 / 16:06:17 / Claus Gittinger"
 ! !
 
 !MethodFinderWindow class methodsFor:'interface specs'!
@@ -169,10 +183,12 @@
     ^ 
     #(FullSpec
        name: windowSpec
+       uuid: '5fb0c294-89f6-11e9-8df0-b8f6b1108e05'
        window: 
       (WindowSpec
          label: 'MethodFinder'
          name: 'MethodFinder'
+         uuid: '5fb0c87a-89f6-11e9-8df0-b8f6b1108e05'
          bounds: (Rectangle 0 0 816 738)
          menu: menu
          icon: defaultIcon
@@ -183,6 +199,7 @@
           (VariableHorizontalPanelSpec
              name: 'VariableHorizontalPanel1'
              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+             uuid: '5fb0cd98-89f6-11e9-8df0-b8f6b1108e05'
              showHandle: true
              snapMode: both
              component: 
@@ -190,18 +207,21 @@
                collection: (
                 (VariableVerticalPanelSpec
                    name: 'LeftBox'
+                   uuid: '5fb0d1a8-89f6-11e9-8df0-b8f6b1108e05'
                    showHandle: true
                    component: 
                   (SpecCollection
                      collection: (
                       (ViewSpec
                          name: 'MethodFinderBox'
+                         uuid: '5fb0d36a-89f6-11e9-8df0-b8f6b1108e05'
                          component: 
                         (SpecCollection
                            collection: (
                             (ViewSpec
                                name: 'ReceiverArgBox'
                                layout: (LayoutFrame 0 0 0 0 0 1 -30 1)
+                               uuid: '5fb0d4f0-89f6-11e9-8df0-b8f6b1108e05'
                                component: 
                               (SpecCollection
                                  collection: (
@@ -209,12 +229,14 @@
                                      label: 'Receiver'
                                      name: 'ReceiverLabel'
                                      layout: (LayoutFrame 0 0 0 0 0 0.34000000000000002 28 0)
+                                     uuid: '5fb0d6b2-89f6-11e9-8df0-b8f6b1108e05'
                                      translateLabel: true
                                    )
                                   (ComboListSpec
                                      name: 'allowedArgments'
                                      layout: (LayoutFrame 0 0.34000000000000002 1 0 0 0.64000000000000135 28 0)
                                      activeHelpKey: argumentCount
+                                     uuid: '5fb0da9a-89f6-11e9-8df0-b8f6b1108e05'
                                      model: argCountHolder
                                      comboList: argCountList
                                      useIndex: true
@@ -224,11 +246,13 @@
                                      name: 'MessageAnswerLabel'
                                      layout: (LayoutFrame 0 0.64000000000000135 0 0 0 1 28 0)
                                      activeHelpKey: arg1Value
+                                     uuid: '5fb0dd60-89f6-11e9-8df0-b8f6b1108e05'
                                      translateLabel: true
                                    )
                                   (HorizontalPanelViewSpec
                                      name: 'HorizontalPanel1'
                                      layout: (LayoutFrame 0 0 30 0 0 1 0 1)
+                                     uuid: '5fb0dee6-89f6-11e9-8df0-b8f6b1108e05'
                                      horizontalLayout: fit
                                      verticalLayout: fit
                                      horizontalSpace: 3
@@ -239,6 +263,7 @@
                                         (WorkspaceSpec
                                            name: 'ReceiverEditor'
                                            activeHelpKey: receiverValue
+                                           uuid: '5fb0e152-89f6-11e9-8df0-b8f6b1108e05'
                                            tabable: true
                                            hasHorizontalScrollBar: true
                                            hasVerticalScrollBar: true
@@ -246,11 +271,12 @@
                                            miniScrollerVertical: true
                                            autoHideScrollBars: true
                                            hasKeyboardFocusInitially: false
-                                           extent: (Point 85 142)
+                                           extent: (Point 86 142)
                                            postBuildCallback: receiverWidgetCreated:
                                          )
                                         (VerticalPanelViewSpec
                                            name: 'VerticalPanel1'
+                                           uuid: '5fb0e51c-89f6-11e9-8df0-b8f6b1108e05'
                                            horizontalLayout: fit
                                            verticalLayout: fit
                                            horizontalSpace: 3
@@ -260,6 +286,7 @@
                                              collection: (
                                               (ViewSpec
                                                  name: 'Box1'
+                                                 uuid: '5fb0e6d4-89f6-11e9-8df0-b8f6b1108e05'
                                                  visibilityChannel: arg1BoxVisible
                                                  component: 
                                                 (SpecCollection
@@ -268,6 +295,7 @@
                                                        name: 'Arg1Editor'
                                                        layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
                                                        activeHelpKey: arg1Value
+                                                       uuid: '5fb0e7ce-89f6-11e9-8df0-b8f6b1108e05'
                                                        tabable: true
                                                        hasHorizontalScrollBar: true
                                                        hasVerticalScrollBar: true
@@ -280,10 +308,11 @@
                                                     )
                                                   
                                                  )
-                                                 extent: (Point 86 45)
+                                                 extent: (Point 87 45)
                                                )
                                               (ViewSpec
                                                  name: 'Box2'
+                                                 uuid: '5fb0e9b8-89f6-11e9-8df0-b8f6b1108e05'
                                                  visibilityChannel: arg2BoxVisible
                                                  component: 
                                                 (SpecCollection
@@ -292,6 +321,7 @@
                                                        name: 'TextEditor5'
                                                        layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
                                                        activeHelpKey: arg2Value
+                                                       uuid: '5fb0eabc-89f6-11e9-8df0-b8f6b1108e05'
                                                        tabable: true
                                                        hasHorizontalScrollBar: true
                                                        hasVerticalScrollBar: true
@@ -304,10 +334,11 @@
                                                     )
                                                   
                                                  )
-                                                 extent: (Point 86 46)
+                                                 extent: (Point 87 46)
                                                )
                                               (ViewSpec
                                                  name: 'Box3'
+                                                 uuid: '5fb0ec74-89f6-11e9-8df0-b8f6b1108e05'
                                                  visibilityChannel: arg3BoxVisible
                                                  component: 
                                                 (SpecCollection
@@ -316,6 +347,7 @@
                                                        name: 'TextEditor6'
                                                        layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
                                                        activeHelpKey: arg3Value
+                                                       uuid: '5fb0ed64-89f6-11e9-8df0-b8f6b1108e05'
                                                        tabable: true
                                                        hasHorizontalScrollBar: true
                                                        hasVerticalScrollBar: true
@@ -328,16 +360,17 @@
                                                     )
                                                   
                                                  )
-                                                 extent: (Point 86 45)
+                                                 extent: (Point 87 45)
                                                )
                                               )
                                             
                                            )
-                                           extent: (Point 86 142)
+                                           extent: (Point 87 142)
                                          )
                                         (WorkspaceSpec
                                            name: 'AnswerEditor'
                                            activeHelpKey: answerValue
+                                           uuid: '5fb0ef30-89f6-11e9-8df0-b8f6b1108e05'
                                            tabable: true
                                            hasHorizontalScrollBar: true
                                            hasVerticalScrollBar: true
@@ -345,7 +378,7 @@
                                            miniScrollerVertical: true
                                            autoHideScrollBars: true
                                            hasKeyboardFocusInitially: false
-                                           extent: (Point 86 142)
+                                           extent: (Point 87 142)
                                            postBuildCallback: messageAnswerWidgetCreated:
                                          )
                                         )
@@ -359,6 +392,7 @@
                             (ViewSpec
                                name: 'ReceiverArgBoxActionBox'
                                layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
+                               uuid: '5fb0f0fc-89f6-11e9-8df0-b8f6b1108e05'
                                component: 
                               (SpecCollection
                                  collection: (
@@ -367,6 +401,7 @@
                                      name: 'Button2'
                                      layout: (LayoutFrame 5 0 0 0 -5 0.5 0 1)
                                      activeHelpKey: clearButton
+                                     uuid: '5fb0f214-89f6-11e9-8df0-b8f6b1108e05'
                                      translateLabel: true
                                      model: clear
                                    )
@@ -375,6 +410,7 @@
                                      name: 'Button1'
                                      layout: (LayoutFrame 5 0.5 0 0 -5 1 0 1)
                                      activeHelpKey: startSearchButton
+                                     uuid: '5fb0f52a-89f6-11e9-8df0-b8f6b1108e05'
                                      translateLabel: true
                                      tabable: true
                                      model: search
@@ -389,12 +425,14 @@
                        )
                       (ViewSpec
                          name: 'SelectorFinderBox'
+                         uuid: '5fb0f714-89f6-11e9-8df0-b8f6b1108e05'
                          component: 
                         (SpecCollection
                            collection: (
                             (ViewSpec
                                name: 'MatchActionBox'
                                layout: (LayoutFrame 0 0 0 0 0 1 90 0)
+                               uuid: '5fb0f818-89f6-11e9-8df0-b8f6b1108e05'
                                component: 
                               (SpecCollection
                                  collection: (
@@ -402,12 +440,15 @@
                                      label: 'Selector Pattern:'
                                      name: 'Label1'
                                      layout: (LayoutFrame 0 0 0 0 0 0.5 25 0)
+                                     uuid: '5fb0f908-89f6-11e9-8df0-b8f6b1108e05'
                                      translateLabel: true
                                      adjust: left
                                    )
                                   (InputFieldSpec
                                      name: 'EntryField1'
                                      layout: (LayoutFrame 2 0 -54 1 -2 1 -29 1)
+                                     activeHelpKey: selectorPattern
+                                     uuid: '5fb0fa70-89f6-11e9-8df0-b8f6b1108e05'
                                      model: selectorPatternHolder
                                      immediateAccept: true
                                      acceptOnReturn: true
@@ -418,6 +459,8 @@
                                      label: 'Search'
                                      name: 'Button4'
                                      layout: (LayoutFrame 5 0.5 -25 1 -5 1 0 1)
+                                     activeHelpKey: startSearchPatternButton
+                                     uuid: '5fb0fea8-89f6-11e9-8df0-b8f6b1108e05'
                                      translateLabel: true
                                      tabable: true
                                      model: searchPatternMatchesInBackground
@@ -429,6 +472,8 @@
                             (SequenceViewSpec
                                name: 'ResultList'
                                layout: (LayoutFrame 0 0 94 0 0 1 0 1)
+                               activeHelpKey: implementorsFound
+                               uuid: '5fb1009c-89f6-11e9-8df0-b8f6b1108e05'
                                model: selectedImplementorsHolder
                                menu: resultListMenu
                                hasHorizontalScrollBar: true
@@ -448,11 +493,13 @@
                  )
                 (VariableVerticalPanelSpec
                    name: 'RightBox'
+                   uuid: '5fb103c6-89f6-11e9-8df0-b8f6b1108e05'
                    component: 
                   (SpecCollection
                      collection: (
                       (SequenceViewSpec
                          name: 'List2'
+                         uuid: '5fb10524-89f6-11e9-8df0-b8f6b1108e05'
                          model: selectedClassOfResultHolder
                          menu: implementorListMenu
                          hasHorizontalScrollBar: true
@@ -465,13 +512,14 @@
                        )
                       (CodeViewSpec
                          name: 'CodeView'
+                         uuid: '5fb106dc-89f6-11e9-8df0-b8f6b1108e05'
                          model: codeHolder
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: true
                          autoHideScrollBars: true
                          hasKeyboardFocusInitially: false
+                         viewClassName: 'codeViewClass'
                          postBuildCallback: sourceCodeWidgetCreated:
-                         viewClassName: 'codeViewClass'
                        )
                       )
                     
@@ -1091,18 +1139,19 @@
         keysAndValuesDo:[:key :value |
             |newValue|
 
-            newValue := value copyReplaceString:'data1' withString:(tempReceiver key).
+            newValue := value copyReplaceString:'data1' 
+                              withString:(tempReceiver value storeString). "/ was: "tempReceiver key" 
             (tempArguments size) >= 1 ifTrue:[
-                newValue := newValue replString:'data2'
-                        withString:(tempArguments keyAt:1)
+                newValue := newValue copyReplaceString:'data2'
+                                     withString:(tempArguments valueAt:1) storeString "/ was "keyAt:1" 
             ].
             (tempArguments size) > 1 ifTrue:[
                 newValue := newValue copyReplaceString:'data3'
-                        withString:(tempArguments keyAt:2).
+                                     withString:(tempArguments valueAt:2) storeString. "/ was "keyAt:2" 
             ].
             (tempArguments size) > 2 ifTrue:[
                 newValue := newValue copyReplaceString:'data4'
-                        withString:(tempArguments keyAt:3).
+                                     withString:(tempArguments valueAt:3) storeString. "/ was: keyAt:3
             ].
             (tempArguments size) > 3 ifTrue:[
                 self halt:'unimplemented'.
@@ -1118,6 +1167,7 @@
 
     "Modified: / 26-09-2011 / 12:42:28 / cg"
     "Modified: / 27-02-2018 / 11:37:58 / stefan"
+    "Modified: / 08-06-2019 / 16:24:00 / Claus Gittinger"
 !
 
 searchPatternMatchesInBackground
@@ -1212,20 +1262,31 @@
             findImplementorsOf:(resultSelectors at:aNumber)
             in:Smalltalk allClasses
             ignoreCase:false.
-    classList := methods asOrderedCollection 
-            collect:[:m | m mclass name , ' ' , m selector ].
-    classList := (self markMatchingClasses:(resultSelectors at:aNumber)
-            classesWithSelector:classList).
+    methods := methods asOrderedCollection. 
+    classList := methods collect:[:m | m mclass name , ' ' , m selector ].
+    classList := self markMatchingClasses:(resultSelectors at:aNumber) 
+                      classesWithSelector:classList.
+    "/ now classList contains a list of <className> <selector>,
+    "/ where the one which is responsible for the selected result is marked (bold)
     self classOfResultHolder value:classList.
-    classList size ~~ 0 ifTrue:[
-        self selectedClassOfResultHolder value:(classList first).
+
+    "/ initially select the bold one
+    classList notEmptyOrNil ifTrue:[
+        |receiversMethodEntryInClass|
+        
+        receiversMethodEntryInClass := classList detect:#isText ifNone:nil.
+        receiversMethodEntryInClass notNil ifTrue:[
+            self selectedClassOfResultHolder value:receiversMethodEntryInClass.
+        ] ifFalse:[
+            self selectedClassOfResultHolder value:(classList first).
+        ].
         self selectedClassOfResultHolderChanged.
     ] ifFalse:[
         self selectedClassOfResultHolder value:nil.
     ].
 
     "Modified (comment): / 24-06-2012 / 18:41:45 / cg"
-    "Modified: / 03-03-2019 / 23:13:43 / Claus Gittinger"
+    "Modified: / 08-06-2019 / 15:39:49 / Claus Gittinger"
 !
 
 updateListAfterPatternSearch:resultList
@@ -1458,25 +1519,29 @@
      The classes are then sorted so the asterisk appears first. Return the
      markedClassList."
     
-    |marker recClass unmarkedClassList markedClassList|
+    |marker recClass unmarkedClassList markedClassList toMark|
 
     marker := self class markerForImplementingClass.
     recClass := receiver value class.
+
+    toMark := OrderedCollection new.
+    
     unmarkedClassList := anOrderedCollection copy.
     unmarkedClassList do:[:classAndMethod |
         |className class sel|
 
-        className := classAndMethod copyButLast:aSelector size.
+        className := (classAndMethod copyButLast:aSelector size) withoutSeparators.
         class := Smalltalk classNamed:className. "/ Compiler evaluate:className.
 
         "/ (recClass == class)
 
         (recClass whichClassImplements:aSelector) == class ifTrue:[
-            "/ unmarkedClassList add: marker, classAndMethod.
-            unmarkedClassList add:classAndMethod allBold.
-            unmarkedClassList remove:classAndMethod.
+            toMark add:classAndMethod.
         ].
     ].
+    unmarkedClassList removeAll:toMark.
+    unmarkedClassList addAll:(toMark collect:#allBold).
+
     unmarkedClassList
         sort:[:a :b |
             |rawA rawB|
@@ -1488,7 +1553,8 @@
     markedClassList := unmarkedClassList.
     ^ markedClassList
 
-    "Modified: / 13.11.2001 / 12:16:05 / cg"
+    "Modified: / 13-11-2001 / 12:16:05 / cg"
+    "Modified: / 08-06-2019 / 15:36:30 / Claus Gittinger"
 !
 
 mergeReceiver: aReceiver withArgument: arguments