FileSelectionBrowser.st
author tz
Wed, 03 Dec 1997 22:12:21 +0100
changeset 384 395b851346df
child 388 45cf0af38948
permissions -rw-r--r--
intitial checkin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
384
395b851346df intitial checkin
tz
parents:
diff changeset
     1
SelectionBrowser subclass:#FileSelectionBrowser
395b851346df intitial checkin
tz
parents:
diff changeset
     2
	instanceVariableNames:'selectedFileFilter fileName readTask'
395b851346df intitial checkin
tz
parents:
diff changeset
     3
	classVariableNames:''
395b851346df intitial checkin
tz
parents:
diff changeset
     4
	poolDictionaries:''
395b851346df intitial checkin
tz
parents:
diff changeset
     5
	category:'Interface-Advanced-Tools'
395b851346df intitial checkin
tz
parents:
diff changeset
     6
!
395b851346df intitial checkin
tz
parents:
diff changeset
     7
395b851346df intitial checkin
tz
parents:
diff changeset
     8
Object subclass:#Row
395b851346df intitial checkin
tz
parents:
diff changeset
     9
	instanceVariableNames:'fileName size iconKey group owner permissions baseName'
395b851346df intitial checkin
tz
parents:
diff changeset
    10
	classVariableNames:''
395b851346df intitial checkin
tz
parents:
diff changeset
    11
	poolDictionaries:''
395b851346df intitial checkin
tz
parents:
diff changeset
    12
	privateIn:FileSelectionBrowser
395b851346df intitial checkin
tz
parents:
diff changeset
    13
!
395b851346df intitial checkin
tz
parents:
diff changeset
    14
395b851346df intitial checkin
tz
parents:
diff changeset
    15
395b851346df intitial checkin
tz
parents:
diff changeset
    16
!FileSelectionBrowser class methodsFor:'instance creation'!
395b851346df intitial checkin
tz
parents:
diff changeset
    17
395b851346df intitial checkin
tz
parents:
diff changeset
    18
requestFileName
395b851346df intitial checkin
tz
parents:
diff changeset
    19
395b851346df intitial checkin
tz
parents:
diff changeset
    20
    ^self new title: 'Select a file'; open
395b851346df intitial checkin
tz
parents:
diff changeset
    21
395b851346df intitial checkin
tz
parents:
diff changeset
    22
!
395b851346df intitial checkin
tz
parents:
diff changeset
    23
395b851346df intitial checkin
tz
parents:
diff changeset
    24
requestFileName: aFileName fileFilters: fileFilters
395b851346df intitial checkin
tz
parents:
diff changeset
    25
395b851346df intitial checkin
tz
parents:
diff changeset
    26
    ^self new
395b851346df intitial checkin
tz
parents:
diff changeset
    27
        fileName: aFileName;
395b851346df intitial checkin
tz
parents:
diff changeset
    28
        listOfFileFilters: fileFilters;
395b851346df intitial checkin
tz
parents:
diff changeset
    29
        open
395b851346df intitial checkin
tz
parents:
diff changeset
    30
! !
395b851346df intitial checkin
tz
parents:
diff changeset
    31
395b851346df intitial checkin
tz
parents:
diff changeset
    32
!FileSelectionBrowser class methodsFor:'accessing'!
395b851346df intitial checkin
tz
parents:
diff changeset
    33
395b851346df intitial checkin
tz
parents:
diff changeset
    34
lastFileSelectionDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
    35
    "^ LastFileSelectionDirectory"
395b851346df intitial checkin
tz
parents:
diff changeset
    36
395b851346df intitial checkin
tz
parents:
diff changeset
    37
! !
395b851346df intitial checkin
tz
parents:
diff changeset
    38
395b851346df intitial checkin
tz
parents:
diff changeset
    39
!FileSelectionBrowser class methodsFor:'interface specs'!
395b851346df intitial checkin
tz
parents:
diff changeset
    40
395b851346df intitial checkin
tz
parents:
diff changeset
    41
windowSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    42
    "this window spec was automatically generated by the ST/X UIPainter"
395b851346df intitial checkin
tz
parents:
diff changeset
    43
395b851346df intitial checkin
tz
parents:
diff changeset
    44
    "do not manually edit this - the painter/builder may not be able to
395b851346df intitial checkin
tz
parents:
diff changeset
    45
     handle the specification if its corrupted."
395b851346df intitial checkin
tz
parents:
diff changeset
    46
395b851346df intitial checkin
tz
parents:
diff changeset
    47
    "
395b851346df intitial checkin
tz
parents:
diff changeset
    48
     UIPainter new openOnClass:FileSelectionBrowser andSelector:#windowSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    49
     FileSelectionBrowser new openInterface:#windowSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    50
    "
395b851346df intitial checkin
tz
parents:
diff changeset
    51
    "FileSelectionBrowser open"
395b851346df intitial checkin
tz
parents:
diff changeset
    52
395b851346df intitial checkin
tz
parents:
diff changeset
    53
    <resource: #canvas>
395b851346df intitial checkin
tz
parents:
diff changeset
    54
395b851346df intitial checkin
tz
parents:
diff changeset
    55
    ^
395b851346df intitial checkin
tz
parents:
diff changeset
    56
     
395b851346df intitial checkin
tz
parents:
diff changeset
    57
       #(#FullSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    58
          #'window:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    59
           #(#WindowSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    60
              #'name:' 'File Selection Browser'
395b851346df intitial checkin
tz
parents:
diff changeset
    61
              #'layout:' #(#LayoutFrame 410 0 282 0 809 0 581 0)
395b851346df intitial checkin
tz
parents:
diff changeset
    62
              #'label:' 'File Selection Browser'
