public void execute(final SNode node, final EditorContext editorContext) {
      SNode templateNode =
          SNodeFactoryOperations.createNewRootNode(
              SNodeOperations.getModel(node),
              "jetbrains.mps.lang.generator.structure.TemplateDeclaration",
              null);
      SNode ruleNode =
          SNodeOperations.getAncestor(
              node, "jetbrains.mps.lang.generator.structure.BaseMappingRule", false, false);
      SLinkOperations.setTarget(
          templateNode,
          "applicableConcept",
          SLinkOperations.getTarget(ruleNode, "applicableConcept", false),
          false);
      SPropertyOperations.set(templateNode, "name", "template1");
      SLinkOperations.setTarget(
          templateNode, "contentNode", SLinkOperations.getTarget(node, "templateNode", true), true);
      SPropertyOperations.set(
          templateNode,
          "virtualPackage",
          SPropertyOperations.getString(SNodeOperations.getContainingRoot(node), "virtualPackage"));

      SNode templateRefNode =
          SNodeFactoryOperations.replaceWithNewChild(
              node, "jetbrains.mps.lang.generator.structure.TemplateDeclarationReference");
      SLinkOperations.setTarget(templateRefNode, "template", templateNode, false);

      SelectionUtil.selectNode(editorContext, templateNode);
    }