private void readDefTemplate(@NotNull String defTemplate,
                               boolean registerTemplate,
                               @NotNull ClassLoader loader,
                               PluginInfo info) throws JDOMException {
    String pluginId = info.getId();
    Element element;
    try {
      byte[] data;
      if (defTemplate.startsWith("/")) {
        data = ResourceUtil.getResourceAsBytes(appendExt(defTemplate.substring(1)), loader);
      }
      else {
        data = ResourceUtil.getResourceAsBytes(appendExt(defTemplate), loader);
      }
      if (data == null) {
        LOG.error(new PluginException("Unable to find template resource: " + defTemplate + "; classLoader: " + loader + "; plugin: " + info,
                                      pluginId == null ? null : PluginId.getId(pluginId)));
        return;
      }

      element = JDOMUtil.load(data);
    }
    catch (IOException e) {
      LOG.error(
        new PluginException("Unable to read template resource: " + defTemplate + "; classLoader: " + loader + "; plugin: " + info, e,
                            pluginId == null ? null : PluginId.getId(pluginId)));
      return;
    }

    TemplateGroup defGroup = parseTemplateGroup(element, getDefaultTemplateName(defTemplate), loader);
    if (defGroup != null) {
      for (TemplateImpl template : defGroup.getElements()) {
        String key = template.getKey();
        String groupName = template.getGroupName();
        if (Strings.isNotEmpty(key) && Strings.isNotEmpty(groupName)) {
          myPredefinedTemplates.put(new Pair<>(key, groupName), info);
        }
      }

      TemplateGroup group = mergeParsedGroup(element, true, registerTemplate, defGroup);
      if (group != null && group.getReplace() != null) {
        for (TemplateImpl template : myTemplates.get(group.getReplace())) {
          removeTemplate(template);
        }
      }
    }
  }
private void readDefTemplate(@NotNull String defTemplate,
                               boolean registerTemplate,
                               @NotNull ClassLoader loader,
                               PluginInfo info)