Tools__MethodList.st
changeset 17736 3cb79393742d
parent 17574 10c33d58d868
child 17738 ba971c5e2c72
--- a/Tools__MethodList.st	Thu Nov 09 10:04:43 2017 +0100
+++ b/Tools__MethodList.st	Thu Nov 09 21:02:04 2017 +0100
@@ -21,7 +21,8 @@
 		lastMethodClassesSubclasses
 		classAndSelectorsRedefinedBySubclassesOfClass showClass
 		showMethodComplexity showMethodTypeIcon
-		showImageResourceMethodsImages showSyntheticMethods'
+		showImageResourceMethodsImages showSyntheticMethods
+		showNameFilterHolder nameFilterPatternHolder'
 	classVariableNames:'ShowComplexityValue'
 	poolDictionaries:''
 	category:'Interface-Browsers-New'
@@ -49,6 +50,14 @@
 "
 ! !
 
+!MethodList class methodsFor:'image specs'!
+
+hideNameFilterIcon
+    ^ GenericToolbarIconLibrary hideFilter16x16Icon
+
+    "Created: / 09-11-2017 / 20:06:26 / cg"
+! !
+
 !MethodList class methodsFor:'interface specs'!
 
 singleMethodWindowSpec
@@ -110,45 +119,100 @@
 
     <resource: #canvas>
 
-    ^
-     #(FullSpec
-	name: windowSpec
-	window:
-       (WindowSpec
-	  label: 'SelectorList'
-	  name: 'SelectorList'
-	  min: (Point 0 0)
-	  bounds: (Rectangle 0 0 300 300)
-	)
-	component:
-       (SpecCollection
-	  collection: (
-	   (SequenceViewSpec
-	      name: 'List'
-	      layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
-	      tabable: true
-	      model: selectedMethodNameIndices
-	      menu: menuHolder
-	      hasHorizontalScrollBar: true
-	      hasVerticalScrollBar: true
-	      miniScrollerHorizontal: true
-	      isMultiSelect: true
-	      valueChangeSelector: selectionChangedByClick
-	      useIndex: true
-	      sequenceList: browserNameList
-	      doubleClickChannel: doubleClickChannel
-	      properties:
-	     (PropertyListDictionary
-		canDropSelector: canDropContext:
-		dragArgument: nil
-		dropArgument: nil
-		dropSelector: doDropContext:
-	      )
-	    )
-	   )
-
-	)
-      )
+    ^ 
+    #(FullSpec
+       name: windowSpec
+       window: 
+      (WindowSpec
+         label: 'SelectorList'
+         name: 'SelectorList'
+         min: (Point 0 0)
+         bounds: (Rectangle 0 0 300 300)
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (VerticalPanelViewSpec
+             name: 'VerticalPanel1'
+             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             horizontalLayout: fit
+             verticalLayout: topFit
+             horizontalSpace: 3
+             verticalSpace: 3
+             component: 
+            (SpecCollection
+               collection: (
+                (HorizontalPanelViewSpec
+                   name: 'HorizontalPanel1'
+                   activeHelpKey: selectorNameFilter
+                   visibilityChannel: showSelectorNameFilter
+                   horizontalLayout: leftFit
+                   verticalLayout: center
+                   component: 
+                  (SpecCollection
+                     collection: (
+                      (ActionButtonSpec
+                         label: 'hideNameFilterIcon'
+                         name: 'Button1'
+                         activeHelpKey: hideSelectorNameFilter
+                         hasCharacterOrientedLabel: false
+                         translateLabel: false
+                         model: hideSelectorNameFilter
+                         extent: (Point 16 22)
+                         usePreferredWidth: true
+                       )
+                      (LabelSpec
+                         label: 'Filter:'
+                         name: 'Label1'
+                         translateLabel: true
+                         adjust: right
+                         extent: (Point 46 24)
+                         usePreferredWidth: true
+                       )
+                      (InputFieldSpec
+                         name: 'EntryField1'
+                         model: nameFilterPatternHolder
+                         immediateAccept: true
+                         acceptOnReturn: true
+                         acceptOnTab: true
+                         acceptOnPointerLeave: true
+                         extent: (Point 228 25)
+                       )
+                      )
+                    
+                   )
+                   extent: (Point 300 30)
+                 )
+                (SequenceViewSpec
+                   name: 'List'
+                   tabable: true
+                   model: selectedMethodNameIndices
+                   menu: menuHolder
+                   hasHorizontalScrollBar: true
+                   hasVerticalScrollBar: true
+                   miniScrollerHorizontal: true
+                   isMultiSelect: true
+                   valueChangeSelector: selectionChangedByClick
+                   useIndex: true
+                   sequenceList: browserNameList
+                   doubleClickChannel: doubleClickChannel
+                   extent: (Point 300 267)
+                   properties: 
+                  (PropertyListDictionary
+                     canDropSelector: canDropContext:
+                     dropArgument: nil
+                     dropSelector: doDropContext:
+                     dragArgument: nil
+                   )
+                 )
+                )
+              
+             )
+           )
+          )
+        
+       )
+     )
 ! !
 
 !MethodList class methodsFor:'plugIn spec'!
@@ -165,29 +229,29 @@
      (if this app is embedded in a subCanvas)."
 
     ^ #(
-	environmentHolder
-	#(doubleClickChannel action)
-	#filterClassVars
-	#forceGeneratorTrigger
-	#immediateUpdate
-	#inGeneratorHolder
-	#menuHolder
-	#methodCategoryHolder
-	#packageFilter
-	#selectedMethods
-	#selectionChangeCondition
-	#showCoverageInformation
-	#showImageResourceMethodsImages
-	#showMethodComplexity
-	#showMethodInheritance
-	#showMethodTypeIcon
-	#sortBy
-	#updateTrigger
-	#variableFilter
-	#showSyntheticMethods
+        #(doubleClickChannel action)
+        #environmentHolder
+        #filterClassVars
+        #forceGeneratorTrigger
+        #immediateUpdate
+        #inGeneratorHolder
+        #menuHolder
+        #methodCategoryHolder
+        #packageFilter
+        #selectedMethods
+        #selectionChangeCondition
+        #showCoverageInformation
+        #showImageResourceMethodsImages
+        #showMethodComplexity
+        #showMethodInheritance
+        #showMethodTypeIcon
+        #showSelectorNameFilter
+        #showSyntheticMethods
+        #sortBy
+        #updateTrigger
+        #variableFilter
       ).
 
-    "Modified: / 24-02-2014 / 10:37:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !MethodList methodsFor:'aspects'!
@@ -234,6 +298,16 @@
     ^ methodList
 !
 
+nameFilterPatternHolder
+    nameFilterPatternHolder isNil ifTrue:[
+        nameFilterPatternHolder := '' asValue.
+        nameFilterPatternHolder addDependent:self
+    ].
+    ^  nameFilterPatternHolder
+
+    "Created: / 09-11-2017 / 20:51:04 / cg"
+!
+
 selectedMethodNameIndices
     selectedMethodNameIndices isNil ifTrue:[
 	selectedMethodNameIndices := ValueHolder new.
@@ -325,6 +399,29 @@
     ].
 !
 
