FileSelectionBrowser.st
author tz
Tue, 27 Jan 1998 17:33:53 +0100
changeset 488 147bf8fe5456
parent 468 bb4e776b9210
child 502 624dc714fd69
permissions -rw-r--r--
new icon method format applied
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
404
35982cf1482f initial checkin
tz
parents:
diff changeset
     1
"
35982cf1482f initial checkin
tz
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG / Thomas Zwick
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:''
35982cf1482f initial checkin
tz
parents:
diff changeset
    19
	category:'Interface-Advanced-Tools'
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
"
35982cf1482f initial checkin
tz
parents:
diff changeset
    26
 COPYRIGHT (c) 1997 by eXept Software AG / Thomas Zwick
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
"
35982cf1482f initial checkin
tz
parents:
diff changeset
    42
    documentation to be added.
35982cf1482f initial checkin
tz
parents:
diff changeset
    43
"
35982cf1482f initial checkin
tz
parents:
diff changeset
    44
!
35982cf1482f initial checkin
tz
parents:
diff changeset
    45
35982cf1482f initial checkin
tz
parents:
diff changeset
    46
history
35982cf1482f initial checkin
tz
parents:
diff changeset
    47
    "Created: / 10.1.1998 / 11:00:06 / tz"
35982cf1482f initial checkin
tz
parents:
diff changeset
    48
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
    49
35982cf1482f initial checkin
tz
parents:
diff changeset
    50
!FileSelectionBrowser class methodsFor:'instance creation'!
35982cf1482f initial checkin
tz
parents:
diff changeset
    51
35982cf1482f initial checkin
tz
parents:
diff changeset
    52
request: aTitle fileFilters: fileFilters
35982cf1482f initial checkin
tz
parents:
diff changeset
    53
35982cf1482f initial checkin
tz
parents:
diff changeset
    54
    "self request: 'Select A File' fileFilters: #('.*')"
35982cf1482f initial checkin
tz
parents:
diff changeset
    55
35982cf1482f initial checkin
tz
parents:
diff changeset
    56
    ^self new
35982cf1482f initial checkin
tz
parents:
diff changeset
    57
        title: aTitle;
35982cf1482f initial checkin
tz
parents:
diff changeset
    58
        listOfFileFilters: fileFilters;
35982cf1482f initial checkin
tz
parents:
diff changeset
    59
        open
35982cf1482f initial checkin
tz
parents:
diff changeset
    60
!
35982cf1482f initial checkin
tz
parents:
diff changeset
    61
35982cf1482f initial checkin
tz
parents:
diff changeset
    62
request: aTitle fileName: aFileName inDirectory: dir withFileFilters: fileFilters
35982cf1482f initial checkin
tz
parents:
diff changeset
    63
35982cf1482f initial checkin
tz
parents:
diff changeset
    64
    "self 
35982cf1482f initial checkin
tz
parents:
diff changeset
    65
        request: 'Select Your Profile File' 
35982cf1482f initial checkin
tz
parents:
diff changeset
    66
        fileName: '.profile' 
35982cf1482f initial checkin
tz
parents:
diff changeset
    67
        inDirectory: Filename homeDirectory 
35982cf1482f initial checkin
tz
parents:
diff changeset
    68
        withFileFilters: #('.*')"
35982cf1482f initial checkin
tz
parents:
diff changeset
    69
35982cf1482f initial checkin
tz
parents:
diff changeset
    70
    ^self new
35982cf1482f initial checkin
tz
parents:
diff changeset
    71
        title: aTitle;
35982cf1482f initial checkin
tz
parents:
diff changeset
    72
        fileName: aFileName;
35982cf1482f initial checkin
tz
parents:
diff changeset
    73
        directory: dir;
35982cf1482f initial checkin
tz
parents:
diff changeset
    74
        listOfFileFilters: fileFilters;
