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