@Override
  public void performPaste(@NotNull DataContext dataContext) {
    TemplateGroup group = myConfigurable.getSingleSelectedGroup();
    assert group != null;

    String buffer = CopyPasteManager.getInstance().getContents(DataFlavor.stringFlavor);
    assert buffer != null;

    try {
      for (Element templateElement :
          JDOMUtil.load(new StringReader("<root>" + buffer + "</root>"))
              .getChildren(TemplateSettings.TEMPLATE)) {
        TemplateImpl template =
            TemplateSettings.readTemplateFromElement(
                group.getName(), templateElement, getClass().getClassLoader());
        while (group.containsTemplate(template.getKey(), template.getId())) {
          template.setKey(template.getKey() + "1");
          if (template.getId() != null) {
            template.setId(template.getId() + "1");
          }
        }
        myConfigurable.addTemplate(template);
      }
    } catch (JDOMException ignore) {
    } catch (IOException ignore) {
    }
  }