395b851346df intitial checkin
tz
parents:
diff changeset
    63
              #'min:' #(#Point 10 10)
395b851346df intitial checkin
tz
parents:
diff changeset
    64
              #'max:' #(#Point 1152 900)
395b851346df intitial checkin
tz
parents:
diff changeset
    65
              #'bounds:' #(#Rectangle 410 282 810 582)
395b851346df intitial checkin
tz
parents:
diff changeset
    66
              #'usePreferredExtent:' false
395b851346df intitial checkin
tz
parents:
diff changeset
    67
          )
395b851346df intitial checkin
tz
parents:
diff changeset
    68
          #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    69
           #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
    70
              #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    71
               #(
395b851346df intitial checkin
tz
parents:
diff changeset
    72
                 #(#ViewSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    73
                    #'name:' 'view'
395b851346df intitial checkin
tz
parents:
diff changeset
    74
                    #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -40 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
    75
                    #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    76
                     #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
    77
                        #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    78
                         #(
395b851346df intitial checkin
tz
parents:
diff changeset
    79
                           #(#VariableHorizontalPanelSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    80
                              #'name:' 'panel'
395b851346df intitial checkin
tz
parents:
diff changeset
    81
                              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -1 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
    82
                              #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    83
                               #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
    84
                                  #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    85
                                   #(
395b851346df intitial checkin
tz
parents:
diff changeset
    86
                                     #(#ViewSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    87
                                        #'name:' 'view1'
395b851346df intitial checkin
tz
parents:
diff changeset
    88
                                        #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    89
                                         #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
    90
                                            #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    91
                                             #(
395b851346df intitial checkin
tz
parents:
diff changeset
    92
                                               #(#FileSelectionTreeSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    93
                                                  #'name:' 'directoryTreeView'
395b851346df intitial checkin
tz
parents:
diff changeset
    94
                                                  #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
    95
                                                  #'model:' #selectionOfDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
    96
                                                  #'hasHorizontalScrollBar:' true
395b851346df intitial checkin
tz
parents:
diff changeset
    97
                                                  #'hasVerticalScrollBar:' true
395b851346df intitial checkin
tz
parents:
diff changeset
    98
                                                  #'miniScrollerHorizontal:' true
395b851346df intitial checkin
tz
parents:
diff changeset
    99
                                                  #'showRoot:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   100
                                                  #'showDirectoryIndicator:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   101
                                                  #'valueChangeSelector:' #readDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   102
                                                  #'hierarchicalList:' #rootOfDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   103
                                                  #'itemClass:' 'Directory'
395b851346df intitial checkin
tz
parents:
diff changeset
   104
                                              )
395b851346df intitial checkin
tz
parents:
diff changeset
   105
                                            )
395b851346df intitial checkin
tz
parents:
diff changeset
   106
                                        )
395b851346df intitial checkin
tz
parents:
diff changeset
   107
                                        #'level:' -1
395b851346df intitial checkin
tz
parents:
diff changeset
   108
                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   109
                                     #(#ViewSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   110
                                        #'name:' 'view2'
395b851346df intitial checkin
tz
parents:
diff changeset
   111
                                        #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   112
                                         #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
   113
                                            #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   114
                                             #(
395b851346df intitial checkin
tz
parents:
diff changeset
   115
                                               #(#DataSetSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   116
                                                  #'name:' 'filesDataSetView'
395b851346df intitial checkin
tz
parents:
diff changeset
   117
                                                  #'layout:' #(#LayoutFrame 0 0.0 24 0.0 0 1.0 -23 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
   118
                                                  #'model:' #selectionOfFile
395b851346df intitial checkin
tz
parents:
diff changeset
   119
                                                  #'hasHorizontalScrollBar:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   120
                                                  #'hasVerticalScrollBar:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   121
                                                  #'miniScrollerHorizontal:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   122
                                                  #'dataList:' #listOfFiles
395b851346df intitial checkin
tz
parents:
diff changeset
   123
                                                  #'useIndex:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   124
                                                  #'level:' 1
395b851346df intitial checkin
tz
parents:
diff changeset
   125
                                                  #'doubleClickSelector:' #fileDoubleClicked
395b851346df intitial checkin
tz
parents:
diff changeset
   126
                                                  #'valueChangeSelector:' #fileSelected
395b851346df intitial checkin
tz
parents:
diff changeset
   127
                                                  #'verticalSpacing:' 1
395b851346df intitial checkin
tz
parents:
diff changeset
   128
                                                  #'columns:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   129
                                                   #(
395b851346df intitial checkin
tz
parents:
diff changeset
   130
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   131
                                                        #'label:' ''
395b851346df intitial checkin
tz
parents:
diff changeset
   132
                                                        #'width:' 30
395b851346df intitial checkin
tz
parents:
diff changeset
   133
                                                        #'printSelector:' #'iconOn:'
395b851346df intitial checkin
tz
parents:
diff changeset
   134
                                                        #'canSelect:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   135
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   136
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   137
                                                        #'label:' 'file name'
395b851346df intitial checkin
tz
parents:
diff changeset
   138
                                                        #'minWidth:' 100
395b851346df intitial checkin
tz
parents:
diff changeset
   139
                                                        #'model:' #baseName
395b851346df intitial checkin
tz
parents:
diff changeset
   140
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   141
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   142
                                                        #'label:' 'size'
395b851346df intitial checkin
tz
parents:
diff changeset
   143
                                                        #'width:' 50
395b851346df intitial checkin
tz
parents:
diff changeset
   144
                                                        #'model:' #size
