Example #1
0
 @Override
 public void execute(@NotNull String pattern) {
   final SNode result =
       SNodeFactoryOperations.createNewNode(
           SNodeFactoryOperations.asInstanceConcept(
               MetaAdapterFactory.getConcept(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x11adecdb4f0L,
                   "jetbrains.mps.baseLanguage.structure.PostfixIncrementExpression")),
           null);
   SLinkOperations.setTarget(
       result,
       MetaAdapterFactory.getContainmentLink(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0x120a4c1f269L,
           0x120a4c433a6L,
           "expression"),
       SNodeOperations.copyNode(_context.getNode()));
   SNodeOperations.replaceWithAnother(_context.getNode(), result);
   SelectionUtil.selectLabelCellAnSetCaret(
       _context.getEditorContext(), result, SelectionManager.LAST_CELL, -1);
   return;
 }
 public void execute(SNode node) {
   SNode expr =
       SNodeOperations.cast(
           node,
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0xf8c37f506fL,
               "jetbrains.mps.baseLanguage.structure.Expression"));
   Object value =
       Expression__BehaviorDescriptor.getCompileTimeConstantValue_idi1LP2xI.invoke(
           expr, SNodeOperations.getModel(expr).getModule());
   if (value instanceof Boolean) {
     SNode v =
         SNodeFactoryOperations.replaceWithNewChild(
             expr,
             SNodeFactoryOperations.asInstanceConcept(
                 MetaAdapterFactory.getConcept(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0xf8cc56b201L,
                     "jetbrains.mps.baseLanguage.structure.BooleanConstant")));
     SPropertyOperations.set(
         v,
         MetaAdapterFactory.getProperty(
             0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b201L, 0xf8cc56b202L, "value"),
         "" + (((Boolean) value).booleanValue()));
   }
 }
    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);
    }
 public void execute(final SNode node, final EditorContext editorContext) {
   // produce throw statement
   SNode throwStatement =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.baseLanguage.structure.ThrowStatement", null);
   SNode newExpr = _quotation_createNode_a1x6vi_a0c0a();
   SLinkOperations.setTarget(throwStatement, "throwable", newExpr, true);
   // produce if statement
   SNode ifStatement =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.baseLanguage.structure.IfStatement", null);
   SNode notExpr =
       SNodeFactoryOperations.setNewChild(
           ifStatement, "condition", "jetbrains.mps.baseLanguage.structure.NotExpression");
   SLinkOperations.setTarget(
       notExpr, "expression", SLinkOperations.getTarget(node, "condition", true), true);
   SNodeFactoryOperations.setNewChild(
       ifStatement, "ifTrue", "jetbrains.mps.baseLanguage.structure.StatementList");
   ListSequence.fromList(
           SLinkOperations.getTargets(
               SLinkOperations.getTarget(ifStatement, "ifTrue", true), "statement", true))
       .insertElement(0, throwStatement);
   // replace assert with if
   SNodeOperations.replaceWithAnother(node, ifStatement);
 }
 @Override
 public void execute(final SNode node, final EditorContext editorContext) {
   SNode newLine =
       SNodeFactoryOperations.createNewNode(
           SNodeFactoryOperations.asInstanceConcept(
               MetaAdapterFactory.getConcept(
                   0x18bc659203a64e29L,
                   0xa83a7ff23bde13baL,
                   0x120154df6f3L,
                   "jetbrains.mps.lang.editor.structure.IndentLayoutNewLineStyleClassItem")),
           null);
   SPropertyOperations.set(
       newLine,
       MetaAdapterFactory.getProperty(
           0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x1143bd1283bL, 0x1143bd161dbL, "flag"),
       "" + (true));
   ListSequence.fromList(
           SLinkOperations.getChildren(
               node,
               MetaAdapterFactory.getContainmentLink(
                   0x18bc659203a64e29L,
                   0xa83a7ff23bde13baL,
                   0x11beb039542L,
                   0x11beb040d06L,
                   "styleItem")))
       .addElement(newLine);
 }
Example #6
0
 public void execute(final SNode node, final EditorContext editorContext) {
   String name = CreateFromUsageUtil.getText(editorContext);
   if (name == null || name.length() == 0) {
     name = "default_" + SPropertyOperations.getString(node, "name");
   }
   SNode t =
       SNodeFactoryOperations.createNewRootNode(
           SNodeOperations.getModel(node),
           "jetbrains.mps.lang.generator.structure.TemplateDeclaration",
           null);
   SPropertyOperations.set(t, "name", name);
   t.setProperty(
       SModelTreeNode.PACK,
       SPropertyOperations.getString(
           SNodeOperations.cast(
               SNodeOperations.getContainingRoot(node),
               "jetbrains.mps.lang.core.structure.BaseConcept"),
           "virtualPackage"));
   // make reference
   SNode tr =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.lang.generator.structure.TemplateDeclarationReference", null);
   SLinkOperations.setTarget(tr, "template", t, false);
   SLinkOperations.setTarget(node, "defaultConsequence", tr, true);
 }
 public SNode nodeFactory(SNode node, EditorContext editorContext) {
   return SNodeFactoryOperations.createNewNode(
       SNodeFactoryOperations.asInstanceConcept(
           MetaAdapterFactory.getConcept(
               0xf280165065d5424eL,
               0xbb1b463a8781b786L,
               0x44ac82392ce5c6b0L,
               "jetbrains.mps.baseLanguage.javadoc.structure.EmptyBlockDocTag")),
       null);
 }
Example #8
0
 @Override
 public void execute(@NotNull String pattern) {
   SNodeOperations.insertPrevSiblingChild(
       _context.getNode(),
       SNodeFactoryOperations.createNewNode(
           SNodeFactoryOperations.asInstanceConcept(
               MetaAdapterFactory.getConcept(
                   0x49a08c51fe543ccL,
                   0xbd998b46d641d7f5L,
                   0x58e59ea713f79f27L,
                   "jetbrains.mps.samples.Kaja.structure.Drop")),
           null));
 }
 public void handleAction(
     SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) {
   SNodeFactoryOperations.setNewChild(
       node,
       MetaAdapterFactory.getContainmentLink(
           0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x1143bd837d7L, 0x11c5653e86eL, "query"),
       SNodeFactoryOperations.asInstanceConcept(
           MetaAdapterFactory.getConcept(
               0x18bc659203a64e29L,
               0xa83a7ff23bde13baL,
               0x11c4d022befL,
               "jetbrains.mps.lang.editor.structure.QueryFunction_Underlined")));
 }
 @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);
 }
Example #11
0
 @Override
 public void execute(@NotNull String pattern) {
   SNode inserted =
       SNodeOperations.insertPrevSiblingChild(
           _context.getNode(),
           SNodeFactoryOperations.createNewNode(
               SNodeFactoryOperations.asInstanceConcept(
                   MetaAdapterFactory.getConcept(
                       0x49a08c51fe543ccL,
                       0xbd998b46d641d7f5L,
                       0x3cfcda239f1a1049L,
                       "jetbrains.mps.samples.Kaja.structure.Require")),
               null));
   _context.getEditorContext().selectWRTFocusPolicy(inserted);
 }
 public void execute(final SNode node, final EditorContext editorContext) {
   EditorCell selectedCell = editorContext.getSelectedCell();
   if (!(selectedCell.isReferenceCell())) {
     return;
   }
   SNode contextNode =
       SNodeOperations.cast(
           selectedCell.getSNode(), "jetbrains.mps.lang.core.structure.BaseConcept");
   if (contextNode == null) {
     return;
   }
   String role = selectedCell.getRole();
   if (SNodeOperations.isInstanceOf(
       contextNode, "jetbrains.mps.lang.quotation.structure.ReferenceAntiquotation")) {
     SNode attributedNode =
         SNodeOperations.cast(
             SNodeOperations.getParent(contextNode),
             "jetbrains.mps.lang.core.structure.BaseConcept");
     assert attributedNode != null;
     AttributeOperations.setAttribute(
         attributedNode,
         new IAttributeDescriptor.LinkAttribute(
             SConceptOperations.findConceptDeclaration(
                 "jetbrains.mps.lang.quotation.structure.ReferenceAntiquotation"),
             role),
         null);
     return;
   }
   if (AttributeOperations.getAttribute(
           contextNode,
           new IAttributeDescriptor.LinkAttribute(
               SConceptOperations.findConceptDeclaration(
                   "jetbrains.mps.lang.quotation.structure.ReferenceAntiquotation"),
               role))
       != null) {
     AttributeOperations.setAttribute(
         contextNode,
         new IAttributeDescriptor.LinkAttribute(
             SConceptOperations.findConceptDeclaration(
                 "jetbrains.mps.lang.quotation.structure.ReferenceAntiquotation"),
             role),
         null);
   } else {
     SNode referenceAntiquotation =
         SNodeFactoryOperations.setNewAttribute(
             contextNode,
             new IAttributeDescriptor.LinkAttribute(
                 SConceptOperations.findConceptDeclaration(
                     "jetbrains.mps.lang.quotation.structure.ReferenceAntiquotation"),
                 role),
             "jetbrains.mps.lang.quotation.structure.ReferenceAntiquotation");
     if (selectedCell.isSingleNodeCell()) {
       SPropertyOperations.set(
           referenceAntiquotation,
           "label",
           SPropertyOperations.getString(
               SNodeOperations.getConceptDeclaration(contextNode), "name"));
     }
   }
 }
 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_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) {
   SNode newLine =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.lang.editor.structure.IndentLayoutOnNewLineStyleClassItem", null);
   SPropertyOperations.set(newLine, "flag", "" + (true));
   ListSequence.fromList(SLinkOperations.getTargets(node, "styleItem", true)).addElement(newLine);
 }
 public void execute(final SNode node, final EditorContext editorContext) {
   Iterable<SNode> nodes =
       ListSequence.fromList(SNodeOperations.getChildren(SNodeOperations.getParent(node)))
           .where(
               new IWhereFilter<SNode>() {
                 public boolean accept(SNode it) {
                   return SNodeOperations.isInstanceOf(
                       it, "jetbrains.mps.lang.generator.structure.NodeMacro");
                 }
               });
   boolean seen = false;
   for (SNode n : nodes) {
     if (seen) {
       if (SNodeOperations.isInstanceOf(
           n, "jetbrains.mps.lang.generator.structure.CopySrcNodeMacro")) {
         SNodeOperations.deleteNode(n);
         SNodeFactoryOperations.replaceWithNewChild(
             node, "jetbrains.mps.lang.generator.structure.CopySrcListMacro");
       }
       return;
     } else if (n == node) {
       seen = true;
     }
   }
 }
