SmallSense__ClassSelectDialog.st
changeset 1144 93164087c56a
equal deleted inserted replaced
1143:66b5c959cee1 1144:93164087c56a
       
     1 "
       
     2 stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
       
     3 Copyright (C) 2013-2014 Jan Vrany
       
     4 Copyright (C) 2020 LabWare
       
     5 Copyright (C) 2022 LabWare
       
     6 
       
     7 This library is free software; you can redistribute it and/or
       
     8 modify it under the terms of the GNU Lesser General Public
       
     9 License as published by the Free Software Foundation; either
       
    10 version 2.1 of the License.
       
    11 
       
    12 This library is distributed in the hope that it will be useful,
       
    13 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    15 Lesser General Public License for more details.
       
    16 
       
    17 You should have received a copy of the GNU Lesser General Public
       
    18 License along with this library; if not, write to the Free Software
       
    19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
       
    20 "
       
    21 "{ Package: 'stx:goodies/smallsense' }"
       
    22 
       
    23 "{ NameSpace: SmallSense }"
       
    24 
       
    25 AbstractSelectDialog subclass:#ClassSelectDialog
       
    26 	instanceVariableNames:''
       
    27 	classVariableNames:''
       
    28 	poolDictionaries:''
       
    29 	category:'SmallSense-Core-Interface-Search'
       
    30 !
       
    31 
       
    32 !ClassSelectDialog class methodsFor:'documentation'!
       
    33 
       
    34 copyright
       
    35 "
       
    36 stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
       
    37 Copyright (C) 2013-2014 Jan Vrany
       
    38 Copyright (C) 2020 LabWare
       
    39 Copyright (C) 2022 LabWare
       
    40 
       
    41 This library is free software; you can redistribute it and/or
       
    42 modify it under the terms of the GNU Lesser General Public
       
    43 License as published by the Free Software Foundation; either
       
    44 version 2.1 of the License.
       
    45 
       
    46 This library is distributed in the hope that it will be useful,
       
    47 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    48 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    49 Lesser General Public License for more details.
       
    50 
       
    51 You should have received a copy of the GNU Lesser General Public
       
    52 License along with this library; if not, write to the Free Software
       
    53 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
       
    54 "
       
    55 ! !
       
    56 
       
    57 !ClassSelectDialog methodsFor:'accessing - private'!
       
    58 
       
    59 matchingObjectForString: aString
       
    60     "Creates a new object from given string. Called only when
       
    61      #canCreateMatchingObjectFromString: returns true"
       
    62 
       
    63     ^ aString asSymbol
       
    64 
       
    65     "Created: / 23-06-2014 / 15:25:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    66 ! !
       
    67 
       
    68 !ClassSelectDialog methodsFor:'accessing-defaults'!
       
    69 
       
    70 defaultTitle
       
    71     ^ (resources string: 'Select class...')
       
    72 
       
    73     "Created: / 13-12-2014 / 12:57:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    74 ! !
       
    75 
       
    76 !ClassSelectDialog methodsFor:'searching'!
       
    77 
       
    78 matchingObjectPOsForPattern:pattern relax: level
       
    79     | environment classes |
       
    80 
       
    81     environment := self environment.
       
    82     classes := Set new.
       
    83 
       
    84     environment allClassesDo: [ :cls |
       
    85         ((filter isNil or:[ filter value: cls ])
       
    86             and:[pattern isNil or:[pattern match: cls name relax: level]]) ifTrue:[ classes add: cls ].
       
    87     ].
       
    88     classes := classes asArray.
       
    89     classes sort: [ :a :b | a name < b name ].
       
    90     ^ classes collect:[ :e | PO forClass: e ].
       
    91 
       
    92     "Created: / 13-12-2014 / 08:42:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    93 ! !
       
    94