mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
moved to ProgressManager
This commit is contained in:
@@ -240,4 +240,17 @@ public abstract class ProgressManager extends ProgressIndicatorProvider {
|
||||
*/
|
||||
public abstract boolean runInReadActionWithWriteActionPriority(@NotNull final Runnable action);
|
||||
|
||||
public static boolean isInNonCancelableSection() {
|
||||
ProgressIndicator indicator = getGlobalProgressIndicator();
|
||||
while (indicator != null) {
|
||||
if (indicator instanceof NonCancelableSection) return true;
|
||||
if (indicator instanceof WrappedProgressIndicator) {
|
||||
indicator = ((WrappedProgressIndicator)indicator).getOriginalProgressIndicator();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
-14
@@ -233,18 +233,4 @@ public class ProgressIndicatorUtils {
|
||||
public static void yieldToPendingWriteActions() {
|
||||
ApplicationManager.getApplication().invokeAndWait(EmptyRunnable.INSTANCE, ModalityState.any());
|
||||
}
|
||||
|
||||
public static boolean isInNonCancelableSection() {
|
||||
ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
|
||||
while (indicator != null) {
|
||||
if (indicator instanceof NonCancelableSection) return true;
|
||||
if (indicator instanceof WrappedProgressIndicator) {
|
||||
indicator = ((WrappedProgressIndicator)indicator).getOriginalProgressIndicator();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -32,7 +32,6 @@ import com.intellij.openapi.components.impl.stores.StorageUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.progress.*;
|
||||
import com.intellij.openapi.progress.util.ProgressIndicatorUtils;
|
||||
import com.intellij.openapi.project.*;
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
@@ -387,7 +386,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements Disposable {
|
||||
}
|
||||
|
||||
private static boolean canCancelProjectLoading() {
|
||||
return !ProgressIndicatorUtils.isInNonCancelableSection();
|
||||
return !ProgressManager.isInNonCancelableSection();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user