395b851346df intitial checkin
tz
parents:
diff changeset
   145
                                                        #'canSelect:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   146
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   147
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   148
                                                        #'label:' 'permissions'
395b851346df intitial checkin
tz
parents:
diff changeset
   149
                                                        #'width:' 85
395b851346df intitial checkin
tz
parents:
diff changeset
   150
                                                        #'model:' #permissions
395b851346df intitial checkin
tz
parents:
diff changeset
   151
                                                        #'canSelect:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   152
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   153
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   154
                                                        #'label:' 'owner'
395b851346df intitial checkin
tz
parents:
diff changeset
   155
                                                        #'width:' 50
395b851346df intitial checkin
tz
parents:
diff changeset
   156
                                                        #'model:' #owner
395b851346df intitial checkin
tz
parents:
diff changeset
   157
                                                        #'canSelect:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   158
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   159
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   160
                                                        #'label:' 'group'
395b851346df intitial checkin
tz
parents:
diff changeset
   161
                                                        #'width:' 50
395b851346df intitial checkin
tz
parents:
diff changeset
   162
                                                        #'model:' #group
395b851346df intitial checkin
tz
parents:
diff changeset
   163
                                                        #'canSelect:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   164
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   165
                                                  )
395b851346df intitial checkin
tz
parents:
diff changeset
   166
                                              )
395b851346df intitial checkin
tz
parents:
diff changeset
   167
                                               #(#ComboBoxSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   168
                                                  #'name:' 'formatComboBox'
395b851346df intitial checkin
tz
parents:
diff changeset
   169
                                                  #'layout:' #(#LayoutFrame 0 0.0 2 0 0 1.0 24 0)
395b851346df intitial checkin
tz
parents:
diff changeset
   170
                                                  #'model:' #selectionOfFileFilter
395b851346df intitial checkin
tz
parents:
diff changeset
   171
                                                  #'immediateAccept:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   172
                                                  #'acceptOnTab:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   173
                                                  #'comboList:' #listOfFileFilters
395b851346df intitial checkin
tz
parents:
diff changeset
   174
                                              )
395b851346df intitial checkin
tz
parents:
diff changeset
   175
                                               #(#InputFieldSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   176
                                                  #'name:' 'EditField'
395b851346df intitial checkin
tz
parents:
diff changeset
   177
                                                  #'layout:' #(#LayoutFrame 0 0.0 -22 1 0 1.0 0 1)
395b851346df intitial checkin
tz
parents:
diff changeset
   178
                                                  #'model:' #valueOfFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   179
                                                  #'acceptOnReturn:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   180
                                                  #'acceptOnTab:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   181
                                              )
395b851346df intitial checkin
tz
parents:
diff changeset
   182
                                            )
395b851346df intitial checkin
tz
parents:
diff changeset
   183
                                        )
395b851346df intitial checkin
tz
parents:
diff changeset
   184
                                        #'level:' -1
395b851346df intitial checkin
tz
parents:
diff changeset
   185
                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   186
                                  )
395b851346df intitial checkin
tz
parents:
diff changeset
   187
                              )
395b851346df intitial checkin
tz
parents:
diff changeset
   188
                              #'handles:' #(#Any 0.5 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
   189
                          )
395b851346df intitial checkin
tz
parents:
diff changeset
   190
                        )
395b851346df intitial checkin
tz
parents:
diff changeset
   191
                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   192
                )
395b851346df intitial checkin
tz
parents:
diff changeset
   193
                 #(#HorizontalPanelViewSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   194
                    #'name:' 'horizontalPanelView'
395b851346df intitial checkin
tz
parents:
diff changeset
   195
                    #'layout:' #(#LayoutFrame 0 0.0 -40 1 0 1.0 0 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
   196
                    #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   197
                     #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
   198
                        #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   199
                         #(
395b851346df intitial checkin
tz
parents:
diff changeset
   200
                           #(#ActionButtonSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   201
                              #'name:' 'cancelButton'
395b851346df intitial checkin
tz
parents:
diff changeset
   202
                              #'label:' 'cancel'
395b851346df intitial checkin
tz
parents:
diff changeset
   203
                              #'model:' #cancel
395b851346df intitial checkin
tz
parents:
diff changeset
   204
                              #'extent:' #(#Point 100 22)
395b851346df intitial checkin
tz
parents:
diff changeset
   205
                          )
395b851346df intitial checkin
tz
parents:
diff changeset
   206
                           #(#ActionButtonSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   207
                              #'name:' 'okButton'
395b851346df intitial checkin
tz
parents:
diff changeset
   208
                              #'label:' 'ok'
395b851346df intitial checkin
tz
parents:
diff changeset
   209
                              #'model:' #accept
395b851346df intitial checkin
tz
parents:
diff changeset
   210
                              #'extent:' #(#Point 100 22)
395b851346df intitial checkin
tz
parents:
diff changeset
   211
                          )
395b851346df intitial checkin
tz
parents:
diff changeset
   212
                        )
395b851346df intitial checkin
tz
parents:
diff changeset
   213
                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   214
                    #'level:' 1
395b851346df intitial checkin
tz
parents:
diff changeset
   215
                    #'horizontalLayout:' #center
395b851346df intitial checkin
tz
parents:
diff changeset
   216
                    #'verticalLayout:' #center
395b851346df intitial checkin
tz
parents:
diff changeset
   217
                    #'horizontalSpace:' 3
395b851346df intitial checkin
tz
parents:
diff changeset
   218
                    #'verticalSpace:' 3
395b851346df intitial checkin
tz
parents:
diff changeset
   219
                )
395b851346df intitial checkin
tz
parents:
diff changeset
   220
              )
