Decoupling search logic from dialogs (part 1)
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sat, 13 Dec 2014 00:11:58 +0000
changeset 366 e2083bc62428
parent 365 58f383e9a862
child 367 bd7749edb1c6
Decoupling search logic from dialogs (part 1) Search logic has been moved to separate class hierarchy under `AbstractSearchProcessor`. This will allow for reusing search logic in multiple dialogs and/or use multiple searches in one dialog.
Make.proto
Make.spec
SmallSense__AbstractListDialog.st
SmallSense__AbstractSearchDialog.st
SmallSense__AbstractSearchProcessor.st
SmallSense__ClassSearchDialog.st
SmallSense__ClassSearchProcessor.st
SmallSense__ImplementorSearchProcessor.st
SmallSense__MethodSearchDialog.st
SmallSense__PackageSearchDialog.st
SmallSense__PackageSearchProcessor.st
abbrev.stc
bc.mak
extensions.st
libInit.cc
smallsense.rc
stx_goodies_smallsense.st
--- a/Make.proto	Mon Dec 08 02:42:33 2014 +0000
+++ b/Make.proto	Sat Dec 13 00:11:58 2014 +0000
@@ -159,6 +159,7 @@
 
 # BEGINMAKEDEPEND --- do not remove this line; make depend needs it
 $(OUTDIR)SmallSense__AbstractDIalog.$(O) SmallSense__AbstractDIalog.$(H): SmallSense__AbstractDIalog.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(INCLUDE_TOP)/stx/libview2/SimpleDialog.$(H) $(STCHDR)
+$(OUTDIR)SmallSense__AbstractSearchProcessor.$(O) SmallSense__AbstractSearchProcessor.$(H): SmallSense__AbstractSearchProcessor.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__CodeHighlightingService.$(O) SmallSense__CodeHighlightingService.$(H): SmallSense__CodeHighlightingService.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__BackgroundSourceProcessingService.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__CodeHighlightingService.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__CodeViewService.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__CodeNavigationService.$(O) SmallSense__CodeNavigationService.$(H): SmallSense__CodeNavigationService.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__CodeNavigationService.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__CodeViewService.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__CompletionContext.$(O) SmallSense__CompletionContext.$(H): SmallSense__CompletionContext.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
@@ -197,15 +198,18 @@
 $(OUTDIR)SmallSense__AbstractListDialog.$(O) SmallSense__AbstractListDialog.$(H): SmallSense__AbstractListDialog.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__AbstractDIalog.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(INCLUDE_TOP)/stx/libview2/SimpleDialog.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__ClassInfo.$(O) SmallSense__ClassInfo.$(H): SmallSense__ClassInfo.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__Info.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__ClassPO.$(O) SmallSense__ClassPO.$(H): SmallSense__ClassPO.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__PO.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libwidg2/HierarchicalItem.$(H) $(STCHDR)
+$(OUTDIR)SmallSense__ClassSearchProcessor.$(O) SmallSense__ClassSearchProcessor.$(H): SmallSense__ClassSearchProcessor.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__AbstractSearchProcessor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__ClassType.$(O) SmallSense__ClassType.$(H): SmallSense__ClassType.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__Type.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__ConstantPO.$(O) SmallSense__ConstantPO.$(H): SmallSense__ConstantPO.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__PO.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libwidg2/HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__GenericEditSupport.$(O) SmallSense__GenericEditSupport.$(H): SmallSense__GenericEditSupport.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__EditSupport.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)SmallSense__ImplementorSearchProcessor.$(O) SmallSense__ImplementorSearchProcessor.$(H): SmallSense__ImplementorSearchProcessor.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__AbstractSearchProcessor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__JavaEditSupport.$(O) SmallSense__JavaEditSupport.$(H): SmallSense__JavaEditSupport.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__EditSupport.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__JavaImportPO.$(O) SmallSense__JavaImportPO.$(H): SmallSense__JavaImportPO.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__PO.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libwidg2/HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__MethodBindingPO.$(O) SmallSense__MethodBindingPO.$(H): SmallSense__MethodBindingPO.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__PO.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libwidg2/HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__MethodInfo.$(O) SmallSense__MethodInfo.$(H): SmallSense__MethodInfo.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__Info.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__MethodPO.$(O) SmallSense__MethodPO.$(H): SmallSense__MethodPO.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__PO.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libwidg2/HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__PackagePO.$(O) SmallSense__PackagePO.$(H): SmallSense__PackagePO.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__PO.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libwidg2/HierarchicalItem.$(H) $(STCHDR)
+$(OUTDIR)SmallSense__PackageSearchProcessor.$(O) SmallSense__PackageSearchProcessor.$(H): SmallSense__PackageSearchProcessor.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__AbstractSearchProcessor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__SmalltalkCompletionEngine.$(O) SmallSense__SmalltalkCompletionEngine.$(H): SmallSense__SmalltalkCompletionEngine.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__CompletionEngine.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__SmalltalkEditSupport.$(O) SmallSense__SmalltalkEditSupport.$(H): SmallSense__SmalltalkEditSupport.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__EditSupport.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__SmalltalkInferencer.$(O) SmallSense__SmalltalkInferencer.$(H): SmallSense__SmalltalkInferencer.st $(INCLUDE_TOP)/stx/goodies/smallsense/SmallSense__SmalltalkParseNodeVisitor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/Make.spec	Mon Dec 08 02:42:33 2014 +0000
+++ b/Make.spec	Sat Dec 13 00:11:58 2014 +0000
@@ -52,6 +52,7 @@
 
 COMMON_CLASSES= \
 	SmallSense::AbstractDIalog \
+	SmallSense::AbstractSearchProcessor \
 	SmallSense::CodeHighlightingService \
 	SmallSense::CodeNavigationService \
 	SmallSense::CompletionContext \
@@ -90,15 +91,18 @@
 	SmallSense::AbstractListDialog \
 	SmallSense::ClassInfo \
 	SmallSense::ClassPO \
+	SmallSense::ClassSearchProcessor \
 	SmallSense::ClassType \
 	SmallSense::ConstantPO \
 	SmallSense::GenericEditSupport \
+	SmallSense::ImplementorSearchProcessor \
 	SmallSense::JavaEditSupport \
 	SmallSense::JavaImportPO \
 	SmallSense::MethodBindingPO \
 	SmallSense::MethodInfo \
 	SmallSense::MethodPO \
 	SmallSense::PackagePO \
+	SmallSense::PackageSearchProcessor \
 	SmallSense::SmalltalkCompletionEngine \
 	SmallSense::SmalltalkEditSupport \
 	SmallSense::SmalltalkInferencer \
@@ -125,6 +129,7 @@
 
 COMMON_OBJS= \
     $(OUTDIR_SLASH)SmallSense__AbstractDIalog.$(O) \
+    $(OUTDIR_SLASH)SmallSense__AbstractSearchProcessor.$(O) \
     $(OUTDIR_SLASH)SmallSense__CodeHighlightingService.$(O) \
     $(OUTDIR_SLASH)SmallSense__CodeNavigationService.$(O) \
     $(OUTDIR_SLASH)SmallSense__CompletionContext.$(O) \
@@ -163,15 +168,18 @@
     $(OUTDIR_SLASH)SmallSense__AbstractListDialog.$(O) \
     $(OUTDIR_SLASH)SmallSense__ClassInfo.$(O) \
     $(OUTDIR_SLASH)SmallSense__ClassPO.$(O) \
+    $(OUTDIR_SLASH)SmallSense__ClassSearchProcessor.$(O) \
     $(OUTDIR_SLASH)SmallSense__ClassType.$(O) \
     $(OUTDIR_SLASH)SmallSense__ConstantPO.$(O) \
     $(OUTDIR_SLASH)SmallSense__GenericEditSupport.$(O) \
+    $(OUTDIR_SLASH)SmallSense__ImplementorSearchProcessor.$(O) \
     $(OUTDIR_SLASH)SmallSense__JavaEditSupport.$(O) \
     $(OUTDIR_SLASH)SmallSense__JavaImportPO.$(O) \
     $(OUTDIR_SLASH)SmallSense__MethodBindingPO.$(O) \
     $(OUTDIR_SLASH)SmallSense__MethodInfo.$(O) \
     $(OUTDIR_SLASH)SmallSense__MethodPO.$(O) \
     $(OUTDIR_SLASH)SmallSense__PackagePO.$(O) \
+    $(OUTDIR_SLASH)SmallSense__PackageSearchProcessor.$(O) \
     $(OUTDIR_SLASH)SmallSense__SmalltalkCompletionEngine.$(O) \
     $(OUTDIR_SLASH)SmallSense__SmalltalkEditSupport.$(O) \
     $(OUTDIR_SLASH)SmallSense__SmalltalkInferencer.$(O) \
--- a/SmallSense__AbstractListDialog.st	Mon Dec 08 02:42:33 2014 +0000
+++ b/SmallSense__AbstractListDialog.st	Sat Dec 13 00:11:58 2014 +0000
@@ -21,11 +21,11 @@
 "{ NameSpace: SmallSense }"
 
 AbstractDIalog subclass:#AbstractListDialog
-	instanceVariableNames:'matchingObjects matchingObjectsView matchingObjectsMultiselect
+	instanceVariableNames:'matchingObjectsView matchingObjectsMultiselect
 		matchingObjectsTree matchingObjectsSelectionHolder
 		matchingObjectsLabelHolder matchingObjectsUpdateJob
 		matchPatternHolder matchPatternView environmentHolder
-		filterHolder filter'
+		filterHolder filter processor'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'SmallSense-Core-Interface-Search'
@@ -241,6 +241,14 @@
     "Created: / 11-03-2013 / 15:21:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+processor
+    ^ processor
+!
+
+processor:aAbstractSearchProcessor
+    processor := aAbstractSearchProcessor.
+!
+
 selection: selection
     | matchingObjectsSelection |
 
@@ -293,6 +301,12 @@
 
 !AbstractListDialog methodsFor:'accessing-defaults'!
 
+defaultProcessorClass
+    self subclassResponsibility
+
+    "Created: / 12-12-2014 / 21:36:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 defaultTitle
     ^ (resources string: 'Search...')
 
@@ -466,10 +480,9 @@
 
 !AbstractListDialog methodsFor:'change & update'!
 
-delayedUpdateMatchingObjects: matchineObjectsArg POs: matchingPOsArg
+delayedUpdateMatchingObjectPOs: matchingPOsArg
     | rootPO matchPatternString  |
 
-    matchingObjects := matchineObjectsArg.
     rootPO := self matchingObjectsTree root.
     rootPO
         children:matchingPOsArg;
@@ -486,7 +499,7 @@
         ]
     ].
 
-    "Created: / 08-12-2014 / 02:31:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 12-12-2014 / 23:32:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 update:something with:aParameter from:changedObject
@@ -583,6 +596,31 @@
     "Modified: / 25-11-2014 / 13:23:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+updateMatching
+    | environment pattern pos |
+
+    environment := self environment.
+    self matchPatternHolder value notEmptyOrNil ifTrue:[
+        pattern := StringPattern fromString: self matchPatternHolder value.
+        pos := processor matchingObjectPOsForPattern: pattern filter: self filterHolder value inEnvironment: environment.
+        self updateMatchingObjectPOs: pos.
+    ] ifFalse:[
+        self updateMatchingIgnorePattern
+    ].
+
+    "Created: / 12-12-2014 / 23:38:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateMatchingIgnorePattern
+    | environment pos |
+
+    environment := self environment.
+    pos := processor matchingObjectPOsForPattern: nil filter: self filterHolder value inEnvironment: environment.
+    self updateMatchingObjectPOs: pos.
+
+    "Created: / 12-12-2014 / 23:39:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 updateMatchingLabelToNormal
     self matchingObjectsLabelHolder value: (resources string: 'Matching items:').
 
@@ -603,56 +641,20 @@
     "Modified: / 28-04-2014 / 22:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-updateMatchingObjects
-    | environment pattern objects |
-
-    environment := self environment.
-    self matchPatternHolder value notEmptyOrNil ifTrue:[
-        pattern := StringPattern fromString: self matchPatternHolder value.
-        objects := self matchingObjectsForPattern: pattern inEnvironment: environment.
-        self updateMatchingObjects: objects.
-    ] ifFalse:[
-        self updateMatchingObjectsIgnorePattern
-    ].
-
-    "Created: / 06-05-2014 / 00:11:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 06-07-2014 / 10:16:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-updateMatchingObjects: objects
-    | objectPOs |
+updateMatchingObjectPOs: matchingPOsArg
+    self enqueueMessage: #delayedUpdateMatchingObjectPOs: for: self arguments: (Array with: matchingPOsArg)
 
-    objectPOs := self matchingObjectPOsFor: objects.
-    self updateMatchingObjects: objects POs: objectPOs
-
-    "Modified: / 08-12-2014 / 02:32:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-updateMatchingObjects: matchineObjectsArg POs: matchingPOsArg
-    self enqueueMessage: #delayedUpdateMatchingObjects:POs: for: self arguments: (Array with: matchineObjectsArg with: matchingPOsArg)
-
-    "Created: / 08-12-2014 / 02:32:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-updateMatchingObjectsIgnorePattern
-    | environment objects |
-
-    environment := self environment.
-    objects := self matchingObjectsForPattern: nil inEnvironment: environment.
-    self updateMatchingObjects: objects.
-
-    "Created: / 10-05-2014 / 01:02:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 06-07-2014 / 10:16:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 12-12-2014 / 23:32:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 updateNoResults: root
     | items |
 
     items := (Array with: ((HierarchicalItemWithLabel new parent: root; label:((resources string:'No search results...') asText colorizeAllWith: Color gray)))).
-    self updateMatchingObjects: nil POs: items.
+    self updateMatchingObjectPOs: items.
 
     "Created: / 11-03-2013 / 14:33:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 08-12-2014 / 02:27:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-12-2014 / 23:32:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !AbstractListDialog methodsFor:'event processing'!
@@ -704,14 +706,14 @@
 
     matchPatternHolder addDependent:self.
     matchPatternView selectAll.
-    matchingObjects isNil ifTrue:[
-        self updateMatchingObjectsIgnorePattern.
-    ].
+
+    self updateMatchingIgnorePattern.
     self updateAcceptEnabled.
     self updateMatchPatternHolderFromSelection.
     super commonPostBuild
 
     "Created: / 25-11-2014 / 13:23:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-12-2014 / 23:38:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 postBuildMatchPatternView:aView
@@ -748,10 +750,17 @@
 
     self accept addDependent: self.
     self matchingObjectsTree. "/force its initialization
-    matchingObjectsUpdateJob := BackgroundJob named: 'SmallSense search dialog updater' on:[self updateMatchingObjects].
+    matchingObjectsUpdateJob := BackgroundJob named: 'SmallSense search dialog updater' on:[self updateMatching].
     matchingObjectsMultiselect := false.
+    self initializeProcessor
 
-    "Modified: / 08-12-2014 / 01:51:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-12-2014 / 23:38:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+initializeProcessor
+    processor := self defaultProcessorClass new
+
+    "Created: / 12-12-2014 / 21:35:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !AbstractListDialog methodsFor:'queries'!
@@ -818,34 +827,5 @@
 
     "Created: / 02-05-2014 / 10:58:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 02-10-2014 / 10:12:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-matchingObjectPOsFor: objects
-
-    self subclassResponsibility.
-
-    "Created: / 30-04-2014 / 09:46:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-matchingObjectsForPattern:pattern inEnvironment:environment
-    | objects |
-
-    objects := self matchingObjectsForPattern:pattern inEnvironment:environment relax: 1.
-    objects notEmptyOrNil ifTrue:[ ^ objects ].
-
-    objects := self matchingObjectsForPattern:pattern inEnvironment:environment relax: 2.
-    objects notEmptyOrNil ifTrue:[ ^ objects ].
-
-    objects := self matchingObjectsForPattern:pattern inEnvironment:environment relax: 3.
-    ^ objects
-
-    "Created: / 28-04-2014 / 23:20:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 20-06-2014 / 21:19:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-matchingObjectsForPattern:pattern inEnvironment:environment relax: level
-    self subclassResponsibility
-
-    "Created: / 20-06-2014 / 21:16:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
--- a/SmallSense__AbstractSearchDialog.st	Mon Dec 08 02:42:33 2014 +0000
+++ b/SmallSense__AbstractSearchDialog.st	Sat Dec 13 00:11:58 2014 +0000
@@ -143,12 +143,13 @@
 "/        matchPatternView selectAll.
 "/    ].
     self recentlySearchedObjects notEmptyOrNil ifTrue:[
-        self updateMatchingObjects: self recentlySearchedObjects asArray reverse.
+        self updateMatchingObjectPOs: (processor matchingObjectPOsFor: self recentlySearchedObjects asArray reverse).
         self updateMatchingLabelToRecentSearches.
     ].
     super commonPostBuild
 
     "Created: / 25-11-2014 / 13:23:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-12-2014 / 23:35:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !AbstractSearchDialog methodsFor:'initialization'!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmallSense__AbstractSearchProcessor.st	Sat Dec 13 00:11:58 2014 +0000
@@ -0,0 +1,99 @@
+"
+stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
+Copyright (C) 2013-2014 Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+"{ Package: 'stx:goodies/smallsense' }"
+
+"{ NameSpace: SmallSense }"
+
+Object subclass:#AbstractSearchProcessor
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'SmallSense-Core-Interface-Search'
+!
+
+!AbstractSearchProcessor class methodsFor:'documentation'!
+
+copyright
+"
+stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
+Copyright (C) 2013-2014 Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+! !
+
+!AbstractSearchProcessor class methodsFor:'queries'!
+
+isAbstract
+    "Return if this class is an abstract class.
+     True is returned here for myself only; false for subclasses.
+     Abstract subclasses must redefine again."
+
+    ^ self == SmallSense::AbstractSearchProcessor.
+! !
+
+!AbstractSearchProcessor methodsFor:'searching'!
+
+matchingObjectPOsFor: objects
+
+    self subclassResponsibility.
+
+    "Created: / 30-04-2014 / 09:46:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+matchingObjectPOsForPattern:pattern filter: filter inEnvironment:environment
+    ^ self matchingObjectPOsFor: 
+        (self matchingObjectsForPattern: pattern filter: filter inEnvironment: environment).
+
+    "Created: / 12-12-2014 / 23:31:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+matchingObjectsForPattern:pattern filter: filter inEnvironment:environment
+    | objects |
+
+    objects := self matchingObjectsForPattern:pattern filter: filter inEnvironment:environment relax: 1.
+    objects notEmptyOrNil ifTrue:[ ^ objects ].
+
+    objects := self matchingObjectsForPattern:pattern filter: filter inEnvironment:environment relax: 2.
+    objects notEmptyOrNil ifTrue:[ ^ objects ].
+
+    objects := self matchingObjectsForPattern:pattern filter: filter inEnvironment:environment relax: 3.
+    ^ objects
+
+    "Created: / 12-12-2014 / 21:23:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+matchingObjectsForPattern:pattern filter: filter inEnvironment:environment relax: level
+    self subclassResponsibility
+
+    "Created: / 12-12-2014 / 21:22:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/SmallSense__ClassSearchDialog.st	Mon Dec 08 02:42:33 2014 +0000
+++ b/SmallSense__ClassSearchDialog.st	Sat Dec 13 00:11:58 2014 +0000
@@ -109,6 +109,14 @@
 
 !ClassSearchDialog methodsFor:'accessing-defaults'!
 
+defaultProcessorClass
+    "superclass SmallSense::AbstractListDialog says that I am responsible to implement this method"
+
+    ^ ClassSearchProcessor
+
+    "Created: / 12-12-2014 / 23:03:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 defaultTitle
     ^ (resources string: 'Search Class...')
 
@@ -139,22 +147,14 @@
 matchFullyQualifiedClassNameHolder
     <resource: #uiAspect>
 
-    "automatically generated by UIPainter ..."
-
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept it in the browser."
-    "*** (and replace this comment by something more useful ;-)"
 
     matchFullyQualifiedClassNameHolder isNil ifTrue:[
-        matchFullyQualifiedClassNameHolder := false asValue.
-"/ if your app needs to be notified of changes, uncomment one of the lines below:
-       matchFullyQualifiedClassNameHolder addDependent:self.
-"/       matchFullyQualifiedClassNameHolder onChangeSend:#matchFullyQualifiedClassNameHolderChanged to:self.
+        matchFullyQualifiedClassNameHolder := (AspectAdaptor forAspect:#matchFullyQualifiedClassName) subject: processor.   
+        matchFullyQualifiedClassNameHolder addDependent:self.
     ].
     ^ matchFullyQualifiedClassNameHolder.
 
-    "Modified: / 18-03-2013 / 11:19:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-12-2014 / 23:15:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 showOnlyInterfacesHolder
@@ -208,14 +208,12 @@
     "Created: / 27-04-2014 / 23:45:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-updateMatchingObjectsIgnorePattern
+updateMatchingIgnorePattern
     "/ There's a lot of classes, do not display them all but
     "/ rather display only recent selections.
 
     | recent objects |
 
-    matchingObjects := nil.
-
     "/ Make sure current environment contains them...
     objects := Set new.
     recent := self recentlySearchedObjects asArray reversed.
@@ -224,12 +222,10 @@
             objects add: cls.
         ].
     ].
-    recent := recent select:[ :cls | objects includes: cls ].
-    matchingObjects := recent.
-    self updateMatchingObjects: recent.
+    recent := processor matchingObjectPOsFor: (recent select:[ :cls | objects includes: cls ]).
+    self updateMatchingObjectPOs: recent.
 
-    "Created: / 10-05-2014 / 11:49:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 20-06-2014 / 14:15:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 12-12-2014 / 23:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ClassSearchDialog methodsFor:'queries'!
@@ -254,53 +250,3 @@
     "Modified: / 18-03-2013 / 13:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!ClassSearchDialog methodsFor:'searching'!
