mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
initialize file watcher in background
This commit is contained in:
+17
-21
@@ -39,10 +39,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.progress.*;
|
||||
import com.intellij.openapi.progress.util.ProgressWindow;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.project.ProjectManagerListener;
|
||||
import com.intellij.openapi.project.ProjectReloadState;
|
||||
import com.intellij.openapi.project.*;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
@@ -417,7 +414,12 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
}
|
||||
|
||||
fireProjectOpened(project);
|
||||
waitForFileWatcher(project);
|
||||
DumbService.getInstance(project).queueTask(new DumbModeTask() {
|
||||
@Override
|
||||
public void performInDumbMode(@NotNull ProgressIndicator indicator) {
|
||||
waitForFileWatcher(indicator);
|
||||
}
|
||||
});
|
||||
|
||||
final StartupManagerImpl startupManager = (StartupManagerImpl)StartupManager.getInstance(project);
|
||||
boolean ok = myProgressManager.runProcessWithProgressSynchronously(new Runnable() {
|
||||
@@ -478,7 +480,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
myOpenProjectsArrayCache = myOpenProjects.toArray(new Project[myOpenProjects.size()]);
|
||||
}
|
||||
|
||||
private void waitForFileWatcher(@NotNull Project project) {
|
||||
private static void waitForFileWatcher(ProgressIndicator indicator) {
|
||||
LocalFileSystem fs = LocalFileSystem.getInstance();
|
||||
if (!(fs instanceof LocalFileSystemImpl)) return;
|
||||
|
||||
@@ -486,21 +488,15 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
if (!watcher.isOperational() || !watcher.isSettingRoots()) return;
|
||||
|
||||
LOG.info("FW/roots waiting started");
|
||||
Task.Modal task = new Task.Modal(project, ProjectBundle.message("project.load.progress"), true) {
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
indicator.setIndeterminate(true);
|
||||
indicator.setText(ProjectBundle.message("project.load.waiting.watcher"));
|
||||
if (indicator instanceof ProgressWindow) {
|
||||
((ProgressWindow)indicator).setCancelButtonText(CommonBundle.message("button.skip"));
|
||||
}
|
||||
while (watcher.isSettingRoots() && !indicator.isCanceled()) {
|
||||
TimeoutUtil.sleep(10);
|
||||
}
|
||||
LOG.info("FW/roots waiting finished");
|
||||
}
|
||||
};
|
||||
myProgressManager.run(task);
|
||||
indicator.setIndeterminate(true);
|
||||
indicator.setText(ProjectBundle.message("project.load.waiting.watcher"));
|
||||
if (indicator instanceof ProgressWindow) {
|
||||
((ProgressWindow)indicator).setCancelButtonText(CommonBundle.message("button.skip"));
|
||||
}
|
||||
while (watcher.isSettingRoots() && !indicator.isCanceled()) {
|
||||
TimeoutUtil.sleep(10);
|
||||
}
|
||||
LOG.info("FW/roots waiting finished");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user