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.
"
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 }"
AbstractListDialog subclass:#AbstractSearchDialog
instanceVariableNames:'recentlySearchedPatterns recentlySearchedObjects'
classVariableNames:''
poolDictionaries:''
category:'SmallSense-Core-Interface-Search'
!
AbstractSearchDialog class instanceVariableNames:'recentlySearchedPatterns recentlySearchedObjects'
"
The following class instance variables are inherited by this class:
SmallSense::AbstractListDialog -
SmallSense::AbstractDIalog -
SimpleDialog -
ApplicationModel - ClassResources
Model -
Object -
"
!
!AbstractSearchDialog 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
"
! !
!AbstractSearchDialog class methodsFor:'accessing'!
recentlySearchedObjects
recentlySearchedObjects isNil ifTrue:[
recentlySearchedObjects := OrderedSet new.
].
^ recentlySearchedObjects
"Created: / 28-04-2014 / 23:13:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
recentlySearchedPatterns
recentlySearchedPatterns isNil ifTrue:[
recentlySearchedPatterns := OrderedSet new.
].
^ recentlySearchedPatterns
"Created: / 28-04-2014 / 23:13:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!AbstractSearchDialog 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::AbstractSearchDialog.
! !
!AbstractSearchDialog methodsFor:'accessing'!
recentlySearchedObjects
^ recentlySearchedObjects
!
recentlySearchedObjects:aCollection
recentlySearchedObjects := aCollection.
!
recentlySearchedPatterns
^ recentlySearchedPatterns
!
recentlySearchedPatterns:aCollection
recentlySearchedPatterns := aCollection.
! !
!AbstractSearchDialog methodsFor:'change & update'!
update:something with:aParameter from:changedObject
"Invoked when an object that I depend upon sends a change notification."
changedObject == accept ifTrue:[
accept value ifTrue:[
self updateAcceptedValue.
recentlySearchedPatterns add: self pattern.
matchingObjectsMultiselect ifTrue:[
recentlySearchedObjects addAll: acceptedValue.
] ifFalse:[
recentlySearchedObjects add: acceptedValue.
].
].
^ self.
].
super update:something with:aParameter from:changedObject
"Created: / 08-12-2014 / 02:36:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!AbstractSearchDialog methodsFor:'hooks'!
commonPostBuild
"/ self updateMatching.
"/ recentlySearchedPatterns notEmptyOrNil ifTrue:[
"/ matchPatternView contents: self recentlySearchedPatterns last.
"/ matchPatternView selectAll.
"/ ].
self recentlySearchedObjects notEmptyOrNil ifTrue:[
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'!
initialize
super initialize.
recentlySearchedPatterns := self class recentlySearchedPatterns.
recentlySearchedObjects := self class recentlySearchedObjects.
"Created: / 08-12-2014 / 01:51:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!AbstractSearchDialog class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !