SmallSense__ClassSearchDialog.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 25 Oct 2017 23:42:41 +0100
changeset 1058 6d4bf422a7dd
parent 370 b02030d796d8
permissions -rw-r--r--
Fix subscript out of bounds error in Smalltalk inderences ...caused by missing size-check when analysing typed prefix.

"
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 }"

AbstractSearchDialog subclass:#ClassSearchDialog
	instanceVariableNames:'matchFullyQualifiedClassNameHolder
		matchFullyQualifiedClassNameEnabledHolder
		showOnlyInterfacesHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'SmallSense-Core-Interface-Search'
!

!ClassSearchDialog 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
"
! !

!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
    <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>


    matchFullyQualifiedClassNameHolder isNil ifTrue:[
        matchFullyQualifiedClassNameHolder := (AspectAdaptor forAspect:#matchFullyQualifiedClassName) subject: processor.   
        matchFullyQualifiedClassNameHolder addDependent:self.
    ].
    ^ matchFullyQualifiedClassNameHolder.

    "Modified: / 12-12-2014 / 23:15:29 / 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:[
        matchingObjectsUpdateJob restart.
        ^ self.
    ].
    changedObject == showOnlyInterfacesHolder ifTrue:[
        matchingObjectsUpdateJob 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:'initialization'!

initialize  
    super initialize.
    processor := ClassSearchProcessor new.

    "Created: / 13-12-2014 / 08:46:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ClassSearchDialog methodsFor:'queries'!

hasOptions
    ^ true

    "Created: / 09-05-2014 / 23:59:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

showOnlyInterfaces
    ^self showOnlyInterfacesHolder value

    "Created: / 18-03-2013 / 10:40:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 18-03-2013 / 13:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !