Exemple #1
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 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);
 }
 private static void attachReference_id2wBFdLy8qmn(@NotNull SNode __thisNode__, SNode reference) {
   assert IReferenceAttachable_BehaviorDescriptor.canAttachReference_id2wBFdLy7HtS.invoke(
       __thisNode__, reference);
   SLinkOperations.setTarget(
       __thisNode__,
       MetaAdapterFactory.getContainmentLink(
           0x8585453e6bfb4d80L,
           0x98deb16074f1d86cL,
           0x73a7cdcfbbbf8aadL,
           0x73a7cdcfbbbf8c41L,
           "warningRef"),
       SConceptOperations.createNewNode(
           SNodeOperations.asInstanceConcept(
               MetaAdapterFactory.getConcept(
                   0x8585453e6bfb4d80L,
                   0x98deb16074f1d86cL,
                   0x6abc06f5f4af0d67L,
                   "jetbrains.mps.lang.test.structure.UnknownRuleReference"))));
   SLinkOperations.setTarget(
       SLinkOperations.getTarget(
           __thisNode__,
           MetaAdapterFactory.getContainmentLink(
               0x8585453e6bfb4d80L,
               0x98deb16074f1d86cL,
               0x73a7cdcfbbbf8aadL,
               0x73a7cdcfbbbf8c41L,
               "warningRef")),
       MetaAdapterFactory.getReferenceLink(
           0x8585453e6bfb4d80L,
           0x98deb16074f1d86cL,
           0x6abc06f5f4afab9dL,
           0x73a7cdcfba51f755L,
           "declaration"),
       reference);
 }
 public static void nodeFactory_NodeSetup_TypeOfExpression_1179476271704(
     final IOperationContext operationContext, final NodeSetupContext _context) {
   if (SNodeOperations.isInstanceOf(
       _context.getSampleNode(), "jetbrains.mps.baseLanguage.structure.Expression")) {
     if (!(SNodeOperations.isInstanceOf(
         _context.getSampleNode(), "jetbrains.mps.lang.typesystem.structure.TypeOfExpression"))) {
       SLinkOperations.setTarget(
           _context.getNewNode(),
           "term",
           SNodeOperations.cast(
               _context.getSampleNode(), "jetbrains.mps.baseLanguage.structure.Expression"),
           true);
     } else {
       SLinkOperations.setTarget(
           _context.getNewNode(),
           "term",
           SLinkOperations.getTarget(
               SNodeOperations.cast(
                   _context.getSampleNode(),
                   "jetbrains.mps.lang.typesystem.structure.TypeOfExpression"),
               "term",
               true),
           true);
     }
   }
 }
 public static void nodeFactory_NodeSetup_CoerceExpression_1178879020941(
     final IOperationContext operationContext, final NodeSetupContext _context) {
   if (SNodeOperations.isInstanceOf(
       _context.getSampleNode(), "jetbrains.mps.lang.typesystem.structure.CoerceExpression")) {
     SLinkOperations.setTarget(
         _context.getNewNode(),
         "nodeToCoerce",
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 _context.getSampleNode(),
                 "jetbrains.mps.lang.typesystem.structure.CoerceExpression"),
             "nodeToCoerce",
             true),
         true);
     SLinkOperations.setTarget(
         _context.getNewNode(),
         "pattern",
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 _context.getSampleNode(),
                 "jetbrains.mps.lang.typesystem.structure.CoerceExpression"),
             "pattern",
             true),
         true);
   }
 }
Exemple #7
0
  public SNode convertField(PsiField x, SNode parentConcept) {
    SNode field;
    if (isStatic(x)
        || SConceptOperations.isSubConceptOf(
            parentConcept, "jetbrains.mps.baseLanguage.structure.Interface")) {
      field =
          SConceptOperations.createNewNode(
              "jetbrains.mps.baseLanguage.structure.StaticFieldDeclaration", null);
    } else {
      field =
          SConceptOperations.createNewNode(
              "jetbrains.mps.baseLanguage.structure.FieldDeclaration", null);
      SPropertyOperations.set(
          SNodeOperations.cast(field, "jetbrains.mps.baseLanguage.structure.FieldDeclaration"),
          "isVolatile",
          "" + (x.hasModifierProperty(PsiModifier.VOLATILE)));
      SPropertyOperations.set(
          SNodeOperations.cast(field, "jetbrains.mps.baseLanguage.structure.FieldDeclaration"),
          "isTransient",
          "" + (x.hasModifierProperty(PsiModifier.TRANSIENT)));
    }

    SPropertyOperations.set(field, "name", x.getName());
    SLinkOperations.setTarget(
        SNodeOperations.cast(field, "jetbrains.mps.baseLanguage.structure.ClassifierMember"),
        "visibility",
        getVisibility(x),
        true);
    SPropertyOperations.set(field, "isFinal", "" + (isFinal(x)));
    SLinkOperations.setTarget(field, "type", convertType(x.getType()), true);
    addAnnotations(x, field);

    return field;
  }
 public static void nodeFactory_NodeSetup_IsSubtypeExpression_1177408248540(
     final IOperationContext operationContext, final NodeSetupContext _context) {
   if (SNodeOperations.isInstanceOf(
       _context.getSampleNode(), "jetbrains.mps.lang.typesystem.structure.IsSubtypeExpression")) {
     SLinkOperations.setTarget(
         _context.getNewNode(),
         "subtypeExpression",
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 _context.getSampleNode(),
                 "jetbrains.mps.lang.typesystem.structure.IsSubtypeExpression"),
             "subtypeExpression",
             true),
         true);
     SLinkOperations.setTarget(
         _context.getNewNode(),
         "supertypeExpression",
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 _context.getSampleNode(),
                 "jetbrains.mps.lang.typesystem.structure.IsSubtypeExpression"),
             "supertypeExpression",
             true),
         true);
   }
 }