35982cf1482f initial checkin
tz
parents:
diff changeset
    75
        open
35982cf1482f initial checkin
tz
parents:
diff changeset
    76
!
35982cf1482f initial checkin
tz
parents:
diff changeset
    77
462
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    78
request: aTitle pathName: aPath fileFilters: fileFilters
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    79
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    80
    "self request: 'Select A File' pathName: '' fileFilters: #('.*')"
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    81
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    82
    ^self new
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    83
        title: aTitle;
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    84
        fileName: aPath;
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    85
        directory: aPath;
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    86
        listOfFileFilters: fileFilters;
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    87
        open
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    88
!
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
    89
404
35982cf1482f initial checkin
tz
parents:
diff changeset
    90
requestFileName
35982cf1482f initial checkin
tz
parents:
diff changeset
    91
35982cf1482f initial checkin
tz
parents:
diff changeset
    92
    "self requestFileName"
35982cf1482f initial checkin
tz
parents:
diff changeset
    93
35982cf1482f initial checkin
tz
parents:
diff changeset
    94
    ^self new title: 'Select A File'; open
35982cf1482f initial checkin
tz
parents:
diff changeset
    95
35982cf1482f initial checkin
tz
parents:
diff changeset
    96
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
    97
35982cf1482f initial checkin
tz
parents:
diff changeset
    98
!FileSelectionBrowser class methodsFor:'accessing'!
35982cf1482f initial checkin
tz
parents:
diff changeset
    99
35982cf1482f initial checkin
tz
parents:
diff changeset
   100
loadImageFileNameFilters
35982cf1482f initial checkin
tz
parents:
diff changeset
   101
    ^self saveImageFileNameFilters addAll: #('*.jpeg' '*.jpg'); yourself
35982cf1482f initial checkin
tz
parents:
diff changeset
   102
35982cf1482f initial checkin
tz
parents:
diff changeset
   103
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   104
35982cf1482f initial checkin
tz
parents:
diff changeset
   105
projectFileNameFilters
35982cf1482f initial checkin
tz
parents:
diff changeset
   106
    ^Array withAll: #('*.st' '*.*o'  '*.s' '*.c' 'Make*' '*.project')
35982cf1482f initial checkin
tz
parents:
diff changeset
   107
35982cf1482f initial checkin
tz
parents:
diff changeset
   108
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   109
35982cf1482f initial checkin
tz
parents:
diff changeset
   110
saveImageFileNameFilters
35982cf1482f initial checkin
tz
parents:
diff changeset
   111
    ^Array withAll: #('*.xpm' '*.xbm' '*.gif' '*.tif' '*.tiff' '*.bmp')
35982cf1482f initial checkin
tz
parents:
diff changeset
   112
35982cf1482f initial checkin
tz
parents:
diff changeset
   113
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   114
35982cf1482f initial checkin
tz
parents:
diff changeset
   115
!FileSelectionBrowser class methodsFor:'interface specs'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   116
35982cf1482f initial checkin
tz
parents:
diff changeset
   117
windowSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   118
    "this window spec was automatically generated by the ST/X UIPainter"
35982cf1482f initial checkin
tz
parents:
diff changeset
   119
35982cf1482f initial checkin
tz
parents:
diff changeset
   120
    "do not manually edit this - the painter/builder may not be able to
35982cf1482f initial checkin
tz
parents:
diff changeset
   121
     handle the specification if its corrupted."
35982cf1482f initial checkin
tz
parents:
diff changeset
   122
35982cf1482f initial checkin
tz
parents:
diff changeset
   123
    "
35982cf1482f initial checkin
tz
parents:
diff changeset
   124
     UIPainter new openOnClass:FileSelectionBrowser andSelector:#windowSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   125
     FileSelectionBrowser new openInterface:#windowSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   126
    "
35982cf1482f initial checkin
tz
parents:
diff changeset
   127
    "FileSelectionBrowser open"
35982cf1482f initial checkin
tz
parents:
diff changeset
   128
35982cf1482f initial checkin
tz
parents:
diff changeset
   129
    <resource: #canvas>
35982cf1482f initial checkin
tz
parents:
diff changeset
   130
35982cf1482f initial checkin
tz
parents:
diff changeset
   131
    ^
35982cf1482f initial checkin
tz
parents:
diff changeset
   132
     
35982cf1482f initial checkin
tz
parents:
diff changeset
   133
       #(#FullSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   134
          #'window:' 
35982cf1482f initial checkin
tz
parents:
diff changeset
   135
           #(#WindowSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   136
              #'name:' 'File Selection Browser'
468
bb4e776b9210 levels changed
tz
parents: 462
diff changeset
   137
              #'layout:' #(#LayoutFrame 207 0 351 0 606 0 650 0)
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   138
              #'label:' 'File Selection Browser'
35982cf1482f initial checkin
tz
parents:
diff changeset
   139
              #'min:' #(#Point 10 10)
35982cf1482f initial checkin
tz
parents:
diff changeset
   140
              #'max:' #(#Point 1152 900)
468
bb4e776b9210 levels changed
tz
parents: 462
diff changeset
   141
              #'bounds:' #(#Rectangle 207 351 607 651)
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   142
              #'usePreferredExtent:' false
35982cf1482f initial checkin
tz
parents:
diff changeset
   143
          )
35982cf1482f initial checkin
tz
parents:
diff changeset
   144
          #'component:' 
35982cf1482f initial checkin
tz
parents:
diff changeset
   145
           #(#SpecCollection
35982cf1482f initial checkin
tz
parents:
diff changeset
   146
              #'collection:' 
35982cf1482f initial checkin
tz
parents:
diff changeset
   147
               #(
35982cf1482f initial checkin
tz
parents:
diff changeset
   148
                 #(#VariableHorizontalPanelSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   149
                    #'name:' 'panel'
35982cf1482f initial checkin
tz
parents:
diff changeset
   150
                    #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -40 1.0)
35982cf1482f initial checkin
tz
parents:
diff changeset
   151
                    #'component:' 
35982cf1482f initial checkin
tz
parents:
diff changeset
   152
                     #(#SpecCollection
35982cf1482f initial checkin
tz
parents:
diff changeset
   153
                        #'collection:' 
35982cf1482f initial checkin
tz
parents:
diff changeset
   154
                         #(
35982cf1482f initial checkin
tz
parents:
diff changeset
   155
                           #(#ViewSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   156
                              #'name:' 'view1'
35982cf1482f initial checkin
tz
parents:
diff changeset
   157
                              #'component:' 
35982cf1482f initial checkin
tz
parents:
diff changeset
   158
                               #(#SpecCollection
35982cf1482f initial checkin
tz
parents:
diff changeset
   159
                                  #'collection:' 
35982cf1482f initial checkin
tz
parents:
diff changeset
   160
                                   #(
35982cf1482f initial checkin
tz
parents:
diff changeset
   161
                                     #(#FileSelectionTreeSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   162
                                        #'name:' 'directoryTreeView'
35982cf1482f initial checkin
tz
parents:
diff changeset
   163
                                        #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
35982cf1482f initial checkin
tz
parents:
diff changeset
   164
                                        #'model:' #selectionOfDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   165
                                        #'hasHorizontalScrollBar:' true
35982cf1482f initial checkin
tz
parents:
diff changeset
   166
                                        #'hasVerticalScrollBar:' true
35982cf1482f initial checkin
tz
parents:
diff changeset
   167
                                        #'miniScrollerHorizontal:' true
35982cf1482f initial checkin
tz
parents:
diff changeset
   168
                                        #'showRoot:' false
35982cf1482f initial checkin
tz
parents:
diff changeset
   169
                                        #'showDirectoryIndicator:' true
