From 1c3d92ca5759e84e3e25252ec9bbcd284afdef89 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Wed, 19 Jan 2005 22:16:46 +0300 Subject: [PATCH] Do not use FileWatcher when asked to refresh synchronously a single file. FileWatcher native stuff is asynchronous by definition. --- .../openapi/vfs/impl/local/LocalFileSystemImpl.java | 13 +++++++++---- .../openapi/vfs/impl/local/VirtualFileImpl.java | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java b/source/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java index 1ea1066a11f0..5e49b91089a1 100644 --- a/source/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java +++ b/source/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java @@ -367,7 +367,7 @@ public class LocalFileSystemImpl extends LocalFileSystem implements ApplicationC getManager().addEventToFireByRefresh(action, asynchronous, modalityState); } else { - refresh(rootFile, true, false, worker, modalityState); + refresh(rootFile, true, false, worker, modalityState, asynchronous); } } } @@ -401,8 +401,13 @@ public class LocalFileSystemImpl extends LocalFileSystem implements ApplicationC return mySynchronizeQueueAlarm; } - void refresh(VirtualFile file, boolean recursive, boolean storeStatus, WorkerThread worker, ModalityState modalityState) { - if (!FileWatcher.isAvailable()) { + void refresh(VirtualFile file, + boolean recursive, + boolean storeStatus, + WorkerThread worker, + ModalityState modalityState, + boolean asynchronous) { + if (!FileWatcher.isAvailable() || !recursive && !asynchronous) { // We're unable to definitely refresh syncronously by means of file watcher. ((VirtualFileImpl)file).refreshInternal(recursive, worker, modalityState); } else { @@ -438,7 +443,7 @@ public class LocalFileSystemImpl extends LocalFileSystem implements ApplicationC for (int i = 0; i < children.length; i++) { VirtualFile child = children[i]; if (status == DIRTY_STATUS && !((VirtualFileImpl)child).getPhysicalFile().exists()) continue; // should be already handled above (see SCR6145) - refresh(child, recursive, false, worker, modalityState); + refresh(child, recursive, false, worker, modalityState, asynchronous); } } } diff --git a/source/com/intellij/openapi/vfs/impl/local/VirtualFileImpl.java b/source/com/intellij/openapi/vfs/impl/local/VirtualFileImpl.java index 386b3d8852af..a83b85dde9ef 100644 --- a/source/com/intellij/openapi/vfs/impl/local/VirtualFileImpl.java +++ b/source/com/intellij/openapi/vfs/impl/local/VirtualFileImpl.java @@ -559,7 +559,7 @@ public class VirtualFileImpl extends VirtualFile { myFileSystem.getManager().addEventToFireByRefresh(runnable, asynchronous, modalityState); } else { - myFileSystem.refresh(VirtualFileImpl.this, recursive, true, worker, modalityState); + myFileSystem.refresh(VirtualFileImpl.this, recursive, true, worker, modalityState, asynchronous); } } };