mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EmptyProgressIndicator: allow to set ModalityState in constructor
This commit is contained in:
committed by
Aleksey Pivovarov
parent
1fc2ddb5bb
commit
e23cc9ef2d
@@ -20,9 +20,19 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EmptyProgressIndicator implements StandardProgressIndicator {
|
||||
@NotNull private final ModalityState myModalityState;
|
||||
|
||||
private volatile boolean myIsRunning;
|
||||
private volatile boolean myIsCanceled;
|
||||
|
||||
public EmptyProgressIndicator() {
|
||||
this(ModalityState.NON_MODAL);
|
||||
}
|
||||
|
||||
public EmptyProgressIndicator(@NotNull ModalityState modalityState) {
|
||||
myModalityState = modalityState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
myIsRunning = true;
|
||||
@@ -108,7 +118,7 @@ public class EmptyProgressIndicator implements StandardProgressIndicator {
|
||||
@Override
|
||||
@NotNull
|
||||
public ModalityState getModalityState() {
|
||||
return ModalityState.NON_MODAL;
|
||||
return myModalityState;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -222,13 +222,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
final ModalityState modalityState = ModalityState.current();
|
||||
|
||||
ApplicationManager.getApplication().executeOnPooledThread(() -> {
|
||||
EmptyProgressIndicator indicator = new EmptyProgressIndicator() {
|
||||
@NotNull
|
||||
@Override
|
||||
public ModalityState getModalityState() {
|
||||
return modalityState;
|
||||
}
|
||||
};
|
||||
EmptyProgressIndicator indicator = new EmptyProgressIndicator(modalityState);
|
||||
ProgressManager.getInstance().executeProcessUnderProgress(() -> {
|
||||
try {
|
||||
if (myDisposed) return;
|
||||
|
||||
+2
-14
@@ -71,13 +71,7 @@ public class BackgroundTaskUtil {
|
||||
final int waitMillis,
|
||||
final boolean forceEDT) {
|
||||
final ModalityState modality = ModalityState.current();
|
||||
final ProgressIndicator indicator = new EmptyProgressIndicator() {
|
||||
@NotNull
|
||||
@Override
|
||||
public ModalityState getModalityState() {
|
||||
return modality;
|
||||
}
|
||||
};
|
||||
final ProgressIndicator indicator = new EmptyProgressIndicator(modality);
|
||||
|
||||
final Semaphore semaphore = new Semaphore(0);
|
||||
final AtomicReference<Runnable> resultRef = new AtomicReference<Runnable>();
|
||||
@@ -164,13 +158,7 @@ public class BackgroundTaskUtil {
|
||||
public static ProgressIndicator executeOnPooledThread(@NotNull final Consumer<ProgressIndicator> task,
|
||||
@NotNull Disposable parent,
|
||||
final ModalityState modalityState) {
|
||||
final ProgressIndicator indicator = new EmptyProgressIndicator() {
|
||||
@NotNull
|
||||
@Override
|
||||
public ModalityState getModalityState() {
|
||||
return modalityState;
|
||||
}
|
||||
};
|
||||
final ProgressIndicator indicator = new EmptyProgressIndicator(modalityState);
|
||||
|
||||
final Disposable disposable = new Disposable() {
|
||||
@Override
|
||||
|
||||
+1
-7
@@ -94,13 +94,7 @@ class RepositoryLoader extends Loader {
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ProgressManager.getInstance().runProcess(new LoadTask(data), new EmptyProgressIndicator() {
|
||||
@NotNull
|
||||
@Override
|
||||
public ModalityState getModalityState() {
|
||||
return state;
|
||||
}
|
||||
});
|
||||
ProgressManager.getInstance().runProcess(new LoadTask(data), new EmptyProgressIndicator(state));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user