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