mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +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 {
|
public abstract class ProgressIndicatorProvider {
|
||||||
@Nullable
|
@Nullable
|
||||||
public static ProgressIndicatorProvider ourInstance;
|
public static volatile ProgressIndicatorProvider ourInstance;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static ProgressIndicatorProvider getInstance() {
|
public static ProgressIndicatorProvider getInstance() {
|
||||||
@@ -36,22 +36,27 @@ public abstract class ProgressIndicatorProvider {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static ProgressIndicator getGlobalProgressIndicator() {
|
public static ProgressIndicator getGlobalProgressIndicator() {
|
||||||
return ourInstance != null ? ourInstance.getProgressIndicator() : null;
|
ProgressIndicatorProvider provider = ourInstance;
|
||||||
|
return provider != null ? provider.getProgressIndicator() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract NonCancelableSection startNonCancelableSection();
|
public abstract NonCancelableSection startNonCancelableSection();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static NonCancelableSection startNonCancelableSectionIfSupported() {
|
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 volatile boolean ourNeedToCheckCancel = false;
|
||||||
public static void checkCanceled() throws ProcessCanceledException {
|
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
|
// smart optimization! There's a thread started in ProgressManagerImpl, that set's this flag up once in 10 milliseconds
|
||||||
if (ourNeedToCheckCancel && ourInstance != null) {
|
if (ourNeedToCheckCancel) {
|
||||||
ourInstance.doCheckCanceled();
|
ProgressIndicatorProvider provider = ourInstance;
|
||||||
ourNeedToCheckCancel = false;
|
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() {
|
public static ProgressManager getInstance() {
|
||||||
if (ourInstance == null) {
|
ProgressManager progressManager = ourInstance;
|
||||||
ourInstance = ServiceManager.getService(ProgressManager.class);
|
if (progressManager == null) {
|
||||||
|
ourInstance = progressManager = ServiceManager.getService(ProgressManager.class);
|
||||||
}
|
}
|
||||||
return ourInstance;
|
return progressManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean hasProgressIndicator();
|
public abstract boolean hasProgressIndicator();
|
||||||
|
|||||||
Reference in New Issue
Block a user