void (ChooseTemplateStep chooseTemplateStep) { myTemplatesList.setPaintBusy(true); chooseTemplateStep.getTemplateList().setPaintBusy(true); ProgressManager.getInstance().run(new Task.Backgroundable(myContext.getProject(), JavaUiBundle.message("progress.title.loading.templates")) { @Override public void run(@NotNull ProgressIndicator indicator) { RemoteTemplatesFactory factory = new RemoteTemplatesFactory(); for (String group : factory.getGroups()) { ProjectTemplate[] templates = factory.createTemplates(group, myContext); for (ProjectTemplate template : templates) { String id = ((ArchivedProjectTemplate)template).getCategory(); for (TemplatesGroup templatesGroup : myTemplatesMap.keySet()) { if (Objects.equals(id, templatesGroup.getId()) || Objects.equals(group, templatesGroup.getName())) { myTemplatesMap.putValue(templatesGroup, template); } } } } } @Override public void onSuccess() { super.onSuccess(); TemplatesGroup group = getSelectedGroup(); if (group == null) return; Collection<ProjectTemplate> templates = myTemplatesMap.get(group); setTemplatesList(group, templates, true); chooseTemplateStep.updateStep(); } @Override public void onFinished() { myTemplatesList.setPaintBusy(false); chooseTemplateStep.getTemplateList().setPaintBusy(false); } }); }