SmallSense__AbstractSelectDialog.st
author Jan Vrany <jan.vrany@labware.com>
Thu, 01 Jun 2023 20:20:33 +0100
changeset 1149 33f8a8571e92
parent 1144 93164087c56a
permissions -rw-r--r--
Fix class selection drop-in dialog Commit 93164087c56a added class selection dialog to SmallSense's `DialogBox`. This commit selever bugs in the implementation.

"
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
Copyright (C) 2013-2014 Jan Vrany
Copyright (C) 2022 LabWare

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:#AbstractSelectDialog
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'SmallSense-Core-Interface-Search'
!

!AbstractSelectDialog class methodsFor:'documentation'!

copyright
"
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
Copyright (C) 2013-2014 Jan Vrany
Copyright (C) 2022 LabWare

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

!AbstractSelectDialog 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::AbstractSelectDialog.
! !

!AbstractSelectDialog methodsFor:'accessing-defaults'!

defaultTitle
    ^ (resources string: 'Select...')

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

!AbstractSelectDialog methodsFor:'change & update'!

updateMatchingLabelToNormal
    self matchPatternHolder value notEmptyOrNil ifTrue: [
        self matchingObjectsLabelHolder value: (resources string: 'Matching items:').
    ] ifFalse: [ 
        self matchingObjectsLabelHolder value: (resources string: 'Available items:').
    ].

    "Created: / 24-08-2022 / 15:11:49 / Jan Vrany <jan.vrany@labware.com>"
! !

!AbstractSelectDialog methodsFor:'queries'!

canSelect:selection
    ^ selection isKindOf: PO

    "Created: / 05-05-2014 / 23:50:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 13-12-2014 / 12:08:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!AbstractSelectDialog methodsFor:'searching'!

matchingObjectPOsForPattern: pattern
    | pos |

    1 to: 3 do:[:i |
        pos := self matchingObjectPOsForPattern: pattern relax: i.
        pos notEmptyOrNil ifTrue:[ ^ pos ]
    ].

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

matchingObjectPOsForPattern: pattern relax: relax
    self subclassResponsibility

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