From 5a0c3a45bd29d63e270376506db552256db00db3 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Tue, 10 Feb 2009 18:24:18 +0300 Subject: [PATCH] beforeRefreshStart/afterRefereshFinish events shall only be fired from EDT. --- .../openapi/vfs/impl/local/LocalFileSystemImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java b/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java index 00ae796f6de1..528940e0f8ba 100644 --- a/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java +++ b/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java @@ -206,7 +206,10 @@ public final class LocalFileSystemImpl extends LocalFileSystem implements Applic public void refreshIoFiles(Iterable files) { final VirtualFileManagerEx manager = (VirtualFileManagerEx)VirtualFileManager.getInstance(); - manager.fireBeforeRefreshStart(false); + Application app = ApplicationManager.getApplication(); + boolean fireCommonRefreshSession = app.isDispatchThread() || app.isWriteAccessAllowed(); + if (fireCommonRefreshSession) manager.fireBeforeRefreshStart(false); + try { List filesToRefresh = new ArrayList(); @@ -218,8 +221,9 @@ public final class LocalFileSystemImpl extends LocalFileSystem implements Applic } RefreshQueue.getInstance().refresh(false, false, null, filesToRefresh.toArray(new VirtualFile[filesToRefresh.size()])); - } finally { - manager.fireAfterRefreshFinish(false); + } + finally { + if (fireCommonRefreshSession) manager.fireAfterRefreshFinish(false); } }