FileSelectionBrowser.st
author ca
Mon, 24 Jan 2000 16:34:28 +0100
changeset 1305 3aa9dab59633
parent 1260 6f81c1d73e75
child 1353 701e41f8ff9f
permissions -rw-r--r--
use the canvasHolder in Notebook
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
404
35982cf1482f initial checkin
tz
parents:
diff changeset
     1
"
502
624dc714fd69 copyright changed
tz
parents: 468
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
404
35982cf1482f initial checkin
tz
parents:
diff changeset
     3
              All Rights Reserved
35982cf1482f initial checkin
tz
parents:
diff changeset
     4
35982cf1482f initial checkin
tz
parents:
diff changeset
     5
 This software is furnished under a license and may be used
35982cf1482f initial checkin
tz
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
35982cf1482f initial checkin
tz
parents:
diff changeset
     7
 inclusion of the above copyright notice. This software may not
35982cf1482f initial checkin
tz
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
35982cf1482f initial checkin
tz
parents:
diff changeset
     9
 other person. No title to or ownership of the software is
35982cf1482f initial checkin
tz
parents:
diff changeset
    10
 hereby transferred.
35982cf1482f initial checkin
tz
parents:
diff changeset
    11
"
35982cf1482f initial checkin
tz
parents:
diff changeset
    12
35982cf1482f initial checkin
tz
parents:
diff changeset
    13
35982cf1482f initial checkin
tz
parents:
diff changeset
    14
35982cf1482f initial checkin
tz
parents:
diff changeset
    15
SelectionBrowser subclass:#FileSelectionBrowser
35982cf1482f initial checkin
tz
parents:
diff changeset
    16
	instanceVariableNames:'selectedFileFilter directoryView listOfFileFilters directory'
35982cf1482f initial checkin
tz
parents:
diff changeset
    17
	classVariableNames:''
35982cf1482f initial checkin
tz
parents:
diff changeset
    18
	poolDictionaries:''
619
36c9d07f7dc3 class category changed
tz
parents: 615
diff changeset
    19
	category:'Interface-Dialogs'
404
35982cf1482f initial checkin
tz
parents:
diff changeset
    20
!
35982cf1482f initial checkin
tz
parents:
diff changeset
    21
35982cf1482f initial checkin
tz
parents:
diff changeset
    22
!FileSelectionBrowser class methodsFor:'documentation'!
35982cf1482f initial checkin
tz
parents:
diff changeset
    23
35982cf1482f initial checkin
tz
parents:
diff changeset
    24
copyright
35982cf1482f initial checkin
tz
parents:
diff changeset
    25
"
502
624dc714fd69 copyright changed
tz
parents: 468
diff changeset
    26
 COPYRIGHT (c) 1997 by eXept Software AG
404
35982cf1482f initial checkin
tz
parents:
diff changeset
    27
              All Rights Reserved
35982cf1482f initial checkin
tz
parents:
diff changeset
    28
35982cf1482f initial checkin
tz
parents:
diff changeset
    29
 This software is furnished under a license and may be used
35982cf1482f initial checkin
tz
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
35982cf1482f initial checkin
tz
parents:
diff changeset
    31
 inclusion of the above copyright notice. This software may not
35982cf1482f initial checkin
tz
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
35982cf1482f initial checkin
tz
parents:
diff changeset
    33
 other person. No title to or ownership of the software is
35982cf1482f initial checkin
tz
parents:
diff changeset
    34
 hereby transferred.
35982cf1482f initial checkin
tz
parents:
diff changeset
    35
"
35982cf1482f initial checkin
tz
parents:
diff changeset
    36
35982cf1482f initial checkin
tz
parents:
diff changeset
    37
35982cf1482f initial checkin
tz
parents:
diff changeset
    38
!
35982cf1482f initial checkin
tz
parents:
diff changeset
    39
35982cf1482f initial checkin
tz
parents:
diff changeset
    40
documentation
35982cf1482f initial checkin
tz
parents:
diff changeset
    41
"
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    42
    The FileSelectionBrowser allows you to browse in file directories
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    43
    and to select files in order to load file contents or to save
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    44
    something to files.
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    45
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    46
    [start with:]
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    47
        FileSelectionBrowser open
502
624dc714fd69 copyright changed
tz
parents: 468
diff changeset
    48
