Search in sources :

Example 1 with ProjectTemplatesFactory

use of com.intellij.platform.ProjectTemplatesFactory in project intellij-community by JetBrains.

the class ProjectTypeStep method getTemplatesMap.

public static MultiMap<TemplatesGroup, ProjectTemplate> getTemplatesMap(WizardContext context) {
    ProjectTemplatesFactory[] factories = ProjectTemplatesFactory.EP_NAME.getExtensions();
    final MultiMap<TemplatesGroup, ProjectTemplate> groups = new MultiMap<>();
    for (ProjectTemplatesFactory factory : factories) {
        for (String group : factory.getGroups()) {
            ProjectTemplate[] templates = factory.createTemplates(group, context);
            List<ProjectTemplate> values = Arrays.asList(templates);
            if (!values.isEmpty()) {
                Icon icon = factory.getGroupIcon(group);
                String parentGroup = factory.getParentGroup(group);
                TemplatesGroup templatesGroup = new TemplatesGroup(group, null, icon, factory.getGroupWeight(group), parentGroup, group, null);
                groups.putValues(templatesGroup, values);
            }
        }
    }
    return groups;
}
Also used : ProjectTemplatesFactory(com.intellij.platform.ProjectTemplatesFactory) ProjectTemplate(com.intellij.platform.ProjectTemplate)

Aggregations

ProjectTemplate (com.intellij.platform.ProjectTemplate)1 ProjectTemplatesFactory (com.intellij.platform.ProjectTemplatesFactory)1