-
-matchingObjectPOsFor: objects
-    | matchFullyQualifiedClassName |
-
-    matchFullyQualifiedClassName := self matchFullyQualifiedClassNameHolder value.
-    matchFullyQualifiedClassName ifTrue:[
-        objects sort:[:a :b | a displayString < b displayString ].
-    ] ifFalse:[
-        objects sort:[:a :b | a nameWithoutPrefix < b nameWithoutPrefix ].
-    ].
-
-    ^ objects collect:[:each | 
-        (ClassPO new)
-            klass:each;
-            showPrefix:matchFullyQualifiedClassName
-    ].
-
-    "Created: / 30-04-2014 / 09:50:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-matchingObjectsForPattern:pattern inEnvironment:environment relax: level 
-    | matching matchFullyQualifiedClassName |
-
-    matching := OrderedCollection new.
-    matchFullyQualifiedClassName := self matchFullyQualifiedClassNameHolder 
-            value.
-    self matchPatternHolder value notEmptyOrNil ifTrue:[
-        matchFullyQualifiedClassName ifFalse:[
-            environment 
-                allClassesDo:[:cls | 
-                    ((filter isNil or:[filter value: cls]) and:[(pattern match:cls nameWithoutPrefix relax: level)]) ifTrue:[
-                        matching add:cls.
-                    ].
-                ].
-        ] ifTrue:[
-            environment 
-                allClassesDo:[:cls | 
-                    ((filter isNil or:[filter value: cls]) and:[(pattern match:cls displayString relax: level)]) ifTrue:[
-                        matching add:cls
-                    ]
-                ].
-        ]
-    ].
-
-    ^ matching
-
-    "Created: / 20-06-2014 / 21:17:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmallSense__ClassSearchProcessor.st	Sat Dec 13 00:11:58 2014 +0000
@@ -0,0 +1,113 @@
+"
+stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
+Copyright (C) 2013-2014 Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+"{ Package: 'stx:goodies/smallsense' }"
+
+"{ NameSpace: SmallSense }"
+
+AbstractSearchProcessor subclass:#ClassSearchProcessor
+	instanceVariableNames:'matchFullyQualifiedClassName'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'SmallSense-Core-Interface-Search'
+!
+
+!ClassSearchProcessor class methodsFor:'documentation'!
+
+copyright
+"
+stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
+Copyright (C) 2013-2014 Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+! !
+
+!ClassSearchProcessor methodsFor:'accessing'!
+
+matchFullyQualifiedClassName
+    ^ matchFullyQualifiedClassName
+!
+
+matchFullyQualifiedClassName:something
+    matchFullyQualifiedClassName := something.
+! !
+
+!ClassSearchProcessor methodsFor:'searching'!
+
+matchingObjectPOsFor: objects
+    | matchQualified |
+
+    matchQualified := matchFullyQualifiedClassName == true.
+    matchQualified ifTrue:[
+        objects sort:[:a :b | a displayString < b displayString ].
+    ] ifFalse:[
+        objects sort:[:a :b | a nameWithoutPrefix < b nameWithoutPrefix ].
+    ].
+
+    ^ objects collect:[:each | 
+        (ClassPO new)
+            klass:each;
+            showPrefix:matchQualified
+    ].
+
+    "Created: / 30-04-2014 / 09:50:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-12-2014 / 23:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+matchingObjectsForPattern:pattern filter: filter inEnvironment:environment relax: level 
+    | matching matchQualified |
+
+    matching := OrderedCollection new.
+    matchQualified := matchFullyQualifiedClassName == true.
+    pattern notNil ifTrue:[
+        matchQualified ifFalse:[
+            environment 
+                allClassesDo:[:cls | 
+                    ((filter isNil or:[filter value: cls]) and:[(pattern match:cls nameWithoutPrefix relax: level)]) ifTrue:[
+                        matching add:cls.
+                    ].
+                ].
+        ] ifTrue:[
+            environment 
+                allClassesDo:[:cls | 
+                    ((filter isNil or:[filter value: cls]) and:[(pattern match:cls displayString relax: level)]) ifTrue:[
+                        matching add:cls
+                    ]
+                ].
+        ]
+    ].
+
+    ^ matching
+
+    "Created: / 12-12-2014 / 21:24:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-12-2014 / 23:14:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmallSense__ImplementorSearchProcessor.st	Sat Dec 13 00:11:58 2014 +0000
@@ -0,0 +1,91 @@
+"
+stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
+Copyright (C) 2013-2014 Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+"{ Package: 'stx:goodies/smallsense' }"
+
+"{ NameSpace: SmallSense }"
+
+AbstractSearchProcessor subclass:#ImplementorSearchProcessor
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'SmallSense-Core-Interface-Search'
+!
+
+!ImplementorSearchProcessor class methodsFor:'documentation'!
+
+copyright
+"
+stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
+Copyright (C) 2013-2014 Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+! !
+
+!ImplementorSearchProcessor methodsFor:'searching'!
+
+matchingObjectPOsFor: objects
+    | pos |
+
+    pos := OrderedCollection new: objects size.
+    objects keysAndValuesDo: [ :selector :classes |
+        pos add: (PO forClasses: classes selector: selector )
+
+    ].
+    ^ pos sort:[ :a :b | a label == b label ifTrue:[ a classes anElement name < b classes anElement name] ifFalse:[ a label < b label ] ]
+
+    "Created: / 30-04-2014 / 09:50:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-12-2014 / 23:50:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+matchingObjectsForPattern:pattern filter: filter inEnvironment:environment relax: level 
+    | matching |
+
+    matching := Dictionary new.
+    pattern notNil ifTrue:[
+        environment 
+            allMethodsDo:[:mthd |
+                | selector name |
+
+                name := selector := mthd selector.
+                mthd isJavaMethod ifTrue:[ name := name upTo: $( ].
+                ((filter isNil or:[filter value: mthd]) and:[(pattern match:name relax: level)]) ifTrue:[
+                    (matching at: selector ifAbsentPut: [ Set new ]) add: mthd mclass
+                ].
+            ].
+    ].
+
+    ^ matching
+
+    "Created: / 12-12-2014 / 21:24:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-12-2014 / 23:51:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/SmallSense__MethodSearchDialog.st	Mon Dec 08 02:42:33 2014 +0000
+++ b/SmallSense__MethodSearchDialog.st	Sat Dec 13 00:11:58 2014 +0000
@@ -107,6 +107,14 @@
 
 !MethodSearchDialog methodsFor:'accessing-defaults'!
 
+defaultProcessorClass
+    "superclass SmallSense::AbstractListDialog says that I am responsible to implement this method"
+
+    ^ ImplementorSearchProcessor
+
+    "Created: / 12-12-2014 / 23:21:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 defaultTitle
     ^ (resources string: 'Search Method...')
 
@@ -115,14 +123,13 @@
 
 !MethodSearchDialog methodsFor:'change & update'!
 
-updateMatchingObjectsIgnorePattern
+updateMatchingIgnorePattern
     "/ There's a lot of method, do not display them all but
     "/ rather display only recent selections.                   
+    "/ 
+    self updateMatchingObjectPOs: (processor matchingObjectPOsFor: self recentlySearchedObjects asArray reversed).
 
-    matchingObjects := self recentlySearchedObjects asArray reversed.
-    self updateMatchingObjects: matchingObjects.
-
-    "Created: / 10-05-2014 / 11:50:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 12-12-2014 / 23:39:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !MethodSearchDialog methodsFor:'queries'!
@@ -134,36 +141,3 @@
     "Modified: / 06-05-2014 / 00:27:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!MethodSearchDialog methodsFor:'searching'!
-
-matchingObjectPOsFor: objects
-    ^ (objects collect:[:each | PO forClass: each mclass selector: each selector ])
-        sort:[ :a :b | a label == b label ifTrue:[ a classes anElement name < b classes anElement name] ifFalse:[ a label < b label ] ];
-        yourself
-
-    "Created: / 30-04-2014 / 09:50:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 20-06-2014 / 14:21:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-matchingObjectsForPattern:pattern inEnvironment:environment relax: level 
-    | matching |
-
-    matching := OrderedCollection new.
-    self matchPatternHolder value notEmptyOrNil ifTrue:[
-        environment 
-            allMethodsDo:[:mthd |
-                | name |
-
-                name := mthd selector.
-                mthd isJavaMethod ifTrue:[ name := name upTo: $( ].
-                ((filter isNil or:[filter value: mthd]) and:[(pattern match:name relax: level)]) ifTrue:[
-                    matching add:mthd.
-                ].
-            ].
-    ].
-
-    ^ matching
-
-    "Created: / 20-06-2014 / 21:17:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
--- a/SmallSense__PackageSearchDialog.st	Mon Dec 08 02:42:33 2014 +0000
+++ b/SmallSense__PackageSearchDialog.st	Sat Dec 13 00:11:58 2014 +0000
@@ -61,6 +61,14 @@
     "Created: / 23-06-2014 / 15:25:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!PackageSearchDialog methodsFor:'accessing-defaults'!
+
+defaultProcessorClass
+    ^ PackageSearchProcessor
+
+    "Created: / 12-12-2014 / 22:45:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !PackageSearchDialog methodsFor:'queries'!
 
 canCreateMatchingObjectFromString:string 
@@ -77,40 +85,3 @@
     "Created: / 05-05-2014 / 23:50:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!PackageSearchDialog methodsFor:'searching'!
-
-matchingObjectPOsFor:objects
-
-    objects sort: [ :a :b | a < b ].
-    ^ objects collect:[ :e | PO forPackage: e ].
-
-    "Created: / 05-05-2014 / 23:54:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 19-06-2014 / 12:04:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-matchingObjectsForPattern:pattern inEnvironment:environment relax: level
-    | packages |
-
-    packages := Set new.
-    environment allClassesDo: [ :cls |
-        | pkg |
-
-        pkg := cls package.
-        ((pkg notNil and:[ pkg ~~ PackageId noProjectID and:[ (pkg startsWith: '__') not] ])
-            and:[(filter isNil or:[ filter value: pkg ])
-            and:[pattern isNil or:[pattern match: pkg relax: level]]]) ifTrue:[ packages add: pkg ].
-    ].
-    environment allMethodsDo:[ :mth |
-        | pkg |
-
-        pkg := mth package.
-        ((pkg notNil and:[ pkg ~~ PackageId noProjectID and:[ (pkg startsWith: '__') not] ])
-            and:[(filter isNil or:[ filter value: pkg ])
-            and:[pattern isNil or:[pattern match: pkg relax: level]]]) ifTrue:[ packages add: pkg ].
-    ].
-    ^ packages asArray.
-
-    "Created: / 20-06-2014 / 21:17:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 08-12-2014 / 02:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmallSense__PackageSearchProcessor.st	Sat Dec 13 00:11:58 2014 +0000
@@ -0,0 +1,88 @@
+"
+stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
+Copyright (C) 2013-2014 Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+"{ Package: 'stx:goodies/smallsense' }"
+
+"{ NameSpace: SmallSense }"
+
+AbstractSearchProcessor subclass:#PackageSearchProcessor
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'SmallSense-Core-Interface-Search'
+!
+
+!PackageSearchProcessor class methodsFor:'documentation'!
+
+copyright
+"
+stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
+Copyright (C) 2013-2014 Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+! !
+
+!PackageSearchProcessor methodsFor:'searching'!
+
+matchingObjectPOsFor:objects
+
+    objects sort: [ :a :b | a < b ].
+    ^ objects collect:[ :e | PO forPackage: e ].
+
+    "Created: / 05-05-2014 / 23:54:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-06-2014 / 12:04:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+matchingObjectsForPattern:pattern filter: filter inEnvironment:environment relax: level
+    | packages |
+
+    packages := Set new.
+    environment allClassesDo: [ :cls |
+        | pkg |
+
+        pkg := cls package.
+        ((pkg notNil and:[ pkg ~~ PackageId noProjectID and:[ (pkg startsWith: '__') not] ])
+            and:[(filter isNil or:[ filter value: pkg ])
+            and:[pattern isNil or:[pattern match: pkg relax: level]]]) ifTrue:[ packages add: pkg ].
+    ].
+    environment allMethodsDo:[ :mth |
+        | pkg |
+
+        pkg := mth package.
+        ((pkg notNil and:[ pkg ~~ PackageId noProjectID and:[ (pkg startsWith: '__') not] ])
+            and:[(filter isNil or:[ filter value: pkg ])
+            and:[pattern isNil or:[pattern match: pkg relax: level]]]) ifTrue:[ packages add: pkg ].
+    ].
+    ^ packages asArray.
+
+    "Created: / 12-12-2014 / 21:24:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/abbrev.stc	Mon Dec 08 02:42:33 2014 +0000
+++ b/abbrev.stc	Sat Dec 13 00:11:58 2014 +0000
@@ -2,6 +2,7 @@
 # this file is needed for stc to be able to compile modules independently.
 # it provides information about a classes filename, category and especially namespace.
 SmallSense::AbstractDIalog SmallSense__AbstractDIalog stx:goodies/smallsense 'SmallSense-Core-Interface-Search' 1
+SmallSense::AbstractSearchProcessor SmallSense__AbstractSearchProcessor stx:goodies/smallsense 'SmallSense-Core-Interface-Search' 0
 SmallSense::CodeHighlightingService SmallSense__CodeHighlightingService stx:goodies/smallsense 'SmallSense-Core-Services' 0
 SmallSense::CodeNavigationService SmallSense__CodeNavigationService stx:goodies/smallsense 'SmallSense-Core-Services' 0
 SmallSense::CompletionContext SmallSense__CompletionContext stx:goodies/smallsense 'SmallSense-Core' 0
@@ -40,15 +41,18 @@
 SmallSense::AbstractListDialog SmallSense__AbstractListDialog stx:goodies/smallsense 'SmallSense-Core-Interface-Search' 1
 SmallSense::ClassInfo SmallSense__ClassInfo stx:goodies/smallsense 'SmallSense-Smalltalk-Types-Info' 0
 SmallSense::ClassPO SmallSense__ClassPO stx:goodies/smallsense 'SmallSense-Core-Interface-PO' 0
+SmallSense::ClassSearchProcessor SmallSense__ClassSearchProcessor stx:goodies/smallsense 'SmallSense-Core-Interface-Search' 0
 SmallSense::ClassType SmallSense__ClassType stx:goodies/smallsense 'SmallSense-Smalltalk-Types' 0
 SmallSense::ConstantPO SmallSense__ConstantPO stx:goodies/smallsense 'SmallSense-Core-Interface-PO' 0
 SmallSense::GenericEditSupport SmallSense__GenericEditSupport stx:goodies/smallsense 'SmallSense-Core-Services' 0
+SmallSense::ImplementorSearchProcessor SmallSense__ImplementorSearchProcessor stx:goodies/smallsense 'SmallSense-Core-Interface-Search' 0
 SmallSense::JavaEditSupport SmallSense__JavaEditSupport stx:goodies/smallsense 'SmallSense-Java' 0
 SmallSense::JavaImportPO SmallSense__JavaImportPO stx:goodies/smallsense 'SmallSense-Java-Interface-PO' 0
 SmallSense::MethodBindingPO SmallSense__MethodBindingPO stx:goodies/smallsense 'SmallSense-Java-Interface-PO' 0
 SmallSense::MethodInfo SmallSense__MethodInfo stx:goodies/smallsense 'SmallSense-Smalltalk-Types-Info' 0
 SmallSense::MethodPO SmallSense__MethodPO stx:goodies/smallsense 'SmallSense-Core-Interface-PO' 0
 SmallSense::PackagePO SmallSense__PackagePO stx:goodies/smallsense 'SmallSense-Core-Interface-PO' 0
+SmallSense::PackageSearchProcessor SmallSense__PackageSearchProcessor stx:goodies/smallsense 'SmallSense-Core-Interface-Search' 0
 SmallSense::SmalltalkCompletionEngine SmallSense__SmalltalkCompletionEngine stx:goodies/smallsense 'SmallSense-Smalltalk' 0
 SmallSense::SmalltalkEditSupport SmallSense__SmalltalkEditSupport stx:goodies/smallsense 'SmallSense-Smalltalk' 0
 SmallSense::SmalltalkInferencer SmallSense__SmalltalkInferencer stx:goodies/smallsense 'SmallSense-Smalltalk-Types-Inference' 0
--- a/bc.mak	Mon Dec 08 02:42:33 2014 +0000
+++ b/bc.mak	Sat Dec 13 00:11:58 2014 +0000
@@ -84,6 +84,7 @@
 
 # BEGINMAKEDEPEND --- do not remove this line; make depend needs it
 $(OUTDIR)SmallSense__AbstractDIalog.$(O) SmallSense__AbstractDIalog.$(H): SmallSense__AbstractDIalog.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(INCLUDE_TOP)\stx\libview2\SimpleDialog.$(H) $(STCHDR)
+$(OUTDIR)SmallSense__AbstractSearchProcessor.$(O) SmallSense__AbstractSearchProcessor.$(H): SmallSense__AbstractSearchProcessor.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__CodeHighlightingService.$(O) SmallSense__CodeHighlightingService.$(H): SmallSense__CodeHighlightingService.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__BackgroundSourceProcessingService.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__CodeHighlightingService.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__CodeViewService.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__CodeNavigationService.$(O) SmallSense__CodeNavigationService.$(H): SmallSense__CodeNavigationService.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__CodeNavigationService.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__CodeViewService.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__CompletionContext.$(O) SmallSense__CompletionContext.$(H): SmallSense__CompletionContext.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
@@ -122,15 +123,18 @@
 $(OUTDIR)SmallSense__AbstractListDialog.$(O) SmallSense__AbstractListDialog.$(H): SmallSense__AbstractListDialog.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__AbstractDIalog.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(INCLUDE_TOP)\stx\libview2\SimpleDialog.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__ClassInfo.$(O) SmallSense__ClassInfo.$(H): SmallSense__ClassInfo.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__Info.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__ClassPO.$(O) SmallSense__ClassPO.$(H): SmallSense__ClassPO.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__PO.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libwidg2\HierarchicalItem.$(H) $(STCHDR)
+$(OUTDIR)SmallSense__ClassSearchProcessor.$(O) SmallSense__ClassSearchProcessor.$(H): SmallSense__ClassSearchProcessor.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__AbstractSearchProcessor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__ClassType.$(O) SmallSense__ClassType.$(H): SmallSense__ClassType.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__Type.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__ConstantPO.$(O) SmallSense__ConstantPO.$(H): SmallSense__ConstantPO.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__PO.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libwidg2\HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__GenericEditSupport.$(O) SmallSense__GenericEditSupport.$(H): SmallSense__GenericEditSupport.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__EditSupport.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)SmallSense__ImplementorSearchProcessor.$(O) SmallSense__ImplementorSearchProcessor.$(H): SmallSense__ImplementorSearchProcessor.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__AbstractSearchProcessor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__JavaEditSupport.$(O) SmallSense__JavaEditSupport.$(H): SmallSense__JavaEditSupport.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__EditSupport.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__JavaImportPO.$(O) SmallSense__JavaImportPO.$(H): SmallSense__JavaImportPO.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__PO.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libwidg2\HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__MethodBindingPO.$(O) SmallSense__MethodBindingPO.$(H): SmallSense__MethodBindingPO.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__PO.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libwidg2\HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__MethodInfo.$(O) SmallSense__MethodInfo.$(H): SmallSense__MethodInfo.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__Info.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__MethodPO.$(O) SmallSense__MethodPO.$(H): SmallSense__MethodPO.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__PO.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libwidg2\HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__PackagePO.$(O) SmallSense__PackagePO.$(H): SmallSense__PackagePO.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__PO.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libwidg2\HierarchicalItem.$(H) $(STCHDR)
+$(OUTDIR)SmallSense__PackageSearchProcessor.$(O) SmallSense__PackageSearchProcessor.$(H): SmallSense__PackageSearchProcessor.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__AbstractSearchProcessor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__SmalltalkCompletionEngine.$(O) SmallSense__SmalltalkCompletionEngine.$(H): SmallSense__SmalltalkCompletionEngine.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__CompletionEngine.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__SmalltalkEditSupport.$(O) SmallSense__SmalltalkEditSupport.$(H): SmallSense__SmalltalkEditSupport.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__EditSupport.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__SmalltalkInferencer.$(O) SmallSense__SmalltalkInferencer.$(H): SmallSense__SmalltalkInferencer.st $(INCLUDE_TOP)\stx\goodies\smallsense\SmallSense__SmalltalkParseNodeVisitor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/extensions.st	Mon Dec 08 02:42:33 2014 +0000
+++ b/extensions.st	Sat Dec 13 00:11:58 2014 +0000
@@ -72,7 +72,7 @@
     dialog := SmallSense::PackageSearchDialog new.
     dialog title: title.
     dialog filter: [ :pkg | listOfProjects includes: pkg ].
-    dialog updateMatchingObjects.
+    dialog updateMatching.
     (initialTextOrNil notNil and:[initialTextOrNil ~~ PackageId noProjectID]) ifTrue:[
         initialTextOrNil isEmpty ifTrue:[
             suggestions size == 1 ifTrue:[
@@ -87,7 +87,7 @@
     ^ dialog open.
 
     "Created: / 25-11-2014 / 13:20:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 08-12-2014 / 02:17:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-12-2014 / 23:38:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !EditTextView methodsFor:'accessing-behavior'!
--- a/libInit.cc	Mon Dec 08 02:42:33 2014 +0000
+++ b/libInit.cc	Sat Dec 13 00:11:58 2014 +0000
@@ -28,6 +28,7 @@
 OBJ snd; struct __vmData__ *__pRT__; {
 __BEGIN_PACKAGE2__("libstx_goodies_smallsense", _libstx_goodies_smallsense_Init, "stx:goodies/smallsense");
 _SmallSense__AbstractDIalog_Init(pass,__pRT__,snd);
+_SmallSense__AbstractSearchProcessor_Init(pass,__pRT__,snd);
 _SmallSense__CodeHighlightingService_Init(pass,__pRT__,snd);
 _SmallSense__CodeNavigationService_Init(pass,__pRT__,snd);
 _SmallSense__CompletionContext_Init(pass,__pRT__,snd);
@@ -66,15 +67,18 @@
 _SmallSense__AbstractListDialog_Init(pass,__pRT__,snd);
 _SmallSense__ClassInfo_Init(pass,__pRT__,snd);
 _SmallSense__ClassPO_Init(pass,__pRT__,snd);
+_SmallSense__ClassSearchProcessor_Init(pass,__pRT__,snd);
 _SmallSense__ClassType_Init(pass,__pRT__,snd);
 _SmallSense__ConstantPO_Init(pass,__pRT__,snd);
 _SmallSense__GenericEditSupport_Init(pass,__pRT__,snd);
+_SmallSense__ImplementorSearchProcessor_Init(pass,__pRT__,snd);
 _SmallSense__JavaEditSupport_Init(pass,__pRT__,snd);
 _SmallSense__JavaImportPO_Init(pass,__pRT__,snd);
 _SmallSense__MethodBindingPO_Init(pass,__pRT__,snd);
 _SmallSense__MethodInfo_Init(pass,__pRT__,snd);
 _SmallSense__MethodPO_Init(pass,__pRT__,snd);
 _SmallSense__PackagePO_Init(pass,__pRT__,snd);
+_SmallSense__PackageSearchProcessor_Init(pass,__pRT__,snd);
 _SmallSense__SmalltalkCompletionEngine_Init(pass,__pRT__,snd);
 _SmallSense__SmalltalkEditSupport_Init(pass,__pRT__,snd);
 _SmallSense__SmalltalkInferencer_Init(pass,__pRT__,snd);
--- a/smallsense.rc	Mon Dec 08 02:42:33 2014 +0000
+++ b/smallsense.rc	Sat Dec 13 00:11:58 2014 +0000
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "Copyright Jan Vrany 2013-2014\0"
       VALUE "ProductName", "SmallSense\0"
       VALUE "ProductVersion", "6.2.5.0\0"
-      VALUE "ProductDate", "Mon, 08 Dec 2014 02:37:43 GMT\0"
+      VALUE "ProductDate", "Sat, 13 Dec 2014 00:09:06 GMT\0"
     END
 
   END
--- a/stx_goodies_smallsense.st	Mon Dec 08 02:42:33 2014 +0000
+++ b/stx_goodies_smallsense.st	Sat Dec 13 00:11:58 2014 +0000
@@ -135,6 +135,7 @@
     ^ #(
         "<className> or (<className> attributes...) in load order"
         #'SmallSense::AbstractDIalog'
+        #'SmallSense::AbstractSearchProcessor'
         #'SmallSense::CodeHighlightingService'
         #'SmallSense::CodeNavigationService'
         #'SmallSense::CompletionContext'
@@ -173,15 +174,18 @@
         #'SmallSense::AbstractListDialog'
         #'SmallSense::ClassInfo'
         #'SmallSense::ClassPO'
+        #'SmallSense::ClassSearchProcessor'
         #'SmallSense::ClassType'
         #'SmallSense::ConstantPO'
         #'SmallSense::GenericEditSupport'
+        #'SmallSense::ImplementorSearchProcessor'
         #'SmallSense::JavaEditSupport'
         #'SmallSense::JavaImportPO'
         #'SmallSense::MethodBindingPO'
         #'SmallSense::MethodInfo'
         #'SmallSense::MethodPO'
         #'SmallSense::PackagePO'
+        #'SmallSense::PackageSearchProcessor'
         #'SmallSense::SmalltalkCompletionEngine'
         #'SmallSense::SmalltalkEditSupport'
         #'SmallSense::SmalltalkInferencer'