Example #17
0
 private void execute_internal(
     final KeyEvent keyEvent,
     final EditorContext editorContext,
     final SNode node,
     final List<SNode> selectedNodes) {
   SNodeFactoryOperations.setNewChild(
       node, "modelToCreate", "jetbrains.mps.baseLanguage.structure.Expression");
 }
Example #18
0
 public void handleAction(
     SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) {
   SNodeFactoryOperations.setNewChild(
       node,
       MetaAdapterFactory.getContainmentLink(
           0x22e72e4c0f6946ceL,
           0x84036750153aa615L,
           0x6c55c13f5bc8e1ecL,
           0x5d457621242d8208L,
           "debuggerConfiguration"),
       SNodeFactoryOperations.asInstanceConcept(
           MetaAdapterFactory.getConcept(
               0xfbc142795e2a4c87L,
               0xa5d15f7061e6c456L,
               0x5d457621242d16f5L,
               "jetbrains.mps.debugger.api.lang.structure.DebuggerConfiguration")));
 }
    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());
    }
Example #20
0
 public void execute(final SNode node, final EditorContext editorContext) {
   SLinkOperations.setTarget(
       node,
       "handler",
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.core.xml.sax.structure.XMLSAXAttributeHandler", null),
       true);
 }
Example #21
0
 private void execute_internal(
     final KeyEvent keyEvent,
     final EditorContext editorContext,
     final SNode node,
     final List<SNode> selectedNodes) {
   SNodeFactoryOperations.setNewChild(
       node, "name", "jetbrains.mps.build.structure.BuildStringNotEmpty");
 }
