FileDialog.st
author penk
Tue, 15 Apr 2003 16:54:43 +0200
changeset 4824 90520012f652
parent 4804 406ea13c6b0a
child 4996 5927cc0508e8
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
     1
"{ Package: 'stx:libtool' }"
321c1729db5b initial checkin
penk
parents:
diff changeset
     2
321c1729db5b initial checkin
penk
parents:
diff changeset
     3
SimpleDialog subclass:#FileDialog
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
     4
	instanceVariableNames:'aspects treeBrowser directory pattern filterHolder initialText
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
     5
		multipleSelect doubleClickAction cancelLabelHolder okLabelHolder
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
     6
		startFilename result filterField filenameField viewFiles
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
     7
		filenameLabelHolder isLoadDialog newDirectoryVisibilityHolder
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
     8
		appendButtonVisibleHolder appendWasPressed
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
     9
		buttonPanelVisibleHolder'
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    10
	classVariableNames:''
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    11
	poolDictionaries:''
321c1729db5b initial checkin
penk
parents:
diff changeset
    12
	category:'Interface-Tools-File'
321c1729db5b initial checkin
penk
parents:
diff changeset
    13
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    14
321c1729db5b initial checkin
penk
parents:
diff changeset
    15
!FileDialog class methodsFor:'documentation'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    16
321c1729db5b initial checkin
penk
parents:
diff changeset
    17
documentation
321c1729db5b initial checkin
penk
parents:
diff changeset
    18
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    19
    documentation to be added.
321c1729db5b initial checkin
penk
parents:
diff changeset
    20
321c1729db5b initial checkin
penk
parents:
diff changeset
    21
    [author:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    22
        Martin Walser (martin@vercingetorix)
321c1729db5b initial checkin
penk
parents:
diff changeset
    23
321c1729db5b initial checkin
penk
parents:
diff changeset
    24
    [instance variables:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    25
321c1729db5b initial checkin
penk
parents:
diff changeset
    26
    [class variables:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    27
321c1729db5b initial checkin
penk
parents:
diff changeset
    28
    [see also:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    29
321c1729db5b initial checkin
penk
parents:
diff changeset
    30
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    31
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    32
321c1729db5b initial checkin
penk
parents:
diff changeset
    33
examples
321c1729db5b initial checkin
penk
parents:
diff changeset
    34
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    35
  Starting the application:
321c1729db5b initial checkin
penk
parents:
diff changeset
    36
                                                                [exBegin]
321c1729db5b initial checkin
penk
parents:
diff changeset
    37
    FileDialog open
321c1729db5b initial checkin
penk
parents:
diff changeset
    38
                                                                [exEnd]
321c1729db5b initial checkin
penk
parents:
diff changeset
    39
321c1729db5b initial checkin
penk
parents:
diff changeset
    40
                                                                [exBegin]
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    41
     FileDialog 
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    42
        requestFileName:'enter a fileName:'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    43
        default:''
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    44
        version:nil
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    45
        ifFail:['none']
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    46
        pattern:'*.conf'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    47
        fromDirectory:'/etc'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    48
        whenBoxCreatedEvaluate:nil.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    49
                                                                [exEnd]
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    50
                                                                [exBegin]
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    51
    |fd|
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    52
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    53
    fd := FileDialog new.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    54
    fd multipleSelect:true.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    55
    fd open
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    56
                                                                [exEnd]
321c1729db5b initial checkin
penk
parents:
diff changeset
    57
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    58
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
    59
321c1729db5b initial checkin
penk
parents:
diff changeset
    60
!FileDialog class methodsFor:'instance creation'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    61
321c1729db5b initial checkin
penk
parents:
diff changeset
    62
requestDirectoryName:title default:aFileName ifFail:failBlock
321c1729db5b initial checkin
penk
parents:
diff changeset
    63
    "same as requestFileName, but only show directories"
321c1729db5b initial checkin
penk
parents:
diff changeset
    64
4795
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    65
    ^ self  
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    66
        requestDirectoryName:title 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    67
        default:aFileName 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    68
        ok:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    69
        abort:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    70
        version:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    71
        pattern:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    72
        fromDirectory:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    73
        ifFail:failBlock 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    74
        whenBoxCreatedEvaluate:nil
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    75
        asLoadDialog:nil.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    76
321c1729db5b initial checkin
penk
parents:
diff changeset
    77
    "
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
    78
     FileDialog
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    79
        requestDirectoryName:'which directory ?' 
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
    80
        default:Filename currentDirectory pathName
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    81
        ifFail:'none'
321c1729db5b initial checkin
penk
parents:
diff changeset
    82
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
    83
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    84
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
    85
requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    86
    "same as requestFileName, but only show directories"
321c1729db5b initial checkin
penk
parents:
diff changeset
    87
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
    88
    |enteredFileName instance enteredFileNameString|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    89
4795
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    90
    instance := self    
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    91
        startApplicationFor:titleString 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    92
        default:aFileName 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    93
        ok:okText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    94
        abort:abortText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    95
        ifFail:failBlock 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    96
        pattern:pattern 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    97
        fromDirectory:aDirectoryPath 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    98
        whenBoxCreatedEvaluate:boxCreatedCallback
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
    99
        asLoadDialog:aBoolean
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   100
        forDirectory:true
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   101
        multipleSelect:false.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   102
321c1729db5b initial checkin
penk
parents:
diff changeset
   103
    enteredFileNameString := instance result.
321c1729db5b initial checkin
penk
parents:
diff changeset
   104
    enteredFileNameString isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   105
        ^ failBlock value
321c1729db5b initial checkin
penk
parents:
diff changeset
   106
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   107
    enteredFileName := enteredFileNameString asFilename.
321c1729db5b initial checkin
penk
parents:
diff changeset
   108
    enteredFileNameString := enteredFileName asString.
321c1729db5b initial checkin
penk
parents:
diff changeset
   109
    (enteredFileName notNil 
321c1729db5b initial checkin
penk
parents:
diff changeset
   110
    and:[enteredFileNameString notEmpty]) ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   111
        versionSymbol isNil ifTrue:[ ^ enteredFileNameString].
321c1729db5b initial checkin
penk
parents:
diff changeset
   112
        versionSymbol == #mustBeNew ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   113
            "/ file may not exist
321c1729db5b initial checkin
penk
parents:
diff changeset
   114
            enteredFileName exists ifTrue:[^ ''].
321c1729db5b initial checkin
penk
parents:
diff changeset
   115
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   116
        versionSymbol == #new ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   117
            "/ file may not exist
321c1729db5b initial checkin
penk
parents:
diff changeset
   118
            enteredFileName exists ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   119
                (Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs)
321c1729db5b initial checkin
penk
parents:
diff changeset
   120
                    ifFalse:[^ ''].
321c1729db5b initial checkin
penk
parents:
diff changeset
   121
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   122
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   123
        versionSymbol == #mustBeOld ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   124
            enteredFileName exists ifFalse:[^ ''].
321c1729db5b initial checkin
penk
parents:
diff changeset
   125
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   126
        versionSymbol == #old ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   127
            "/ file may not exist
321c1729db5b initial checkin
penk
parents:
diff changeset
   128
            enteredFileName exists ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   129
                (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs)
321c1729db5b initial checkin
penk
parents:
diff changeset
   130
                ifFalse:[^ ''].
321c1729db5b initial checkin
penk
parents:
diff changeset
   131
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   132
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   133
        FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString).
321c1729db5b initial checkin
penk
parents:
diff changeset
   134
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   135
    ^ enteredFileNameString
321c1729db5b initial checkin
penk
parents:
diff changeset
   136
321c1729db5b initial checkin
penk
parents:
diff changeset
   137
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   138
     FileDialog
321c1729db5b initial checkin
penk
parents:
diff changeset
   139
        requestDirectoryName:'which directory ?' 
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
   140
        default:Filename currentDirectory pathName
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   141
        ifFail:nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   142
    "
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   143
    "
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   144
     FileDialog
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   145
        requestDirectoryName:'which directory ?' 
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
   146
        default:Filename currentDirectory pathName 
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   147
        ok:nil
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   148
        abort:nil 
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   149
        version:nil 
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   150
        pattern:nil 
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   151
        fromDirectory:nil 
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   152
        ifFail:nil 
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   153
        whenBoxCreatedEvaluate:nil
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   154
        asLoadDialog:true
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   155
    "
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   156
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   157
321c1729db5b initial checkin
penk
parents:
diff changeset
   158
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback
321c1729db5b initial checkin
penk
parents:
diff changeset
   159
4795
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   160
    ^ self  
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   161
        requestFileName:titleString 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   162
        default:defaultName 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   163
        ok:okText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   164
        abort:abortText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   165
        version:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   166
        ifFail:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   167
        pattern:pattern 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   168
        fromDirectory:aDirectoryPathOrNil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   169
        whenBoxCreatedEvaluate:boxCreatedCallback
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   170
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   171
321c1729db5b initial checkin
penk
parents:
diff changeset
   172
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback
321c1729db5b initial checkin
penk
parents:
diff changeset
   173
    "launch a Dialog, which allows user to enter a filename.
321c1729db5b initial checkin
penk
parents:
diff changeset
   174
     The files presented initially are those in aDirectoryPathOrNil, or the
321c1729db5b initial checkin
penk
parents:
diff changeset
   175
     last fileBox directory (default: current directory) (if a nil path is given).
321c1729db5b initial checkin
penk
parents:
diff changeset
   176
     The box will show okText in its okButton, abortText in the abortButton.
321c1729db5b initial checkin
penk
parents:
diff changeset
   177
     The matchPattern is set to pattern initially.
321c1729db5b initial checkin
penk
parents:
diff changeset
   178
     Return the string, or nil if cancel was pressed
321c1729db5b initial checkin
penk
parents:
diff changeset
   179
     The version argument allows validation of the files existance;
321c1729db5b initial checkin
penk
parents:
diff changeset
   180
     it may be any of:
321c1729db5b initial checkin
penk
parents:
diff changeset
   181
        #mustBeNew      - fail (return empty string) if the file exists
321c1729db5b initial checkin
penk
parents:
diff changeset
   182
        #new            - confirm if the file exists
321c1729db5b initial checkin
penk
parents:
diff changeset
   183
        #mustBeOld      - fail if the file does not exist
321c1729db5b initial checkin
penk
parents:
diff changeset
   184
        #old            - confirm if the file does not exist
321c1729db5b initial checkin
penk
parents:
diff changeset
   185
        #any (other)    - no validation
321c1729db5b initial checkin
penk
parents:
diff changeset
   186
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   187
4795
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   188
    ^ self  
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   189
        requestFileName:titleString 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   190
        default:defaultName 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   191
        ok:okText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   192
        abort:abortText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   193
        version:versionSymbol 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   194
        ifFail:failBlock 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   195
        pattern:pattern 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   196
        fromDirectory:aDirectoryPath 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   197
        whenBoxCreatedEvaluate:boxCreatedCallback 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   198
        asLoadDialog:nil
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   199
!
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   200
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   201
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   202
    "launch a Dialog, which allows user to enter a filename.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   203
     The files presented initially are those in aDirectoryPathOrNil, or the
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   204
     last fileBox directory (default: current directory) (if a nil path is given).
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   205
     The box will show okText in its okButton, abortText in the abortButton.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   206
     The matchPattern is set to pattern initially.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   207
     Return the string, or nil if cancel was pressed
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   208
     The version argument allows validation of the files existance;
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   209
     it may be any of:
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   210
        #mustBeNew      - fail (return empty string) if the file exists
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   211
        #new            - confirm if the file exists
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   212
        #mustBeOld      - fail if the file does not exist
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   213
        #old            - confirm if the file does not exist
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   214
        #any (other)    - no validation
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   215
    "
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   216
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   217
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   218
    | instance enteredFileName enteredFileNameString|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   219
4795
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   220
    instance := self    
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   221
        startApplicationFor:titleString 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   222
        default:defaultName 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   223
        ok:okText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   224
        abort:abortText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   225
        ifFail:failBlock 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   226
        pattern:pattern 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   227
        fromDirectory:aDirectoryPath 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   228
        whenBoxCreatedEvaluate:boxCreatedCallback
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   229
        asLoadDialog:aBoolean
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   230
        forDirectory:false
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   231
        multipleSelect:false.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   232
321c1729db5b initial checkin
penk
parents:
diff changeset
   233
    enteredFileNameString := instance result.
3938
cc381aba7134 for empty string do fail action
penk
parents: 3923
diff changeset
   234
    (enteredFileNameString isNil or:[enteredFileNameString isEmpty]) ifTrue:[
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   235
        ^ failBlock value
321c1729db5b initial checkin
penk
parents:
diff changeset
   236
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   237
    enteredFileName := enteredFileNameString asFilename.
321c1729db5b initial checkin
penk
parents:
diff changeset
   238
    enteredFileNameString := enteredFileName asString.
4666
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
   239
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   240
    (enteredFileName notNil 
321c1729db5b initial checkin
penk
parents:
diff changeset
   241
    and:[enteredFileNameString notEmpty]) ifTrue:[
4666
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
   242
        FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName).
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   243
        versionSymbol isNil ifTrue:[ ^ enteredFileNameString].
321c1729db5b initial checkin
penk
parents:
diff changeset
   244
        versionSymbol == #mustBeNew ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   245
            "/ file may not exist
321c1729db5b initial checkin
penk
parents:
diff changeset
   246
            enteredFileName exists ifTrue:[^ ''].
321c1729db5b initial checkin
penk
parents:
diff changeset
   247
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   248
        versionSymbol == #new ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   249
            "/ file may not exist
321c1729db5b initial checkin
penk
parents:
diff changeset
   250
            enteredFileName exists ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   251
                (Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs)
321c1729db5b initial checkin
penk
parents:
diff changeset
   252
                    ifFalse:[^ ''].
321c1729db5b initial checkin
penk
parents:
diff changeset
   253
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   254
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   255
        versionSymbol == #mustBeOld ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   256
            enteredFileName exists ifFalse:[^ ''].
321c1729db5b initial checkin
penk
parents:
diff changeset
   257
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   258
        versionSymbol == #old ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   259
            "/ file may not exist
321c1729db5b initial checkin
penk
parents:
diff changeset
   260
            enteredFileName exists ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   261
                (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs)
321c1729db5b initial checkin
penk
parents:
diff changeset
   262
                ifFalse:[^ ''].
321c1729db5b initial checkin
penk
parents:
diff changeset
   263
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   264
        ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   265
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   266
    ^ enteredFileNameString
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   267
"
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   268
     FileDialog 
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   269
        requestFileName:'enter a fileName:'
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   270
        default:''
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   271
        ok:nil 
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   272
        abort:nil
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   273
        version:nil
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   274
        ifFail:['none']
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   275
        pattern:'*.conf'
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
   276
        fromDirectory:Filename currentDirectory pathName
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   277
        whenBoxCreatedEvaluate:nil
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   278
        asLoadDialog:true
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   279
"
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   280
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   281
321c1729db5b initial checkin
penk
parents:
diff changeset
   282
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback
321c1729db5b initial checkin
penk
parents:
diff changeset
   283
4795
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   284
    ^ self  
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   285
        requestFileName:titleString 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   286
        default:defaultName 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   287
        ok:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   288
        abort:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   289
        version:versionSymbol 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   290
        ifFail:failBlock 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   291
        pattern:pattern 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   292
        fromDirectory:aDirectoryPathOrNil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   293
        whenBoxCreatedEvaluate:boxCreatedCallback
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   294
321c1729db5b initial checkin
penk
parents:
diff changeset
   295
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   296
     FileDialog 
321c1729db5b initial checkin
penk
parents:
diff changeset
   297
        requestFileName:'enter a fileName:'
321c1729db5b initial checkin
penk
parents:
diff changeset
   298
        default:''
321c1729db5b initial checkin
penk
parents:
diff changeset
   299
        version:nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   300
        ifFail:['none']
321c1729db5b initial checkin
penk
parents:
diff changeset
   301
        pattern:'*.conf'
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
   302
        fromDirectory:Filename currentDirectory pathName
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   303
        whenBoxCreatedEvaluate:nil.
321c1729db5b initial checkin
penk
parents:
diff changeset
   304
     Dialog 
321c1729db5b initial checkin
penk
parents:
diff changeset
   305
        requestFileName:'enter a fileName:'
321c1729db5b initial checkin
penk
parents:
diff changeset
   306
        default:''
321c1729db5b initial checkin
penk
parents:
diff changeset
   307
        version:nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   308
        ifFail:['none']
321c1729db5b initial checkin
penk
parents:
diff changeset
   309
        pattern:'*.conf'
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
   310
        fromDirectory:Filename currentDirectory pathName
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   311
        whenBoxCreatedEvaluate:nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   312
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   313
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   314
     FileDialog
321c1729db5b initial checkin
penk
parents:
diff changeset
   315
        requestFileName:'enter a fileName:'
321c1729db5b initial checkin
penk
parents:
diff changeset
   316
        default:''
321c1729db5b initial checkin
penk
parents:
diff changeset
   317
        version:#old 
321c1729db5b initial checkin
penk
parents:
diff changeset
   318
        ifFail:['none']   
321c1729db5b initial checkin
penk
parents:
diff changeset
   319
        pattern:'*.conf'
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
   320
        fromDirectory:Filename currentDirectory pathName
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   321
        whenBoxCreatedEvaluate:nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   322
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   323
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   324
     FileDialog
321c1729db5b initial checkin
penk
parents:
diff changeset
   325
        requestFileName:'enter a fileName:'
321c1729db5b initial checkin
penk
parents:
diff changeset
   326
        default:''
321c1729db5b initial checkin
penk
parents:
diff changeset
   327
        version:#mustBeNew 
321c1729db5b initial checkin
penk
parents:
diff changeset
   328
        ifFail:['none']   
321c1729db5b initial checkin
penk
parents:
diff changeset
   329
        pattern:'*.conf'
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
   330
        fromDirectory:Filename currentDirectory pathName
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   331
        whenBoxCreatedEvaluate:nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   332
    "
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   333
!
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   334
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   335
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   336
    "launch a Dialog, which allows user to enter a filename.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   337
     The files presented initially are those in aDirectoryPathOrNil, or the
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   338
     last fileBox directory (default: current directory) (if a nil path is given).
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   339
     The box will show okText in its okButton, abortText in the abortButton.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   340
     The matchPattern is set to pattern initially.
3905
2a1afd0fdcd3 add requestFilenames method
penk
parents: 3904
diff changeset
   341
     Return all selected Filenames as filenames in a collection, or nil if cancel was pressed
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   342
    "
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   343
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   344
4795
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   345
    ^ self  
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   346
        requestFileNames:titleString 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   347
        default:defaultName 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   348
        ok:okText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   349
        abort:abortText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   350
        ifFail:failBlock 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   351
        pattern:pattern 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   352
        fromDirectory:aDirectoryPath 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   353
        whenBoxCreatedEvaluate:boxCreatedCallback 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   354
        asLoadDialog:nil.
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   355
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   356
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   357
"
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   358
     FileDialog 
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   359
        requestFileNames:'enter a fileName:'
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   360
        default:''
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   361
        ok:nil 
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   362
        abort:nil 
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   363
        ifFail:['none']
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   364
        pattern:'*.conf'
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
   365
        fromDirectory:Filename currentDirectory pathName
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   366
        whenBoxCreatedEvaluate:nil.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   367
"
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   368
!
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   369
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   370
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   371
    "launch a Dialog, which allows user to enter a filename.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   372
     The files presented initially are those in aDirectoryPathOrNil, or the
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   373
     last fileBox directory (default: current directory) (if a nil path is given).
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   374
     The box will show okText in its okButton, abortText in the abortButton.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   375
     The matchPattern is set to pattern initially.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   376
     Return all selected Filenames as filenames in a collection, or nil if cancel was pressed
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   377
    "
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   378
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   379
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   380
    | instance enteredFileNames lastDirectory|
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   381
4795
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   382
    instance := self    
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   383
        startApplicationFor:titleString 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   384
        default:defaultName 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   385
        ok:okText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   386
        abort:abortText 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   387
        ifFail:failBlock 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   388
        pattern:pattern 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   389
        fromDirectory:aDirectoryPath 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   390
        whenBoxCreatedEvaluate:boxCreatedCallback
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   391
        asLoadDialog:asLoadDialog 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   392
        forDirectory:false
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   393
        multipleSelect:true.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   394
3996
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   395
    enteredFileNames := instance currentSelectedFiles.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   396
    (enteredFileNames isEmpty or:[instance result isNil]) ifTrue:[
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   397
        ^ failBlock value
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   398
    ].
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   399
    lastDirectory := enteredFileNames first.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   400
    lastDirectory := lastDirectory isFilename ifTrue:[lastDirectory directory] ifFalse:[lastDirectory].
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   401
    FileSelectionBox lastFileSelectionDirectory:(lastDirectory directoryName).
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   402
    ^ enteredFileNames
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   403
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   404
"
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   405
     FileDialog 
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   406
        requestFileNames:'enter a fileName:'
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   407
        default:''
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   408
        ok:nil 
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   409
        abort:nil 
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   410
        ifFail:['none']
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   411
        pattern:'*.conf'
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
   412
        fromDirectory:Filename currentDirectory pathName
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   413
        whenBoxCreatedEvaluate:nil
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   414
        asLoadDialog:true.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   415
"
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   416
!
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   417
3958
39364b0202cf fileDialog multiple select changes
penk
parents: 3956
diff changeset
   418
startApplicationFor:titleString default:aFileName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog forDirectory:forDirectory multipleSelect:multipleSelect
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   419
    "launch a Dialog, which allows user to enter a filename.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   420
     The files presented initially are those in aDirectoryPathOrNil, or the
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   421
     last fileBox directory (default: current directory) (if a nil path is given).
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   422
     The box will show okText in its okButton, abortText in the abortButton.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   423
     The matchPattern is set to pattern initially.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   424
     Return the string, or nil if cancel was pressed
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   425
     The version argument allows validation of the files existance;
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   426
     it may be any of:
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   427
        #mustBeNew      - fail (return empty string) if the file exists
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   428
        #new            - confirm if the file exists
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   429
        #mustBeOld      - fail if the file does not exist
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   430
        #old            - confirm if the file does not exist
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   431
        #any (other)    - no validation
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   432
    "
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   433
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   434
4539
845e4e692dbf *** empty log message ***
penk
parents: 4206
diff changeset
   435
    | defaultDir defaultNm instance defaultFile locFilename|
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   436
4539
845e4e692dbf *** empty log message ***
penk
parents: 4206
diff changeset
   437
    locFilename := aFileName.
845e4e692dbf *** empty log message ***
penk
parents: 4206
diff changeset
   438
    defaultNm := locFilename.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   439
    defaultDir := aDirectoryPath.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   440
    defaultDir isNil ifTrue:[
4539
845e4e692dbf *** empty log message ***
penk
parents: 4206
diff changeset
   441
        defaultNm notNil ifTrue:[
845e4e692dbf *** empty log message ***
penk
parents: 4206
diff changeset
   442
            defaultDir := locFilename asFilename asAbsoluteFilename directory.
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   443
        ] ifFalse:[
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   444
            defaultDir := FileSelectionBox lastFileSelectionDirectory.
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   445
            defaultDir isNil ifTrue:[
4539
845e4e692dbf *** empty log message ***
penk
parents: 4206
diff changeset
   446
                defaultDir := Filename currentDirectory asAbsoluteFilename.        
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   447
            ].
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   448
        ]
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   449
    ].
4824
90520012f652 checkin from browser
penk
parents: 4804
diff changeset
   450
    locFilename isNil ifTrue:[
90520012f652 checkin from browser
penk
parents: 4804
diff changeset
   451
        locFilename := defaultDir.
90520012f652 checkin from browser
penk
parents: 4804
diff changeset
   452
    ].
4206
ebbc6f79a43d defaultDir asAbsoluteFilename
penk
parents: 4175
diff changeset
   453
    defaultDir := defaultDir asFilename asAbsoluteFilename.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   454
    [defaultDir exists not] whileTrue:[
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   455
        defaultDir := defaultDir directory.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   456
    ].
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   457
    forDirectory not ifTrue:[
4539
845e4e692dbf *** empty log message ***
penk
parents: 4206
diff changeset
   458
        (locFilename notNil and:[locFilename asFilename withoutSuffix baseName ~= '*']) ifTrue:[
845e4e692dbf *** empty log message ***
penk
parents: 4206
diff changeset
   459
            defaultFile := defaultDir construct:(locFilename asFilename baseName).
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   460
        ].
4539
845e4e692dbf *** empty log message ***
penk
parents: 4206
diff changeset
   461
    ] ifFalse:[
845e4e692dbf *** empty log message ***
penk
parents: 4206
diff changeset
   462
        defaultFile := locFilename asFilename asAbsoluteFilename.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   463
    ].
4562
967b5b5a8519 *** empty log message ***
penk
parents: 4539
diff changeset
   464
    defaultFile isNil ifTrue:[
967b5b5a8519 *** empty log message ***
penk
parents: 4539
diff changeset
   465
        defaultFile := defaultDir.
967b5b5a8519 *** empty log message ***
penk
parents: 4539
diff changeset
   466
    ].
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   467
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   468
    instance := self new.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   469
    defaultDir notNil ifTrue:[instance directory:(defaultDir asFilename)].
3958
39364b0202cf fileDialog multiple select changes
penk
parents: 3956
diff changeset
   470
    instance multipleSelect:multipleSelect ? false.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   471
    instance startFilename:defaultFile.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   472
    instance pattern:((pattern isNil or:[pattern isEmpty]) ifTrue:['*'] ifFalse:[pattern]).
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   473
    instance initialText:titleString.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   474
    instance okLabelHolder value:okText.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   475
    instance cancelLabelHolder value:abortText.
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   476
    instance beLoadDialog:asLoadDialog ? false.
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   477
    instance viewFiles:(forDirectory isNil ifTrue:[true] ifFalse:[forDirectory not]).
3953
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   478
    self setDoubleClickActionFor:instance.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   479
    instance allButOpenInterface:#windowSpec.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   480
    boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:instance].
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   481
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   482
    Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:instance.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   483
    instance openWindowModal.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   484
    ^ instance
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   485
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   486
321c1729db5b initial checkin
penk
parents:
diff changeset
   487
!FileDialog class methodsFor:'accessing'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   488
3953
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   489
setDoubleClickActionFor:instance
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   490
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   491
    instance doubleClickAction:[:anIndex|
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   492
        | item |
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   493
        item := instance treeBrowser fileList at:anIndex ifAbsent:nil.
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   494
        item notNil ifTrue:[
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   495
            ((instance viewFiles and:[item isDirectory not]) or:[instance viewFiles not]) ifTrue:[
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   496
                instance doAccept.
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   497
            ]
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   498
        ]
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   499
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   500
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   501
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   502
!FileDialog class methodsFor:'active help'!
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   503
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   504
flyByHelpSpec
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   505
    <resource: #help>
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   506
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   507
    |spec hist|
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   508
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   509
    spec := super flyByHelpSpec addPairsFrom:#(
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   510
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   511
#directoryUp
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   512
'Directory Up'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   513
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   514
#directoryBack
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   515
'Directory Back'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   516
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   517
#directoryForward
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   518
'Directory Forward'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   519
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   520
#directoryHistory
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   521
'Directory'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   522
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   523
#fileHome
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   524
'Home Directory'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   525
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   526
#fileGotoDefault
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   527
'Default Directory (ST/X Start Directory)'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   528
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   529
#fileHistory
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   530
'File History'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   531
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   532
).
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   533
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   534
"/    hist := self directoryHistory.
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   535
"/    hist notNil ifTrue:[
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   536
"/        hist canForward ifTrue:[
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   537
"/            spec at:#directoryForward put:(self classResources string:'Forward to: %1' with:hist nextForwardItem).
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   538
"/        ].
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   539
"/        hist canBackward ifTrue:[
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   540
"/            spec at:#directoryBack put:(self classResources string:'Back to: %1' with:hist nextBackwardItem).
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   541
"/        ].
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   542
"/    ].
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   543
    ^ spec.
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   544
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   545
    "
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   546
     self flyByHelpSpec
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   547
    "
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   548
! !
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   549
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   550
!FileDialog class methodsFor:'interface specs'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   551
321c1729db5b initial checkin
penk
parents:
diff changeset
   552
windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   553
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
   554
     by the UIPainter of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
   555
321c1729db5b initial checkin
penk
parents:
diff changeset
   556
    "Do not manually edit this!! If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
   557
     the UIPainter may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
   558
321c1729db5b initial checkin
penk
parents:
diff changeset
   559
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   560
     UIPainter new openOnClass:FileDialog andSelector:#windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   561
     FileDialog new openInterface:#windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   562
     FileDialog open
321c1729db5b initial checkin
penk
parents:
diff changeset
   563
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   564
321c1729db5b initial checkin
penk
parents:
diff changeset
   565
    <resource: #canvas>
321c1729db5b initial checkin
penk
parents:
diff changeset
   566
321c1729db5b initial checkin
penk
parents:
diff changeset
   567
    ^ 
321c1729db5b initial checkin
penk
parents:
diff changeset
   568
     #(#FullSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   569
        #name: #windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   570
        #window: 
321c1729db5b initial checkin
penk
parents:
diff changeset
   571
       #(#WindowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   572
          #label: 'FileDialog'
321c1729db5b initial checkin
penk
parents:
diff changeset
   573
          #name: 'FileDialog'
321c1729db5b initial checkin
penk
parents:
diff changeset
   574
          #min: #(#Point 10 10)
321c1729db5b initial checkin
penk
parents:
diff changeset
   575
          #max: #(#Point 1024 768)
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   576
          #bounds: #(#Rectangle 16 46 416 446)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   577
        )
321c1729db5b initial checkin
penk
parents:
diff changeset
   578
        #component: 
321c1729db5b initial checkin
penk
parents:
diff changeset
   579
       #(#SpecCollection
321c1729db5b initial checkin
penk
parents:
diff changeset
   580
          #collection: #(
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   581
           #(#ViewSpec
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   582
              #name: 'FilePart'
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   583
              #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -40 1.0)
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   584
              #component: 
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   585
             #(#SpecCollection
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   586
                #collection: #(
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   587
                 #(#MenuPanelSpec
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   588
                    #name: 'ToolBar1'
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   589
                    #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 30 0)
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   590
                    #tabable: true
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   591
                    #menu: #toolBarMenu
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   592
                    #textDefault: true
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   593
                  )
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   594
                 #(#SubCanvasSpec
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   595
                    #name: 'DirectoryTreeBrowser'
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   596
                    #layout: #(#LayoutFrame 0 0.0 55 0 0 1.0 -60 1)
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   597
                    #tabable: true
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   598
                    #hasHorizontalScrollBar: false
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   599
                    #hasVerticalScrollBar: false
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   600
                    #majorKey: #DirectoryTreeBrowser
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   601
                    #createNewApplication: true
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   602
                    #createNewBuilder: true
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   603
                    #postBuildCallback: #postBuildTreeBrowser:
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   604
                  )
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   605
                 #(#LabelSpec
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   606
                    #label: 'Filename:'
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   607
                    #name: 'FilenameLabel'
4729
d2367ffbe952 fixed: Layout
tm
parents: 4728
diff changeset
   608
                    #layout: #(#LayoutFrame 3 0 -50 1 73 0 -30 1)
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   609
                    #translateLabel: true
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   610
                    #labelChannel: #filenameLabelHolder
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   611
                    #adjust: #left
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   612
                  )
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   613
                 #(#FilenameInputFieldSpec
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   614
                    #name: 'FilenameEntryField'
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   615
                    #layout: #(#LayoutFrame 70 0 -50 1 -2 1 -30 1)
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   616
                    #tabable: true
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   617
                    #model: #filenameHolder
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   618
                    #immediateAccept: false
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   619
                    #acceptOnPointerLeave: false
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   620
                    #postBuildCallback: #postBuildFileNameField:
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   621
                  )
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   622
                 #(#VariableHorizontalPanelSpec
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   623
                    #name: 'VariableHorizontalPanel1'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   624
                    #layout: #(#LayoutFrame 0 0 30 0 0 1 55 0)
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   625
                    #level: 1
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   626
                    #showHandle: false
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   627
                    #barLevel: 0
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   628
                    #component: 
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   629
                   #(#SpecCollection
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   630
                      #collection: #(
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   631
                       #(#ViewSpec
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   632
                          #name: 'Box1'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   633
                        )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   634
                       #(#ViewSpec
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   635
                          #name: 'Box2'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   636
                          #component: 
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   637
                         #(#SpecCollection
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   638
                            #collection: #(
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   639
                             #(#LabelSpec
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   640
                                #label: 'Filter:'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   641
                                #name: 'FilterLabel'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   642
                                #layout: #(#LayoutFrame 8 0 2 0 59 0 -2 1)
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   643
                                #translateLabel: true
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   644
                                #adjust: #right
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   645
                              )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   646
                             #(#InputFieldSpec
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   647
                                #name: 'FilterEntryField'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   648
                                #layout: #(#LayoutFrame 60 0 -22 1 -2 1 -2 1)
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   649
                                #model: #filterHolder
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   650
                                #immediateAccept: true
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   651
                                #acceptOnReturn: true
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   652
                                #acceptOnTab: true
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   653
                                #acceptOnLostFocus: true
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   654
                                #acceptOnPointerLeave: false
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   655
                                #postBuildCallback: #postBuildFilterField:
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   656
                              )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   657
                             )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   658
                           
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   659
                          )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   660
                        )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   661
                       )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   662
                     
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   663
                    )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   664
                    #handles: #(#Any 0.5 1.0)
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   665
                  )
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   666
                 )
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   667
               
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   668
              )
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   669
            )
321c1729db5b initial checkin
penk
parents:
diff changeset
   670
           #(#HorizontalPanelViewSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   671
              #name: 'ButtonPanel'
321c1729db5b initial checkin
penk
parents:
diff changeset
   672
              #layout: #(#LayoutFrame 0 0.0 -40 1 0 1 0 1)
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   673
              #visibilityChannel: #buttonPanelVisibleHolder
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   674
              #horizontalLayout: #fitSpace
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   675
              #verticalLayout: #center
321c1729db5b initial checkin
penk
parents:
diff changeset
   676
              #horizontalSpace: 3
321c1729db5b initial checkin
penk
parents:
diff changeset
   677
              #verticalSpace: 3
321c1729db5b initial checkin
penk
parents:
diff changeset
   678
              #reverseOrderIfOKAtLeft: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   679
              #component: 
321c1729db5b initial checkin
penk
parents:
diff changeset
   680
             #(#SpecCollection
321c1729db5b initial checkin
penk
parents:
diff changeset
   681
                #collection: #(
321c1729db5b initial checkin
penk
parents:
diff changeset
   682
                 #(#ActionButtonSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   683
                    #label: 'Cancel'
321c1729db5b initial checkin
penk
parents:
diff changeset
   684
                    #name: 'cancelButton'
321c1729db5b initial checkin
penk
parents:
diff changeset
   685
                    #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   686
                    #labelChannel: #cancelLabelHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
   687
                    #tabable: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   688
                    #model: #doCancel
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   689
                    #extent: #(#Point 129 21)
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   690
                  )
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   691
                 #(#ActionButtonSpec
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   692
                    #label: 'Append'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   693
                    #name: 'appendButton'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   694
                    #visibilityChannel: #appendButtonVisibleHolder
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   695
                    #translateLabel: true
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   696
                    #labelChannel: #appendLabelHolder
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   697
                    #tabable: true
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   698
                    #model: #appendPressed
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   699
                    #extent: #(#Point 129 22)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   700
                  )
321c1729db5b initial checkin
penk
parents:
diff changeset
   701
                 #(#ActionButtonSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   702
                    #label: 'OK'
321c1729db5b initial checkin
penk
parents:
diff changeset
   703
                    #name: 'okButton'
321c1729db5b initial checkin
penk
parents:
diff changeset
   704
                    #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   705
                    #labelChannel: #okLabelHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
   706
                    #tabable: true
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   707
                    #model: #okPressed
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   708
                    #isDefault: true
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   709
                    #extent: #(#Point 130 22)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   710
                  )
321c1729db5b initial checkin
penk
parents:
diff changeset
   711
                 )
321c1729db5b initial checkin
penk
parents:
diff changeset
   712
               
321c1729db5b initial checkin
penk
parents:
diff changeset
   713
              )
321c1729db5b initial checkin
penk
parents:
diff changeset
   714
            )
321c1729db5b initial checkin
penk
parents:
diff changeset
   715
           )
321c1729db5b initial checkin
penk
parents:
diff changeset
   716
         
321c1729db5b initial checkin
penk
parents:
diff changeset
   717
        )
321c1729db5b initial checkin
penk
parents:
diff changeset
   718
      )
321c1729db5b initial checkin
penk
parents:
diff changeset
   719
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   720
321c1729db5b initial checkin
penk
parents:
diff changeset
   721
!FileDialog class methodsFor:'menu specs'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   722
321c1729db5b initial checkin
penk
parents:
diff changeset
   723
toolBarMenu
321c1729db5b initial checkin
penk
parents:
diff changeset
   724
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
   725
     by the MenuEditor of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
   726
321c1729db5b initial checkin
penk
parents:
diff changeset
   727
    "Do not manually edit this!! If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
   728
     the MenuEditor may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
   729
321c1729db5b initial checkin
penk
parents:
diff changeset
   730
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   731
     MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu
321c1729db5b initial checkin
penk
parents:
diff changeset
   732
     (Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp
321c1729db5b initial checkin
penk
parents:
diff changeset
   733
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   734
321c1729db5b initial checkin
penk
parents:
diff changeset
   735
    <resource: #menu>
321c1729db5b initial checkin
penk
parents:
diff changeset
   736
321c1729db5b initial checkin
penk
parents:
diff changeset
   737
    ^ 
321c1729db5b initial checkin
penk
parents:
diff changeset
   738
     #(#Menu
321c1729db5b initial checkin
penk
parents:
diff changeset
   739
        #(
321c1729db5b initial checkin
penk
parents:
diff changeset
   740
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   741
            #activeHelpKey: #directoryUp
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   742
            #enabled: #enableDirectoryUp
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   743
            #label: 'DirectoryUp'
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   744
            #itemValue: #doGoDirectoryUp
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   745
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   746
            #isButton: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   747
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #upArrow20x20Icon)
321c1729db5b initial checkin
penk
parents:
diff changeset
   748
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   749
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   750
            #label: ''
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   751
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   752
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   753
            #activeHelpKey: #directoryBack
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   754
            #enabled: #enableBack
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   755
            #label: 'Back'
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   756
            #itemValue: #doBack
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   757
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   758
            #isButton: true
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   759
            #submenuChannel: #menuDirHistoryBack
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   760
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #leftArrow20x20Icon)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   761
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   762
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   763
            #label: ''
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   764
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   765
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   766
            #activeHelpKey: #directoryForward
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   767
            #enabled: #enableForward
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   768
            #label: 'Forward'
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   769
            #itemValue: #doForward
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   770
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   771
            #isButton: true
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   772
            #submenuChannel: #menuDirHistoryForward
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   773
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #rightArrow20x20Icon)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   774
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   775
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   776
            #label: ''
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   777
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   778
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   779
            #activeHelpKey: #fileHome
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   780
            #enabled: #enableHome
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   781
            #label: 'Home'
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   782
            #itemValue: #doGotoHomeDirectory
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   783
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   784
            #isButton: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   785
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #goHomeIcon)
321c1729db5b initial checkin
penk
parents:
diff changeset
   786
          )
3923
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   787
         #(#MenuItem
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   788
            #label: '-'
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   789
          )
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   790
         #(#MenuItem
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   791
            #label: 'New Directory'
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   792
            #itemValue: #newDirectory
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   793
            #translateLabel: true
3923
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   794
            #isButton: true
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   795
            #isVisible: #newDirectoryVisibilityHolder
3923
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   796
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #newDirectory20x20Icon)
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   797
          )
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   798
         )
321c1729db5b initial checkin
penk
parents:
diff changeset
   799
        nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   800
        nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   801
      )
321c1729db5b initial checkin
penk
parents:
diff changeset
   802
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   803
321c1729db5b initial checkin
penk
parents:
diff changeset
   804
!FileDialog methodsFor:'accessing'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   805
3996
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   806
currentSelectedFiles
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   807
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   808
    | selectedFiles|
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   809
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   810
    selectedFiles := treeBrowser currentFileNameHolder value.
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   811
    ^ selectedFiles select:[:aFile| aFile isDirectory not].
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   812
!
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   813
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   814
directory
321c1729db5b initial checkin
penk
parents:
diff changeset
   815
    "return the value of the instance variable 'directory' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   816
321c1729db5b initial checkin
penk
parents:
diff changeset
   817
    ^ directory
321c1729db5b initial checkin
penk
parents:
diff changeset
   818
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   819
321c1729db5b initial checkin
penk
parents:
diff changeset
   820
directory:something
321c1729db5b initial checkin
penk
parents:
diff changeset
   821
    "set the value of the instance variable 'directory' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   822
321c1729db5b initial checkin
penk
parents:
diff changeset
   823
    directory := something.
321c1729db5b initial checkin
penk
parents:
diff changeset
   824
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   825
321c1729db5b initial checkin
penk
parents:
diff changeset
   826
initialText
321c1729db5b initial checkin
penk
parents:
diff changeset
   827
    "return the value of the instance variable 'initialText' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   828
321c1729db5b initial checkin
penk
parents:
diff changeset
   829
    ^ initialText
321c1729db5b initial checkin
penk
parents:
diff changeset
   830
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   831
321c1729db5b initial checkin
penk
parents:
diff changeset
   832
initialText:something
321c1729db5b initial checkin
penk
parents:
diff changeset
   833
    "set the value of the instance variable 'initialText' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   834
321c1729db5b initial checkin
penk
parents:
diff changeset
   835
    initialText := something.
321c1729db5b initial checkin
penk
parents:
diff changeset
   836
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   837
321c1729db5b initial checkin
penk
parents:
diff changeset
   838
pattern
321c1729db5b initial checkin
penk
parents:
diff changeset
   839
    "return the value of the instance variable 'pattern' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   840
321c1729db5b initial checkin
penk
parents:
diff changeset
   841
    ^ pattern
321c1729db5b initial checkin
penk
parents:
diff changeset
   842
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   843
321c1729db5b initial checkin
penk
parents:
diff changeset
   844
pattern:something
321c1729db5b initial checkin
penk
parents:
diff changeset
   845
    "set the value of the instance variable 'pattern' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   846
321c1729db5b initial checkin
penk
parents:
diff changeset
   847
    pattern := something.
321c1729db5b initial checkin
penk
parents:
diff changeset
   848
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   849
321c1729db5b initial checkin
penk
parents:
diff changeset
   850
result
321c1729db5b initial checkin
penk
parents:
diff changeset
   851
    "return the value of the instance variable 'result' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   852
321c1729db5b initial checkin
penk
parents:
diff changeset
   853
    ^ result
321c1729db5b initial checkin
penk
parents:
diff changeset
   854
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   855
321c1729db5b initial checkin
penk
parents:
diff changeset
   856
result:something
321c1729db5b initial checkin
penk
parents:
diff changeset
   857
    "set the value of the instance variable 'result' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   858
321c1729db5b initial checkin
penk
parents:
diff changeset
   859
    result := something.
321c1729db5b initial checkin
penk
parents:
diff changeset
   860
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   861
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   862
selectedDirectories
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   863
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   864
    | selectedFiles|
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   865
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   866
    selectedFiles := treeBrowser currentFileNameHolder value.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   867
    ^ selectedFiles select:[:aFile| aFile isDirectory].
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   868
!
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   869
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   870
startFilename
321c1729db5b initial checkin
penk
parents:
diff changeset
   871
    "return the value of the instance variable 'startFilename' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   872
321c1729db5b initial checkin
penk
parents:
diff changeset
   873
    startFilename isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
   874
        startFilename := Filename currentDirectory asAbsoluteFilename.
321c1729db5b initial checkin
penk
parents:
diff changeset
   875
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
   876
    ^ startFilename
321c1729db5b initial checkin
penk
parents:
diff changeset
   877
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   878
321c1729db5b initial checkin
penk
parents:
diff changeset
   879
startFilename:something
321c1729db5b initial checkin
penk
parents:
diff changeset
   880
    "set the value of the instance variable 'startFilename' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   881
321c1729db5b initial checkin
penk
parents:
diff changeset
   882
    startFilename := something.
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   883
! !
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   884
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   885
!FileDialog methodsFor:'accessing-behavior'!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   886
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   887
asLoadDialog
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   888
    self halt.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   889
    ^ self isLoadDialog
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   890
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   891
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   892
asLoadDialog:aBoolean
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   893
    self halt.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   894
    self beLoadDialog:aBoolean
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   895
!
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   896
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   897
beLoadDialog:aBoolean
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   898
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   899
    isLoadDialog := aBoolean
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   900
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   901
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   902
doubleClickAction
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   903
    "return the value of the instance variable 'doubleClickAction' (automatically generated)"
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   904
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   905
    ^ doubleClickAction
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   906
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   907
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   908
doubleClickAction:something
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   909
    "set the value of the instance variable 'doubleClickAction' (automatically generated)"
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   910
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   911
    doubleClickAction := something.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   912
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   913
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   914
isLoadDialog
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   915
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   916
    ^ isLoadDialog ? true
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   917
!
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   918
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   919
multipleSelect
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   920
    ^ multipleSelect ? false
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   921
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   922
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   923
multipleSelect:aBoolean
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   924
    multipleSelect := aBoolean.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   925
    treeBrowser notNil ifTrue:[
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   926
        treeBrowser multipleSelect:aBoolean.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   927
    ].
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   928
! !
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   929
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   930
!FileDialog methodsFor:'accessing-components'!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   931
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   932
addButton:aButton
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   933
    DialogBox defaultOKButtonAtLeft ifTrue:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   934
        (self componentAt:#ButtonPanel) addSubView:aButton before:(self okButton)
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   935
    ] ifFalse:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   936
        (self componentAt:#ButtonPanel) addSubView:aButton after:(self okButton)
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   937
    ].
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   938
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   939
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   940
okButton
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   941
    ^ (self componentAt:#okButton) 
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   942
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   943
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   944
treeBrowser
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   945
    "return the value of the instance variable 'treeBrowser' (automatically generated)"
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   946
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   947
    ^ treeBrowser
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   948
! !
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   949
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   950
!FileDialog methodsFor:'accessing-look'!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   951
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   952
hideButtonPanel
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   953
    self buttonPanelVisibleHolder value:false
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   954
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   955
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   956
newDirectoryVisibilityHolder
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   957
    newDirectoryVisibilityHolder isNil ifTrue:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   958
        newDirectoryVisibilityHolder := true asValue.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   959
    ].
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   960
    ^ newDirectoryVisibilityHolder
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   961
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   962
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   963
showButtonPanel
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   964
    self buttonPanelVisibleHolder value:true
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   965
!
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   966
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   967
viewFiles
321c1729db5b initial checkin
penk
parents:
diff changeset
   968
    "return the value of the instance variable 'viewFiles' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   969
