mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 22:17:05 +07:00
IDEA-117507 NullPointerException on startup of IDEA 13
This commit is contained in:
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public abstract class ProgressIndicatorProvider {
|
||||
@Nullable
|
||||
public static ProgressIndicatorProvider ourInstance;
|
||||
public static volatile ProgressIndicatorProvider ourInstance;
|
||||
|
||||
@Nullable
|
||||
public static ProgressIndicatorProvider getInstance() {
|
||||
@@ -36,22 +36,27 @@ public abstract class ProgressIndicatorProvider {
|
||||
|
||||
@Nullable
|
||||
public static ProgressIndicator getGlobalProgressIndicator() {
|
||||
return ourInstance != null ? ourInstance.getProgressIndicator() : null;
|
||||
ProgressIndicatorProvider provider = ourInstance;
|
||||
return provider != null ? provider.getProgressIndicator() : null;
|
||||
}
|
||||
|
||||
public abstract NonCancelableSection startNonCancelableSection();
|
||||
|
||||
@NotNull
|
||||
public static NonCancelableSection startNonCancelableSectionIfSupported() {
|
||||
return ourInstance != null ? ourInstance.startNonCancelableSection() : NonCancelableSection.EMPTY;
|
||||
ProgressIndicatorProvider provider = ourInstance;
|
||||
return provider != null ? provider.startNonCancelableSection() : NonCancelableSection.EMPTY;
|
||||
}
|
||||
|
||||
public static volatile boolean ourNeedToCheckCancel = false;
|
||||
public static void checkCanceled() throws ProcessCanceledException {
|
||||
// smart optimization! There's a thread started in ProgressManagerImpl, that set's this flag up once in 10 milliseconds
|
||||
if (ourNeedToCheckCancel && ourInstance != null) {
|
||||
ourInstance.doCheckCanceled();
|
||||
ourNeedToCheckCancel = false;
|
||||
if (ourNeedToCheckCancel) {
|
||||
ProgressIndicatorProvider provider = ourInstance;
|
||||
if (provider != null) {
|
||||
provider.doCheckCanceled();
|
||||
ourNeedToCheckCancel = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,13 +50,14 @@ public abstract class ProgressManager {
|
||||
};
|
||||
}
|
||||
|
||||
private static ProgressManager ourInstance;
|
||||
private static volatile ProgressManager ourInstance;
|
||||
|
||||
public static ProgressManager getInstance() {
|
||||
if (ourInstance == null) {
|
||||
ourInstance = ServiceManager.getService(ProgressManager.class);
|
||||
ProgressManager progressManager = ourInstance;
|
||||
if (progressManager == null) {
|
||||
ourInstance = progressManager = ServiceManager.getService(ProgressManager.class);
|
||||
}
|
||||
return ourInstance;
|
||||
return progressManager;
|
||||
}
|
||||
|
||||
public abstract boolean hasProgressIndicator();
|
||||
|
||||
Reference in New Issue
Block a user