Search in sources :

Example 1 with ProjectTemplateEP

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

the class ProjectTypeStep method loadLocalTemplates.

private MultiMap<String, ProjectTemplate> loadLocalTemplates() {
    ConcurrentMultiMap<String, ProjectTemplate> map = new ConcurrentMultiMap<>();
    ProjectTemplateEP[] extensions = ProjectTemplateEP.EP_NAME.getExtensions();
    for (ProjectTemplateEP ep : extensions) {
        ClassLoader classLoader = ep.getLoaderForClass();
        URL url = classLoader.getResource(ep.templatePath);
        if (url != null) {
            try {
                LocalArchivedTemplate template = new LocalArchivedTemplate(url, classLoader);
                if (ep.category) {
                    TemplateBasedCategory category = new TemplateBasedCategory(template, ep.projectType);
                    myTemplatesMap.putValue(new TemplatesGroup(category), template);
                } else {
                    map.putValue(ep.projectType, template);
                }
            } catch (Exception e) {
                LOG.error("Error loading template from URL " + ep.templatePath, e);
            }
        } else {
            LOG.error("Can't find resource for project template " + ep.templatePath);
        }
    }
    return map;
}
Also used : ProjectTemplateEP(com.intellij.platform.ProjectTemplateEP) URL(java.net.URL) CommitStepException(com.intellij.ide.wizard.CommitStepException) ConfigurationException(com.intellij.openapi.options.ConfigurationException) ProjectTemplate(com.intellij.platform.ProjectTemplate)

Aggregations

CommitStepException (com.intellij.ide.wizard.CommitStepException)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 ProjectTemplate (com.intellij.platform.ProjectTemplate)1 ProjectTemplateEP (com.intellij.platform.ProjectTemplateEP)1 URL (java.net.URL)1