--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SmallSense__ClassSearchDialog.st Mon Apr 28 08:36:50 2014 +0100
@@ -0,0 +1,165 @@
+"{ Package: 'jv:smallsense' }"
+
+"{ NameSpace: SmallSense }"
+
+AbstractSearchDialog subclass:#ClassSearchDialog
+ instanceVariableNames:'matchFullyQualifiedClassNameHolder
+ matchFullyQualifiedClassNameEnabledHolder
+ showOnlyInterfacesHolder'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'SmallSense-Core-Interface-Search'
+!
+
+!ClassSearchDialog methodsFor:'aspects'!
+
+matchFullyQualifiedClassNameEnabledHolder
+ <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 ;-)"
+
+ matchFullyQualifiedClassNameEnabledHolder isNil ifTrue:[
+ matchFullyQualifiedClassNameEnabledHolder := true asValue.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/ matchFullyQualifiedClassNameEnabledHolder addDependent:self.
+"/ matchFullyQualifiedClassNameEnabledHolder onChangeSend:#matchFullyQualifiedClassNameEnabledHolderChanged to:self.
+ ].
+ ^ matchFullyQualifiedClassNameEnabledHolder.
+!
+
+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.
+
+ "Modified: / 18-03-2013 / 11:19:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+showOnlyInterfacesHolder
+ "return/create the 'showOnlyIntefacesHolder' value holder (automatically generated)"
+
+ showOnlyInterfacesHolder isNil ifTrue:[
+ showOnlyInterfacesHolder := false asValue.
+ showOnlyInterfacesHolder addDependent:self.
+ ].
+ ^ showOnlyInterfacesHolder
+
+ "Modified: / 24-04-2014 / 23:42:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+showOnlyInterfacesHolder:something
+ "set the 'showOnlyIntefacesHolder' value holder (automatically generated)"
+
+ | oldValue newValue |
+
+ showOnlyInterfacesHolder notNil ifTrue:[
+ oldValue := showOnlyInterfacesHolder value.
+ showOnlyInterfacesHolder removeDependent:self.
+ ].
+ showOnlyInterfacesHolder := something.
+ showOnlyInterfacesHolder notNil ifTrue:[
+ showOnlyInterfacesHolder addDependent:self.
+ ].
+ newValue := showOnlyInterfacesHolder value.
+ oldValue ~~ newValue ifTrue:[
+ self
+ update:#value
+ with:newValue
+ from:showOnlyInterfacesHolder.
+ ].
+! !
+
+!ClassSearchDialog methodsFor:'change & update'!
+
+update:something with:aParameter from:changedObject
+ changedObject == matchFullyQualifiedClassNameHolder ifTrue:[
+ matchingUpdateJob restart.
+ ^ self.
+ ].
+ changedObject == showOnlyInterfacesHolder ifTrue:[
+ matchingUpdateJob restart.
+ ^ self.
+ ].
+
+ ^ super update:something with:aParameter from:changedObject
+
+ "Created: / 27-04-2014 / 23:45:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ClassSearchDialog methodsFor:'queries'!
+
+canSelect: selection
+ | po |
+
+ po := selection isInteger ifTrue:[ matchingObjectsTree at: selection ] ifFalse:[ selection ].
+ ^ po isSmallSenseClassPO.
+
+ "Created: / 22-04-2014 / 13:08:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-04-2014 / 00:11:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ClassSearchDialog methodsFor:'searching'!
+
+computeMatchingObjects
+ | environment pattern matching root matchFullyQualifiedClassName |
+
+ matching := OrderedCollection new.
+ root := self matchingObjectsTree root.
+ pattern := StringPattern fromString: self matchPatternHolder value.
+ environment := self environment.
+ matchFullyQualifiedClassName := self matchFullyQualifiedClassNameHolder value.
+
+ self matchPatternHolder value notEmptyOrNil ifTrue:[
+ matchFullyQualifiedClassName ifFalse:[
+ environment allClassesDo:[:cls|
+ (pattern match: cls nameWithoutPrefix) ifTrue:[
+ matching add: cls.
+ ].
+ ].
+ ] ifTrue:[
+ environment allClassesDo:[:cls|
+ (pattern match: cls displayString) ifTrue:[
+ matching add: cls
+ ]
+ ].
+ ]
+ ].
+
+"/ matching isEmpty ifTrue:[
+"/ self updateNoResults: root.
+"/ ^self
+"/ ].
+
+ matchFullyQualifiedClassName ifTrue:[
+ matching sort: [ :a :b | a displayString < b displayString ].
+ ] ifFalse:[
+ matching sort: [ :a :b | a nameWithoutPrefix < b nameWithoutPrefix ].
+ ].
+ matching := matching collect: [:each | ClassPO new klass: each; showPrefix: matchFullyQualifiedClassName ].
+
+ root children: matching; expand.
+ matching size == 1 ifTrue:[
+ self matchingObjectsSelectionHolder value: matching anElement
+ ]
+
+ "Created: / 28-04-2014 / 00:03:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+