mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduce runProcessWithProgressAsync
This commit is contained in:
@@ -93,7 +93,7 @@ public abstract class ProgressManager {
|
||||
protected abstract void doCheckCanceled() throws ProcessCanceledException;
|
||||
|
||||
public abstract void executeNonCancelableSection(@NotNull Runnable runnable);
|
||||
public abstract NonCancelableSection startNonCancelableSection();
|
||||
public abstract NonCancelableSection startNonCancelableSection();
|
||||
|
||||
public abstract void setCancelButtonText(String cancelButtonText);
|
||||
|
||||
@@ -191,4 +191,5 @@ public abstract class ProgressManager {
|
||||
*/
|
||||
public abstract void run(@NotNull Task task);
|
||||
|
||||
}
|
||||
public abstract void runProcessWithProgressAsynchronously(@NotNull Task.Backgroundable task, @NotNull ProgressIndicator progressIndicator);
|
||||
}
|
||||
+7
-6
@@ -379,14 +379,15 @@ public class ProgressManagerImpl extends ProgressManager implements Disposable{
|
||||
else {
|
||||
progressIndicator = new BackgroundableProcessIndicator(task);
|
||||
}
|
||||
runProcessWithProgressAsynchronously(task, progressIndicator);
|
||||
}
|
||||
|
||||
public static void runProcessWithProgressAsynchronously(@NotNull final Task.Backgroundable task, @NotNull final ProgressIndicator progressIndicator) {
|
||||
runProcessWithProgressAsynchronously(task, progressIndicator, null);
|
||||
}
|
||||
|
||||
public static void runProcessWithProgressAsynchronously(@NotNull final Task.Backgroundable task, @NotNull final ProgressIndicator progressIndicator,
|
||||
public void runProcessWithProgressAsynchronously(@NotNull Task.Backgroundable task, @NotNull ProgressIndicator progressIndicator) {
|
||||
runProcessWithProgressAsynchronously(task, progressIndicator, null);
|
||||
}
|
||||
|
||||
public static void runProcessWithProgressAsynchronously(@NotNull final Task.Backgroundable task,
|
||||
@NotNull final ProgressIndicator progressIndicator,
|
||||
@Nullable final Runnable continuation) {
|
||||
if (progressIndicator instanceof Disposable) {
|
||||
Disposer.register(ApplicationManager.getApplication(), (Disposable)progressIndicator);
|
||||
@@ -416,7 +417,7 @@ public class ProgressManagerImpl extends ProgressManager implements Disposable{
|
||||
}
|
||||
}, ModalityState.NON_MODAL);
|
||||
}
|
||||
else if (!canceled) {
|
||||
else {
|
||||
final Task.NotificationInfo notificationInfo = task.notifyFinished();
|
||||
if (notificationInfo != null && time > 5000) { // snow notification if process took more than 5 secs
|
||||
final Component window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
|
||||
|
||||
@@ -19,8 +19,8 @@ import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.impl.BackgroundableProcessIndicator;
|
||||
import com.intellij.openapi.progress.impl.ProgressManagerImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.CalledInAwt;
|
||||
import com.intellij.openapi.vcs.changes.BackgroundFromStartOption;
|
||||
@@ -89,7 +89,7 @@ public class SeparatePiecesRunner extends GeneralRunner {
|
||||
else {
|
||||
setIndicator(new BackgroundableProcessIndicator(task));
|
||||
}
|
||||
ProgressManagerImpl.runProcessWithProgressAsynchronously(task, getIndicator());
|
||||
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, getIndicator());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.progress.impl.BackgroundableProcessIndicator;
|
||||
import com.intellij.openapi.progress.impl.ProgressManagerImpl;
|
||||
import com.intellij.openapi.project.DumbModeAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
@@ -263,7 +263,7 @@ public class TestPackage extends TestObject {
|
||||
final MySearchForTestsTask task =
|
||||
new MySearchForTestsTask(classFilter, isJunit4, classes, callback);
|
||||
mySearchForTestsIndicator = new BackgroundableProcessIndicator(task);
|
||||
ProgressManagerImpl.runProcessWithProgressAsynchronously(task, mySearchForTestsIndicator);
|
||||
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, mySearchForTestsIndicator);
|
||||
return task;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.util.JavaParametersUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.progress.impl.BackgroundableProcessIndicator;
|
||||
import com.intellij.openapi.progress.impl.ProgressManagerImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -112,7 +112,7 @@ public class TestsPattern extends TestPackage {
|
||||
}
|
||||
};
|
||||
mySearchForTestsIndicator = new BackgroundableProcessIndicator(task);
|
||||
ProgressManagerImpl.runProcessWithProgressAsynchronously(task, mySearchForTestsIndicator);
|
||||
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, mySearchForTestsIndicator);
|
||||
return task;
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -37,15 +37,14 @@ import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil;
|
||||
import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties;
|
||||
import com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView;
|
||||
import com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.execution.util.JavaParametersUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.module.LanguageLevelUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.impl.BackgroundableProcessIndicator;
|
||||
import com.intellij.openapi.progress.impl.ProgressManagerImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.ex.JavaSdkUtil;
|
||||
@@ -146,7 +145,7 @@ public class TestNGRunnableState extends JavaCommandLineState {
|
||||
final SearchingForTestsTask task = createSearchingForTestsTask(myServerSocket, config, myTempFile);
|
||||
processHandler.addProcessListener(new ProcessAdapter() {
|
||||
private boolean myStarted = false;
|
||||
|
||||
|
||||
@Override
|
||||
public void processTerminated(final ProcessEvent event) {
|
||||
unboundOutputRoot.flush();
|
||||
@@ -195,7 +194,7 @@ public class TestNGRunnableState extends JavaCommandLineState {
|
||||
client.prepareListening(listener, port);
|
||||
myStarted = true;
|
||||
mySearchForTestIndicator = new BackgroundableProcessIndicator(task);
|
||||
ProgressManagerImpl.runProcessWithProgressAsynchronously(task, mySearchForTestIndicator);
|
||||
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, mySearchForTestIndicator);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -290,7 +289,7 @@ public class TestNGRunnableState extends JavaCommandLineState {
|
||||
@Override
|
||||
public void startNotified(final ProcessEvent event) {
|
||||
mySearchForTestIndicator = new BackgroundableProcessIndicator(task);
|
||||
ProgressManagerImpl.runProcessWithProgressAsynchronously(task, mySearchForTestIndicator);
|
||||
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, mySearchForTestIndicator);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user