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