how to run Backgroundable Task and wait for result?
Subj.
I can run void task in background with
private static void runInBackground(@Nullable Project project, @NotNull Runnable runnable) {
ProgressManager.getInstance()
.run(
new Task.Backgroundable(project, "DeepCode: Analyse Files...") {
@Override
public void run(@NotNull ProgressIndicator indicator) {
runnable.run();
}
});
}
But how can wait and receive any results from there?
PS I see ProgressManager has:
/**
* Runs a specified computation with a modal progress dialog.
*/
public <T, E extends Exception> T run(@NotNull Task.WithResult<T, E> task) throws E {
run((Task)task);
return task.getResult();
}
But it's doing modal dialog with Task.WithResult and I can't find the analogy for Task.Backgroundable
Thanks in advance for any advices!
Please sign in to leave a comment.