+showSelectorNameFilter
+    |holder|
+    
+    showNameFilterHolder isNil ifTrue:[
+        masterApplication notNil ifTrue:[
+            holder := masterApplication perform:#showSelectorNameFilter ifNotUnderstood:nil.
+        ].
+        holder isNil ifTrue:[
+            holder := ValueHolder with:false.
+        ].    
+        showNameFilterHolder := IndirectValue for:holder.
+    ].
+    ^  showNameFilterHolder
+
+    "Created: / 09-11-2017 / 20:24:22 / cg"
+!
+
+showSelectorNameFilter:aValueHolder
+    self showSelectorNameFilter value:aValueHolder.
+
+    "Created: / 09-11-2017 / 20:24:08 / cg"
+!
+
 showSyntheticMethods
     showSyntheticMethods isNil ifTrue:[
         showSyntheticMethods := ValueHolder with:false.
@@ -620,7 +717,7 @@
 "/        ^ self
 "/    ].
 
-    changedObject == sortBy ifTrue:[
+    (changedObject == sortBy) ifTrue:[
         listValid ~~ true ifTrue:[  "/ could be nil
             inGeneratorHolder value isNil ifTrue:[
                 "/ ok, no need to react on that one
@@ -708,8 +805,14 @@
     super delayedUpdate:something with:aParameter from:changedObject
 
     "Created: / 05-02-2000 / 13:42:14 / cg"
-    "Modified: / 05-06-2012 / 23:47:15 / cg"
     "Modified: / 24-08-2013 / 00:41:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-11-2017 / 19:53:17 / cg"
+!
+
+hideSelectorNameFilter
+    self showSelectorNameFilter value:false.
+
+    "Created: / 09-11-2017 / 20:48:19 / cg"
 !
 
 selectedMethodsChanged
@@ -936,11 +1039,16 @@
             ^ self   "/ I dont care for that class
         ].
     ].
-
+    changedObject == nameFilterPatternHolder ifTrue:[
+        nameFilter := nameFilterPatternHolder value.
+        self enqueueDelayedUpdateList.
+        ^ self.
+    ].
+    
     super update:something with:aParameter from:changedObject
 
-    "Modified: / 05-06-2012 / 23:41:50 / cg"
     "Modified: / 17-04-2014 / 21:48:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-11-2017 / 20:57:17 / cg"
 ! !
 
 !MethodList methodsFor:'drag & drop'!
@@ -1086,36 +1194,42 @@
     generator do:[:cls :cat :sel :mthd |
         |categoryIsExtensionsPseudoCategory|
 
-        categoryIsExtensionsPseudoCategory := (cat = nameListEntryForExtensions).
-        (cls isNil and:[ cat isNil and:[ sel isNil ] ]) ifTrue:[
-            enforceClassAndProtocolInList := true
-        ] ifFalse:[
-            cls notNil ifTrue:[
-                allClasses add:cls.
+        (nameFilter isEmptyOrNil
+        or:[nameFilter = '*'
+        or:[ (nameFilter includesMatchCharacters not and:[sel startsWith:nameFilter]) 
+        or:[ nameFilter match:sel caseSensitive:false]]]) ifTrue:[
+            
+            categoryIsExtensionsPseudoCategory := (cat = nameListEntryForExtensions).
+            (cls isNil and:[ cat isNil and:[ sel isNil ] ]) ifTrue:[
+                enforceClassAndProtocolInList := true
+            ] ifFalse:[
+                cls notNil ifTrue:[
+                    allClasses add:cls.
+                ].
+                "/ JV: Filter method through package filter
+                "/ but not, if it is an extension method and we are showing extensions
+                (mthd notNil
+                    and:[ (mthd isSynthetic not or:[showSyntheticMethods value == true])
+                    and:[ sel notNil ]]
+                ) ifTrue:[
+                    (packageFilterValue isNil
+                        or:[ (packageFilterValue includes:mthd package)
+                        or:[ categoryIsExtensionsPseudoCategory and:[ mthd isExtension] ]]
+                    ) ifTrue:[
+                        entries add:(Array with:cls with:sel with:mthd).
+                        selectorBag add:sel.
+                        newClasses add:cls.
+
+                        allCategories add:mthd category.
+                        "/ allSelectors add:sel.
+                    ]
+                ]
             ].
-            "/ JV: Filter method through package filter
-            "/ but not, if it is an extension method and we are showing extensions
-            (mthd notNil
-                and:[ (mthd isSynthetic not or:[showSyntheticMethods value == true])
-                and:[ sel notNil ]]
-            ) ifTrue:[
-                (packageFilterValue isNil
-                    or:[ (packageFilterValue includes:mthd package)
-                    or:[ categoryIsExtensionsPseudoCategory and:[ mthd isExtension] ]]
-                ) ifTrue:[
-                    entries add:(Array with:cls with:sel with:mthd).
-                    selectorBag add:sel.
-                    newClasses add:cls.
-
-                    allCategories add:mthd category.
-                    "/ allSelectors add:sel.
+            (mthd notNil and:[ mthd isWrapped ]) ifTrue:[
+                (mthd isTiming or:[ mthd isCounting or:[ mthd isCountingMemoryUsage ] ]) ifTrue:[
+                    anyMethodToWatch := true
                 ]
-            ]
-        ].
-        (mthd notNil and:[ mthd isWrapped ]) ifTrue:[
-            (mthd isTiming or:[ mthd isCounting or:[ mthd isCountingMemoryUsage ] ]) ifTrue:[
-                anyMethodToWatch := true
-            ]
+            ].
         ].
     ].
     showMethodInheritance value ~~ false ifTrue:[
@@ -1308,8 +1422,8 @@
 
     "Created: / 05-02-2000 / 22:43:40 / cg"
     "Modified: / 24-08-2010 / 20:34:09 / Jan Vrany"
-    "Modified: / 20-07-2012 / 20:00:58 / cg"
     "Modified (comment): / 17-09-2013 / 10:31:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-11-2017 / 20:58:33 / cg"
 !
 
 makeDependent