FileSelectionList.st
changeset 2833 1544bb56f6bf
parent 2832 23ad57a4ad76
child 2913 bdf4fb09cfc0
equal deleted inserted replaced
2832:23ad57a4ad76 2833:1544bb56f6bf
    65 
    65 
    66             directoryName           the path when it was taken
    66             directoryName           the path when it was taken
    67 
    67 
    68             directoryContents       (cached) contents of current directory
    68             directoryContents       (cached) contents of current directory
    69 
    69 
    70             directoryFileTypes      (cached) file types (symbols) of current directory
    70             directoryFileTypes      (cached) isDirectory-boolean per entry
    71 
    71 
    72             fileTypes               file types as shown in list (i.e only matching ones)
    72             fileTypes               file types as shown in list (i.e only matching ones)
    73 
    73 
    74             matchBlock              if non-nil: block evaluated per full filename;
    74             matchBlock              if non-nil: block evaluated per full filename;
    75                                     only files for which matchBlock returns true are shown.
    75                                     only files for which matchBlock returns true are shown.
   939 !
   939 !
   940 
   940 
   941 updateList
   941 updateList
   942     "set the lists contents to the filenames in the directory"
   942     "set the lists contents to the filenames in the directory"
   943 
   943 
   944     |newList newTypes index obsolete 
   944     |newList newTypes obsolete 
   945      matching dir ignoreCase|
   945      matching dir ignoreCase|
   946 
   946 
   947     directory isNil ifTrue:[
   947     directory isNil ifTrue:[
   948         self list:nil.
   948         self list:nil.
   949         ^ self
   949         ^ self
   967             directoryContents := (directory fullDirectoryContents ? #()) sort.
   967             directoryContents := (directory fullDirectoryContents ? #()) sort.
   968         ].
   968         ].
   969 
   969 
   970         newList := OrderedCollection new.
   970         newList := OrderedCollection new.
   971         newTypes := OrderedCollection new.
   971         newTypes := OrderedCollection new.
   972         index := 1.
       
   973 
   972 
   974         ignoreCase := ignoreCaseInPattern ? (Filename isCaseSensitive not).
   973         ignoreCase := ignoreCaseInPattern ? (Filename isCaseSensitive not).
   975 
   974 
   976         dir := directory pathName asFilename.
   975         dir := directory pathName asFilename.
   977         directoryContents do:[:name |
   976         directoryContents do:[:name |
  1015             ].
  1014             ].
  1016             ignore ifFalse:[
  1015             ignore ifFalse:[
  1017                 newList add:name.
  1016                 newList add:name.
  1018                 newTypes add:isDirectory.
  1017                 newTypes add:isDirectory.
  1019             ].
  1018             ].
  1020             index := index + 1
       
  1021         ].
  1019         ].
  1022         directoryFileTypes := newTypes.
  1020         directoryFileTypes := newTypes.
  1023         self list:newList.
  1021         self list:newList.
  1024     ].
  1022     ].
  1025 
  1023 
  1079 ! !
  1077 ! !
  1080 
  1078 
  1081 !FileSelectionList class methodsFor:'documentation'!
  1079 !FileSelectionList class methodsFor:'documentation'!
  1082 
  1080 
  1083 version
  1081 version
  1084     ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.51 2004-01-07 15:40:53 cg Exp $'
  1082     ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.52 2004-01-07 15:43:33 cg Exp $'
  1085 ! !
  1083 ! !