Exemple #9
0
 public static void nodeFactory_NodeSetup_CBinaryOp_6585869519574724396(
     final IOperationContext operationContext, final NodeSetupContext _context) {
   if (SNodeOperations.isInstanceOf(
       _context.getSampleNode(), "jetbrains.mps.nanoc.structure.CBinaryOp")) {
     SNode binaryOp =
         SNodeOperations.cast(_context.getSampleNode(), "jetbrains.mps.nanoc.structure.CBinaryOp");
     SLinkOperations.setTarget(
         _context.getNewNode(), "left", SLinkOperations.getTarget(binaryOp, "left", true), true);
     SLinkOperations.setTarget(
         _context.getNewNode(), "right", SLinkOperations.getTarget(binaryOp, "right", true), true);
   }
 }
  public SNode getSubOrSuperType(
      SNode xmlType, TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
    if ((SLinkOperations.getTarget(xmlType, "schema", false) == null)) {
      return _quotation_createNode_vusj77_a0a0a0();
    } else {
      for (SNode te :
          ListSequence.fromList(
              SLinkOperations.getTargets(
                  SLinkOperations.getTarget(
                      SLinkOperations.getTarget(xmlType, "complexType", false),
                      "typeExpressionList",
                      true),
                  "typeExpression",
                  true))) {
        if (SNodeOperations.isInstanceOf(te, "jetbrains.mps.xmlSchema.structure.ComplexContent")) {
          if (SNodeOperations.isInstanceOf(
              SLinkOperations.getTarget(
                  SNodeOperations.cast(te, "jetbrains.mps.xmlSchema.structure.ComplexContent"),
                  "contentItem",
                  true),
              "jetbrains.mps.xmlSchema.structure.Extension")) {
            SNode ct =
                SLinkOperations.getTarget(
                    SLinkOperations.getTarget(
                        SLinkOperations.getTarget(
                            SNodeOperations.cast(
                                te, "jetbrains.mps.xmlSchema.structure.ComplexContent"),
                            "contentItem",
                            true),
                        "complexTypeReference",
                        true),
                    "complexType",
                    false);

            SNode type =
                SConceptOperations.createNewNode(
                    "jetbrains.mps.xmlQuery.structure.XMLElementType", null);
            SLinkOperations.setTarget(
                type,
                "schema",
                SNodeOperations.getAncestor(
                    ct, "jetbrains.mps.xmlSchema.structure.Schema", false, false),
                false);
            SLinkOperations.setTarget(type, "complexType", ct, false);

            return type;
          }
        }
      }
      return _quotation_createNode_vusj77_a1a0a0a();
    }
  }
    public void execute(final SNode node, final EditorContext editorContext) {
      SNode statement =
          SConceptOperations.createNewNode(
              "org.jetbrains.mps.samples.IfAndUnless.structure.MyIfStatement", null);
      SLinkOperations.setTarget(
          statement, "condition", SLinkOperations.getTarget(node, "condition", true), true);
      SNode ifBody =
          SConceptOperations.createNewNode(
              "org.jetbrains.mps.samples.IfAndUnless.structure.TrueFlow", null);
      ListSequence.fromList(SLinkOperations.getTargets(ifBody, "statement", true))
          .addSequence(
              ListSequence.fromList(
                  SLinkOperations.getTargets(
                      SLinkOperations.getTarget(node, "ifTrue", true), "statement", true)));
      SLinkOperations.setTarget(statement, "body", ifBody, true);

      SLinkOperations.setTarget(
          statement,
          "alternative",
          SConceptOperations.createNewNode(
              "org.jetbrains.mps.samples.IfAndUnless.structure.FalseFlow", null),
          true);
      if (SNodeOperations.isInstanceOf(
          SLinkOperations.getTarget(node, "ifFalseStatement", true),
          "jetbrains.mps.baseLanguage.structure.BlockStatement")) {
        ListSequence.fromList(
                SLinkOperations.getTargets(
                    SLinkOperations.getTarget(statement, "alternative", true), "statement", true))
            .addSequence(
                ListSequence.fromList(
                    SLinkOperations.getTargets(
                        SLinkOperations.getTarget(
                            SNodeOperations.cast(
                                SLinkOperations.getTarget(node, "ifFalseStatement", true),
                                "jetbrains.mps.baseLanguage.structure.BlockStatement"),
                            "statements",
                            true),
                        "statement",
                        true)));
      } else {
        ListSequence.fromList(
                SLinkOperations.getTargets(
                    SLinkOperations.getTarget(statement, "alternative", true), "statement", true))
            .addElement(SLinkOperations.getTarget(node, "ifFalseStatement", true));
      }
      SNodeOperations.replaceWithAnother(node, statement);
      editorContext.select(SLinkOperations.getTarget(statement, "condition", true));
    }
 public static void init(SNode thisNode) {
   SLinkOperations.setTarget(
       thisNode,
       MetaAdapterFactory.getContainmentLink(
           0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x112670d273fL, 0x112670d886aL, "visibility"),
       _quotation_createNode_fkmlyr_a0a0a());
 }
Exemple #13
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 SNode createMethodCall(SNode declaration, List<SNode> parameters) {
   if (SNodeOperations.isInstanceOf(
       declaration, "jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration")) {
     SNode result =
         SConceptOperations.createNewNode(
             "jetbrains.mps.baseLanguage.structure.DotExpression", null);
     SLinkOperations.setTarget(
         result,
         "operand",
         SConceptOperations.createNewNode(
             "jetbrains.mps.baseLanguage.structure.ThisExpression", null),
         true);
     SNode callOperation =
         SConceptOperations.createNewNode(
             "jetbrains.mps.baseLanguage.structure.InstanceMethodCallOperation", null);
     SLinkOperations.setTarget(result, "operation", callOperation, true);
     SLinkOperations.setTarget(
         callOperation,
         "baseMethodDeclaration",
         SNodeOperations.cast(
             declaration, "jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration"),
         false);
     ListSequence.fromList(SLinkOperations.getTargets(callOperation, "actualArgument", true))
         .addSequence(ListSequence.fromList(parameters));
     return result;
   } else {
     SNode call =
         SConceptOperations.createNewNode(
             "jetbrains.mps.baseLanguage.structure.StaticMethodCall", null);
     SLinkOperations.setTarget(
         call,
         "classConcept",
         SNodeOperations.cast(
             SNodeOperations.getParent(declaration),
             "jetbrains.mps.baseLanguage.structure.ClassConcept"),
         false);
     SLinkOperations.setTarget(
         call,
         "baseMethodDeclaration",
         SNodeOperations.cast(
             declaration, "jetbrains.mps.baseLanguage.structure.StaticMethodDeclaration"),
         false);
     ListSequence.fromList(SLinkOperations.getTargets(call, "actualArgument", true))
         .addSequence(ListSequence.fromList(parameters));
     return call;
   }
 }
Exemple #15
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);
 }
Exemple #16
0
 private void addEnum(SNode attrDecl, String[] enumValues) {
   if (enumValues == null) {
     return;
   }
   SNode senum = _quotation_createNode_ixz87t_a0b0j9();
   this.updateEnum(senum, enumValues);
   SLinkOperations.setTarget(attrDecl, "enum", senum, true);
 }
 public void execute_internal(EditorContext editorContext, SNode node) {
   SLinkOperations.setTarget(
       node,
       "removeHints",
       SConceptOperations.createNewNode(
           "jetbrains.mps.lang.editor.structure.ExplicitHintsSpecification", null),
       true);
 }
Exemple #18
0
 private SNode convert(Dependency source) {
   SNode dep =
       SModelOperations.createNewNode(
           myModel, "jetbrains.mps.lang.project.structure.ModuleDependency", null);
   SPropertyOperations.set(dep, "reexport", "" + source.isReexport());
   SLinkOperations.setTarget(dep, "moduleRef", convert(source.getModuleRef()), true);
   return dep;
 }
Exemple #19
0
 public static SNode getBinaryOperationType(SNode leftType, SNode rightType, boolean mayBeString) {
   List<SNode> leastCommonSupertypes =
       SubtypingUtil.leastCommonSuperTypes(Arrays.asList(leftType, rightType), null);
   if (mayBeString) {
     SModel javaLangJavaStubModelDescriptor =
         SModelRepository.getInstance()
             .getModelDescriptor(SModelReference.fromString("java.lang@java_stub"));
     assert javaLangJavaStubModelDescriptor != null;
     SModel javaLang = javaLangJavaStubModelDescriptor.getSModel();
     SNode stringClass = SModelOperations.getRootByName(javaLang, "String");
     if (SNodeOperations.isInstanceOf(
                 leftType, "jetbrains.mps.baseLanguage.structure.ClassifierType")
             && SLinkOperations.getTarget(
                     (SNodeOperations.cast(
                         leftType, "jetbrains.mps.baseLanguage.structure.ClassifierType")),
                     "classifier",
                     false)
                 == stringClass
         || SNodeOperations.isInstanceOf(
                 rightType, "jetbrains.mps.baseLanguage.structure.ClassifierType")
             && SLinkOperations.getTarget(
                     (SNodeOperations.cast(
                         rightType, "jetbrains.mps.baseLanguage.structure.ClassifierType")),
                     "classifier",
                     false)
                 == stringClass) {
       SNode classifierType =
           SConceptOperations.createNewNode(
               "jetbrains.mps.baseLanguage.structure.ClassifierType", null);
       SLinkOperations.setTarget(
           classifierType,
           "classifier",
           SNodeOperations.cast(stringClass, "jetbrains.mps.baseLanguage.structure.Classifier"),
           false);
       return classifierType;
     }
   }
   if (leastCommonSupertypes.isEmpty()) {
     SNode runtimeErrorType =
         SConceptOperations.createNewNode(
             "jetbrains.mps.lang.typesystem.structure.RuntimeErrorType", null);
     SPropertyOperations.set(runtimeErrorType, "errorText", "incompatible types");
     return runtimeErrorType;
   }
   SNode type = leastCommonSupertypes.iterator().next();
   {
     IMatchingPattern pattern_j6k1pf_e0c =
         HUtil.createMatchingPatternByConceptFQName(
             "jetbrains.mps.baseLanguage.structure.PrimitiveType");
     SNode coercedNode_j6k1pf_e0c =
         TypeChecker.getInstance().getRuntimeSupport().coerce_(type, pattern_j6k1pf_e0c);
     if (coercedNode_j6k1pf_e0c != null) {
       return coercedNode_j6k1pf_e0c;
     } else {
       return type;
     }
   }
 }
 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);
 }
