WI-15315 (refresh project/module files immediately)

This commit is contained in:
Roman Shevchenko
2013-02-07 19:49:28 +01:00
parent ab2be770e5
commit b649bcb600
2 changed files with 21 additions and 4 deletions
@@ -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;
@@ -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);