395b851346df intitial checkin
tz
parents:
diff changeset
   221
          )
395b851346df intitial checkin
tz
parents:
diff changeset
   222
      )
395b851346df intitial checkin
tz
parents:
diff changeset
   223
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   224
395b851346df intitial checkin
tz
parents:
diff changeset
   225
!FileSelectionBrowser methodsFor:'accessing'!
395b851346df intitial checkin
tz
parents:
diff changeset
   226
395b851346df intitial checkin
tz
parents:
diff changeset
   227
fileName
395b851346df intitial checkin
tz
parents:
diff changeset
   228
395b851346df intitial checkin
tz
parents:
diff changeset
   229
    (fileName notNil and: [(fileName name ~= self valueOfFileName value and: [self valueOfFileName value notNil])])
395b851346df intitial checkin
tz
parents:
diff changeset
   230
        ifTrue: [^(LastFileSelectionDirectory, Filename separator, self valueOfFileName value) asFilename].
395b851346df intitial checkin
tz
parents:
diff changeset
   231
    ^fileName
395b851346df intitial checkin
tz
parents:
diff changeset
   232
!
395b851346df intitial checkin
tz
parents:
diff changeset
   233
395b851346df intitial checkin
tz
parents:
diff changeset
   234
fileName: aFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   235
395b851346df intitial checkin
tz
parents:
diff changeset
   236
    fileName  := aFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   237
!
395b851346df intitial checkin
tz
parents:
diff changeset
   238
395b851346df intitial checkin
tz
parents:
diff changeset
   239
title: aString
395b851346df intitial checkin
tz
parents:
diff changeset
   240
395b851346df intitial checkin
tz
parents:
diff changeset
   241
    title := aString
395b851346df intitial checkin
tz
parents:
diff changeset
   242
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   243
395b851346df intitial checkin
tz
parents:
diff changeset
   244
!FileSelectionBrowser methodsFor:'actions'!
395b851346df intitial checkin
tz
parents:
diff changeset
   245
395b851346df intitial checkin
tz
parents:
diff changeset
   246
closeCancel
395b851346df intitial checkin
tz
parents:
diff changeset
   247
395b851346df intitial checkin
tz
parents:
diff changeset
   248
    readTask notNil ifTrue: [readTask terminate].
395b851346df intitial checkin
tz
parents:
diff changeset
   249
    fileName := nil.
395b851346df intitial checkin
tz
parents:
diff changeset
   250
    super closeCancel
395b851346df intitial checkin
tz
parents:
diff changeset
   251
!
395b851346df intitial checkin
tz
parents:
diff changeset
   252
395b851346df intitial checkin
tz
parents:
diff changeset
   253
closeRequest
395b851346df intitial checkin
tz
parents:
diff changeset
   254
395b851346df intitial checkin
tz
parents:
diff changeset
   255
    readTask notNil ifTrue: [readTask terminate].
395b851346df intitial checkin
tz
parents:
diff changeset
   256
    super closeRequest
395b851346df intitial checkin
tz
parents:
diff changeset
   257
!
395b851346df intitial checkin
tz
parents:
diff changeset
   258
395b851346df intitial checkin
tz
parents:
diff changeset
   259
closeWindow
395b851346df intitial checkin
tz
parents:
diff changeset
   260
395b851346df intitial checkin
tz
parents:
diff changeset
   261
    readTask notNil ifTrue: [readTask terminate].
395b851346df intitial checkin
tz
parents:
diff changeset
   262
    super closeWindow
395b851346df intitial checkin
tz
parents:
diff changeset
   263
!
395b851346df intitial checkin
tz
parents:
diff changeset
   264
395b851346df intitial checkin
tz
parents:
diff changeset
   265
fileDoubleClicked
395b851346df intitial checkin
tz
parents:
diff changeset
   266
395b851346df intitial checkin
tz
parents:
diff changeset
   267
    self valueOfFileName value: self selectionOfFile value baseName.
395b851346df intitial checkin
tz
parents:
diff changeset
   268
    fileName := self selectionOfFile value fileName.
395b851346df intitial checkin
tz
parents:
diff changeset
   269
    accept value: true.
395b851346df intitial checkin
tz
parents:
diff changeset
   270
    self close
395b851346df intitial checkin
tz
parents:
diff changeset
   271
!
395b851346df intitial checkin
tz
parents:
diff changeset
   272
395b851346df intitial checkin
tz
parents:
diff changeset
   273
fileSelected
395b851346df intitial checkin
tz
parents:
diff changeset
   274
395b851346df intitial checkin
tz
parents:
diff changeset
   275
    self valueOfFileName value: self selectionOfFile value baseName.   
395b851346df intitial checkin
tz
parents:
diff changeset
   276
    fileName := self selectionOfFile value fileName.
395b851346df intitial checkin
tz
parents:
diff changeset
   277
!
395b851346df intitial checkin
tz
parents:
diff changeset
   278
395b851346df intitial checkin
tz
parents:
diff changeset
   279
readDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   280
395b851346df intitial checkin
tz
parents:
diff changeset
   281
    | file list dir lst|
395b851346df intitial checkin
tz
parents:
diff changeset
   282
    self selectionOfDirectory value isNil ifTrue: [^nil].
395b851346df intitial checkin
tz
parents:
diff changeset
   283
    readTask notNil ifTrue: [readTask terminate].
