IDEA-151793 IDEA failed to restart after plugins activation

This commit is contained in:
Vladimir Krivosheev
2016-08-01 16:12:08 +02:00
parent 9f24659cd7
commit 9555c13fba
2 changed files with 14 additions and 21 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -29,21 +29,22 @@ import javax.swing.*;
import java.util.Set;
public abstract class ProgressManager extends ProgressIndicatorProvider {
private static class ProgressManagerHolder {
private static final ProgressManager ourInstance;
static {
ourInstance = ServiceManager.getService(ProgressManager.class);
if (ourInstance == null) {
throw new AssertionError("ProgressManager is null; " + ApplicationManager.getApplication());
}
}
}
private static ProgressManager ourInstance;
@NotNull
@SuppressWarnings("MethodOverridesStaticMethodOfSuperclass")
public static ProgressManager getInstance() {
return ProgressManagerHolder.ourInstance;
ProgressManager result = ourInstance;
if (result == null) {
result = ServiceManager.getService(ProgressManager.class);
if (result == null) {
throw new AssertionError("ProgressManager is null; " + ApplicationManager.getApplication());
}
else {
ourInstance = result;
}
}
return result;
}
public abstract boolean hasProgressIndicator();
@@ -34,7 +34,6 @@ import com.intellij.openapi.application.*;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.components.ServiceKt;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.impl.PlatformComponentManagerImpl;
import com.intellij.openapi.components.impl.ServiceManagerImpl;
import com.intellij.openapi.components.impl.stores.StoreUtil;
@@ -444,14 +443,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
task.run();
}
else {
ProgressManager progressManager = ServiceManager.getService(ProgressManager.class);
if (progressManager == null) {
// https://youtrack.jetbrains.com/issue/IDEA-134164
task.run();
}
else {
progressManager.runProcess(task, indicator);
}
ProgressManager.getInstance().runProcess(task, indicator);
}
}