321c1729db5b initial checkin
penk
parents:
diff changeset
   970
    ^ viewFiles
321c1729db5b initial checkin
penk
parents:
diff changeset
   971
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   972
321c1729db5b initial checkin
penk
parents:
diff changeset
   973
viewFiles:something
321c1729db5b initial checkin
penk
parents:
diff changeset
   974
    "set the value of the instance variable 'viewFiles' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   975
321c1729db5b initial checkin
penk
parents:
diff changeset
   976
    viewFiles := something.
321c1729db5b initial checkin
penk
parents:
diff changeset
   977
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   978
321c1729db5b initial checkin
penk
parents:
diff changeset
   979
!FileDialog methodsFor:'aspects'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   980
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   981
appendButtonVisibleHolder
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   982
    appendButtonVisibleHolder isNil ifTrue:[
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   983
        appendButtonVisibleHolder := false asValue.
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   984
    ].
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   985
    ^ appendButtonVisibleHolder
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   986
!
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   987
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   988
aspectOrNil:aKey forSubApplication:aSubApp
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   989
    "this hook provides an aspect for a subApp"
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   990
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   991
    aKey == #currentFileNameHolder ifTrue:[
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   992
        directory notNil ifTrue:[
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   993
            ^ (OrderedCollection with:directory) asValue
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   994
        ]
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   995
    ].
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   996
    ^ nil
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   997
!
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   998
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   999
buttonPanelVisibleHolder
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1000
    buttonPanelVisibleHolder isNil ifTrue:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1001
        buttonPanelVisibleHolder := true asValue.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1002
        buttonPanelVisibleHolder onChangeSend:#buttonPanelVisibilityChanged to:self.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1003
    ].
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1004
    ^ buttonPanelVisibleHolder.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1005
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1006
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1007
cancelLabelHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1008
    "automatically generated by UIPainter ..."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1009
321c1729db5b initial checkin
penk
parents:
diff changeset
  1010
    "*** the code below creates a default model when invoked."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1011
    "*** (which may not be the one you wanted)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1012
    "*** Please change as required and accept it in the browser."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1013
    "*** (and replace this comment by something more useful ;-)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1014
321c1729db5b initial checkin
penk
parents:
diff changeset
  1015
    cancelLabelHolder isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1016
        cancelLabelHolder := 'Cancel' asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1017
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1018
    ^ cancelLabelHolder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1019
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1020
321c1729db5b initial checkin
penk
parents:
diff changeset
  1021
enableBack
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1022
    ^ treeBrowser enableBack.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1023
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1024
321c1729db5b initial checkin
penk
parents:
diff changeset
  1025
enableDirectoryUp
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1026
    ^ treeBrowser enableDirectoryUp.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1027
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1028
321c1729db5b initial checkin
penk
parents:
diff changeset
  1029
enableForward
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1030
    ^ treeBrowser enableForward.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1031
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1032
321c1729db5b initial checkin
penk
parents:
diff changeset
  1033
enableHome
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1034
    ^ treeBrowser enableHome.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1035
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1036
321c1729db5b initial checkin
penk
parents:
diff changeset
  1037
filenameHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1038
    "Return a value holder with the filename.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1039
     Shown in the filename input-field.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1040
     Being the selection in the tree.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1041
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
  1042
    |holder|
321c1729db5b initial checkin
penk
parents:
diff changeset
  1043
    holder := builder bindingAt:#filenameHolder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1044
321c1729db5b initial checkin
penk
parents:
diff changeset
  1045
    holder ifNil:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1046
        holder := ValueHolder new.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1047
        holder addDependent:self.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1048
        builder aspectAt:#filenameHolder 
321c1729db5b initial checkin
penk
parents:
diff changeset
  1049
                     put:holder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1050
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1051
321c1729db5b initial checkin
penk
parents:
diff changeset
  1052
    ^ holder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1053
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1054
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1055
filenameLabelHolder
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1056
    "Return a value holder for the input string.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1057
    "
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1058
    filenameLabelHolder isNil ifTrue:[
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1059
        filenameLabelHolder := 'Filename:' asValue.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1060
    ].
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1061
    ^ filenameLabelHolder
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1062
!
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1063
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1064
filterHolder
4011
73fa35b1963b *** empty log message ***
penk
parents: 4005
diff changeset
  1065
    "Return a value holder for filter
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1066
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
  1067
321c1729db5b initial checkin
penk
parents:
diff changeset
  1068
    filterHolder isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1069
        filterHolder := treeBrowser filterModel.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1070
        self pattern notNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1071
            filterHolder value:pattern.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1072
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
  1073
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1074
    ^ filterHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1075
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1076
321c1729db5b initial checkin
penk
parents:
diff changeset
  1077
okLabelHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1078
    "automatically generated by UIPainter ..."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1079
321c1729db5b initial checkin
penk
parents:
diff changeset
  1080
    "*** the code below creates a default model when invoked."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1081
    "*** (which may not be the one you wanted)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1082
    "*** Please change as required and accept it in the browser."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1083
    "*** (and replace this comment by something more useful ;-)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1084
321c1729db5b initial checkin
penk
parents:
diff changeset
  1085
    okLabelHolder isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1086
        okLabelHolder := 'OK' asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1087
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1088
    ^ okLabelHolder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1089
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1090
321c1729db5b initial checkin
penk
parents:
diff changeset
  1091
!FileDialog methodsFor:'change & update'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1092
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1093
buttonPanelVisibilityChanged
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1094
    |filePart buttonPanel|
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1095
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1096
    filePart := builder componentAt:#FilePart.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1097
    buttonPanel := builder componentAt:#ButtonPanel.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1098
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1099
    buttonPanelVisibleHolder value ifTrue:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1100
        filePart layout bottomOffset:-40
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1101
    ] ifFalse:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1102
        filePart layout bottomOffset:0
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1103
    ].
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1104
    filePart containerChangedSize    "/ force resize
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1105
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1106
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1107
update:something with:aParameter from:changedObject
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1108
    |files newFile newLabel fn|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1109
321c1729db5b initial checkin
penk
parents:
diff changeset
  1110
    changedObject == treeBrowser currentFileNameHolder ifTrue:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1111
        files := changedObject value.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1112
321c1729db5b initial checkin
penk
parents:
diff changeset
  1113
        (files isEmpty) ifTrue:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1114
            newFile := nil.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1115
        ] ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1116
            files size == 1 ifTrue:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1117
                newFile := files first.    
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1118
            ] ifFalse:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1119
                newFile := ''.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1120
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1121
        ].
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1122
        self filenameHolder value:newFile withoutNotifying:self.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1123
    ].
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1124
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1125
    changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1126
        changedObject value ifTrue:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1127
            newLabel := 'Filename:'.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1128
        ] ifFalse:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1129
            newLabel := 'Directory:'.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1130
        ].
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1131
        self filenameLabelHolder value:(resources string:newLabel)
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1132
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1133
    changedObject == self filenameHolder ifTrue:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1134
        fn := changedObject value asFilename.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1135
        (fn exists) ifFalse:[^ self].
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1136
        treeBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1137
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1138
    ^ super update:something with:aParameter from:changedObject
