how to run Backgroundable Task and wait for result?


I can run void task in background with 

private static void runInBackground(@Nullable Project project, @NotNull Runnable runnable) {
new Task.Backgroundable(project, "DeepCode: Analyse Files...") {
public void run(@NotNull ProgressIndicator indicator) {;

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 {
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.