#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Mon, 14 May 2018 19:41:15 +0200
changeset 18122 5d52a9b323a1
parent 18121 f302a4e00815
child 18123 905cdbcd7be1
#FEATURE by cg class: Tools::MethodList changed: #isNameFilterMatchingSelector:method: #nameFilterTypeHolder class: Tools::MethodList class changed: #windowSpec
Tools__MethodList.st
--- a/Tools__MethodList.st	Mon May 14 19:41:05 2018 +0200
+++ b/Tools__MethodList.st	Mon May 14 19:41:15 2018 +0200
@@ -130,7 +130,7 @@
     ^ 
     #(FullSpec
        name: windowSpec
-       uuid: '35f88efc-5430-11e8-b6f1-b8f6b1108e05'
+       uuid: 'c0c44ee4-579c-11e8-8560-b8f6b1108e05'
        window: 
       (WindowSpec
          label: 'SelectorList'
@@ -195,14 +195,14 @@
                            collection: (
                             (InputFieldSpec
                                name: 'EntryField1'
+                               activeHelpKey: nameFilterField
                                uuid: '0ad3d374-d1ce-11e7-900e-c42c033b4871'
                                model: nameFilterPatternHolder
                                immediateAccept: true
                                acceptOnReturn: true
                                acceptOnTab: true
                                acceptOnPointerLeave: true
-                               activeHelpKey: nameFilterField
-                               extent: (Point 177 26)
+                               extent: (Point 172 26)
                              )
                             (ComboListSpec
                                name: 'ComboList1'
@@ -211,11 +211,12 @@
                                model: nameFilterTypeHolder
                                comboList: 
                               (Array
-                                 'T' 'S'
-                                 '-S' '-T'
+                                 'Ss' 'Tt' '-Ss' '-Tt' '-'
+                                 'S' '-S'
+                                 'T' '-T'
                                )
                                useIndex: false
-                               extent: (Point 40 26)
+                               extent: (Point 45 26)
                              )
                             )
                           
@@ -355,7 +356,7 @@
 
 nameFilterTypeHolder
     nameFilterTypeHolder isNil ifTrue:[
-        nameFilterTypeHolder := 'S' asValue.
+        nameFilterTypeHolder := 'Ss' asValue.
         nameFilterTypeHolder addDependent:self
     ].
     ^  nameFilterTypeHolder
@@ -1215,7 +1216,9 @@
 !
 
 isNameFilterMatchingSelector:sel method:mthd
-    |source filterType doesMatch|
+    "true if the method matches the current nameFilter"
+    
+    |source filterType doesMatch caseSensitive positiveMatch|
     
     sel isNil ifTrue:[^ true].
     nameFilter isEmptyOrNil ifTrue:[^ true].   
@@ -1224,32 +1227,45 @@
     (showNameFilterHolder value ? false) ifFalse:[^ true].
 
     filterType := nameFilterTypeHolder value.
+
+    caseSensitive := true.
+    positiveMatch := true.
     
-    (filterType = 'S' or:[ filterType = '-S' ]) ifTrue:[
+    (#('Ss' '-Ss' 'Tt' '-Tt') includes:filterType) ifTrue:[
+        caseSensitive := false.
+        filterType := filterType copyButLast.
+    ].        
+    filterType first == $- ifTrue:[
+        positiveMatch := false.
+        filterType := filterType copyButFirst.
+    ].
+    
+    (filterType = 'S') ifTrue:[
         "/ selector filter
         nameFilter includesMatchCharacters ifTrue:[
-            doesMatch := nameFilter match:sel caseSensitive:false.
+            doesMatch := nameFilter match:sel caseSensitive:caseSensitive.
         ] ifFalse:[ 
-            doesMatch := sel includesString:nameFilter caseSensitive:false
+            doesMatch := sel includesString:nameFilter caseSensitive:caseSensitive
         ].
-        filterType = '-S' ifTrue:[^ doesMatch not ].
+        positiveMatch ifFalse:[^ doesMatch not ].
         ^ doesMatch
     ].
 
     source := mthd source.
     
-    (filterType = 'T' or:[ filterType = '-T' ]) ifTrue:[
+    (filterType = 'T') ifTrue:[
         "/ text filter
         nameFilter includesMatchCharacters ifTrue:[
-            doesMatch := source asCollectionOfWords contains:[:word | nameFilter match:word caseSensitive:false]
+            doesMatch := source asCollectionOfWords 
+                            contains:[:word | nameFilter match:word caseSensitive:caseSensitive]
         ] ifFalse:[
-            doesMatch := source includesString:nameFilter caseSensitive:false
+            doesMatch := source includesString:nameFilter caseSensitive:caseSensitive
         ].
-        filterType = '-T' ifTrue:[^ doesMatch not ].
+        positiveMatch ifFalse:[^ doesMatch not ].
         ^ doesMatch
     ].
     
-    "/ oops - unknwon filterType
+    "/ oops - unknown filterType
     ^ true
 
     "Created: / 25-11-2017 / 12:04:21 / cg"