diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java index 5a2530d8f79b..02fb9ce70fc9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java @@ -21,6 +21,7 @@ import com.intellij.ide.highlighter.WorkspaceFileType; import com.intellij.notification.NotificationsManager; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationNamesInfo; +import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.components.*; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileTypes.FileType; @@ -181,7 +182,12 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject stateStorageManager.addMacro(StoragePathMacros.getMacroName(StoragePathMacros.PROJECT_CONFIG_DIR), dirStore.getPath()); - VfsUtil.markDirtyAndRefresh(false, true, true, fs.refreshAndFindFileByIoFile(dirStore)); + ApplicationManager.getApplication().invokeAndWait(new Runnable() { + @Override + public void run() { + VfsUtil.markDirtyAndRefresh(false, true, true, fs.refreshAndFindFileByIoFile(dirStore)); + } + }, ModalityState.defaultModalityState()); } else { myScheme = StorageScheme.DEFAULT; @@ -191,7 +197,12 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject final String workspacePath = composeWsPath(filePath); stateStorageManager.addMacro(StoragePathMacros.getMacroName(StoragePathMacros.WORKSPACE_FILE), workspacePath); - VfsUtil.markDirtyAndRefresh(false, true, false, fs.refreshAndFindFileByPath(filePath), fs.refreshAndFindFileByPath(workspacePath)); + ApplicationManager.getApplication().invokeAndWait(new Runnable() { + @Override + public void run() { + VfsUtil.markDirtyAndRefresh(false, true, false, fs.refreshAndFindFileByPath(filePath), fs.refreshAndFindFileByPath(workspacePath)); + } + }, ModalityState.defaultModalityState()); } myCachedLocation = null; diff --git a/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java index 45acc4f93c4a..2c359a75be6c 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package com.intellij.openapi.module.impl; import com.intellij.ProjectTopics; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.ProjectComponent; import com.intellij.openapi.components.StateStorageException; @@ -720,7 +721,12 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project ModuleEx module = getModuleByFilePath(moduleFile.getPath()); if (module == null) { - moduleFile.refresh(false, false); + ApplicationManager.getApplication().invokeAndWait(new Runnable() { + @Override + public void run() { + moduleFile.refresh(false, false); + } + }, ModalityState.defaultModalityState()); module = createAndLoadModule(moduleFile.getPath()); module.loadModuleComponents(); initModule(module);