321c1729db5b initial checkin
penk
parents:
diff changeset
  1139
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1140
321c1729db5b initial checkin
penk
parents:
diff changeset
  1141
!FileDialog methodsFor:'event handling'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1142
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1143
appendWasPressed
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1144
    "valid after the dialog has been closed: true if append was pressed"
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1145
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1146
    ^ appendWasPressed
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1147
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1148
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1149
processEvent:anEvent
321c1729db5b initial checkin
penk
parents:
diff changeset
  1150
    "filter keyboard events.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1151
     Return true, if I have eaten the event"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1152
4666
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1153
"/    |focusView key rawKey|
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1154
"/
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1155
    anEvent isKeyPressEvent ifTrue:[
4666
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1156
self halt.
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1157
"/        focusView := anEvent targetView.
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1158
"/        key := anEvent key.
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1159
"/        rawKey := anEvent rawKey.
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1160
"/
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1161
"/        (focusView == filterField) ifTrue:[
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1162
"/            ^ false.
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1163
"/        ].
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1164
"/        (focusView == filenameField) ifTrue:[
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1165
"/            ^ false.
2775d69bc8be accept return in fileName field
martin
parents: 4627
diff changeset
  1166
"/        ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1167
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1168
    ^ false
321c1729db5b initial checkin
penk
parents:
diff changeset
  1169
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1170
321c1729db5b initial checkin
penk
parents:
diff changeset
  1171
!FileDialog methodsFor:'initialization & release'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1172
321c1729db5b initial checkin
penk
parents:
diff changeset
  1173
postBuildFileNameField:aWidget
321c1729db5b initial checkin
penk
parents:
diff changeset
  1174
321c1729db5b initial checkin
penk
parents:
diff changeset
  1175
    filenameField := aWidget.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1176
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1177
321c1729db5b initial checkin
penk
parents:
diff changeset
  1178
postBuildFilterField:aWidget
321c1729db5b initial checkin
penk
parents:
diff changeset
  1179
321c1729db5b initial checkin
penk
parents:
diff changeset
  1180
    filterField := aWidget.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1181
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1182
321c1729db5b initial checkin
penk
parents:
diff changeset
  1183
postBuildTreeBrowser:aSubCanvasView
321c1729db5b initial checkin
penk
parents:
diff changeset
  1184
321c1729db5b initial checkin
penk
parents:
diff changeset
  1185
    treeBrowser := aSubCanvasView client.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1186
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1187
4005
42f09ac0e0aa Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents: 3996
diff changeset
  1188
postBuildWith:aBuilder    
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1189
    treeBrowser multipleSelect:multipleSelect.
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
  1190
    appendWasPressed := false.
4005
42f09ac0e0aa Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents: 3996
diff changeset
  1191
    ^ super postBuildWith:aBuilder
42f09ac0e0aa Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents: 3996
diff changeset
  1192
!
42f09ac0e0aa Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents: 3996
diff changeset
  1193
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1194
postOpen
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1195
321c1729db5b initial checkin
penk
parents:
diff changeset
  1196
"/     self windowGroup addPreEventHook:self.
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1197
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1198
    self window topView isModal ifFalse:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1199
        self hideButtonPanel
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1200
    ].
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1201
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1202
    treeBrowser currentFileNameHolder addDependent:self.
3953
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
  1203
    treeBrowser doubleClickAction:(self doubleClickAction).
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1204
    treeBrowser viewFilesInDirectoryTree addDependent:self.
3982
fc30449d705d *** empty log message ***
penk
parents: 3960
diff changeset
  1205
    treeBrowser rootHolder value:((self directory) ? (Filename currentDirectory asAbsoluteFilename)).
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1206
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1207
    treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true).
4796
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1208
    treeBrowser viewFilesInDirectoryTree changed.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1209
    treeBrowser currentFileNameHolder value:(OrderedCollection with:(self startFilename)).
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1210
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1211
    self isLoadDialog ifTrue:[
4796
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1212
        treeBrowser newVisibilityHolder value:false.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1213
        treeBrowser allowFileOperations value:false.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1214
        self newDirectoryVisibilityHolder value:false.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1215
    ].
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1216
    self filenameHolder value:(self startFilename).
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1217
    self window label:(resources string:((self initialText) ? 'File Dialog')).
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1218
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1219
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1220
postOpenAsSubcanvasWith:aBuilder    
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1221
    self postOpen.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1222
    ^ super postOpenAsSubcanvasWith:aBuilder
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1223
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1224
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1225
postOpenWith:aBuilder    
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1226
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1227
    self postOpen.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1228
    ^ super postOpenWith:aBuilder.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1229
! !
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1230
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1231
!FileDialog methodsFor:'private'!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1232
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1233
returnWasPressedInFilterField
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1234
    |ev|
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1235
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1236
    ev := self windowGroup lastEvent.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1237
    (ev notNil 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1238
    and:[ev isKeyEvent 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1239
    and:[ev key == #Return
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1240
    and:[(   ev targetView isSameOrComponentOf:filterField) 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1241
         or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1242
        ^ true
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1243
    ].
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1244
    ^ false
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1245
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1246
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1247
returnWasPressedInFilterOrFilenameField
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1248
    |ev|
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1249
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1250
    ev := self windowGroup lastEvent.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1251
    (ev notNil 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1252
    and:[ev isKeyEvent 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1253
    and:[ev key == #Return
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1254
    and:[(   ev targetView isSameOrComponentOf:filterField) 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1255
         or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1256
        ^ true
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1257
    ].
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1258
    ^ false
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1259
! !
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1260
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1261
!FileDialog methodsFor:'user actions'!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1262
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1263
appendPressed
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1264
    appendWasPressed := true.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1265
    self commonAcceptAction.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1266
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1267
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1268
commonAcceptAction
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1269
    filenameField accept.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1270
    self result:(self filenameHolder value asString).
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1271
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1272
    ^ super doAccept
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1273
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1274
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1275
doAccept
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1276
    "force accept - ignore in filterField"
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1277
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1278
    self returnWasPressedInFilterField ifTrue:[
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1279
        ^ self
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1280
    ].
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1281
    appendWasPressed := false.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1282
    self commonAcceptAction.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1283
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1284
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1285
doBack
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1286
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1287
    treeBrowser doBack.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1288
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1289
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1290
doCancel
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1291
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1292
    self result:nil.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1293
    ^ super doCancel.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1294
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1295
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1296
doForward
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1297
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1298
    treeBrowser doForward.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1299
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1300
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1301
doGoDirectoryUp
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1302
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1303
    treeBrowser doGoDirectoryUp.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1304
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1305
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1306
doGotoHomeDirectory
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1307
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1308
    treeBrowser doGotoHomeDirectory.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1309
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1310
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1311
menuDirHistory:backOrForward
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1312
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1313
    ^ treeBrowser menuDirHistory:backOrForward.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1314
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1315
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1316
menuDirHistoryBack
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1317
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1318
    ^ treeBrowser menuDirHistory:#back.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1319
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1320
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1321
menuDirHistoryForward
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1322
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1323
    ^ treeBrowser menuDirHistory:#forward.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1324
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1325
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1326
newDirectory
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1327
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1328
    ^ treeBrowser newDirectory
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1329
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1330
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1331
okPressed
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1332
    self doAccept
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1333
! !
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1334
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1335
!FileDialog class methodsFor:'documentation'!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1336
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1337
version
4824
90520012f652 checkin from browser
penk
parents: 4804
diff changeset
  1338
    ^ '$Header: /cvs/stx/stx/libtool/FileDialog.st,v 1.35 2003-04-15 14:54:43 penk Exp $'
4796
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1339
! !