624dc714fd69 copyright changed
tz
parents: 468
diff changeset
    49
    [author:]
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    50
        Thomas Zwick, eXept Software AG
404
35982cf1482f initial checkin
tz
parents:
diff changeset
    51
"
35982cf1482f initial checkin
tz
parents:
diff changeset
    52
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
    53
35982cf1482f initial checkin
tz
parents:
diff changeset
    54
!FileSelectionBrowser class methodsFor:'instance creation'!
35982cf1482f initial checkin
tz
parents:
diff changeset
    55
35982cf1482f initial checkin
tz
parents:
diff changeset
    56
request: aTitle fileName: aFileName inDirectory: dir withFileFilters: fileFilters
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    57
    ^self new
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    58
        title: aTitle;
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    59
        fileName: aFileName;
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    60
        directory: dir;
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    61
        listOfFileFilters: fileFilters;
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    62
        open
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    63
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    64
    "
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    65
    self 
404
35982cf1482f initial checkin
tz
parents:
diff changeset
    66
        request: 'Select Your Profile File' 
35982cf1482f initial checkin
tz
parents:
diff changeset
    67
        fileName: '.profile' 
35982cf1482f initial checkin
tz
parents:
diff changeset
    68
        inDirectory: Filename homeDirectory 
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    69
        withFileFilters: #('.*')
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    70
    "
404
35982cf1482f initial checkin
tz
parents:
diff changeset
    71
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    72
    "Modified: / 17.8.1998 / 10:15:50 / cg"
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    73
!
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    74
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    75
request: aTitle fileName: aFileName withFileFilters: fileFilters
404
35982cf1482f initial checkin
tz
parents:
diff changeset
    76
    ^self new
35982cf1482f initial checkin
tz
parents:
diff changeset
    77
        title: aTitle;
35982cf1482f initial checkin
tz
parents:
diff changeset
    78
        fileName: aFileName;
35982cf1482f initial checkin
tz
parents:
diff changeset
    79
        listOfFileFilters: fileFilters;
35982cf1482f initial checkin
tz
parents:
diff changeset
    80
        open
35982cf1482f initial checkin
tz
parents:
diff changeset
    81
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    82
    "
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    83
    self 
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    84
        request: 'Select Your Profile File' 
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    85
        fileName: '/etc/fstab' 
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    86
        withFileFilters: #('*')  
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    87
    "
462
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    88
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    89
    "Modified: / 17.8.1998 / 10:15:50 / cg"
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    90
!
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    91
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    92
request: aTitle pathName: aPath withFileFilters: fileFilters
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    93
    ^self new
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    94
        title: aTitle;
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    95
        directory: aPath;
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    96
        listOfFileFilters: fileFilters;
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    97
        open
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
    98
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
    99
    "
871
45c6d4418ae6 checkin from browser
tz
parents: 745
diff changeset
   100
    self 
45c6d4418ae6 checkin from browser
tz
parents: 745
diff changeset
   101
        request: 'Select A File' 
45c6d4418ae6 checkin from browser
tz
parents: 745
diff changeset
   102
        pathName: '/etc' 
45c6d4418ae6 checkin from browser
tz
parents: 745
diff changeset
   103
        withFileFilters: #('*.conf')
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   104
    "
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   105
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   106
    "Modified: / 17.8.1998 / 10:15:50 / cg"
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   107
!
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   108
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   109
request: aTitle withFileFilters: fileFilters
1087
60922fe52470 comment
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   110
    ^ self new
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   111
        title: aTitle;
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   112
        listOfFileFilters: fileFilters;
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   113
        open
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   114
    "
1087
60922fe52470 comment
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   115
    self request: 'Select A File' withFileFilters: #('.*')
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   116
    "
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   117
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   118
    "Modified: / 17.8.1998 / 10:15:49 / cg"
462
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
   119
!
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
   120
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   121
requestFileName
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   122
    ^self new title: 'Select A File'; open
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   123
    "
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   124
    self requestFileName
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   125
    "
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   126
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   127
    "Modified: / 17.8.1998 / 10:15:48 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   128
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   129
35982cf1482f initial checkin
tz
parents:
diff changeset
   130
!FileSelectionBrowser class methodsFor:'accessing'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   131
35982cf1482f initial checkin
tz
parents:
diff changeset
   132
loadImageFileNameFilters
992
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   133
    ^ OrderedCollection 
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   134
        withAll: #(
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   135
                    '*.xpm ; *.xbm ; *.gif ; *.tif ; *.tiff ; *.bmp ; *.jpeg ; *.jpg'
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   136
                    '*'
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   137
                  )
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   138
992
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   139
    "Modified: / 12.9.1998 / 17:23:42 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   140
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   141
35982cf1482f initial checkin
tz
parents:
diff changeset
   142
projectFileNameFilters
992
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   143
    ^Array withAll: #(
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   144
                      '*.st ; *.*o ; *.s ; *.c ; Make* ; *.project'
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   145
                      '*'
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   146
                     )
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   147
992
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   148
    "Modified: / 12.9.1998 / 17:23:22 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   149
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   150
35982cf1482f initial checkin
tz
parents:
diff changeset
   151
saveImageFileNameFilters
992
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   152
    ^ OrderedCollection 
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   153
        withAll: #(
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   154
                    '*.xpm ; *.xbm ; *.gif ; *.tif ; *.tiff ; *.bmp'
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   155
                    '*'
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   156
                  )
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   157
992
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   158
    "Modified: / 12.9.1998 / 17:23:54 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   159
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   160
35982cf1482f initial checkin
tz
parents:
diff changeset
   161
!FileSelectionBrowser class methodsFor:'interface specs'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   162
35982cf1482f initial checkin
tz
parents:
diff changeset
   163
windowSpec
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   164
    "This resource specification was automatically generated
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   165
     by the UIPainter of ST/X."
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   166
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   167
    "Do not manually edit this!! If it is corrupted,
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   168
     the UIPainter may not be able to read the specification."
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   169
35982cf1482f initial checkin
tz
parents:
diff changeset
   170
    "
35982cf1482f initial checkin
tz
parents:
diff changeset
   171
     UIPainter new openOnClass:FileSelectionBrowser andSelector:#windowSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   172
     FileSelectionBrowser new openInterface:#windowSpec
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   173
     FileSelectionBrowser open
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   174
    "
35982cf1482f initial checkin
tz
parents:
diff changeset
   175
35982cf1482f initial checkin
tz
parents:
diff changeset
   176
    <resource: #canvas>
35982cf1482f initial checkin
tz
parents:
diff changeset
   177
1260
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   178
    ^ 
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   179
     #(#FullSpec
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   180
        #name: #windowSpec
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   181
        #window: 
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   182
       #(#WindowSpec
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   183
          #label: 'File Selection Browser'
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   184
          #name: 'File Selection Browser'
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   185
          #min: #(#Point 10 10)
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   186
          #max: #(#Point 1152 900)
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   187
          #bounds: #(#Rectangle 18 51 618 401)
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   188
        )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   189
        #component: 
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   190
       #(#SpecCollection
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   191
          #collection: #(
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   192
           #(#VariableHorizontalPanelSpec
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   193
              #name: 'panel'
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   194
              #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -40 1.0)
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   195
              #component: 
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   196
             #(#SpecCollection
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   197
                #collection: #(
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   198
                 #(#ViewSpec
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   199
                    #name: 'view1'
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   200
                    #component: 
1260
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   201
                   #(#SpecCollection
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   202
                      #collection: #(
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   203
                       #(#FileSelectionTreeSpec
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   204
                          #name: 'directoryTreeView'
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   205
                          #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -25 1.0)
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   206
                          #model: #selectionOfDirectory
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   207
                          #hasHorizontalScrollBar: true
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   208
                          #hasVerticalScrollBar: true
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   209
                          #miniScrollerHorizontal: true
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   210
                          #showDirectoryIndicatorForRoot: false
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   211
                          #showDirectoryIndicator: true
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   212
                          #valueChangeSelector: #readDirectory
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   213
                          #hierarchicalList: #rootOfDirectory
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   214
                          #highlightMode: #line
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   215
                          #itemClass: 'Directory'
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   216
                        )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   217
                       #(#InputFieldSpec
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   218
                          #name: 'directoryInputField'
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   219
                          #layout: #(#LayoutFrame 2 0.0 -22 1 0 1.0 0 1)
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   220
                          #model: #selectionOfDirectory
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   221
                          #immediateAccept: false
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   222
                          #acceptOnPointerLeave: false
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   223
                        )
