use of org.eclipse.che.api.project.templates.shared.dto.ProjectTemplateDescriptor in project che by eclipse.
the class CategoriesPagePresenter method loadProjectTypesAndTemplates.
private void loadProjectTypesAndTemplates() {
List<ProjectTypeDto> projectTypes = projectTypeRegistry.getProjectTypes();
Map<String, Set<ProjectTypeDto>> typesByCategory = new HashMap<>();
Map<String, Set<ProjectTemplateDescriptor>> templatesByCategory = new HashMap<>();
for (ProjectTypeDto type : projectTypes) {
if (wizardRegistry.getWizardRegistrar(type.getId()) != null) {
final String category = wizardRegistry.getWizardCategory(type.getId());
if (!typesByCategory.containsKey(category)) {
typesByCategory.put(category, new HashSet<ProjectTypeDto>());
}
typesByCategory.get(category).add(type);
}
List<ProjectTemplateDescriptor> templateDescriptors = projectTemplateRegistry.getTemplateDescriptors(type.getId());
for (ProjectTemplateDescriptor template : templateDescriptors) {
final String category = template.getCategory() == null ? DEFAULT_TEMPLATE_CATEGORY : template.getCategory();
if (!templatesByCategory.containsKey(category)) {
templatesByCategory.put(category, new HashSet<ProjectTemplateDescriptor>());
}
templatesByCategory.get(category).add(template);
}
}
view.setProjectTypes(projectTypes);
view.setCategories(typesByCategory, templatesByCategory);
}
Aggregations