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