1260
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   224
                       )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   225
                     
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   226
                    )
1260
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   227
                  )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   228
                 #(#ViewSpec
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   229
                    #name: 'view2'
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   230
                    #component: 
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   231
                   #(#SpecCollection
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   232
                      #collection: #(
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   233
                       #(#InputFieldSpec
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   234
                          #name: 'EditField'
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   235
                          #layout: #(#LayoutFrame 1 0.0 -22 1 -2 1.0 0 1)
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   236
                          #model: #valueOfFileName
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   237
                          #acceptOnReturn: false
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   238
                          #acceptOnTab: false
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   239
                          #acceptOnPointerLeave: false
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   240
                        )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   241
                       #(#SubCanvasSpec
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   242
                          #name: 'subCanvas1'
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   243
                          #layout: #(#LayoutFrame 1 0.0 0 0.0 0 1.0 -25 1.0)
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   244
                          #clientHolder: #directoryView
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   245
                        )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   246
                       )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   247
                     
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   248
                    )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   249
                  )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   250
                 )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   251
               
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   252
              )
1260
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   253
              #handles: #(#Any 0.5 1.0)
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   254
            )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   255
           #(#UISubSpecification
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   256
              #name: 'SubSpecification'
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   257
              #layout: #(#LayoutFrame 2 0.0 -32 1 0 1.0 0 1.0)
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   258
              #majorKey: #ToolApplicationModel
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   259
              #minorKey: #windowSpecForCommitWithoutChannels
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   260
            )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   261
           )
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   262
         
6f81c1d73e75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   263
        )
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   264
      )
35982cf1482f initial checkin
tz
parents:
diff changeset
   265
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   266
35982cf1482f initial checkin
tz
parents:
diff changeset
   267
!FileSelectionBrowser methodsFor:'accessing'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   268
35982cf1482f initial checkin
tz
parents:
diff changeset
   269
directory: aDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   270
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   271
    directory := (aDirectory ? Filename currentDirectory) asFilename asAbsoluteFilename pathName
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   272
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   273
    "Modified: / 17.8.1998 / 10:15:53 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   274
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   275
35982cf1482f initial checkin
tz
parents:
diff changeset
   276
directoryView
998
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   277
    "return the directory view on the right side (a subcanvas)"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   278
35982cf1482f initial checkin
tz
parents:
diff changeset
   279
    ^directoryView ? (directoryView := DirectoryView new)
998
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   280
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   281
    "Modified: / 23.9.1998 / 16:46:50 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   282
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   283
35982cf1482f initial checkin
tz
parents:
diff changeset
   284
fileName: aFileName
1003
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   285
    |prevDir|
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   286
35982cf1482f initial checkin
tz
parents:
diff changeset
   287
    self valueOfFileName value: (aFileName ? '') asFilename baseName.
1003
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   288
    prevDir := directory.
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   289
    directory := directory ? ((aFileName ? '') asFilename asAbsoluteFilename directoryName).
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   290
1003
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   291
    "/ on systems with volumes, we might have to update
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   292
    "/ the root here.
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   293
    (prevDir isNil
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   294
    or:[directory asFilename volume ~= prevDir asFilename volume]) ifTrue:[
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   295
        self setRootForFile:directory asFilename.
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   296
    ].
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   297
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   298
    "Modified: / 24.9.1998 / 23:41:08 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   299
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   300
35982cf1482f initial checkin
tz
parents:
diff changeset
   301
listOfFileFilters: anArray
35982cf1482f initial checkin
tz
parents:
diff changeset
   302
35982cf1482f initial checkin
tz
parents:
diff changeset
   303
    listOfFileFilters := anArray
35982cf1482f initial checkin
tz
parents:
diff changeset
   304
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   305
35982cf1482f initial checkin
tz
parents:
diff changeset
   306
!FileSelectionBrowser methodsFor:'accessing - views'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   307
592
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   308
directoryInputField
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   309
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   310
    ^builder componentAt: #directoryInputField
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   311
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   312
!
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   313
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   314
directoryTreeView
35982cf1482f initial checkin
tz
parents:
diff changeset
   315
35982cf1482f initial checkin
tz
parents:
diff changeset
   316
    ^builder componentAt: #directoryTreeView
35982cf1482f initial checkin
tz
parents:
diff changeset
   317
35982cf1482f initial checkin
tz
parents:
diff changeset
   318
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   319
35982cf1482f initial checkin
tz
parents:
diff changeset
   320
!FileSelectionBrowser methodsFor:'aspects'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   321
35982cf1482f initial checkin
tz
parents:
diff changeset
   322
rootOfDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   323
35982cf1482f initial checkin
tz
parents:
diff changeset
   324
    |holder|
35982cf1482f initial checkin
tz
parents:
diff changeset
   325
    (holder := builder bindingAt:#rootOfDirectory) isNil ifTrue:[
998
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   326
        builder 
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   327
            aspectAt:#rootOfDirectory 
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   328
            put: (holder :=  Filename rootDirectory name asValue).
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   329
    ].
35982cf1482f initial checkin
tz
parents:
diff changeset
   330
    ^ holder
35982cf1482f initial checkin
tz
parents:
diff changeset
   331
1011
b3be5697d26f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1005
diff changeset
   332
    "Modified: / 5.10.1998 / 12:46:10 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   333
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   334
35982cf1482f initial checkin
tz
parents:
diff changeset
   335
selectionOfDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   336
35982cf1482f initial checkin
tz
parents:
diff changeset
   337
    |holder|
35982cf1482f initial checkin
tz
parents:
diff changeset
   338
    (holder := builder bindingAt:#selectionOfDirectory) isNil ifTrue:[
35982cf1482f initial checkin
tz
parents:
diff changeset
   339
        builder aspectAt:#selectionOfDirectory put: (holder := ValueHolder new)
35982cf1482f initial checkin
tz
parents:
diff changeset
   340
    ].
35982cf1482f initial checkin
tz
parents:
diff changeset
   341
    ^ holder
35982cf1482f initial checkin
tz
parents:
diff changeset
   342
35982cf1482f initial checkin
tz
parents:
diff changeset
   343
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   344
998
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   345
setRootForFile:aFilename
1144
480d64f9ad81 removed unused local
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   346
    |f root parent|
1000
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   347
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   348
    f := aFilename asFilename.
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   349
    root := Filename rootDirectoryOnVolume:f volume.
1001
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   350
    self directory:aFilename.
1000
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   351
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   352
    "/ on some systems, the root itself is not readable,
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   353
    "/ but subdirs are (WIN32-network drives and VMS)
1001
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   354
    "/ to avoid trouble in the treeView, search for the
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   355
    "/ last readable directory and fake that as the trees root.
1000
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   356
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   357
    (root exists and:[root isDirectory and:[root isReadable]])
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   358
    ifFalse:[
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   359
        "/ search backward from aFilename for the last readable dir.
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   360
        root := f.
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   361
        parent := root directory.
1005
0b2b698bc4f3 oops - avoid endless loop when alking dir-hierarchy up.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   362
        [parent ~= root
0b2b698bc4f3 oops - avoid endless loop when alking dir-hierarchy up.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   363
         and:[parent exists 
0b2b698bc4f3 oops - avoid endless loop when alking dir-hierarchy up.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   364
         and:[parent isDirectory 
0b2b698bc4f3 oops - avoid endless loop when alking dir-hierarchy up.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   365
         and:[parent isReadable]]]]
1000
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   366
        whileTrue:[
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   367
            root := parent.
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   368
            parent := root directory.
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   369
        ].
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   370
    ].
efafa57e0313 kludge for win32 in #setRootForFile:
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   371
1011
b3be5697d26f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1005
diff changeset
   372
    self rootOfDirectory value:root pathName
998
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   373
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   374
    "Created: / 23.9.1998 / 16:36:28 / cg"
1011
b3be5697d26f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1005
diff changeset
   375
    "Modified: / 5.10.1998 / 12:46:06 / cg"
998
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   376
!
ad33f2625598 care for volume changes in directory field.
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   377
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   378
valueOfFileName
35982cf1482f initial checkin
tz
parents:
diff changeset
   379
35982cf1482f initial checkin
tz
parents:
diff changeset
   380
    |holder|
35982cf1482f initial checkin
tz
parents:
diff changeset
   381
    (holder := builder bindingAt:#valueOfFileName) isNil ifTrue:[
35982cf1482f initial checkin
tz
parents:
diff changeset
   382
        builder aspectAt:#valueOfFileName put:(holder :=  ValueHolder new).
35982cf1482f initial checkin
tz
parents:
diff changeset
   383
    ].
35982cf1482f initial checkin
tz
parents:
diff changeset
   384
    ^ holder
35982cf1482f initial checkin
tz
parents:
diff changeset
   385
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   386
35982cf1482f initial checkin
tz
parents:
diff changeset
   387
!FileSelectionBrowser methodsFor:'callbacks'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   388
35982cf1482f initial checkin
tz
parents:
diff changeset
   389
fileDoubleClicked: aFileName
35982cf1482f initial checkin
tz
parents:
diff changeset
   390
35982cf1482f initial checkin
tz
parents:
diff changeset
   391
    self valueOfFileName value: aFileName.
35982cf1482f initial checkin
tz
parents:
diff changeset
   392
    accept value: true.
1035
25575d9c0fc5 replace send of #close with #closeRequest.
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
   393
    self closeRequest
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   394
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   395
35982cf1482f initial checkin
tz
parents:
diff changeset
   396
readDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   397
592
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   398
    self directoryTreeView selection notNil 
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   399
    ifTrue: 
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   400
    [
1001
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   401
        directoryView directory: self selectionOfDirectory value.
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   402
        directoryView readDirectory.  
745
d3995881fa13 some changes for instancing
tz
parents: 626
diff changeset
   403
        self class lastSelection notNil ifTrue: [self class lastSelection: self selectionOfDirectory value]
592
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   404
    ]
1001
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   405
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   406
    "Modified: / 24.9.1998 / 21:58:50 / cg"
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   407
! !
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   408
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   409
!FileSelectionBrowser methodsFor:'misc'!
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   410
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   411
entryCompletion
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   412
    |completedDirectory f dir treeView inputField|
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   413
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   414
    treeView := self directoryTreeView.
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   415
    inputField := self directoryInputField.
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   416
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   417
    f := inputField contents.
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   418
    dir := f asFilename directoryName.
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   419
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   420
    (completedDirectory := Filename 
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   421
        filenameCompletionFor:f
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   422
        directory:dir
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   423
        directoriesOnly:true 
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   424
        filesOnly:false 
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   425
        ifMultiple:
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   426
        [:dir | 
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   427
            treeView selection notNil ifTrue:[
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   428
                treeView selectedNodeExpand: true
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   429
            ]
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   430
        ]) asFilename exists
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   431
    ifTrue:
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   432
    [
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   433
        "/ volume changed ... (win32 or VMS)
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   434
        completedDirectory asFilename volume ~= directory asFilename volume ifTrue:[
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   435
            self setRootForFile:completedDirectory asFilename.
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   436
        ].
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   437
        treeView selectPathname: completedDirectory.
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   438
        inputField contents: completedDirectory.
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   439
"/            self directoryTreeView selectPathname: completedDirectory.
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   440
        self readDirectory
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   441
    ] ifFalse: [
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   442
        inputField flash
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   443
    ]
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   444
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   445
    "Created: / 24.9.1998 / 21:33:37 / cg"
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   446
    "Modified: / 24.9.1998 / 22:20:23 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   447
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   448
35982cf1482f initial checkin
tz
parents:
diff changeset
   449
!FileSelectionBrowser methodsFor:'startup / release'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   450
35982cf1482f initial checkin
tz
parents:
diff changeset
   451
closeCancel
35982cf1482f initial checkin
tz
parents:
diff changeset
   452
35982cf1482f initial checkin
tz
parents:
diff changeset
   453
    directoryView release.
35982cf1482f initial checkin
tz
parents:
diff changeset
   454
    super closeCancel
35982cf1482f initial checkin
tz
parents:
diff changeset
   455
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   456
35982cf1482f initial checkin
tz
parents:
diff changeset
   457
closeRequest
35982cf1482f initial checkin
tz
parents:
diff changeset
   458
35982cf1482f initial checkin
tz
parents:
diff changeset
   459
    directoryView release.
35982cf1482f initial checkin
tz
parents:
diff changeset
   460
    super closeRequest
35982cf1482f initial checkin
tz
parents:
diff changeset
   461
35982cf1482f initial checkin
tz
parents:
diff changeset
   462
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   463
35982cf1482f initial checkin
tz
parents:
diff changeset
   464
open
35982cf1482f initial checkin
tz
parents:
diff changeset
   465
35982cf1482f initial checkin
tz
parents:
diff changeset
   466
    super open.
515
1b64e990e495 Fix copyright.
Stefan Vogel <sv@exept.de>
parents: 502
diff changeset
   467
    accept value ifTrue:[
1b64e990e495 Fix copyright.
Stefan Vogel <sv@exept.de>
parents: 502
diff changeset
   468
        ^ (self selectionOfDirectory value ? '') asFilename 
1b64e990e495 Fix copyright.
Stefan Vogel <sv@exept.de>
parents: 502
diff changeset
   469
                constructString:(self valueOfFileName value ? '')
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   470
    ].
515
1b64e990e495 Fix copyright.
Stefan Vogel <sv@exept.de>
parents: 502
diff changeset
   471
    ^ nil
957
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   472
c09018dc6954 comments
Claus Gittinger <cg@exept.de>
parents: 923
diff changeset
   473
    "Modified: / 17.8.1998 / 10:15:55 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   474
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   475
35982cf1482f initial checkin
tz
parents:
diff changeset
   476
postBuildWith:aBuilder
1003
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   477
    |nm file|
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   478
35982cf1482f initial checkin
tz
parents:
diff changeset
   479
    directoryView listOfFileFilters: listOfFileFilters ? #('*').
462
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
   480
    directoryView fileSelectAction: [:aFileName |self valueOfFileName value: aFileName asFilename baseName].
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
   481
    directoryView fileDoubleClickAction: [:aFileName |self fileDoubleClicked: aFileName asFilename baseName].
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   482
    directoryView fileFilterSelectAction: [:fileFilter|
992
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   483
"/        CG: obscure code - isn't the code below the same as ?
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   484
"/        self valueOfFileName value:((self valueOfFileName value ? 'unknown') 
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   485
"/                                    asFilename
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   486
"/                                        withSuffix:(fileFilter asFilename suffix))
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   487
        self valueOfFileName value: (
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   488
            ((self valueOfFileName value ? 'unknown') readStream upTo: $.), '.',
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   489
            (fileFilter copy reverse readStream upTo: $.) reverse)
4d408220a60b fixed file filters.
Claus Gittinger <cg@exept.de>
parents: 969
diff changeset
   490
    ]. 
1003
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   491
    nm := directory.
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   492
    nm isNil ifTrue:[
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   493
        nm := self class lastSelection.
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   494
        nm isNil ifTrue:[
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   495
            nm := Filename currentDirectory asAbsoluteFilename name.
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   496
        ].
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   497
    ].
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   498
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   499
    self directoryTreeView selectPathname:nm.
592
0383cd70fe79 dir input field added
tz
parents: 589
diff changeset
   500
1001
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   501
    self directoryInputField 
4474ba86a5d8 made expandFilename a separate method and fixed it.
Claus Gittinger <cg@exept.de>
parents: 1000
diff changeset
   502
        entryCompletionBlock:[:f| self entryCompletion].
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   503
1003
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   504
    file := self valueOfFileName value.
626
402a50b931d5 select row of file after opening
tz
parents: 622
diff changeset
   505
    directoryView selectionOfFile value: 
1003
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   506
        (directoryView listOfFiles 
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   507
            detect: [:row | row baseName = file] 
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   508
            ifNone: nil).
626
402a50b931d5 select row of file after opening
tz
parents: 622
diff changeset
   509
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   510
    ^super postBuildWith:aBuilder
969
c6530cd784bd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
   511
1003
7880fc48f0bb care for root when file changes and volume is different (win & vms)
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   512
    "Modified: / 24.9.1998 / 23:41:29 / cg"
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   513
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   514
35982cf1482f initial checkin
tz
parents:
diff changeset
   515
!FileSelectionBrowser class methodsFor:'documentation'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   516
35982cf1482f initial checkin
tz
parents:
diff changeset
   517
version
35982cf1482f initial checkin
tz
parents:
diff changeset
   518
    ^ '$Header$'
35982cf1482f initial checkin
tz
parents:
diff changeset
   519
! !