Exemple #21
0
 private SNode convert(ModelRoot source) {
   SNode result =
       SModelOperations.createNewNode(
           myModel, "jetbrains.mps.lang.project.structure.ModelRoot", null);
   SPropertyOperations.set(result, "path", source.getPath());
   SPropertyOperations.set(result, "prefix", source.getPrefix());
   SLinkOperations.setTarget(result, "manager", convert(source.getManager()), true);
   return result;
 }
 @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 SNode execute(final SModule m) {
   {
     final SearchScope scope = CommandUtil.createScope(m);
     QueryExecutionContext context =
         new QueryExecutionContext() {
           public SearchScope getDefaultSearchScope() {
             return scope;
           }
         };
     Iterable<SNode> cellModels =
         CollectionSequence.fromCollection(
                 CommandUtil.instances(
                     CommandUtil.createConsoleScope(null, false, context),
                     MetaAdapterFactory.getConcept(
                         0x18bc659203a64e29L,
                         0xa83a7ff23bde13baL,
                         0xf9eb05cdc7L,
                         "jetbrains.mps.lang.editor.structure.CellModel_RefNode")))
             .where(
                 new IWhereFilter<SNode>() {
                   public boolean accept(SNode it) {
                     return needToMigrate(it);
                   }
                 });
     for (SNode cellModel : Sequence.fromIterable(cellModels)) {
       SNodeOperations.deleteNode(
           SLinkOperations.getTarget(
               cellModel,
               MetaAdapterFactory.getContainmentLink(
                   0x18bc659203a64e29L,
                   0xa83a7ff23bde13baL,
                   0xf9eafb9a39L,
                   0x10a19696199L,
                   "renderingCondition")));
       SPropertyOperations.set(
           cellModel,
           MetaAdapterFactory.getProperty(
               0x18bc659203a64e29L,
               0xa83a7ff23bde13baL,
               0xf9eb05cdc7L,
               0x3a4d559b401214L,
               "customizeEmptyCell"),
           "" + (true));
       SLinkOperations.setTarget(
           cellModel,
           MetaAdapterFactory.getContainmentLink(
               0x18bc659203a64e29L,
               0xa83a7ff23bde13baL,
               0xf9eb05cdc7L,
               0x3a4d559b42e5cbL,
               "emptyCellModel"),
           _quotation_createNode_i6fkmm_a0c0b0a0h());
     }
   }
   return null;
 }
 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);
 }
