FileDialog.st
author Claus Gittinger <cg@exept.de>
Mon, 17 May 2004 18:54:01 +0200
changeset 5853 88f64d56a279
parent 5823 79a3ac980853
child 5858 d5648b365b8d
permissions -rw-r--r--
initial focus
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5140
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
     1
"
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
     2
 COPYRIGHT (c) 2002 by eXept Software AG
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
     3
              All Rights Reserved
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
     4
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
     5
 This software is furnished under a license and may be used
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
     6
 only in accordance with the terms of that license and with the
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
     8
 be provided or otherwise made available to, or used by, any
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
     9
 other person.  No title to or ownership of the software is
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    10
 hereby transferred.
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    11
"
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    12
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    13
"{ Package: 'stx:libtool' }"
321c1729db5b initial checkin
penk
parents:
diff changeset
    14
321c1729db5b initial checkin
penk
parents:
diff changeset
    15
SimpleDialog subclass:#FileDialog
5220
1de409e5ea52 initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents: 5193
diff changeset
    16
	instanceVariableNames:'aspects treeBrowser directory pattern filterHolder initialText
1de409e5ea52 initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents: 5193
diff changeset
    17
		multipleSelect doubleClickAction cancelLabelHolder okLabelHolder
1de409e5ea52 initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents: 5193
diff changeset
    18
		startFilename result filterField filenameField viewFiles
1de409e5ea52 initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents: 5193
diff changeset
    19
		filenameLabelHolder isLoadDialog newDirectoryVisibilityHolder
1de409e5ea52 initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents: 5193
diff changeset
    20
		appendButtonVisibleHolder appendWasPressed
1de409e5ea52 initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents: 5193
diff changeset
    21
		buttonPanelVisibleHolder appendLabelHolder'
1de409e5ea52 initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents: 5193
diff changeset
    22
	classVariableNames:''
1de409e5ea52 initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents: 5193
diff changeset
    23
	poolDictionaries:''
1de409e5ea52 initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents: 5193
diff changeset
    24
	category:'Interface-Tools-File'
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    25
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    26
321c1729db5b initial checkin
penk
parents:
diff changeset
    27
!FileDialog class methodsFor:'documentation'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    28
5140
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    29
copyright
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    30
"
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    31
 COPYRIGHT (c) 2002 by eXept Software AG
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    32
              All Rights Reserved
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    33
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    34
 This software is furnished under a license and may be used
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    35
 only in accordance with the terms of that license and with the
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    36
 inclusion of the above copyright notice.   This software may not
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    37
 be provided or otherwise made available to, or used by, any
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    38
 other person.  No title to or ownership of the software is
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    39
 hereby transferred.
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    40
"
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    41
!
36c7da05d814 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
    42
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    43
documentation
321c1729db5b initial checkin
penk
parents:
diff changeset
    44
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    45
    documentation to be added.
321c1729db5b initial checkin
penk
parents:
diff changeset
    46
321c1729db5b initial checkin
penk
parents:
diff changeset
    47
    [author:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    48
        Martin Walser (martin@vercingetorix)
321c1729db5b initial checkin
penk
parents:
diff changeset
    49
321c1729db5b initial checkin
penk
parents:
diff changeset
    50
    [instance variables:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    51
321c1729db5b initial checkin
penk
parents:
diff changeset
    52
    [class variables:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    53
321c1729db5b initial checkin
penk
parents:
diff changeset
    54
    [see also:]
321c1729db5b initial checkin
penk
parents:
diff changeset
    55
321c1729db5b initial checkin
penk
parents:
diff changeset
    56
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    57
!
321c1729db5b initial checkin
penk
parents:
diff changeset
    58
321c1729db5b initial checkin
penk
parents:
diff changeset
    59
examples
321c1729db5b initial checkin
penk
parents:
diff changeset
    60
"
321c1729db5b initial checkin
penk
parents:
diff changeset
    61
                                                                [exBegin]
321c1729db5b initial checkin
penk
parents:
diff changeset
    62
    FileDialog open
321c1729db5b initial checkin
penk
parents:
diff changeset
    63
                                                                [exEnd]
321c1729db5b initial checkin
penk
parents:
diff changeset
    64
321c1729db5b initial checkin
penk
parents:
diff changeset
    65
                                                                [exBegin]
5188
283a77f6efe2 care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents: 5173
diff changeset
    66
    FileDialog 
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    67
        requestFileName:'enter a fileName:'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    68
        default:''
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    69
        version:nil
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    70
        ifFail:['none']
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    71
        pattern:'*.conf'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    72
        fromDirectory:'/etc'
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    73
        whenBoxCreatedEvaluate:nil.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    74
                                                                [exEnd]
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    75
                                                                [exBegin]
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    76
    |fd|
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    77
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    78
    fd := FileDialog new.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    79
    fd multipleSelect:true.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
    80
    fd open
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    81
                                                                [exEnd]
321c1729db5b initial checkin
penk
parents:
diff changeset
    82
"
5062
dc8526b353f7 add a todo list
penk
parents: 5039
diff changeset
    83
!
dc8526b353f7 add a todo list
penk
parents: 5039
diff changeset
    84
dc8526b353f7 add a todo list
penk
parents: 5039
diff changeset
    85
todo
dc8526b353f7 add a todo list
penk
parents: 5039
diff changeset
    86
"
dc8526b353f7 add a todo list
penk
parents: 5039
diff changeset
    87
    - make the filedialog windows like f
dc8526b353f7 add a todo list
penk
parents: 5039
diff changeset
    88
      filename entry field shows only the filename not the whole directory 
dc8526b353f7 add a todo list
penk
parents: 5039
diff changeset
    89
      the tree allways starts in currrent directory
dc8526b353f7 add a todo list
penk
parents: 5039
diff changeset
    90
      the parent tree is shown in a compobox where the perents are selectable
dc8526b353f7 add a todo list
penk
parents: 5039
diff changeset
    91
    - do not expand the ~ or relative pathnames to absolute pathnames        
dc8526b353f7 add a todo list
penk
parents: 5039
diff changeset
    92
"
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
    93
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
    94
321c1729db5b initial checkin
penk
parents:
diff changeset
    95
!FileDialog class methodsFor:'instance creation'!
321c1729db5b initial checkin
penk
parents:
diff changeset
    96
321c1729db5b initial checkin
penk
parents:
diff changeset
    97
requestDirectoryName:title default:aFileName ifFail:failBlock
321c1729db5b initial checkin
penk
parents:
diff changeset
    98
    "same as requestFileName, but only show directories"
321c1729db5b initial checkin
penk
parents:
diff changeset
    99
4795
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   100
    ^ self  
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   101
        requestDirectoryName:title 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   102
        default:aFileName 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   103
        ok:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   104
        abort:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   105
        version:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   106
        pattern:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   107
        fromDirectory:nil 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   108
        ifFail:failBlock 
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   109
        whenBoxCreatedEvaluate:nil
86443bbe1451 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4793
diff changeset
   110
        asLoadDialog:nil.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   111
321c1729db5b initial checkin
penk
parents:
diff changeset
   112
    "
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   113
     FileDialog
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   114
        requestDirectoryName:'which directory ?' 
4627
856a643c7854 fix for windows
penk
parents: 4603
diff changeset
   115
        default:Filename currentDirectory pathName
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   116
        ifFail:'none'
321c1729db5b initial checkin
penk
parents:
diff changeset
   117
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   118
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   119
5336
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   120
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   121
    "same as requestFileName, but only show directories"
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   122
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   123
    ^ self  
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   124
        requestDirectoryName:title 
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   125
        default:aFileName 
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   126
        ok:okText 
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   127
        abort:abortText 
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   128
        version:nil 
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   129
        pattern:nil 
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   130
        fromDirectory:nil 
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   131
        ifFail:failBlock 
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   132
        whenBoxCreatedEvaluate:nil
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   133
        asLoadDialog:nil.
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   134
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   135
    "
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   136
     FileDialog
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   137
        requestDirectoryName:'which directory ?' 
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   138
        default:Filename currentDirectory pathName
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   139
        ok:'Yes'
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   140
        abort:'No'
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   141
        ifFail:'none'
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   142
    "
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   143
!
6a28518b52a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5329
diff changeset
   144
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.
321c1729db5b initial checkin
penk
parents:
diff changeset
   347
    enteredFileNameString := enteredFileName asString.
4666
2775d69bc8be accept return in fileName field
martin
parents: 4627
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']
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   384
        pattern:'*.conf'
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
3953
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   627
setDoubleClickActionFor:instance
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   628
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   629
    instance doubleClickAction:[:anIndex|
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   630
        | item |
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   631
        item := instance treeBrowser fileList at:anIndex ifAbsent:nil.
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   632
        item notNil ifTrue:[
5329
022b6631df6f checkin from browser
Michael Beyl <mb@exept.de>
parents: 5230
diff changeset
   633
            (instance viewFiles and:[item isDirectory not]) ifTrue:[ 
3953
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   634
                instance doAccept.
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   635
            ]
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   636
        ]
4fd0ed70cf36 next stage
penk
parents: 3944
diff changeset
   637
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   638
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   639
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   640
!FileDialog class methodsFor:'active help'!
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   641
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   642
flyByHelpSpec
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   643
    <resource: #help>
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   644
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   645
    |spec hist|
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   646
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   647
    spec := super flyByHelpSpec addPairsFrom:#(
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   648
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   649
#directoryUp
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   650
'Directory Up'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   651
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   652
#directoryBack
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   653
'Directory Back'
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
#directoryForward
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   656
'Directory Forward'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   657
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   658
#directoryHistory
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   659
'Directory'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   660
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   661
#fileHome
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   662
'Home Directory'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   663
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   664
#fileGotoDefault
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   665
'Default Directory (ST/X Start Directory)'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   666
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   667
#fileHistory
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   668
'File History'
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   669
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   670
).
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
"/    hist := self directoryHistory.
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   673
"/    hist notNil ifTrue:[
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   674
"/        hist canForward ifTrue:[
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   675
"/            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
   676
"/        ].
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   677
"/        hist canBackward ifTrue:[
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   678
"/            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
   679
"/        ].
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   680
"/    ].
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   681
    ^ spec.
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
    "
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   684
     self flyByHelpSpec
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   685
    "
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   686
! !
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   687
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   688
!FileDialog class methodsFor:'interface specs'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   689
321c1729db5b initial checkin
penk
parents:
diff changeset
   690
windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   691
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
   692
     by the UIPainter of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
   693
321c1729db5b initial checkin
penk
parents:
diff changeset
   694
    "Do not manually edit this!! If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
   695
     the UIPainter may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
   696
321c1729db5b initial checkin
penk
parents:
diff changeset
   697
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   698
     UIPainter new openOnClass:FileDialog andSelector:#windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   699
     FileDialog new openInterface:#windowSpec
321c1729db5b initial checkin
penk
parents:
diff changeset
   700
     FileDialog open
321c1729db5b initial checkin
penk
parents:
diff changeset
   701
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   702
321c1729db5b initial checkin
penk
parents:
diff changeset
   703
    <resource: #canvas>
321c1729db5b initial checkin
penk
parents:
diff changeset
   704
321c1729db5b initial checkin
penk
parents:
diff changeset
   705
    ^ 
5229
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   706
     #(FullSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   707
        name: windowSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   708
        window: 
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   709
       (WindowSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   710
          label: 'FileDialog'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   711
          name: 'FileDialog'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   712
          min: (Point 10 10)
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   713
          max: (Point 1024 768)
5853
88f64d56a279 initial focus
Claus Gittinger <cg@exept.de>
parents: 5823
diff changeset
   714
          bounds: (Rectangle 0 0 400 400)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   715
        )
5229
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   716
        component: 
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   717
       (SpecCollection
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   718
          collection: (
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   719
           (ViewSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   720
              name: 'FilePart'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   721
              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0)
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   722
              component: 
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   723
             (SpecCollection
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   724
                collection: (
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   725
                 (MenuPanelSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   726
                    name: 'ToolBar1'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   727
                    layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 30 0)
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   728
                    tabable: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   729
                    menu: toolBarMenu
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   730
                    textDefault: true
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   731
                  )
5229
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   732
                 (SubCanvasSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   733
                    name: 'DirectoryTreeBrowser'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   734
                    layout: (LayoutFrame 0 0.0 55 0 0 1.0 -30 1)
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   735
                    tabable: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   736
                    hasHorizontalScrollBar: false
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   737
                    hasVerticalScrollBar: false
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   738
                    majorKey: DirectoryTreeBrowser
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   739
                    createNewApplication: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   740
                    createNewBuilder: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   741
                    postBuildCallback: postBuildTreeBrowser:
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
                 (VariableHorizontalPanelSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   744
                    name: 'VariableHorizontalPanel1'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   745
                    layout: (LayoutFrame 0 0 30 0 0 1 55 0)
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   746
                    level: 1
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   747
                    showHandle: false
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   748
                    barLevel: 0
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   749
                    component: 
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   750
                   (SpecCollection
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   751
                      collection: (
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   752
                       (ViewSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   753
                          name: 'Box1'
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   754
                        )
5229
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   755
                       (ViewSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   756
                          name: 'Box2'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   757
                          component: 
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   758
                         (SpecCollection
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   759
                            collection: (
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   760
                             (LabelSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   761
                                label: 'Filter:'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   762
                                name: 'FilterLabel'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   763
                                layout: (LayoutFrame 8 0 2 0 59 0 -2 1)
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   764
                                translateLabel: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   765
                                adjust: right
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   766
                              )
5229
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   767
                             (InputFieldSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   768
                                name: 'FilterEntryField'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   769
                                layout: (LayoutFrame 60 0 -22 1 -2 1 -2 1)
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   770
                                model: filterHolder
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   771
                                immediateAccept: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   772
                                acceptOnReturn: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   773
                                acceptOnTab: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   774
                                acceptOnLostFocus: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   775
                                acceptOnPointerLeave: false
5853
88f64d56a279 initial focus
Claus Gittinger <cg@exept.de>
parents: 5823
diff changeset
   776
                                hasKeyboardFocusInitially: false
5229
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   777
                                postBuildCallback: postBuildFilterField:
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   778
                              )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   779
                             )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   780
                           
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   781
                          )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   782
                        )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   783
                       )
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   784
                     
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
   785
                    )
5229
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   786
                    handles: (Any 0.5 1.0)
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   787
                  )
5230
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   788
                 (LabelSpec
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   789
                    label: 'Filename:'
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   790
                    name: 'FilenameLabel'
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   791
                    layout: (LayoutFrame 3 0 -21 1 73 0 -1 1)
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   792
                    translateLabel: true
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   793
                    labelChannel: filenameLabelHolder
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   794
                    adjust: left
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   795
                  )
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   796
                 (FilenameInputFieldSpec
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   797
                    name: 'FilenameEntryField'
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   798
                    layout: (LayoutFrame 70 0 -21 1 -4 1 -1 1)
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   799
                    tabable: true
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   800
                    model: filenameHolder
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   801
                    immediateAccept: false
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   802
                    acceptOnPointerLeave: false
5853
88f64d56a279 initial focus
Claus Gittinger <cg@exept.de>
parents: 5823
diff changeset
   803
                    hasKeyboardFocusInitially: true
5230
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   804
                    postBuildCallback: postBuildFileNameField:
f81f386620c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5229
diff changeset
   805
                  )
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   806
                 )
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   807
               
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
   808
              )
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   809
            )
5229
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   810
           (HorizontalPanelViewSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   811
              name: 'ButtonPanel'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   812
              layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1)
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   813
              visibilityChannel: buttonPanelVisibleHolder
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   814
              horizontalLayout: fitSpace
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   815
              verticalLayout: center
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   816
              horizontalSpace: 3
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   817
              verticalSpace: 3
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   818
              reverseOrderIfOKAtLeft: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   819
              component: 
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   820
             (SpecCollection
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   821
                collection: (
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   822
                 (ActionButtonSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   823
                    label: 'Cancel'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   824
                    name: 'cancelButton'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   825
                    translateLabel: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   826
                    labelChannel: cancelLabelHolder
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   827
                    tabable: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   828
                    model: doCancel
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   829
                    extent: (Point 129 22)
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   830
                  )
5229
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   831
                 (ActionButtonSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   832
                    label: 'Append'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   833
                    name: 'appendButton'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   834
                    visibilityChannel: appendButtonVisibleHolder
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   835
                    translateLabel: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   836
                    labelChannel: appendLabelHolder
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   837
                    tabable: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   838
                    model: appendPressed
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   839
                    extent: (Point 129 22)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   840
                  )
5229
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   841
                 (ActionButtonSpec
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   842
                    label: 'OK'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   843
                    name: 'okButton'
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   844
                    translateLabel: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   845
                    labelChannel: okLabelHolder
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   846
                    tabable: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   847
                    model: okPressed
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   848
                    isDefault: true
Claus Gittinger <cg@exept.de>
parents: 5220
diff changeset
   849
                    extent: (Point 130 22)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   850
                  )
321c1729db5b initial checkin
penk
parents:
diff changeset
   851
                 )
321c1729db5b initial checkin
penk
parents:
diff changeset
   852
               
321c1729db5b initial checkin
penk
parents:
diff changeset
   853
              )
321c1729db5b initial checkin
penk
parents:
diff changeset
   854
            )
321c1729db5b initial checkin
penk
parents:
diff changeset
   855
           )
321c1729db5b initial checkin
penk
parents:
diff changeset
   856
         
321c1729db5b initial checkin
penk
parents:
diff changeset
   857
        )
321c1729db5b initial checkin
penk
parents:
diff changeset
   858
      )
321c1729db5b initial checkin
penk
parents:
diff changeset
   859
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   860
321c1729db5b initial checkin
penk
parents:
diff changeset
   861
!FileDialog class methodsFor:'menu specs'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   862
321c1729db5b initial checkin
penk
parents:
diff changeset
   863
toolBarMenu
321c1729db5b initial checkin
penk
parents:
diff changeset
   864
    "This resource specification was automatically generated
321c1729db5b initial checkin
penk
parents:
diff changeset
   865
     by the MenuEditor of ST/X."
321c1729db5b initial checkin
penk
parents:
diff changeset
   866
321c1729db5b initial checkin
penk
parents:
diff changeset
   867
    "Do not manually edit this!! If it is corrupted,
321c1729db5b initial checkin
penk
parents:
diff changeset
   868
     the MenuEditor may not be able to read the specification."
321c1729db5b initial checkin
penk
parents:
diff changeset
   869
321c1729db5b initial checkin
penk
parents:
diff changeset
   870
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   871
     MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu
321c1729db5b initial checkin
penk
parents:
diff changeset
   872
     (Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp
321c1729db5b initial checkin
penk
parents:
diff changeset
   873
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
   874
321c1729db5b initial checkin
penk
parents:
diff changeset
   875
    <resource: #menu>
321c1729db5b initial checkin
penk
parents:
diff changeset
   876
321c1729db5b initial checkin
penk
parents:
diff changeset
   877
    ^ 
321c1729db5b initial checkin
penk
parents:
diff changeset
   878
     #(#Menu
321c1729db5b initial checkin
penk
parents:
diff changeset
   879
        #(
321c1729db5b initial checkin
penk
parents:
diff changeset
   880
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   881
            #activeHelpKey: #directoryUp
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   882
            #enabled: #enableDirectoryUp
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   883
            #label: 'DirectoryUp'
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   884
            #itemValue: #doGoDirectoryUp
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   885
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   886
            #isButton: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   887
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #upArrow20x20Icon)
321c1729db5b initial checkin
penk
parents:
diff changeset
   888
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   889
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   890
            #label: ''
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   891
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   892
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   893
            #activeHelpKey: #directoryBack
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   894
            #enabled: #enableBack
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   895
            #label: 'Back'
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   896
            #itemValue: #doBack
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   897
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   898
            #isButton: true
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   899
            #submenuChannel: #menuDirHistoryBack
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   900
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #leftArrow20x20Icon)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   901
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   902
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   903
            #label: ''
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   904
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   905
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   906
            #activeHelpKey: #directoryForward
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   907
            #enabled: #enableForward
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   908
            #label: 'Forward'
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   909
            #itemValue: #doForward
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   910
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   911
            #isButton: true
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   912
            #submenuChannel: #menuDirHistoryForward
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
   913
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #rightArrow20x20Icon)
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   914
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   915
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   916
            #label: ''
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   917
          )
321c1729db5b initial checkin
penk
parents:
diff changeset
   918
         #(#MenuItem
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   919
            #activeHelpKey: #fileHome
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   920
            #enabled: #enableHome
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   921
            #label: 'Home'
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   922
            #itemValue: #doGotoHomeDirectory
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   923
            #translateLabel: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   924
            #isButton: true
321c1729db5b initial checkin
penk
parents:
diff changeset
   925
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #goHomeIcon)
321c1729db5b initial checkin
penk
parents:
diff changeset
   926
          )
3923
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   927
         #(#MenuItem
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   928
            #label: '-'
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   929
          )
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   930
         #(#MenuItem
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   931
            #label: 'New Directory'
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   932
            #itemValue: #newDirectory
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   933
            #translateLabel: true
3923
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   934
            #isButton: true
3956
617ef25f6d1e allow for loadDialog no fileoperations
penk
parents: 3953
diff changeset
   935
            #isVisible: #newDirectoryVisibilityHolder
3923
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   936
            #labelImage: #(#ResourceRetriever #AbstractFileBrowser #newDirectory20x20Icon)
2988fc3c88ab next stage
penk
parents: 3905
diff changeset
   937
          )
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   938
         )
321c1729db5b initial checkin
penk
parents:
diff changeset
   939
        nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   940
        nil
321c1729db5b initial checkin
penk
parents:
diff changeset
   941
      )
321c1729db5b initial checkin
penk
parents:
diff changeset
   942
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
   943
321c1729db5b initial checkin
penk
parents:
diff changeset
   944
!FileDialog methodsFor:'accessing'!
321c1729db5b initial checkin
penk
parents:
diff changeset
   945
3996
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   946
currentSelectedFiles
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   947
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   948
    | selectedFiles|
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   949
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   950
    selectedFiles := treeBrowser currentFileNameHolder value.
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   951
    ^ selectedFiles select:[:aFile| aFile isDirectory not].
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   952
!
17c9a6d10f75 *** empty log message ***
penk
parents: 3994
diff changeset
   953
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   954
directory
321c1729db5b initial checkin
penk
parents:
diff changeset
   955
    "return the value of the instance variable 'directory' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   956
321c1729db5b initial checkin
penk
parents:
diff changeset
   957
    ^ directory
321c1729db5b initial checkin
penk
parents:
diff changeset
   958
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   959
321c1729db5b initial checkin
penk
parents:
diff changeset
   960
directory:something
321c1729db5b initial checkin
penk
parents:
diff changeset
   961
    "set the value of the instance variable 'directory' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   962
321c1729db5b initial checkin
penk
parents:
diff changeset
   963
    directory := something.
321c1729db5b initial checkin
penk
parents:
diff changeset
   964
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   965
321c1729db5b initial checkin
penk
parents:
diff changeset
   966
initialText
321c1729db5b initial checkin
penk
parents:
diff changeset
   967
5598
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
   968
    initialText isNil ifTrue:[
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
   969
        ^ resources string:'File Dialog'.
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
   970
    ].
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
   971
    ^ resources string:initialText
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
   972
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   973
321c1729db5b initial checkin
penk
parents:
diff changeset
   974
initialText:something
321c1729db5b initial checkin
penk
parents:
diff changeset
   975
    "set the value of the instance variable 'initialText' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   976
321c1729db5b initial checkin
penk
parents:
diff changeset
   977
    initialText := something.
321c1729db5b initial checkin
penk
parents:
diff changeset
   978
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   979
321c1729db5b initial checkin
penk
parents:
diff changeset
   980
pattern
321c1729db5b initial checkin
penk
parents:
diff changeset
   981
    "return the value of the instance variable 'pattern' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   982
321c1729db5b initial checkin
penk
parents:
diff changeset
   983
    ^ pattern
321c1729db5b initial checkin
penk
parents:
diff changeset
   984
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   985
321c1729db5b initial checkin
penk
parents:
diff changeset
   986
pattern:something
321c1729db5b initial checkin
penk
parents:
diff changeset
   987
    "set the value of the instance variable 'pattern' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   988
321c1729db5b initial checkin
penk
parents:
diff changeset
   989
    pattern := something.
321c1729db5b initial checkin
penk
parents:
diff changeset
   990
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   991
321c1729db5b initial checkin
penk
parents:
diff changeset
   992
result
321c1729db5b initial checkin
penk
parents:
diff changeset
   993
    "return the value of the instance variable 'result' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
   994
321c1729db5b initial checkin
penk
parents:
diff changeset
   995
    ^ result
321c1729db5b initial checkin
penk
parents:
diff changeset
   996
!
321c1729db5b initial checkin
penk
parents:
diff changeset
   997
321c1729db5b initial checkin
penk
parents:
diff changeset
   998
result:something
321c1729db5b initial checkin
penk
parents:
diff changeset
   999
    "set the value of the instance variable 'result' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1000
321c1729db5b initial checkin
penk
parents:
diff changeset
  1001
    result := something.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1002
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1003
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1004
selectedDirectories
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1005
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1006
    | selectedFiles|
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1007
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1008
    selectedFiles := treeBrowser currentFileNameHolder value.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1009
    ^ selectedFiles select:[:aFile| aFile isDirectory].
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1010
!
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1011
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1012
startFilename
321c1729db5b initial checkin
penk
parents:
diff changeset
  1013
    "return the value of the instance variable 'startFilename' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1014
321c1729db5b initial checkin
penk
parents:
diff changeset
  1015
    startFilename isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1016
        startFilename := Filename currentDirectory asAbsoluteFilename.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1017
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1018
    ^ startFilename
321c1729db5b initial checkin
penk
parents:
diff changeset
  1019
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1020
321c1729db5b initial checkin
penk
parents:
diff changeset
  1021
startFilename:something
321c1729db5b initial checkin
penk
parents:
diff changeset
  1022
    "set the value of the instance variable 'startFilename' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1023
321c1729db5b initial checkin
penk
parents:
diff changeset
  1024
    startFilename := something.
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1025
! !
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1026
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1027
!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
  1028
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1029
asLoadDialog
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1030
    ^ self isLoadDialog
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1031
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1032
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1033
asLoadDialog:aBoolean
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1034
    self beLoadDialog:aBoolean
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1035
!
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1036
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1037
beLoadDialog:aBoolean
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1038
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1039
    isLoadDialog := aBoolean
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1040
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1041
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1042
doubleClickAction
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1043
    "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
  1044
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1045
    ^ doubleClickAction
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1046
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1047
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1048
doubleClickAction:something
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1049
    "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
  1050
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1051
    doubleClickAction := something.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1052
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1053
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1054
isLoadDialog
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1055
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1056
    ^ isLoadDialog ? true
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1057
!
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1058
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1059
multipleSelect
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1060
    ^ multipleSelect ? false
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1061
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1062
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1063
multipleSelect:aBoolean
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1064
    multipleSelect := aBoolean.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1065
    treeBrowser notNil ifTrue:[
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1066
        treeBrowser multipleSelect:aBoolean.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1067
    ].
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1068
! !
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1069
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1070
!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
  1071
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1072
addButton:aButton
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1073
    DialogBox defaultOKButtonAtLeft ifTrue:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1074
        (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
  1075
    ] ifFalse:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1076
        (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
  1077
    ].
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1078
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1079
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1080
okButton
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1081
    ^ (self componentAt:#okButton) 
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1082
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1083
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1084
treeBrowser
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1085
    "return the value of the instance variable 'treeBrowser' (automatically generated)"
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1086
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1087
    ^ treeBrowser
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1088
! !
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1089
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1090
!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
  1091
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1092
hideButtonPanel
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1093
    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
  1094
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1095
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1096
newDirectoryVisibilityHolder
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1097
    newDirectoryVisibilityHolder isNil ifTrue:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1098
        newDirectoryVisibilityHolder := true asValue.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1099
    ].
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1100
    ^ newDirectoryVisibilityHolder
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1101
!
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
showButtonPanel
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1104
    self buttonPanelVisibleHolder value:true
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1105
!
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1106
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1107
viewFiles
321c1729db5b initial checkin
penk
parents:
diff changeset
  1108
    "return the value of the instance variable 'viewFiles' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1109
321c1729db5b initial checkin
penk
parents:
diff changeset
  1110
    ^ viewFiles
321c1729db5b initial checkin
penk
parents:
diff changeset
  1111
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1112
321c1729db5b initial checkin
penk
parents:
diff changeset
  1113
viewFiles:something
321c1729db5b initial checkin
penk
parents:
diff changeset
  1114
    "set the value of the instance variable 'viewFiles' (automatically generated)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1115
321c1729db5b initial checkin
penk
parents:
diff changeset
  1116
    viewFiles := something.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1117
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1118
321c1729db5b initial checkin
penk
parents:
diff changeset
  1119
!FileDialog methodsFor:'aspects'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1120
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
  1121
appendButtonVisibleHolder
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
  1122
    appendButtonVisibleHolder isNil ifTrue:[
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
  1123
        appendButtonVisibleHolder := false asValue.
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
  1124
    ].
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
  1125
    ^ appendButtonVisibleHolder
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
  1126
!
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
  1127
5193
cc132f6bb560 appendLabelHolder was removed
penk
parents: 5189
diff changeset
  1128
appendLabelHolder
cc132f6bb560 appendLabelHolder was removed
penk
parents: 5189
diff changeset
  1129
    appendLabelHolder isNil ifTrue:[
cc132f6bb560 appendLabelHolder was removed
penk
parents: 5189
diff changeset
  1130
        appendLabelHolder := 'Append' asValue.
cc132f6bb560 appendLabelHolder was removed
penk
parents: 5189
diff changeset
  1131
    ].
cc132f6bb560 appendLabelHolder was removed
penk
parents: 5189
diff changeset
  1132
    ^ appendLabelHolder
cc132f6bb560 appendLabelHolder was removed
penk
parents: 5189
diff changeset
  1133
!
cc132f6bb560 appendLabelHolder was removed
penk
parents: 5189
diff changeset
  1134
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1135
aspectOrNil:aKey forSubApplication:aSubApp
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1136
    "this hook provides an aspect for a subApp"
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1137
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1138
    aKey == #currentFileNameHolder ifTrue:[
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1139
        directory notNil ifTrue:[
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1140
            ^ (OrderedCollection with:directory) asValue
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1141
        ]
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1142
    ].
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1143
    ^ nil
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1144
!
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1145
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1146
buttonPanelVisibleHolder
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1147
    buttonPanelVisibleHolder isNil ifTrue:[
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1148
        buttonPanelVisibleHolder := true asValue.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1149
        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
  1150
    ].
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1151
    ^ buttonPanelVisibleHolder.
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1152
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1153
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1154
cancelLabelHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1155
    "automatically generated by UIPainter ..."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1156
321c1729db5b initial checkin
penk
parents:
diff changeset
  1157
    "*** the code below creates a default model when invoked."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1158
    "*** (which may not be the one you wanted)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1159
    "*** Please change as required and accept it in the browser."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1160
    "*** (and replace this comment by something more useful ;-)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1161
321c1729db5b initial checkin
penk
parents:
diff changeset
  1162
    cancelLabelHolder isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1163
        cancelLabelHolder := 'Cancel' asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1164
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1165
    ^ cancelLabelHolder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1166
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1167
321c1729db5b initial checkin
penk
parents:
diff changeset
  1168
enableBack
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1169
    ^ treeBrowser enableBack.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1170
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1171
321c1729db5b initial checkin
penk
parents:
diff changeset
  1172
enableDirectoryUp
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1173
    ^ treeBrowser enableDirectoryUp.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1174
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1175
321c1729db5b initial checkin
penk
parents:
diff changeset
  1176
enableForward
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1177
    ^ treeBrowser enableForward.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1178
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1179
321c1729db5b initial checkin
penk
parents:
diff changeset
  1180
enableHome
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1181
    ^ treeBrowser enableHome.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1182
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1183
321c1729db5b initial checkin
penk
parents:
diff changeset
  1184
filenameHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1185
    "Return a value holder with the filename.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1186
     Shown in the filename input-field.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1187
     Being the selection in the tree.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1188
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
  1189
    |holder|
321c1729db5b initial checkin
penk
parents:
diff changeset
  1190
    holder := builder bindingAt:#filenameHolder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1191
321c1729db5b initial checkin
penk
parents:
diff changeset
  1192
    holder ifNil:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1193
        holder := ValueHolder new.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1194
        holder addDependent:self.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1195
        builder aspectAt:#filenameHolder 
321c1729db5b initial checkin
penk
parents:
diff changeset
  1196
                     put:holder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1197
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1198
321c1729db5b initial checkin
penk
parents:
diff changeset
  1199
    ^ holder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1200
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1201
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1202
filenameLabelHolder
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1203
    "Return a value holder for the input string.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1204
    "
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1205
    filenameLabelHolder isNil ifTrue:[
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1206
        filenameLabelHolder := 'Filename:' asValue.
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1207
    ].
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1208
    ^ filenameLabelHolder
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1209
!
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1210
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1211
filterHolder
4011
73fa35b1963b *** empty log message ***
penk
parents: 4005
diff changeset
  1212
    "Return a value holder for filter
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1213
    "
321c1729db5b initial checkin
penk
parents:
diff changeset
  1214
321c1729db5b initial checkin
penk
parents:
diff changeset
  1215
    filterHolder isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1216
        filterHolder := treeBrowser filterModel.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1217
        self pattern notNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1218
            filterHolder value:pattern.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1219
        ]
321c1729db5b initial checkin
penk
parents:
diff changeset
  1220
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1221
    ^ filterHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1222
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1223
321c1729db5b initial checkin
penk
parents:
diff changeset
  1224
okLabelHolder
321c1729db5b initial checkin
penk
parents:
diff changeset
  1225
    "automatically generated by UIPainter ..."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1226
321c1729db5b initial checkin
penk
parents:
diff changeset
  1227
    "*** the code below creates a default model when invoked."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1228
    "*** (which may not be the one you wanted)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1229
    "*** Please change as required and accept it in the browser."
321c1729db5b initial checkin
penk
parents:
diff changeset
  1230
    "*** (and replace this comment by something more useful ;-)"
321c1729db5b initial checkin
penk
parents:
diff changeset
  1231
321c1729db5b initial checkin
penk
parents:
diff changeset
  1232
    okLabelHolder isNil ifTrue:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1233
        okLabelHolder := 'OK' asValue.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1234
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1235
    ^ okLabelHolder.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1236
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1237
321c1729db5b initial checkin
penk
parents:
diff changeset
  1238
!FileDialog methodsFor:'change & update'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1239
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1240
buttonPanelVisibilityChanged
5598
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1241
    |filePart|
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1242
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1243
    filePart := builder componentAt:#FilePart.
5598
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1244
    filePart notNil ifTrue:[
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1245
        buttonPanelVisibleHolder value ifTrue:[
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1246
            filePart layout bottomOffset:-40
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1247
        ] ifFalse:[
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1248
            filePart layout bottomOffset:0
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1249
        ].
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1250
        filePart containerChangedSize    "/ force resize
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1251
   ]
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1252
!
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1253
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1254
update:something with:aParameter from:changedObject
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1255
    |files newFile newLabel fn|
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1256
321c1729db5b initial checkin
penk
parents:
diff changeset
  1257
    changedObject == treeBrowser currentFileNameHolder ifTrue:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1258
        files := changedObject value.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1259
321c1729db5b initial checkin
penk
parents:
diff changeset
  1260
        (files isEmpty) ifTrue:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1261
            newFile := nil.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1262
        ] ifFalse:[
321c1729db5b initial checkin
penk
parents:
diff changeset
  1263
            files size == 1 ifTrue:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1264
                newFile := files first.    
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1265
            ] ifFalse:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1266
                newFile := ''.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1267
            ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1268
        ].
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1269
        self filenameHolder value:newFile withoutNotifying:self.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1270
    ].
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1271
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1272
    changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1273
        changedObject value ifTrue:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1274
            newLabel := 'Filename:'.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1275
        ] ifFalse:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1276
            newLabel := 'Directory:'.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1277
        ].
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1278
        self filenameLabelHolder value:(resources string:newLabel)
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1279
    ].
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1280
    changedObject == self filenameHolder ifTrue:[
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1281
        fn := changedObject value asFilename.
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1282
        (fn exists) ifFalse:[^ self].
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1283
        treeBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self.
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1284
    ].
321c1729db5b initial checkin
penk
parents:
diff changeset
  1285
    ^ super update:something with:aParameter from:changedObject
321c1729db5b initial checkin
penk
parents:
diff changeset
  1286
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1287
321c1729db5b initial checkin
penk
parents:
diff changeset
  1288
!FileDialog methodsFor:'event handling'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1289
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1290
appendWasPressed
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1291
    "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
  1292
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1293
    ^ appendWasPressed
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1294
! !
321c1729db5b initial checkin
penk
parents:
diff changeset
  1295
321c1729db5b initial checkin
penk
parents:
diff changeset
  1296
!FileDialog methodsFor:'initialization & release'!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1297
321c1729db5b initial checkin
penk
parents:
diff changeset
  1298
postBuildFileNameField:aWidget
321c1729db5b initial checkin
penk
parents:
diff changeset
  1299
321c1729db5b initial checkin
penk
parents:
diff changeset
  1300
    filenameField := aWidget.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1301
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1302
321c1729db5b initial checkin
penk
parents:
diff changeset
  1303
postBuildFilterField:aWidget
321c1729db5b initial checkin
penk
parents:
diff changeset
  1304
321c1729db5b initial checkin
penk
parents:
diff changeset
  1305
    filterField := aWidget.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1306
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1307
321c1729db5b initial checkin
penk
parents:
diff changeset
  1308
postBuildTreeBrowser:aSubCanvasView
321c1729db5b initial checkin
penk
parents:
diff changeset
  1309
321c1729db5b initial checkin
penk
parents:
diff changeset
  1310
    treeBrowser := aSubCanvasView client.
321c1729db5b initial checkin
penk
parents:
diff changeset
  1311
!
321c1729db5b initial checkin
penk
parents:
diff changeset
  1312
4005
42f09ac0e0aa Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents: 3996
diff changeset
  1313
postBuildWith:aBuilder    
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1314
    treeBrowser multipleSelect:multipleSelect.
4603
49cca8deebde support an additional "append" button
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
  1315
    appendWasPressed := false.
5571
333ee892a087 thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents: 5375
diff changeset
  1316
333ee892a087 thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents: 5375
diff changeset
  1317
    (aBuilder componentAt:'cancelButton') cursor:(Cursor thumbsDown).
333ee892a087 thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents: 5375
diff changeset
  1318
    (aBuilder componentAt:'appendButton') cursor:(Cursor thumbsUp).
333ee892a087 thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents: 5375
diff changeset
  1319
    (aBuilder componentAt:'okButton') cursor:(Cursor thumbsUp).
333ee892a087 thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents: 5375
diff changeset
  1320
4005
42f09ac0e0aa Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents: 3996
diff changeset
  1321
    ^ super postBuildWith:aBuilder
42f09ac0e0aa Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents: 3996
diff changeset
  1322
!
42f09ac0e0aa Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents: 3996
diff changeset
  1323
4728
545cd2c65dfa hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  1324
postOpen
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1325
321c1729db5b initial checkin
penk
parents:
diff changeset
  1326
"/     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
  1327
5617
2b10cdfc8b38 oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents: 5598
diff changeset
  1328
    "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
  1329
    self window topView isModal ifFalse:[
2b10cdfc8b38 oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents: 5598
diff changeset
  1330
        self hideButtonPanel
2b10cdfc8b38 oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents: 5598
diff changeset
  1331
    ].
2b10cdfc8b38 oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents: 5598
diff changeset
  1332
3892
321c1729db5b initial checkin
penk
parents:
diff changeset
  1333
    treeBrowser currentFileNameHolder addDependent:self.
5598
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1334
    treeBrowser doubleClickAction:self doubleClickAction.
3904
7f20fe941a4c add requestFilenames method
penk
parents: 3892
diff changeset
  1335
    treeBrowser viewFilesInDirectoryTree addDependent:self.
3982
fc30449d705d *** empty log message ***
penk
parents: 3960
diff changeset
  1336
    treeBrowser rootHolder value:((self directory) ? (Filename currentDirectory asAbsoluteFilename)).
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1337
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1338
    treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true).
4796
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1339
    treeBrowser viewFilesInDirectoryTree changed.
5598
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1340
    treeBrowser currentFileNameHolder value:(OrderedCollection with:self startFilename).
4804
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1341
406ea13c6b0a initial selection;
Claus Gittinger <cg@exept.de>
parents: 4796
diff changeset
  1342
    self isLoadDialog ifTrue:[
4796
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1343
        treeBrowser newVisibilityHolder value:false.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1344
        treeBrowser allowFileOperations value:false.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1345
        self newDirectoryVisibilityHolder value:false.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1346
    ].
5598
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1347
    self filenameHolder value:self startFilename.
5b48cc4c1ef6 Fix for hideButtonPanel
Stefan Vogel <sv@exept.de>
parents: 5571
diff changeset
  1348
    self window label:self initialText.
4796
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1349
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1350
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1351
postOpenAsSubcanvasWith:aBuilder    
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1352
    self postOpen.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1353
    ^ super postOpenAsSubcanvasWith:aBuilder
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1354
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1355
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1356
postOpenWith:aBuilder    
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1357
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1358
    self postOpen.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1359
    ^ super postOpenWith:aBuilder.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1360
! !
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1361
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1362
!FileDialog methodsFor:'private'!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1363
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1364
returnWasPressedInFilterField
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1365
    |ev|
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1366
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1367
    ev := self windowGroup lastEvent.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1368
    (ev notNil 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1369
    and:[ev isKeyEvent 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1370
    and:[ev key == #Return
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1371
    and:[(   ev targetView isSameOrComponentOf:filterField) 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1372
         or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1373
        ^ true
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1374
    ].
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1375
    ^ false
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1376
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1377
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1378
returnWasPressedInFilterOrFilenameField
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1379
    |ev|
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1380
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1381
    ev := self windowGroup lastEvent.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1382
    (ev notNil 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1383
    and:[ev isKeyEvent 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1384
    and:[ev key == #Return
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1385
    and:[(   ev targetView isSameOrComponentOf:filterField) 
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1386
         or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1387
        ^ true
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
    ^ false
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1390
! !
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1391
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1392
!FileDialog methodsFor:'user actions'!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1393
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1394
appendPressed
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1395
    appendWasPressed := true.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1396
    self commonAcceptAction.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1397
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1398
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1399
commonAcceptAction
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1400
    filenameField accept.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1401
    self result:(self filenameHolder value asString).
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1402
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1403
    ^ super doAccept
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1404
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1405
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1406
doAccept
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1407
    "force accept - ignore in filterField"
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1408
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1409
    self returnWasPressedInFilterField ifTrue:[
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1410
        ^ self
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1411
    ].
4996
5927cc0508e8 close the editor in treebrowser on rename if ENTER is pressed
penk
parents: 4824
diff changeset
  1412
    treeBrowser hasOpenEditor ifTrue:[
5927cc0508e8 close the editor in treebrowser on rename if ENTER is pressed
penk
parents: 4824
diff changeset
  1413
        "/ 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
  1414
        treeBrowser browser closeEditor.
5927cc0508e8 close the editor in treebrowser on rename if ENTER is pressed
penk
parents: 4824
diff changeset
  1415
        ^ self
5927cc0508e8 close the editor in treebrowser on rename if ENTER is pressed
penk
parents: 4824
diff changeset
  1416
    ].
4796
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1417
    appendWasPressed := false.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1418
    self commonAcceptAction.
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
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1421
doBack
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1422
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1423
    treeBrowser doBack.
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
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1426
doCancel
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1427
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1428
    self result:nil.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1429
    ^ super doCancel.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1430
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1431
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1432
doForward
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1433
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1434
    treeBrowser doForward.
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
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1437
doGoDirectoryUp
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
    treeBrowser doGoDirectoryUp.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1440
!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1441
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1442
doGotoHomeDirectory
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1443
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1444
    treeBrowser doGotoHomeDirectory.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1445
!
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
menuDirHistory:backOrForward
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
    ^ treeBrowser menuDirHistory:backOrForward.
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1450
!
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
menuDirHistoryBack
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1453
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1454
    ^ treeBrowser menuDirHistory:#back.
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
menuDirHistoryForward
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1458
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1459
    ^ treeBrowser menuDirHistory:#forward.
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
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1462
newDirectory
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
    ^ treeBrowser newDirectory
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1465
!
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
okPressed
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1468
    self doAccept
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1469
! !
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1470
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1471
!FileDialog class methodsFor:'documentation'!
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1472
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1473
version
5853
88f64d56a279 initial focus
Claus Gittinger <cg@exept.de>
parents: 5823
diff changeset
  1474
    ^ '$Header: /cvs/stx/stx/libtool/FileDialog.st,v 1.57 2004-05-17 16:54:01 cg Exp $'
4796
9131f6780fb5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4795
diff changeset
  1475
! !