35982cf1482f initial checkin
tz
parents:
diff changeset
   170
                                        #'valueChangeSelector:' #readDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   171
                                        #'hierarchicalList:' #rootOfDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   172
                                        #'itemClass:' 'Directory'
35982cf1482f initial checkin
tz
parents:
diff changeset
   173
                                    )
35982cf1482f initial checkin
tz
parents:
diff changeset
   174
                                  )
35982cf1482f initial checkin
tz
parents:
diff changeset
   175
                              )
35982cf1482f initial checkin
tz
parents:
diff changeset
   176
                          )
35982cf1482f initial checkin
tz
parents:
diff changeset
   177
                           #(#ViewSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   178
                              #'name:' 'view2'
35982cf1482f initial checkin
tz
parents:
diff changeset
   179
                              #'component:' 
35982cf1482f initial checkin
tz
parents:
diff changeset
   180
                               #(#SpecCollection
35982cf1482f initial checkin
tz
parents:
diff changeset
   181
                                  #'collection:' 
35982cf1482f initial checkin
tz
parents:
diff changeset
   182
                                   #(
35982cf1482f initial checkin
tz
parents:
diff changeset
   183
                                     #(#InputFieldSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   184
                                        #'name:' 'EditField'
35982cf1482f initial checkin
tz
parents:
diff changeset
   185
                                        #'layout:' #(#LayoutFrame 1 0.0 -22 1 0 1.0 0 1)
35982cf1482f initial checkin
tz
parents:
diff changeset
   186
                                        #'model:' #valueOfFileName
35982cf1482f initial checkin
tz
parents:
diff changeset
   187
                                        #'acceptOnReturn:' false
35982cf1482f initial checkin
tz
parents:
diff changeset
   188
                                        #'acceptOnTab:' false
35982cf1482f initial checkin
tz
parents:
diff changeset
   189
                                    )
35982cf1482f initial checkin
tz
parents:
diff changeset
   190
                                     #(#SubCanvasSpec
35982cf1482f initial checkin
tz
parents:
diff changeset
   191
                                        #'name:' 'subCanvas1'
35982cf1482f initial checkin
tz
parents:
diff changeset
   192
                                        #'layout:' #(#LayoutFrame 1 0.0 0 0.0 0 1.0 -22 1.0)
35982cf1482f initial checkin
tz
parents:
diff changeset
   193
                                        #'clientHolder:' #directoryView
35982cf1482f initial checkin
tz
parents:
diff changeset
   194
                                    )
35982cf1482f initial checkin
tz
parents:
diff changeset
   195
                                  )
35982cf1482f initial checkin
tz
parents:
diff changeset
   196
                              )
35982cf1482f initial checkin
tz
parents:
diff changeset
   197
                          )
35982cf1482f initial checkin
tz
parents:
diff changeset
   198
                        )
35982cf1482f initial checkin
tz
parents:
diff changeset
   199
                    )
35982cf1482f initial checkin
tz
parents:
diff changeset
   200
                    #'handles:' #(#Any 0.5 1.0)
35982cf1482f initial checkin
tz
parents:
diff changeset
   201
                )
426
b8110a424326 commit buttons replaced by subSpec in ToolApplicationModel
tz
parents: 404
diff changeset
   202
                 #(#UISubSpecification
b8110a424326 commit buttons replaced by subSpec in ToolApplicationModel
tz
parents: 404
diff changeset
   203
                    #'name:' 'SubSpecification'
b8110a424326 commit buttons replaced by subSpec in ToolApplicationModel
tz
parents: 404
diff changeset
   204
                    #'layout:' #(#LayoutFrame 2 0.0 -32 1 -2 1.0 -8 1.0)
b8110a424326 commit buttons replaced by subSpec in ToolApplicationModel
tz
parents: 404
diff changeset
   205
                    #'majorKey:' #ToolApplicationModel
452
d6d5eceb23a9 #valueOfFileName now contains complete path
tz
parents: 426
diff changeset
   206
                    #'minorKey:' #windowSpecForCommitWithoutChannels
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   207
                )
35982cf1482f initial checkin
tz
parents:
diff changeset
   208
              )
35982cf1482f initial checkin
tz
parents:
diff changeset
   209
          )
35982cf1482f initial checkin
tz
parents:
diff changeset
   210
      )
35982cf1482f initial checkin
tz
parents:
diff changeset
   211
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   212
35982cf1482f initial checkin
tz
parents:
diff changeset
   213
!FileSelectionBrowser methodsFor:'accessing'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   214
35982cf1482f initial checkin
tz
parents:
diff changeset
   215
directory: aDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   216
462
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
   217
    directory := (aDirectory ? Filename homeDirectory) asFilename asAbsoluteFilename name
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   218
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   219
35982cf1482f initial checkin
tz
parents:
diff changeset
   220
directoryView
35982cf1482f initial checkin
tz
parents:
diff changeset
   221
35982cf1482f initial checkin
tz
parents:
diff changeset
   222
    ^directoryView ? (directoryView := DirectoryView new)
35982cf1482f initial checkin
tz
parents:
diff changeset
   223
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   224
35982cf1482f initial checkin
tz
parents:
diff changeset
   225
fileName: aFileName
35982cf1482f initial checkin
tz
parents:
diff changeset
   226
35982cf1482f initial checkin
tz
parents:
diff changeset
   227
    self valueOfFileName value: (aFileName ? '') asFilename baseName.
35982cf1482f initial checkin
tz
parents:
diff changeset
   228
    directory := directory ? ((aFileName ? '') asFilename directoryName).
35982cf1482f initial checkin
tz
parents:
diff changeset
   229
35982cf1482f initial checkin
tz
parents:
diff changeset
   230
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   231
35982cf1482f initial checkin
tz
parents:
diff changeset
   232
listOfFileFilters: anArray
35982cf1482f initial checkin
tz
parents:
diff changeset
   233
35982cf1482f initial checkin
tz
parents:
diff changeset
   234
    listOfFileFilters := anArray
35982cf1482f initial checkin
tz
parents:
diff changeset
   235
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   236
35982cf1482f initial checkin
tz
parents:
diff changeset
   237
!FileSelectionBrowser methodsFor:'accessing - views'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   238
35982cf1482f initial checkin
tz
parents:
diff changeset
   239
directoryTreeView
35982cf1482f initial checkin
tz
parents:
diff changeset
   240
35982cf1482f initial checkin
tz
parents:
diff changeset
   241
    ^builder componentAt: #directoryTreeView
35982cf1482f initial checkin
tz
parents:
diff changeset
   242
35982cf1482f initial checkin
tz
parents:
diff changeset
   243
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   244
35982cf1482f initial checkin
tz
parents:
diff changeset
   245
!FileSelectionBrowser methodsFor:'aspects'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   246
35982cf1482f initial checkin
tz
parents:
diff changeset
   247
rootOfDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   248
35982cf1482f initial checkin
tz
parents:
diff changeset
   249
    |holder|
35982cf1482f initial checkin
tz
parents:
diff changeset
   250
    (holder := builder bindingAt:#rootOfDirectory) isNil ifTrue:[
35982cf1482f initial checkin
tz
parents:
diff changeset
   251
        builder aspectAt:#rootOfDirectory put: (holder :=  Filename rootDirectory name asValue).
35982cf1482f initial checkin
tz
parents:
diff changeset
   252
    ].
35982cf1482f initial checkin
tz
parents:
diff changeset
   253
    ^ holder
35982cf1482f initial checkin
tz
parents:
diff changeset
   254
35982cf1482f initial checkin
tz
parents:
diff changeset
   255
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   256
35982cf1482f initial checkin
tz
parents:
diff changeset
   257
selectionOfDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   258
35982cf1482f initial checkin
tz
parents:
diff changeset
   259
    |holder|
35982cf1482f initial checkin
tz
parents:
diff changeset
   260
    (holder := builder bindingAt:#selectionOfDirectory) isNil ifTrue:[
35982cf1482f initial checkin
tz
parents:
diff changeset
   261
        builder aspectAt:#selectionOfDirectory put: (holder := ValueHolder new)
35982cf1482f initial checkin
tz
parents:
diff changeset
   262
    ].
35982cf1482f initial checkin
tz
parents:
diff changeset
   263
    ^ holder
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
valueOfFileName
35982cf1482f initial checkin
tz
parents:
diff changeset
   268
35982cf1482f initial checkin
tz
parents:
diff changeset
   269
    |holder|
35982cf1482f initial checkin
tz
parents:
diff changeset
   270
    (holder := builder bindingAt:#valueOfFileName) isNil ifTrue:[
35982cf1482f initial checkin
tz
parents:
diff changeset
   271
        builder aspectAt:#valueOfFileName put:(holder :=  ValueHolder new).
35982cf1482f initial checkin
tz
parents:
diff changeset
   272
    ].
35982cf1482f initial checkin
tz
parents:
diff changeset
   273
    ^ holder
35982cf1482f initial checkin
tz
parents:
diff changeset
   274
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   275
35982cf1482f initial checkin
tz
parents:
diff changeset
   276
!FileSelectionBrowser methodsFor:'callbacks'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   277
35982cf1482f initial checkin
tz
parents:
diff changeset
   278
fileDoubleClicked: aFileName
35982cf1482f initial checkin
tz
parents:
diff changeset
   279
35982cf1482f initial checkin
tz
parents:
diff changeset
   280
    self valueOfFileName value: aFileName.
35982cf1482f initial checkin
tz
parents:
diff changeset
   281
    accept value: true.
35982cf1482f initial checkin
tz
parents:
diff changeset
   282
    self close
35982cf1482f initial checkin
tz
parents:
diff changeset
   283
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   284
35982cf1482f initial checkin
tz
parents:
diff changeset
   285
readDirectory
35982cf1482f initial checkin
tz
parents:
diff changeset
   286
    "Diesen Mist musste ich machen, weil ztk es nicht fertig bringt,
35982cf1482f initial checkin
tz
parents:
diff changeset
   287
    seine Models upzudaten, bevor er die Callbacks aufruft!!!!!!"
35982cf1482f initial checkin
tz
parents:
diff changeset
   288
35982cf1482f initial checkin
tz
parents:
diff changeset
   289
    |dir|
35982cf1482f initial checkin
tz
parents:
diff changeset
   290
    directoryView listOfFiles removeAll.
35982cf1482f initial checkin
tz
parents:
diff changeset
   291
    directoryView directory: 
35982cf1482f initial checkin
tz
parents:
diff changeset
   292
        (dir := (self directoryTreeView model list at:
35982cf1482f initial checkin
tz
parents:
diff changeset
   293
        self directoryTreeView model selection) contents name);   
35982cf1482f initial checkin
tz
parents:
diff changeset
   294
        readDirectory.
35982cf1482f initial checkin
tz
parents:
diff changeset
   295
    directory isNil ifTrue: [self class lastSelection: dir]
35982cf1482f initial checkin
tz
parents:
diff changeset
   296
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   297
35982cf1482f initial checkin
tz
parents:
diff changeset
   298
!FileSelectionBrowser methodsFor:'startup / release'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   299
35982cf1482f initial checkin
tz
parents:
diff changeset
   300
closeCancel
35982cf1482f initial checkin
tz
parents:
diff changeset
   301
35982cf1482f initial checkin
tz
parents:
diff changeset
   302
    directoryView release.
35982cf1482f initial checkin
tz
parents:
diff changeset
   303
    super closeCancel