395b851346df intitial checkin
tz
parents:
diff changeset
   284
    readTask := [
395b851346df intitial checkin
tz
parents:
diff changeset
   285
395b851346df intitial checkin
tz
parents:
diff changeset
   286
    file := (builder componentAt: #directoryTreeView) selectedPathname asFilename.
395b851346df intitial checkin
tz
parents:
diff changeset
   287
    builder window label: 'Reading: ''', file name, ''''.
395b851346df intitial checkin
tz
parents:
diff changeset
   288
    self class lastSelection: file name.
395b851346df intitial checkin
tz
parents:
diff changeset
   289
    (file isReadable and:[file isExecutable]) ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   290
        list := self listOfFiles.
395b851346df intitial checkin
tz
parents:
diff changeset
   291
        list removeAll.
395b851346df intitial checkin
tz
parents:
diff changeset
   292
        lst := OrderedCollection new.
395b851346df intitial checkin
tz
parents:
diff changeset
   293
        self listOfFileFilters value
395b851346df intitial checkin
tz
parents:
diff changeset
   294
        do: [:filter|
395b851346df intitial checkin
tz
parents:
diff changeset
   295
            (file filesMatchingWithoutDotDirs: filter) do:
395b851346df intitial checkin
tz
parents:
diff changeset
   296
            [:aFileName|                
395b851346df intitial checkin
tz
parents:
diff changeset
   297
                lst add: (Row new fileName: (file name, Filename separator, aFileName) asFilename)
395b851346df intitial checkin
tz
parents:
diff changeset
   298
            ].
395b851346df intitial checkin
tz
parents:
diff changeset
   299
        ].
395b851346df intitial checkin
tz
parents:
diff changeset
   300
        lst := lst asSortedCollection: [:r1 :r2| r1 baseName < r2 baseName].
395b851346df intitial checkin
tz
parents:
diff changeset
   301
        list addAll:lst beforeIndex:1].
395b851346df intitial checkin
tz
parents:
diff changeset
   302
        self selectionOfFile value: (self listOfFiles detect: [:r| r fileName = fileName] ifNone: [nil]).
395b851346df intitial checkin
tz
parents:
diff changeset
   303
        self setLabel.
395b851346df intitial checkin
tz
parents:
diff changeset
   304
    ] forkAt: 4
395b851346df intitial checkin
tz
parents:
diff changeset
   305
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   306
395b851346df intitial checkin
tz
parents:
diff changeset
   307
!FileSelectionBrowser methodsFor:'aspects'!
395b851346df intitial checkin
tz
parents:
diff changeset
   308
395b851346df intitial checkin
tz
parents:
diff changeset
   309
listOfFileFilters
395b851346df intitial checkin
tz
parents:
diff changeset
   310
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   311
395b851346df intitial checkin
tz
parents:
diff changeset
   312
    (holder := builder bindingAt:#listOfFileFilters) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   313
        builder aspectAt:#listOfFileFilters put:(holder :=  List with: '*.*').
395b851346df intitial checkin
tz
parents:
diff changeset
   314
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   315
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   316
!
395b851346df intitial checkin
tz
parents:
diff changeset
   317
395b851346df intitial checkin
tz
parents:
diff changeset
   318
listOfFileFilters: aCollection
395b851346df intitial checkin
tz
parents:
diff changeset
   319
    self listOfFileFilters contents: aCollection.
395b851346df intitial checkin
tz
parents:
diff changeset
   320
!
395b851346df intitial checkin
tz
parents:
diff changeset
   321
395b851346df intitial checkin
tz
parents:
diff changeset
   322
listOfFiles
395b851346df intitial checkin
tz
parents:
diff changeset
   323
395b851346df intitial checkin
tz
parents:
diff changeset
   324
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   325
    (holder := builder bindingAt:#listOfFiles) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   326
        builder aspectAt:#listOfFiles put:(holder :=  List new).
395b851346df intitial checkin
tz
parents:
diff changeset
   327
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   328
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   329
395b851346df intitial checkin
tz
parents:
diff changeset
   330
!
395b851346df intitial checkin
tz
parents:
diff changeset
   331
395b851346df intitial checkin
tz
parents:
diff changeset
   332
rootOfDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   333
395b851346df intitial checkin
tz
parents:
diff changeset
   334
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   335
395b851346df intitial checkin
tz
parents:
diff changeset
   336
    (holder := builder bindingAt:#rootOfDirectory) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   337
        builder aspectAt:#rootOfDirectory put: (holder :=  ValueHolder with: Filename rootDirectory name).
395b851346df intitial checkin
tz
parents:
diff changeset
   338
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   339
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   340
395b851346df intitial checkin
tz
parents:
diff changeset
   341
!
395b851346df intitial checkin
tz
parents:
diff changeset
   342
395b851346df intitial checkin
tz
parents:
diff changeset
   343
selectionOfDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   344
395b851346df intitial checkin
tz
parents:
diff changeset
   345
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   346
    (holder := builder bindingAt:#selectionOfDirectory) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   347
        builder aspectAt:#selectionOfDirectory put: (holder := ValueHolder new)
395b851346df intitial checkin
tz
parents:
diff changeset
   348
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   349
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   350
395b851346df intitial checkin
tz
parents:
diff changeset
   351
!
395b851346df intitial checkin
tz
parents:
diff changeset
   352
395b851346df intitial checkin
tz
parents:
diff changeset
   353
selectionOfFile
395b851346df intitial checkin
tz
parents:
diff changeset
   354
395b851346df intitial checkin
tz
parents:
diff changeset
   355
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   356
    (holder := builder bindingAt:#selectionOfFile) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   357
        builder aspectAt:#selectionOfFile put:(holder :=  ValueHolder new).
395b851346df intitial checkin
tz
parents:
diff changeset
   358
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   359
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   360
395b851346df intitial checkin
tz
parents:
diff changeset
   361
!
395b851346df intitial checkin
tz
parents:
diff changeset
   362
395b851346df intitial checkin
tz
parents:
diff changeset
   363
selectionOfFileFilter
395b851346df intitial checkin
tz
parents:
diff changeset
   364
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   365
395b851346df intitial checkin
tz
parents:
diff changeset
   366
    (holder := builder bindingAt:#selectionOfFileFilter) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   367
        builder aspectAt:#selectionOfFileFilter put:
395b851346df intitial checkin
tz
parents:
diff changeset
   368
        (holder := AspectAdaptor new subject:self; forAspect:#selectedFileFilter).
395b851346df intitial checkin
tz
parents:
diff changeset
   369
        selectedFileFilter := '*.*'.
395b851346df intitial checkin
tz
parents:
diff changeset
   370
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   371
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   372
!
395b851346df intitial checkin
tz
parents:
diff changeset
   373
395b851346df intitial checkin
tz
parents:
diff changeset
   374
valueOfFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   375
395b851346df intitial checkin
tz
parents:
diff changeset
   376
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   377
    (holder := builder bindingAt:#valueOfFileName) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   378
        builder aspectAt:#valueOfFileName put:(holder :=  ValueHolder new).
395b851346df intitial checkin
tz
parents:
diff changeset
   379
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   380
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   381
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   382
395b851346df intitial checkin
tz
parents:
diff changeset
   383
!FileSelectionBrowser methodsFor:'initialization'!
395b851346df intitial checkin
tz
parents:
diff changeset
   384
395b851346df intitial checkin
tz
parents:
diff changeset
   385
open
395b851346df intitial checkin
tz
parents:
diff changeset
   386
395b851346df intitial checkin
tz
parents:
diff changeset
   387
    super open.
395b851346df intitial checkin
tz
parents:
diff changeset
   388
    accept value
395b851346df intitial checkin
tz
parents:
diff changeset
   389
    ifTrue:
395b851346df intitial checkin
tz
parents:
diff changeset
   390
    [
395b851346df intitial checkin
tz
parents:
diff changeset
   391
        ^(self selectionOfDirectory value ? '') , Filename separator, (self valueOfFileName value ? '')
395b851346df intitial checkin
tz
parents:
diff changeset
   392
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   393
    ^nil
395b851346df intitial checkin
tz
parents:
diff changeset
   394
395b851346df intitial checkin
tz
parents:
diff changeset
   395
395b851346df intitial checkin
tz
parents:
diff changeset
   396
395b851346df intitial checkin
tz
parents:
diff changeset
   397
!
395b851346df intitial checkin
tz
parents:
diff changeset
   398
395b851346df intitial checkin
tz
parents:
diff changeset
   399
postBuildWith:aBuilder
395b851346df intitial checkin
tz
parents:
diff changeset
   400
395b851346df intitial checkin
tz
parents:
diff changeset
   401
    (fileName notNil and: [fileName asFilename exists])
395b851346df intitial checkin
tz
parents:
diff changeset
   402
    ifTrue:
395b851346df intitial checkin
tz
parents:
diff changeset
   403
    [
395b851346df intitial checkin
tz
parents:
diff changeset
   404
        self class lastSelection: fileName asFilename directoryName.
395b851346df intitial checkin
tz
parents:
diff changeset
   405
        self valueOfFileName value: fileName asFilename baseName
395b851346df intitial checkin
tz
parents:
diff changeset
   406
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   407
    (builder componentAt: #directoryTreeView) selectPathname: self class lastSelection.
395b851346df intitial checkin
tz
parents:
diff changeset
   408
    self selectionOfFileFilter value:  (self listOfFileFilters at: 1 ifAbsent: [nil]).
395b851346df intitial checkin
tz
parents:
diff changeset
   409
    self readDirectory.
395b851346df intitial checkin
tz
parents:
diff changeset
   410
    (builder componentAt: #directoryTreeView) monitoring: true.
395b851346df intitial checkin
tz
parents:
diff changeset
   411
    ^super postBuildWith:aBuilder
395b851346df intitial checkin
tz
parents:
diff changeset
   412
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   413
395b851346df intitial checkin
tz
parents:
diff changeset
   414
!FileSelectionBrowser methodsFor:'selection'!
395b851346df intitial checkin
tz
parents:
diff changeset
   415
395b851346df intitial checkin
tz
parents:
diff changeset
   416
selectedFileFilter
395b851346df intitial checkin
tz
parents:
diff changeset
   417
395b851346df intitial checkin
tz
parents:
diff changeset
   418
    ^selectedFileFilter
395b851346df intitial checkin
tz
parents:
diff changeset
   419
!
395b851346df intitial checkin
tz
parents:
diff changeset
   420
395b851346df intitial checkin
tz
parents:
diff changeset
   421
selectedFileFilter: aString
395b851346df intitial checkin
tz
parents:
diff changeset
   422
395b851346df intitial checkin
tz
parents:
diff changeset
   423
    selectedFileFilter := aString.
395b851346df intitial checkin
tz
parents:
diff changeset
   424
395b851346df intitial checkin
tz
parents:
diff changeset
   425
    self readDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   426
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   427
395b851346df intitial checkin
tz
parents:
diff changeset
   428
!FileSelectionBrowser::Row methodsFor:'accessing'!
395b851346df intitial checkin
tz
parents:
diff changeset
   429
395b851346df intitial checkin
tz
parents:
diff changeset
   430
baseName
395b851346df intitial checkin
tz
parents:
diff changeset
   431
    baseName isNil ifTrue: [baseName := fileName baseName].
395b851346df intitial checkin
tz
parents:
diff changeset
   432
    ^ baseName
395b851346df intitial checkin
tz
parents:
diff changeset
   433
395b851346df intitial checkin
tz
parents:
diff changeset
   434
395b851346df intitial checkin
tz
parents:
diff changeset
   435
395b851346df intitial checkin
tz
parents:
diff changeset
   436
395b851346df intitial checkin
tz
parents:
diff changeset
   437
395b851346df intitial checkin
tz
parents:
diff changeset
   438
!
395b851346df intitial checkin
tz
parents:
diff changeset
   439
395b851346df intitial checkin
tz
parents:
diff changeset
   440
fileName
395b851346df intitial checkin
tz
parents:
diff changeset
   441
    ^ fileName
395b851346df intitial checkin
tz
parents:
diff changeset
   442
395b851346df intitial checkin
tz
parents:
diff changeset
   443
!
395b851346df intitial checkin
tz
parents:
diff changeset
   444
395b851346df intitial checkin
tz
parents:
diff changeset
   445
fileName: aFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   446
    fileName := aFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   447
395b851346df intitial checkin
tz
parents:
diff changeset
   448
!
395b851346df intitial checkin
tz
parents:
diff changeset
   449
395b851346df intitial checkin
tz
parents:
diff changeset
   450
group
395b851346df intitial checkin
tz
parents:
diff changeset
   451
    group isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   452
        self validateAttributes
395b851346df intitial checkin
tz
parents:
diff changeset
   453
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   454
    ^ group
395b851346df intitial checkin
tz
parents:
diff changeset
   455
!
395b851346df intitial checkin
tz
parents:
diff changeset
   456
395b851346df intitial checkin
tz
parents:
diff changeset
   457
iconOn:aGC
395b851346df intitial checkin
tz
parents:
diff changeset
   458
    |icon|
395b851346df intitial checkin
tz
parents:
diff changeset
   459
395b851346df intitial checkin
tz
parents:
diff changeset
   460
    iconKey isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   461
        self validateAttributes.
395b851346df intitial checkin
tz
parents:
diff changeset
   462
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   463
    (iconKey == #image) | (iconKey == #imageFile)
395b851346df intitial checkin
tz
parents:
diff changeset
   464
    ifTrue:
395b851346df intitial checkin
tz
parents:
diff changeset
   465
    [
395b851346df intitial checkin
tz
parents:
diff changeset
   466
        Object errorSignal handle: [:ex|]
395b851346df intitial checkin
tz
parents:
diff changeset
   467
        do:
395b851346df intitial checkin
tz
parents:
diff changeset
   468
        [
395b851346df intitial checkin
tz
parents:
diff changeset
   469
            ((size < 5000) and: [(icon := Image fromFile: fileName name) notNil]) 
395b851346df intitial checkin
tz
parents:
diff changeset
   470
            ifTrue: [aGC registerImage: icon key:(iconKey :=fileName name asSymbol).]
395b851346df intitial checkin
tz
parents:
diff changeset
   471
        ].
395b851346df intitial checkin
tz
parents:
diff changeset
   472
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   473
    (icon := aGC registeredImageAt:iconKey) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   474
        self registerIconsOn:aGC.
395b851346df intitial checkin
tz
parents:
diff changeset
   475
        icon := aGC  registeredImageAt:iconKey.
395b851346df intitial checkin
tz
parents:
diff changeset
   476
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   477
    ^ icon
395b851346df intitial checkin
tz
parents:
diff changeset
   478
395b851346df intitial checkin
tz
parents:
diff changeset
   479
395b851346df intitial checkin
tz
parents:
diff changeset
   480
395b851346df intitial checkin
tz
parents:
diff changeset
   481
!
395b851346df intitial checkin
tz
parents:
diff changeset
   482
395b851346df intitial checkin
tz
parents:
diff changeset
   483
owner
395b851346df intitial checkin
tz
parents:
diff changeset
   484
    owner isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   485
        self validateAttributes
395b851346df intitial checkin
tz
parents:
diff changeset
   486
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   487
    ^ owner
395b851346df intitial checkin
tz
parents:
diff changeset
   488
395b851346df intitial checkin
tz
parents:
diff changeset
   489
395b851346df intitial checkin
tz
parents:
diff changeset
   490
!
395b851346df intitial checkin
tz
parents:
diff changeset
   491
395b851346df intitial checkin
tz
parents:
diff changeset
   492
permissions
395b851346df intitial checkin
tz
parents:
diff changeset
   493
    permissions isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   494
        self validateAttributes
395b851346df intitial checkin
tz
parents:
diff changeset
   495
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   496
    ^ permissions
395b851346df intitial checkin
tz
parents:
diff changeset
   497
395b851346df intitial checkin
tz
parents:
diff changeset
   498
395b851346df intitial checkin
tz
parents:
diff changeset
   499
!
395b851346df intitial checkin
tz
parents:
diff changeset
   500
395b851346df intitial checkin
tz
parents:
diff changeset
   501
size
395b851346df intitial checkin
tz
parents:
diff changeset
   502
    size isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   503
        self validateAttributes
395b851346df intitial checkin
tz
parents:
diff changeset
   504
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   505
    ^ size
395b851346df intitial checkin
tz
parents:
diff changeset
   506
395b851346df intitial checkin
tz
parents:
diff changeset
   507
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   508
395b851346df intitial checkin
tz
parents:
diff changeset
   509
!FileSelectionBrowser::Row methodsFor:'private'!
395b851346df intitial checkin
tz
parents:
diff changeset
   510
395b851346df intitial checkin
tz
parents:
diff changeset
   511
registerIconsOn:aGC
395b851346df intitial checkin
tz
parents:
diff changeset
   512
    "register all file icons on the gc
395b851346df intitial checkin
tz
parents:
diff changeset
   513
    "
395b851346df intitial checkin
tz
parents:
diff changeset
   514
    |directory|
395b851346df intitial checkin
tz
parents:
diff changeset
   515
395b851346df intitial checkin
tz
parents:
diff changeset
   516
    directory := 'xpmBitmaps/document_images/'.
395b851346df intitial checkin
tz
parents:
diff changeset
   517
395b851346df intitial checkin
tz
parents:
diff changeset
   518
    #(
395b851346df intitial checkin
tz
parents:
diff changeset
   519
        (#file            'tiny_file_plain.xpm'       )
395b851346df intitial checkin
tz
parents:
diff changeset
   520
        (#fileLink        'tiny_file_link.xpm'        )
395b851346df intitial checkin
tz
parents:
diff changeset
   521
        (#fileLocked      'tiny_file_lock.xpm'        )
395b851346df intitial checkin
tz
parents:
diff changeset
   522
        (#imageFile       'tiny_file_pix.xpm'         )
395b851346df intitial checkin
tz
parents:
diff changeset
   523
395b851346df intitial checkin
tz
parents:
diff changeset
   524
     ) do:[:el|
395b851346df intitial checkin
tz
parents:
diff changeset
   525
        aGC registerImage:(Image fromFile:(directory, el last)) key:(el first)
395b851346df intitial checkin
tz
parents:
diff changeset
   526
     ].
395b851346df intitial checkin
tz
parents:
diff changeset
   527
395b851346df intitial checkin
tz
parents:
diff changeset
   528
395b851346df intitial checkin
tz
parents:
diff changeset
   529
395b851346df intitial checkin
tz
parents:
diff changeset
   530
395b851346df intitial checkin
tz
parents:
diff changeset
   531
395b851346df intitial checkin
tz
parents:
diff changeset
   532
!
395b851346df intitial checkin
tz
parents:
diff changeset
   533
395b851346df intitial checkin
tz
parents:
diff changeset
   534
validateAttributes
395b851346df intitial checkin
tz
parents:
diff changeset
   535
    |info mode|
395b851346df intitial checkin
tz
parents:
diff changeset
   536
395b851346df intitial checkin
tz
parents:
diff changeset
   537
    permissions := String new:9 withAll:$-.
395b851346df intitial checkin
tz
parents:
diff changeset
   538
395b851346df intitial checkin
tz
parents:
diff changeset
   539
    (info := fileName info) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   540
        iconKey := #fileLocked.
395b851346df intitial checkin
tz
parents:
diff changeset
   541
        size    := owner := group := '?'.
395b851346df intitial checkin
tz
parents:
diff changeset
   542
      ^ self
395b851346df intitial checkin
tz
parents:
diff changeset
   543
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   544
    size   := info size.
395b851346df intitial checkin
tz
parents:
diff changeset
   545
    owner  := OperatingSystem  getUserNameFromID:(info uid).
395b851346df intitial checkin
tz
parents:
diff changeset
   546
    group  := OperatingSystem getGroupNameFromID:(info gid).
395b851346df intitial checkin
tz
parents:
diff changeset
   547
    mode   := info mode.
395b851346df intitial checkin
tz
parents:
diff changeset
   548
395b851346df intitial checkin
tz
parents:
diff changeset
   549
    1 to:9 by:3 do:[:i|
395b851346df intitial checkin
tz
parents:
diff changeset
   550
        (mode bitAt:i    ) == 1 ifTrue:[permissions at:10 - i put:$x].
395b851346df intitial checkin
tz
parents:
diff changeset
   551
        (mode bitAt:i + 1) == 1 ifTrue:[permissions at:9  - i put:$w].
395b851346df intitial checkin
tz
parents:
diff changeset
   552
        (mode bitAt:i + 2) == 1 ifTrue:[permissions at:8  - i put:$r].
395b851346df intitial checkin
tz
parents:
diff changeset
   553
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   554
395b851346df intitial checkin
tz
parents:
diff changeset
   555
    fileName isReadable ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   556
        info type == #symbolicLink ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   557
            iconKey == #fileLink
395b851346df intitial checkin
tz
parents:
diff changeset
   558
        ] ifFalse:[
395b851346df intitial checkin
tz
parents:
diff changeset
   559
            (Image isImageFileSuffix:(fileName suffix)) ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   560
                iconKey := #imageFile
395b851346df intitial checkin
tz
parents:
diff changeset
   561
            ] ifFalse:[
395b851346df intitial checkin
tz
parents:
diff changeset
   562
                iconKey := #file
395b851346df intitial checkin
tz
parents:
diff changeset
   563
            ]
395b851346df intitial checkin
tz
parents:
diff changeset
   564
        ]
395b851346df intitial checkin
tz
parents:
diff changeset
   565
    ] ifFalse:[
395b851346df intitial checkin
tz
parents:
diff changeset
   566
        iconKey := #fileLocked
395b851346df intitial checkin
tz
parents:
diff changeset
   567
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   568
395b851346df intitial checkin
tz
parents:
diff changeset
   569
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   570
395b851346df intitial checkin
tz
parents:
diff changeset
   571
!FileSelectionBrowser class methodsFor:'documentation'!
395b851346df intitial checkin
tz
parents:
diff changeset
   572
395b851346df intitial checkin
tz
parents:
diff changeset
   573
version
395b851346df intitial checkin
tz
parents:
diff changeset
   574
    ^ '$Header$'
395b851346df intitial checkin
tz
parents:
diff changeset
   575
! !