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;
}
Aggregations