SmallSense__AbstractSelectDialog.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 25 Oct 2017 23:42:41 +0100
changeset 1058 6d4bf422a7dd
parent 368 a94d9afd766b
child 1144 93164087c56a
permissions -rw-r--r--
Fix subscript out of bounds error in Smalltalk inderences ...caused by missing size-check when analysing typed prefix.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
367
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
Copyright (C) 2013-2014 Jan Vrany
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
This library is free software; you can redistribute it and/or
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
modify it under the terms of the GNU Lesser General Public
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
License as published by the Free Software Foundation; either
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
version 2.1 of the License.
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
This library is distributed in the hope that it will be useful,
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
but WITHOUT ANY WARRANTY; without even the implied warranty of
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
Lesser General Public License for more details.
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
You should have received a copy of the GNU Lesser General Public
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
License along with this library; if not, write to the Free Software
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
"
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
"{ Package: 'stx:goodies/smallsense' }"
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
"{ NameSpace: SmallSense }"
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
AbstractListDialog subclass:#AbstractSelectDialog
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
	instanceVariableNames:''
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
	classVariableNames:''
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
	poolDictionaries:''
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	category:'SmallSense-Core-Interface-Search'
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
!
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
!AbstractSelectDialog class methodsFor:'documentation'!
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
copyright
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
"
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
Copyright (C) 2013-2014 Jan Vrany
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
This library is free software; you can redistribute it and/or
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
modify it under the terms of the GNU Lesser General Public
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
License as published by the Free Software Foundation; either
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
version 2.1 of the License.
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
This library is distributed in the hope that it will be useful,
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
but WITHOUT ANY WARRANTY; without even the implied warranty of
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
Lesser General Public License for more details.
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
You should have received a copy of the GNU Lesser General Public
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
License along with this library; if not, write to the Free Software
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
"
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
! !
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
!AbstractSelectDialog class methodsFor:'queries'!
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
isAbstract
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
    "Return if this class is an abstract class.
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
     True is returned here for myself only; false for subclasses.
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
     Abstract subclasses must redefine again."
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
    ^ self == SmallSense::AbstractSelectDialog.
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
! !
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
368
a94d9afd766b Introduced a ProtocolSelectDialog...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 367
diff changeset
    63
!AbstractSelectDialog methodsFor:'accessing-defaults'!
a94d9afd766b Introduced a ProtocolSelectDialog...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 367
diff changeset
    64
a94d9afd766b Introduced a ProtocolSelectDialog...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 367
diff changeset
    65
defaultTitle
a94d9afd766b Introduced a ProtocolSelectDialog...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 367
diff changeset
    66
    ^ (resources string: 'Select...')
a94d9afd766b Introduced a ProtocolSelectDialog...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 367
diff changeset
    67
a94d9afd766b Introduced a ProtocolSelectDialog...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 367
diff changeset
    68
    "Created: / 13-12-2014 / 12:57:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a94d9afd766b Introduced a ProtocolSelectDialog...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 367
diff changeset
    69
! !
a94d9afd766b Introduced a ProtocolSelectDialog...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 367
diff changeset
    70
367
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
!AbstractSelectDialog methodsFor:'searching'!
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
matchingObjectPOsForPattern: pattern
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
    | pos |
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
    1 to: 3 do:[:i |
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
        pos := self matchingObjectPOsForPattern: pattern relax: i.
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
        pos notEmptyOrNil ifTrue:[ ^ pos ]
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    ].
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
    "Created: / 13-12-2014 / 08:39:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
!
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
matchingObjectPOsForPattern: pattern relax: relax
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
    self subclassResponsibility
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
    "Created: / 13-12-2014 / 08:40:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
! !
bd7749edb1c6 Decoupling search logic from dialogs (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89