public void execute_internal(EditorContext editorContext, SNode node) {
   if ((int) ListSequence.fromList(SLinkOperations.getTargets(node, "throwsItem", true)).count()
       == 0) {
     SNodeFactoryOperations.addNewChild(
         node, "throwsItem", "jetbrains.mps.baseLanguage.structure.Type");
   }
 }
    public void execute(final SNode node, final EditorContext editorContext) {
      DocCommentHelper.addJavadocLangIfMissing(node);

      if ((AttributeOperations.getAttribute(
              node,
              new IAttributeDescriptor.NodeAttribute(
                  SConceptOperations.findConceptDeclaration(
                      "jetbrains.mps.baseLanguage.javadoc.structure.FieldDocComment")))
          == null)) {
        SNodeFactoryOperations.setNewAttribute(
            node,
            new IAttributeDescriptor.NodeAttribute(
                SConceptOperations.findConceptDeclaration(
                    "jetbrains.mps.baseLanguage.javadoc.structure.FieldDocComment")),
            "jetbrains.mps.baseLanguage.javadoc.structure.FieldDocComment");
        SNode line =
            SNodeFactoryOperations.addNewChild(
                AttributeOperations.getAttribute(
                    node,
                    new IAttributeDescriptor.NodeAttribute(
                        SConceptOperations.findConceptDeclaration(
                            "jetbrains.mps.baseLanguage.javadoc.structure.FieldDocComment"))),
                "body",
                "jetbrains.mps.baseLanguage.javadoc.structure.CommentLine");
        SNodeFactoryOperations.addNewChild(
            line, "part", "jetbrains.mps.baseLanguage.javadoc.structure.TextCommentLinePart");
      } else {
        AttributeOperations.setAttribute(
            node,
            new IAttributeDescriptor.NodeAttribute(
                SConceptOperations.findConceptDeclaration(
                    "jetbrains.mps.baseLanguage.javadoc.structure.FieldDocComment")),
            null);
      }
      editorContext.select(
          ListSequence.fromList(
                  SLinkOperations.getTargets(
                      AttributeOperations.getAttribute(
                          node,
                          new IAttributeDescriptor.NodeAttribute(
                              SConceptOperations.findConceptDeclaration(
                                  "jetbrains.mps.baseLanguage.javadoc.structure.FieldDocComment"))),
                      "body",
                      true))
              .first());
    }
 private void execute_internal(
     final KeyEvent keyEvent,
     final EditorContext editorContext,
     final SNode node,
     final List<SNode> selectedNodes) {
   SNode typeVarDeclaration =
       SNodeOperations.getAncestor(
           ListSequence.fromList(selectedNodes).first(),
           "jetbrains.mps.baseLanguage.structure.TypeVariableDeclaration",
           true,
           false);
   SNodeFactoryOperations.addNewChild(
       typeVarDeclaration, "auxBounds", "jetbrains.mps.baseLanguage.structure.ClassifierType");
 }
 @Override
 public void execute(@NotNull String pattern) {
   SNodeFactoryOperations.addNewChild(
       SNodeOperations.cast(
           SNodeOperations.getParent(_context.getNode()),
           MetaAdapterFactory.getConcept(
               0xfd3920347849419dL,
               0x907112563d152375L,
               0x1174a4d19ffL,
               "jetbrains.mps.baseLanguage.closures.structure.FunctionType")),
       MetaAdapterFactory.getContainmentLink(
           0xfd3920347849419dL,
           0x907112563d152375L,
           0x1174a4d19ffL,
           0x11ad99d9c36L,
           "throwsType"),
       SNodeFactoryOperations.asInstanceConcept(
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0xf8c37f506dL,
               "jetbrains.mps.baseLanguage.structure.Type")));
   SelectionUtil.selectLabelCellAnSetCaret(
       _context.getEditorContext(),
       ListSequence.fromList(
               SLinkOperations.getChildren(
                   SNodeOperations.cast(
                       SNodeOperations.getParent(_context.getNode()),
                       MetaAdapterFactory.getConcept(
                           0xfd3920347849419dL,
                           0x907112563d152375L,
                           0x1174a4d19ffL,
                           "jetbrains.mps.baseLanguage.closures.structure.FunctionType")),
                   MetaAdapterFactory.getContainmentLink(
                       0xfd3920347849419dL,
                       0x907112563d152375L,
                       0x1174a4d19ffL,
                       0x11ad99d9c36L,
                       "throwsType")))
           .first(),
       SelectionManager.FIRST_ERROR_CELL
           + "|"
           + SelectionManager.FOCUS_POLICY_CELL
           + "|"
           + SelectionManager.FIRST_EDITABLE_CELL
           + "|"
           + SelectionManager.FIRST_CELL,
       -1);
 }
 public void setup(SNode newNode, SNode sampleNode, SNode enclosingNode, SModel model) {
   SNodeFactoryOperations.addNewChild(
       newNode,
       MetaAdapterFactory.getContainmentLink(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0x57d533a7af15ed3aL,
           0x57d533a7af16ff73L,
           "commentPart"),
       SNodeFactoryOperations.asInstanceConcept(
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x57d533a7af15ed3dL,
               "jetbrains.mps.baseLanguage.structure.TextCommentPart")));
 }
 public void execute(final SNode node, final EditorContext editorContext) {
   List<SNode> configs =
       SModelOperations.getRoots(
           SNodeOperations.getModel(node),
           "jetbrains.mps.lang.generator.structure.MappingConfiguration");
   if (ListSequence.fromList(configs).count() > 1) {
     Iterable<SNode> sameVPackConfigs =
         ListSequence.fromList(configs)
             .where(
                 new IWhereFilter<SNode>() {
                   public boolean accept(SNode it) {
                     return Comparing.equal(
                         SPropertyOperations.getString(it, "virtualPackage"),
                         SPropertyOperations.getString(node, "virtualPackage"));
                   }
                 });
     if (Sequence.fromIterable(sameVPackConfigs).isNotEmpty()) {
       configs = Sequence.fromIterable(sameVPackConfigs).toListSequence();
     }
   }
   if (ListSequence.fromList(configs).count() > 1) {
     // TODO: let user to choose mapping config?
   }
   //  add new rule
   SNode rule =
       SNodeFactoryOperations.addNewChild(
           ListSequence.fromList(configs).first(),
           "rootMappingRule",
           "jetbrains.mps.lang.generator.structure.Root_MappingRule");
   SLinkOperations.setTarget(
       rule,
       "applicableConcept",
       SLinkOperations.getTarget(
           AttributeOperations.getAttribute(
               node,
               new IAttributeDescriptor.NodeAttribute(
                   "jetbrains.mps.lang.generator.structure.RootTemplateAnnotation")),
           "applicableConcept",
           false),
       false);
   SLinkOperations.setTarget(rule, "template", node, false);
   //  open in editor
   NavigationSupport.getInstance()
       .openNode(editorContext.getOperationContext(), rule, true, true);
 }
 @Override
 public void execute(final SNode node, final EditorContext editorContext) {
   SNode ifFalse =
       SLinkOperations.getTarget(
           node,
           MetaAdapterFactory.getContainmentLink(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0xf8cc56b217L,
               0xfc092b6b76L,
               "ifFalseStatement"));
   SLinkOperations.setTarget(
       node,
       MetaAdapterFactory.getContainmentLink(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0xf8cc56b217L,
           0xfc092b6b76L,
           "ifFalseStatement"),
       null);
   SNodeFactoryOperations.addNewChild(
       node,
       MetaAdapterFactory.getContainmentLink(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0xf8cc56b217L,
           0x118cecf1287L,
           "elsifClauses"),
       SNodeFactoryOperations.asInstanceConcept(
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x118ceceb41aL,
               "jetbrains.mps.baseLanguage.structure.ElsifClause")));
   SLinkOperations.setTarget(
       node,
       MetaAdapterFactory.getContainmentLink(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0xf8cc56b217L,
           0xfc092b6b76L,
           "ifFalseStatement"),
       ifFalse);
 }
 public void execute(final SNode node, final EditorContext editorContext) {
   SNodeFactoryOperations.addNewChild(
       node, "typeArgument", "jetbrains.mps.baseLanguage.structure.Type");
 }
 @Override
 public void execute(final SNode node, final EditorContext editorContext) {
   List<SNode> configs =
       SModelOperations.roots(
           SNodeOperations.getModel(node),
           MetaAdapterFactory.getConcept(
               0xb401a68083254110L,
               0x8fd384331ff25befL,
               0xff0bea0475L,
               "jetbrains.mps.lang.generator.structure.MappingConfiguration"));
   if (ListSequence.fromList(configs).count() > 1) {
     Iterable<SNode> sameVPackConfigs =
         ListSequence.fromList(configs)
             .where(
                 new IWhereFilter<SNode>() {
                   public boolean accept(SNode it) {
                     return EqualUtil.equals(
                         SPropertyOperations.getString(
                             it,
                             MetaAdapterFactory.getProperty(
                                 0xceab519525ea4f22L,
                                 0x9b92103b95ca8c0cL,
                                 0x10802efe25aL,
                                 0x115eca8579fL,
                                 "virtualPackage")),
                         SPropertyOperations.getString(
                             node,
                             MetaAdapterFactory.getProperty(
                                 0xceab519525ea4f22L,
                                 0x9b92103b95ca8c0cL,
                                 0x10802efe25aL,
                                 0x115eca8579fL,
                                 "virtualPackage")));
                   }
                 });
     if (Sequence.fromIterable(sameVPackConfigs).isNotEmpty()) {
       configs = Sequence.fromIterable(sameVPackConfigs).toListSequence();
     }
   }
   if (ListSequence.fromList(configs).count() > 1) {
     // TODO: let user to choose mapping config?
   }
   //  add new rule
   SNode rule =
       SNodeFactoryOperations.addNewChild(
           ListSequence.fromList(configs).first(),
           MetaAdapterFactory.getContainmentLink(
               0xb401a68083254110L,
               0x8fd384331ff25befL,
               0xff0bea0475L,
               0x10fbbe00519L,
               "createRootRule"),
           SNodeFactoryOperations.asInstanceConcept(
               MetaAdapterFactory.getConcept(
                   0xb401a68083254110L,
                   0x8fd384331ff25befL,
                   0x10fbbd5854aL,
                   "jetbrains.mps.lang.generator.structure.CreateRootRule")));
   SLinkOperations.setTarget(
       rule,
       MetaAdapterFactory.getReferenceLink(
           0xb401a68083254110L,
           0x8fd384331ff25befL,
           0x10fbbd5854aL,
           0x10fbbd5854dL,
           "templateNode"),
       node);
   //  open in editor
   NavigationSupport.getInstance()
       .openNode(editorContext.getOperationContext(), rule, true, true);
 }