public BackgroundTask(@Nullable Project project, @NotNull String title, boolean startInBackground) {
this(project, title, startInBackground, false);
}
public void start() {
final ProgressManager progressManager = ProgressManager.getInstance();
final BackgroundTask task = BackgroundTask.this;
Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
progressManager.run(task);
} else {
Runnable runnable = new Runnable() {
public void run() {
progressManager.run(task);
}
};
application.invokeLater(runnable, ModalityState.NON_MODAL);
}
}