Exemple #25
0
    private void addNestedName(SNode declaration, SNode nref, String name) {
      for (SNode ref : SLinkOperations.getTargets(nref, "role", true)) {
        if (eq_ixz87t_a0a0a0m9(
            SPropertyOperations.getString(
                SLinkOperations.getTarget(ref, "declaration", false), "name"),
            name)) {
          return;
        }
      }

      if (eq_ixz87t_a0c0m9(
          SPropertyOperations.getString(
              SLinkOperations.getTarget(nref, "declaration", false), "name"),
          name)) {
        ListSequence.fromList(SLinkOperations.getTargets(nref, "role", true))
            .addElement(
                Generator.GENERATOR.createDeclarationReference(
                    SNodeOperations.cast(
                        SLinkOperations.getTarget(nref, "declaration", false),
                        "jetbrains.mps.build.generictasks.structure.BuiltInTaskDeclaration")));
        return;
      }

      SNode parentDeclaration =
          SNodeOperations.cast(
              SLinkOperations.getTarget(nref, "declaration", false),
              "jetbrains.mps.build.generictasks.structure.BuiltInTaskDeclaration");
      SNode parentRef = Generator.GENERATOR.createDeclarationReference(parentDeclaration);
      SNode fake;
      if (SNodeOperations.isInstanceOf(
          parentDeclaration,
          "jetbrains.mps.build.generictasks.structure.TaskInterfaceDeclaration")) {
        fake =
            Generator.GENERATOR.createInterfaceDeclaration(
                name,
                SPropertyOperations.getString(parentDeclaration, "classname"),
                SPropertyOperations.getBoolean(parentDeclaration, "depracated"));
        ListSequence.fromList(SLinkOperations.getTargets(fake, "interfaces", true))
            .addElement(parentRef);
      } else {
        fake =
            Generator.GENERATOR.createDeclaration(
                name,
                SPropertyOperations.getString(parentDeclaration, "classname"),
                SPropertyOperations.getBoolean(parentDeclaration, "abstract"),
                SPropertyOperations.getBoolean(parentDeclaration, "canHaveInternalText"),
                SPropertyOperations.getBoolean(parentDeclaration, "depracated"));
        SLinkOperations.setTarget(fake, "parentRef", parentRef, true);
      }
      SPropertyOperations.set(fake, "fake", "" + (true));
      ListSequence.fromList(SLinkOperations.getTargets(nref, "role", true))
          .addElement(Generator.GENERATOR.createDeclarationReference(fake));
      ListSequence.fromList(SLinkOperations.getTargets(declaration, "fakeDeclaration", true))
          .addElement(fake);
    }
 public void test_testRotation() throws Exception {
   this.addNodeById("3852894662483441863");
   this.addNodeById("3852894662483449708");
   SNode op =
       SConceptOperations.createNewNode(
           "jetbrains.mps.baseLanguage.structure.PlusExpression", null);
   SNode constant =
       SConceptOperations.createNewNode(
           "jetbrains.mps.baseLanguage.structure.IntegerConstant", null);
   SPropertyOperations.set(constant, "value", "" + (3));
   SLinkOperations.setTarget(op, "leftExpression", constant, true);
   SNodeOperations.replaceWithAnother(
       SNodeOperations.cast(
           this.getNodeById("3852894662483449704"),
           "jetbrains.mps.baseLanguage.structure.PlusExpression"),
       op);
   SLinkOperations.setTarget(
       op,
       "rightExpression",
       SNodeOperations.cast(
           this.getNodeById("3852894662483449704"),
           "jetbrains.mps.baseLanguage.structure.PlusExpression"),
       true);
   ParenthesisUtil.checkOperationWRTPriority(op);
   {
     List<SNode> nodesBefore =
         ListSequence.fromListAndArray(
             new ArrayList<SNode>(),
             SNodeOperations.cast(
                 this.getNodeById("3852894662483449711"),
                 "jetbrains.mps.baseLanguage.structure.ExpressionStatement"));
     List<SNode> nodesAfter =
         ListSequence.fromListAndArray(
             new ArrayList<SNode>(),
             SNodeOperations.cast(
                 this.getNodeById("3852894662483449702"),
                 "jetbrains.mps.baseLanguage.structure.ExpressionStatement"));
     Assert.assertNull(
         "nodes '" + nodesBefore + "' and '" + nodesAfter + "' do not match!",
         NodesMatcher.matchNodes(nodesBefore, nodesAfter));
   }
 }
 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);
 }
Exemple #28
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);
 }
 public static SNode virtual_getType_228266671027861783(SNode thisNode) {
   SNode listType =
       SConceptOperations.createNewNode(
           "jetbrains.mps.core.query.structure.MqlOrderedSetType", null);
   SLinkOperations.setTarget(
       listType,
       "inner",
       SNodeOperations.copyNode(SLinkOperations.getTarget(thisNode, "elementType", true)),
       true);
   return listType;
 }
 /*package*/ static void setTarget_id1xCtdgeUoP5(@NotNull SNode __thisNode__, SNode target) {
   SLinkOperations.setTarget(
       __thisNode__,
       MetaAdapterFactory.getReferenceLink(
           0xd7706f639be2479cL,
           0xa3daae92af1e64d5L,
           0x3fb2d847d55fc21eL,
           0x3fb2d847d55fdcd5L,
           "patternVarDecl"),
       null);
 }