SmallSense__ClassSearchDialog.st
changeset 337 5f39eba6a1e3
parent 333 d0698eecaea4
child 338 0a04e7f6e747
--- a/SmallSense__ClassSearchDialog.st	Mon May 05 09:23:22 2014 +0100
+++ b/SmallSense__ClassSearchDialog.st	Tue May 06 08:23:16 2014 +0100
@@ -11,6 +11,69 @@
 	category:'SmallSense-Core-Interface-Search'
 !
 
+!ClassSearchDialog class methodsFor:'interface specs-content'!
+
+optionsPaneSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:SmallSense::ClassSearchDialog andSelector:#optionsPaneSpec
+     SmallSense::ClassSearchDialog new openInterface:#optionsPaneSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+    #(FullSpec
+       name: optionsPaneSpec
+       window: 
+      (WindowSpec
+         label: 'Search Options...'
+         name: 'Search Options...'
+         min: (Point 10 10)
+         bounds: (Rectangle 0 0 634 25)
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (VerticalPanelViewSpec
+             name: 'Options'
+             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             horizontalLayout: fit
+             verticalLayout: fit
+             horizontalSpace: 3
+             verticalSpace: 3
+             component: 
+            (SpecCollection
+               collection: (
+                (CheckBoxSpec
+                   label: 'Match fully qualified class names'
+                   name: 'CheckBox1'
+                   model: matchFullyQualifiedClassNameHolder
+                   extent: (Point 634 25)
+                 )
+                )
+              
+             )
+           )
+          )
+        
+       )
+     )
+! !
+
+!ClassSearchDialog methodsFor:'accessing-defaults'!
+
+defaultTitle
+    ^ (resources string: 'Search Class...')
+
+    "Created: / 05-05-2014 / 23:39:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ClassSearchDialog methodsFor:'aspects'!
 
 matchFullyQualifiedClassNameEnabledHolder
@@ -102,18 +165,56 @@
     ^ super update:something with:aParameter from:changedObject
 
     "Created: / 27-04-2014 / 23:45:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateMatchingObjects
+    | environment |
+
+    matchingObjects := nil.
+    environment := self environment.
+    self matchPatternHolder value notEmptyOrNil ifTrue:[ 
+        | pattern |
+        pattern := StringPattern fromString: self matchPatternHolder value.
+"/        [
+"/            self updateMatchingLabelToSearching.
+            matchingObjects := self matchingObjectsForPattern: pattern inEnvironment: environment.
+"/        ] ensure:[
+"/            self updateMatchingLabelToNormal.
+"/        ]
+    ] ifFalse:[
+            matchingObjects := self recentlySearchedObjects asArray reversed.
+    ].
+    self updateMatchingObjects: matchingObjects.
+
+    "Created: / 27-04-2014 / 23:48:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 30-04-2014 / 11:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ClassSearchDialog methodsFor:'hooks'!
+
+commonPostOpen
+"/    self updateMatching.
+"/    recentlySearchedPatterns notEmptyOrNil ifTrue:[
+"/        matchPatternView contents: self recentlySearchedPatterns last.
+"/        matchPatternView selectAll.
+"/    ].
+    self recentlySearchedObjects notEmptyOrNil ifTrue:[
+        self updateMatchingObjects: self recentlySearchedObjects asArray reverse.
+        self updateMatchingLabelToRecentSearches.
+    ].
+    self updateAcceptEnabled.
+
+    "Created: / 08-03-2013 / 13:15:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 30-04-2014 / 11:48:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ClassSearchDialog methodsFor:'queries'!
 
 canSelect: selection
-    | po |
-
-    po := selection isInteger ifTrue:[ matchingObjectsTree at: selection ] ifFalse:[ selection ].
-    ^ po askFor: #isSmallSenseClassPO.
+    ^ selection askFor: #isSmallSenseClassPO.
 
     "Created: / 22-04-2014 / 13:08:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 28-04-2014 / 23:56:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-05-2014 / 23:52:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ClassSearchDialog methodsFor:'searching'!
@@ -147,14 +248,14 @@
         matchFullyQualifiedClassName ifFalse:[
             environment 
                 allClassesDo:[:cls | 
-                    (pattern match:cls nameWithoutPrefix) ifTrue:[
+                    ((filter isNil or:[filter value: cls]) and:[(pattern match:cls nameWithoutPrefix)]) ifTrue:[
                         matching add:cls.
                     ].
                 ].
         ] ifTrue:[
             environment 
                 allClassesDo:[:cls | 
-                    (pattern match:cls displayString) ifTrue:[
+                    ((filter isNil or:[filter value: cls]) and:[(pattern match:cls displayString)]) ifTrue:[
                         matching add:cls
                     ]
                 ].
@@ -164,6 +265,6 @@
     ^ matching
 
     "Created: / 28-04-2014 / 23:20:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 30-04-2014 / 09:48:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 05-05-2014 / 23:47:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !