SmallSense__DialogBox.st
changeset 1149 33f8a8571e92
parent 1144 93164087c56a
equal deleted inserted replaced
1148:7f766abefbbc 1149:33f8a8571e92
     1 "
     1 "
     2 COPYRIGHT (c) 2022 LabWare
     2 COPYRIGHT (c) 2022-2023 LabWare
     3 
     3 
     4 stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
     4 stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
     5 
     5 
     6 This library is free software; you can redistribute it and/or
     6 This library is free software; you can redistribute it and/or
     7 modify it under the terms of the GNU Lesser General Public
     7 modify it under the terms of the GNU Lesser General Public
    30 
    30 
    31 !DialogBox class methodsFor:'documentation'!
    31 !DialogBox class methodsFor:'documentation'!
    32 
    32 
    33 copyright
    33 copyright
    34 "
    34 "
    35 COPYRIGHT (c) 2022 LabWare
    35 COPYRIGHT (c) 2022-2023 LabWare
    36 
    36 
    37 stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
    37 stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
    38 
    38 
    39 This library is free software; you can redistribute it and/or
    39 This library is free software; you can redistribute it and/or
    40 modify it under the terms of the GNU Lesser General Public
    40 modify it under the terms of the GNU Lesser General Public
   100 requestClassName:title list: classesOrNil okLabel:okLabel initialAnswer:initialTextOrNil
   100 requestClassName:title list: classesOrNil okLabel:okLabel initialAnswer:initialTextOrNil
   101     "launch a Dialog, which allows user to enter a class name.
   101     "launch a Dialog, which allows user to enter a class name.
   102      Return the entered string (may be empty string) or nil (if cancel was pressed).
   102      Return the entered string (may be empty string) or nil (if cancel was pressed).
   103      The entryField does classNameCompletion on TAB."
   103      The entryField does classNameCompletion on TAB."
   104 
   104 
   105     | dialog |
   105     | dialog class |
   106 
   106 
   107     UserPreferences current smallSenseNewDialogsEnabled ifFalse:[ 
   107     UserPreferences current smallSenseNewDialogsEnabled ifFalse:[ 
   108         ^ super requestClassName:title list: classesOrNil okLabel:okLabel initialAnswer:initialTextOrNil
   108         ^ super requestClassName:title list: classesOrNil okLabel:okLabel initialAnswer:initialTextOrNil
   109     ].
   109     ].
   110     dialog := SmallSense::ClassSelectDialog new.
   110     dialog := SmallSense::ClassSelectDialog new.
   111     dialog title: title.
   111     dialog title: title.
   112     dialog filter: [ :cls | classesOrNil isNil or:[classesOrNil includes: cls name] ].
   112     dialog filter: [ :cls | classesOrNil isNil or:[classesOrNil includes: cls ] ].
   113     initialTextOrNil notNil ifTrue: [
   113     initialTextOrNil notNil ifTrue: [
   114         dialog pattern: initialTextOrNil.
   114         dialog pattern: initialTextOrNil.
   115         dialog selection: initialTextOrNil.
   115         dialog selection: initialTextOrNil.
   116     ].
   116     ].
   117     ^ dialog open.
   117     class := dialog open.
       
   118     ^ class name
   118 
   119 
   119     "Created: / 24-08-2022 / 14:45:09 / Jan Vrany <jan.vrany@labware.com>"
   120     "Created: / 24-08-2022 / 14:45:09 / Jan Vrany <jan.vrany@labware.com>"
       
   121     "Modified: / 01-06-2023 / 19:42:27 / Jan Vrany <jan.vrany@labware.com>"
   120 !
   122 !
   121 
   123 
   122 requestProject:title from:listOfProjects initialAnswer:initialTextOrNil suggestions:suggestions
   124 requestProject:title from:listOfProjects initialAnswer:initialTextOrNil suggestions:suggestions
   123     "Ask for a project (package-id)"
   125     "Ask for a project (package-id)"
   124     | dialog |
   126     | dialog |