Task (Consumer<ProgressIndicator> f, boolean inBackground) { if (inBackground) { //noinspection DialogTitleCapitalization return new Task.Backgroundable(null, IdeBundle.message("progress.download.plugins"), true, PluginManagerUISettings.getInstance()) { @Override public void run(@NotNull ProgressIndicator indicator) { f.accept(indicator); } }; } else { return new Task.Modal(null, IdeBundle.message("progress.download.plugins"), true) { @Override public void run(@NotNull ProgressIndicator indicator) { f.accept(indicator); } }; } }