35982cf1482f initial checkin
tz
parents:
diff changeset
   304
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   305
35982cf1482f initial checkin
tz
parents:
diff changeset
   306
closeRequest
35982cf1482f initial checkin
tz
parents:
diff changeset
   307
35982cf1482f initial checkin
tz
parents:
diff changeset
   308
    directoryView release.
35982cf1482f initial checkin
tz
parents:
diff changeset
   309
    super closeRequest
35982cf1482f initial checkin
tz
parents:
diff changeset
   310
35982cf1482f initial checkin
tz
parents:
diff changeset
   311
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   312
35982cf1482f initial checkin
tz
parents:
diff changeset
   313
open
35982cf1482f initial checkin
tz
parents:
diff changeset
   314
35982cf1482f initial checkin
tz
parents:
diff changeset
   315
    super open.
35982cf1482f initial checkin
tz
parents:
diff changeset
   316
    accept value
35982cf1482f initial checkin
tz
parents:
diff changeset
   317
    ifTrue:
35982cf1482f initial checkin
tz
parents:
diff changeset
   318
    [
462
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
   319
        ^(self selectionOfDirectory value ? '') , Filename separator, (self valueOfFileName value ? '')
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   320
    ].
35982cf1482f initial checkin
tz
parents:
diff changeset
   321
    ^nil
35982cf1482f initial checkin
tz
parents:
diff changeset
   322
35982cf1482f initial checkin
tz
parents:
diff changeset
   323
35982cf1482f initial checkin
tz
parents:
diff changeset
   324
35982cf1482f initial checkin
tz
parents:
diff changeset
   325
!
35982cf1482f initial checkin
tz
parents:
diff changeset
   326
35982cf1482f initial checkin
tz
parents:
diff changeset
   327
postBuildWith:aBuilder
35982cf1482f initial checkin
tz
parents:
diff changeset
   328
35982cf1482f initial checkin
tz
parents:
diff changeset
   329
    directoryView listOfFileFilters: listOfFileFilters ? #('*').
462
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
   330
    directoryView fileSelectAction: [:aFileName |self valueOfFileName value: aFileName asFilename baseName].
90b8b353cd2f *** empty log message ***
tz
parents: 452
diff changeset
   331
    directoryView fileDoubleClickAction: [:aFileName |self fileDoubleClicked: aFileName asFilename baseName].
404
35982cf1482f initial checkin
tz
parents:
diff changeset
   332
    directoryView fileFilterSelectAction: [:fileFilter|
35982cf1482f initial checkin
tz
parents:
diff changeset
   333
    self valueOfFileName value: (
35982cf1482f initial checkin
tz
parents:
diff changeset
   334
        ((self valueOfFileName value ? 'unknown') readStream upTo: $.), '.',
35982cf1482f initial checkin
tz
parents:
diff changeset
   335
        (fileFilter copy reverse readStream upTo: $.) reverse)].
35982cf1482f initial checkin
tz
parents:
diff changeset
   336
    self directoryTreeView selectPathname: directory ? self class lastSelection.
35982cf1482f initial checkin
tz
parents:
diff changeset
   337
35982cf1482f initial checkin
tz
parents:
diff changeset
   338
    ^super postBuildWith:aBuilder
35982cf1482f initial checkin
tz
parents:
diff changeset
   339
! !
35982cf1482f initial checkin
tz
parents:
diff changeset
   340
35982cf1482f initial checkin
tz
parents:
diff changeset
   341
!FileSelectionBrowser class methodsFor:'documentation'!
35982cf1482f initial checkin
tz
parents:
diff changeset
   342
35982cf1482f initial checkin
tz
parents:
diff changeset
   343
version
35982cf1482f initial checkin
tz
parents:
diff changeset
   344
    ^ '$Header$'
35982cf1482f initial checkin
tz
parents:
diff changeset
   345
! !