DirectoryContentsBrowser.st
changeset 4072 b2abfcbcaf34
parent 4071 f923c8257818
child 4073 ed730823f751
--- a/DirectoryContentsBrowser.st	Mon Oct 28 08:58:31 2002 +0100
+++ b/DirectoryContentsBrowser.st	Mon Oct 28 09:58:31 2002 +0100
@@ -1,12 +1,12 @@
 "{ Package: 'stx:libtool' }"
 
 AbstractFileBrowser subclass:#DirectoryContentsBrowser
-	instanceVariableNames:'updateDirectoryContentsTask updateColumnsTask modificationTime
-		directory columnDescriptors iconIndex fileDescriptionIndex
-		iconExtent tableColumns previewIndex allItemsList
-		updateToExternFileHolderLock inDropMode draggedItem canDropItem
-		viewBrowserMenu updateContentsSelection selectionInFileList
-		contentsBrowser browserItemList matchBlock updateContentsTask'
+	instanceVariableNames:'updateColumnsTask modificationTime directory columnDescriptors
+		iconIndex fileDescriptionIndex iconExtent tableColumns
+		previewIndex allItemsList updateToExternFileHolderLock inDropMode
+		draggedItem canDropItem viewBrowserMenu updateContentsSelection
+		selectionInFileList contentsBrowser browserItemList matchBlock
+		updateContentsTask'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-Tools-File'
@@ -783,18 +783,6 @@
     ^ updateContentsSelection
 !
 
-updateDirectoryContentsTask
-    "return the value of the instance variable 'updateDirectoryContentsTask' (automatically generated)"
-
-    ^ updateDirectoryContentsTask
-!
-
-updateDirectoryContentsTask:something
-    "set the value of the instance variable 'updateDirectoryContentsTask' (automatically generated)"
-
-    updateDirectoryContentsTask := something.
-!
-
 updateToExternFileHolderLock
     "return the value of the instance variable 'updateToExternFileHolder' (automatically generated)"
 
@@ -1587,7 +1575,6 @@
     "release my resources
     "                    
     self updateColumnsTaskStop.
-    self updateDirectoryContentsTaskStop.
     updateContentsTask stop.
     super release.
 !
@@ -1595,7 +1582,7 @@
 releaseAsSubCanvas
 
     self updateColumnsTaskStop.
-    self updateDirectoryContentsTaskStop.
+    updateContentsTask stop.
     ^ super releaseAsSubCanvas.
 !
 
@@ -1874,91 +1861,6 @@
     ].
 ! !
 
-!DirectoryContentsBrowser methodsFor:'task update contents'!
-
-updateDirectoryContentsTaskCycle
-
-    | contents|
-
-    "/ DIRECTORY CONTENTS HAVE CHANGED
-    (modificationTime ~= self directory modificationTime) ifTrue:[
-        modificationTime := self directory modificationTime.
-        contents := self directory directoryContentsAsFilenames.
-        contents size == 0 ifTrue:[ 
-            allItemsList removeAll. 
-        ] ifFalse:[
-            "/ MERGE WITH CURRENT CONTENTS
-            allItemsList reverseDo:[:aDesc|
-                "/ remove no longer valid files
-                (contents detect:[:f| aDesc fileName = f] ifNone:nil) isNil ifTrue:[
-                    allItemsList removeIdentical:aDesc
-                ]
-            ].
-            allItemsList size ~~ contents size ifTrue:[
-                "/ add new files
-                | addedFiles |
-                addedFiles := OrderedCollection new.
-                contents reverseDo:[:aFile|
-                    (allItemsList contains:[:item| item fileName = aFile]) ifTrue:[
-                        addedFiles add:(DirectoryContentsItem fileName:aFile)
-                    ]
-                ].
-                allItemsList addAll:addedFiles.
-            ]
-        ].
-        "/ because this can be invoked by a background task,
-        "/ ensure that we syncronize this operation with the main browsers GUI
-        "/ (i.e. avoid changing the list, while the main process loops over it in
-        "/ a redraw, select etc.)
-        self enqueueMessage:#value for:[self evaluateItems] arguments:nil.
-    ].
-!
-
-updateDirectoryContentsTaskStart
-    |p|
-
-    self directory notNil ifTrue:[
-        p := [ 
-                 [   
-                     [true] whileTrue:[
-                         (contentsBrowser shown and:[self directory notNil]) ifTrue:[
-                             self updateDirectoryContentsTaskCycle.
-                             Processor yield.
-                         ].
-                         Delay waitForSeconds:1.0
-                     ]
-                 ] valueNowOrOnUnwindDo:[
-                     self updateDirectoryContentsTask:nil.
-                     self updateColumnsTaskStop.
-                 ]
-              ] newProcess.
-
-        "/ p priority:(Processor systemBackgroundPriority).
-        p priorityRange:(Processor userBackgroundPriority to:Processor activePriority).
-        self updateDirectoryContentsTask:p.
-
-        p name:('DirectoryContentsBrowser update contents[', self directory baseName, ']').
-        p resume.
-    ]
-!
-
-updateDirectoryContentsTaskStop
-    |task|
-
-    (task := self updateDirectoryContentsTask) notNil ifTrue:[
-        self updateDirectoryContentsTask:nil.
-
-        Object errorSignal handle:[:ex|
-            Dialog warn:ex description.
-        ]do:[
-            task isDead ifFalse:[
-                task terminateWithAllSubprocessesInGroup.
-                task waitUntilTerminated.
-            ]
-        ]
-    ].
-! !
-
 !DirectoryContentsBrowser::DirectoryContentsItem class methodsFor:'instance creation'!
 
 fileName:aFilename 
@@ -2557,7 +2459,6 @@
 
     self directoryContentsChangeFlag:true.
     self changeSema signal.
-"/    self modificationTaskStop.
 !
 
 wakeUpForFilterChanged
@@ -2598,7 +2499,6 @@
         [true] whileTrue:[
             AbortSignal handle:[
                 self debugMessage:'get an abort signal'.
-                self directoryChangeFlag:false.             
                 self directoryContentsChangeFlag:false.
                 self filterChangeFlag:false.
                 self sortBlockChangeFlag:false.
@@ -2640,6 +2540,7 @@
 
 modificationTaskStart
 
+    modificationTask notNil ifTrue:[^ self].
     modificationTask := [ 
          [
             [ true ] whileTrue:[
@@ -2744,7 +2645,6 @@
             ]
         arguments:#().
     filteredItems := newItems.
-    self modificationTaskStart.
 !
 
 evaluateFilter:aItemsList
@@ -2839,5 +2739,5 @@
 !DirectoryContentsBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/DirectoryContentsBrowser.st,v 1.39 2002-10-28 07:58:28 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DirectoryContentsBrowser.st,v 1.40 2002-10-28 08:58:31 penk Exp $'
 ! !