DirectoryView.st
changeset 999 3dc1bc073981
parent 991 9454c462dad4
child 1346 0793db434b21
equal deleted inserted replaced
998:ad33f2625598 999:3dc1bc073981
   378     foundFiles := Set new.
   378     foundFiles := Set new.
   379     "/ filterList := self listOfFileFilters value.
   379     "/ filterList := self listOfFileFilters value.
   380     filterList := self selectedFileFilter asCollectionOfSubstringsSeparatedBy:$;.
   380     filterList := self selectedFileFilter asCollectionOfSubstringsSeparatedBy:$;.
   381     filterList := filterList collect:[:pattern | pattern withoutSeparators].
   381     filterList := filterList collect:[:pattern | pattern withoutSeparators].
   382 
   382 
   383     Cursor wait showWhile: 
   383     self withCursor:Cursor read do:[ 
   384     [ 
       
   385         (dir := DirectoryContents directoryNamed: directory) notNil ifTrue:[
   384         (dir := DirectoryContents directoryNamed: directory) notNil ifTrue:[
   386 "/            dir filesAndBasenamesDo:[:file :name|      
   385 "/            dir filesAndBasenamesDo:[:file :name|      
   387 "/                filterList do:[:filter|
   386 "/                filterList do:[:filter|
   388 "/                    ((filter match:name) and:[(foundFiles includes: name) not])
   387 "/                    ((filter match:name) and:[(foundFiles includes: name) not])
   389 "/                    ifTrue:[
   388 "/                    ifTrue:[
   393 "/            ].
   392 "/            ].
   394             dir filesAndBasenamesDo:[:file :name|      
   393             dir filesAndBasenamesDo:[:file :name|      
   395                 allFiles add: name
   394                 allFiles add: name
   396             ].
   395             ].
   397 
   396 
   398             filterList do:[:filter|
   397             Filename isCaseSensitive ifFalse:[
   399                 foundFiles addAll:(allFiles select:[:name | filter match:name]).
   398                 filterList do:[:filter|
       
   399                     |lcFilter|
       
   400 
       
   401                     lcFilter := filter asLowercase.
       
   402                     foundFiles
       
   403                         addAll:(allFiles 
       
   404                                     select:[:name | lcFilter match:name asLowercase]
       
   405                                 ).
       
   406                 ]
       
   407             ] ifTrue:[
       
   408                 filterList do:[:filter|
       
   409                     foundFiles
       
   410                         addAll:(allFiles 
       
   411                                     select:[:name | filter match:name]
       
   412                                 ).
       
   413                 ]
   400             ].
   414             ].
   401 
   415 
   402             foundFiles := foundFiles asOrderedCollection sort.
   416             foundFiles := foundFiles asOrderedCollection sort.
   403             dir := directory asFilename.
   417             dir := directory asFilename.
   404             self listOfFiles contents: (foundFiles collect:[:name| FileRow new fileName:(dir construct:name)])
   418             self listOfFiles contents: (foundFiles collect:[:name| FileRow new fileName:(dir construct:name)])
   405         ]
   419         ]
   406     ]
   420     ]
   407 
   421 
   408     "Modified: / 12.9.1998 / 17:25:25 / cg"
   422     "Modified: / 23.9.1998 / 17:00:42 / cg"
   409 !
   423 !
   410 
   424 
   411 readMonitoringDirectory
   425 readMonitoringDirectory
   412 
   426 
   413     |readBlock|
   427     |readBlock|
   471 
   485 
   472     ^selectedFileFilter
   486     ^selectedFileFilter
   473 
   487 
   474 !
   488 !
   475 
   489 
   476 selectedFileFilter: aString
   490 selectedFileFilter:aString
   477 
   491     "change the file filter"
   478     aString size = 0 ifTrue: [self listOfFileFilters remove: selectedFileFilter ifAbsent: nil].
   492 
       
   493     |listOfFileFilters nArgs|
       
   494 
       
   495     aString = selectedFileFilter ifTrue:[^ self].
       
   496 
       
   497     listOfFileFilters := self listOfFileFilters.
       
   498 
       
   499     "/ what is this for ?
       
   500     aString size == 0 ifTrue: [
       
   501         listOfFileFilters remove: selectedFileFilter ifAbsent: nil
       
   502     ].
   479     selectedFileFilter := aString.
   503     selectedFileFilter := aString.
   480     (self listOfFileFilters includes: selectedFileFilter) not &
   504 
   481     selectedFileFilter notEmpty
   505     ((listOfFileFilters includes: selectedFileFilter) not
   482     ifTrue:
   506     and:[selectedFileFilter notEmpty])
   483     [
   507     ifTrue: [
   484         self listOfFileFilters addFirst: selectedFileFilter
   508         listOfFileFilters addFirst: selectedFileFilter
   485     ].
   509     ].
   486     (self listOfFileFilters includes: selectedFileFilter) &
   510     ((listOfFileFilters includes: selectedFileFilter)
   487     fileFilterSelectAction notNil 
   511     and:[fileFilterSelectAction notNil]) 
   488     ifTrue: 
   512     ifTrue: [
   489     [
   513         (nArgs := fileFilterSelectAction numArgs) == 0
   490         fileFilterSelectAction numArgs = 0
   514         ifTrue: [
   491         ifTrue:
       
   492         [
       
   493             fileFilterSelectAction value
   515             fileFilterSelectAction value
   494         ].
   516         ] ifFalse:[
   495         fileFilterSelectAction numArgs = 1
   517             nArgs == 1 ifTrue:[
   496         ifTrue:
   518                 fileFilterSelectAction value: selectedFileFilter
   497         [
   519             ] ifFalse:[
   498             fileFilterSelectAction value: selectedFileFilter
   520                 self error:'bad numArgs of fileFilter action block'
       
   521             ]
   499         ]
   522         ]
   500     ].       
   523     ].       
   501     self readDirectory.
   524     self readDirectory.
       
   525 
       
   526     "Modified: / 23.9.1998 / 16:53:05 / cg"
   502 ! !
   527 ! !
   503 
   528 
   504 !DirectoryView methodsFor:'startup / release'!
   529 !DirectoryView methodsFor:'startup / release'!
   505 
   530 
   506 closeRequest
   531 closeRequest