Example #22
0
 public SNode createReplacementNode_impl(
     SNode parameterObject,
     SNode node,
     SModel model,
     IOperationContext operationContext,
     EditorContext editorContext) {
   return SNodeFactoryOperations.createNewNode(NameUtil.nodeFQName(parameterObject), node);
 }
 public void execute(final SNode node, final EditorContext editorContext) {
   SNode result =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.lang.editor.structure.CellModel_Collection", null);
   SLinkOperations.setTarget(
       result,
       "cellLayout",
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.lang.editor.structure.CellLayout_Horizontal", null),
       true);
   List<SNode> nodes = editorContext.getSelectedNodes();
   SNodeOperations.insertNextSiblingChild(ListSequence.fromList(nodes).last(), result);
   for (SNode sn : nodes) {
     ListSequence.fromList(SLinkOperations.getTargets(result, "childCellModel", true))
         .addElement(
             SNodeOperations.cast(sn, "jetbrains.mps.lang.editor.structure.EditorCellModel"));
   }
 }
 public SNode nodeFactory(SNode node, EditorContext editorContext) {
   SNode result =
       SNodeFactoryOperations.createNewNode(
           SNodeOperations.getModel(node),
           SNodeFactoryOperations.asInstanceConcept(
               MetaAdapterFactory.getConcept(
                   0xc72da2b97cce4447L,
                   0x8389f407dc1158b7L,
                   0xf979bd086aL,
                   "jetbrains.mps.lang.structure.structure.LinkDeclaration")),
           null);
   SPropertyOperations.set(
       result,
       MetaAdapterFactory.getProperty(
           0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xf979bd086aL, 0xf980556927L, "metaClass"),
       "reference");
   return result;
 }
 public void execute(final SNode node, final EditorContext editorContext) {
   AttributeOperations.setAttribute(
       node,
       new IAttributeDescriptor.NodeAttribute(
           SConceptOperations.findConceptDeclaration(
               "org.jetbrains.mps.samples.ParallelFor.structure.ThreadSafe")),
       SNodeFactoryOperations.createNewNode(
           "org.jetbrains.mps.samples.ParallelFor.structure.ThreadSafe", null));
 }
Example #26
0
 @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) {
   if ((SLinkOperations.getTarget(node, "query", true) == null)) {
     SPropertyOperations.set(node, "style", "QUERY");
     SNodeFactoryOperations.setNewChild(
         node, "query", "jetbrains.mps.lang.editor.structure.QueryFunction_FontStyle");
   } else {
     SNodeOperations.detachNode(SLinkOperations.getTarget(node, "query", true));
     SPropertyOperations.set(node, "style", "PLAIN");
   }
 }
 public void execute(final SNode node, final EditorContext editorContext) {
   SNode externalProperty =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.buildlanguage.structure.ExternalPropertyDeclaration", null);
   SLinkOperations.setTarget(
       externalProperty, "type", SLinkOperations.getTarget(node, "type", true), true);
   SPropertyOperations.set(
       externalProperty, "name", SPropertyOperations.getString(node, "name"));
   SNodeOperations.replaceWithAnother(node, externalProperty);
 }
 public void execute(final SNode node, final EditorContext editorContext) {
   SNode castVariable =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.baseLanguage.structure.LocalVariableDeclarationStatement", null);
   SNode instanceOfExpression =
       SNodeOperations.cast(
           SLinkOperations.getTarget(node, "condition", true),
           "jetbrains.mps.baseLanguage.structure.InstanceOfExpression");
   SNode declaration = SLinkOperations.getTarget(castVariable, "localVariableDeclaration", true);
   SLinkOperations.setTarget(
       declaration,
       "type",
       SNodeOperations.copyNode(
           SLinkOperations.getTarget(instanceOfExpression, "classType", true)),
       true);
   List<String> variableSuffixes =
       BehaviorReflection.invokeVirtual(
           (Class<List<String>>) ((Class) Object.class),
           SLinkOperations.getTarget(instanceOfExpression, "classType", true),
           "virtual_getVariableSuffixes_1213877337304",
           new Object[] {});
   SPropertyOperations.set(declaration, "name", ListSequence.fromList(variableSuffixes).first());
   SNode castExpression =
       SNodeFactoryOperations.setNewChild(
           declaration, "initializer", "jetbrains.mps.baseLanguage.structure.CastExpression");
   SLinkOperations.setTarget(
       castExpression,
       "type",
       SNodeOperations.copyNode(
           SLinkOperations.getTarget(instanceOfExpression, "classType", true)),
       true);
   SLinkOperations.setTarget(
       castExpression,
       "expression",
       SNodeOperations.copyNode(
           SLinkOperations.getTarget(instanceOfExpression, "leftExpression", true)),
       true);
   ListSequence.fromList(
           SLinkOperations.getTargets(
               SLinkOperations.getTarget(node, "ifTrue", true), "statement", true))
       .insertElement(0, castVariable);
 }
Example #30
0
 public void execute(final SNode node, final EditorContext editorContext) {
   SNode executor =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.execution.configurations.structure.RunConfigurationExecutor", null);
   SLinkOperations.setTarget(executor, "configuration", node, false);
   SPropertyOperations.set(
       executor, "virtualPackage", SPropertyOperations.getString(node, "virtualPackage"));
   SModelOperations.addRootNode(SNodeOperations.getModel(node), executor);
   NavigationSupport.getInstance()
       .openNode(editorContext.getOperationContext(), executor, true, false);
 }