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 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 SNode createNewMethod() { if (isStatic) { return SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.StaticMethodDeclaration", null); } else { return SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration", null); } }
private SNode getVisibility(PsiModifierListOwner x) { if (x.hasModifierProperty(PsiModifier.PUBLIC)) { return SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.PublicVisibility", null); } else if (x.hasModifierProperty(PsiModifier.PROTECTED)) { return SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.ProtectedVisibility", null); } else if (x.hasModifierProperty(PsiModifier.PRIVATE)) { return SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.PrivateVisibility", null); } else { return null; } }
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)); }
private SNode convertLanguage(LanguageDescriptor source) { SNode result = SConceptOperations.createNewNode("jetbrains.mps.lang.project.structure.Language", null); result.setId(SNodeId.fromString("~root")); SModelOperations.addRootNode(myModel, result); fill(result, source); SPropertyOperations.set(result, "doNotGenerateAdapters", "" + source.isDoNotGenerateAdapters()); SPropertyOperations.set(result, "genPath", source.getGenPath()); SPropertyOperations.set(result, "languagePath", myFile.getPath()); for (SModelReference ref : source.getAccessoryModels()) { SLinkOperations.getTargets(result, "accessoryModels", true).add(convert(ref)); } for (GeneratorDescriptor descriptor : source.getGenerators()) { SLinkOperations.getTargets(result, "generator", true).add(convert(descriptor)); } for (ModuleReference ref : source.getExtendedLanguages()) { SLinkOperations.getTargets(result, "extendedLanguages", true).add(convert(ref)); } for (Dependency dep : source.getRuntimeModules()) { SLinkOperations.getTargets(result, "runtimeModules", true).add(convert(dep)); } for (ModelRoot entry : source.getRuntimeStubModels()) { SLinkOperations.getTargets(result, "runtimeStubModels", true).add(convert(entry)); } for (StubSolution sol : source.getStubSolutions()) { SLinkOperations.getTargets(result, "stubSolutions", true).add(convert(sol)); } collectModels(result, source); return result; }
public SNode resolveClass(PsiClassType t) { PsiClass cls = t.resolve(); // TODO q: handle this case? create dynamic reference? if (cls == null) { return null; } System.out.println("Class resolved: " + cls.getQualifiedName()); PsiElement e = cls; do { e = e.getParent(); if (!(e instanceof PsiClass) && !(e instanceof PsiJavaFile)) { return null; } } while (!(e instanceof PsiJavaFile)); PsiJavaFile file = (PsiJavaFile) e; String packageName = file.getPackageName(); SModelReference modelRef = SModelReference.fromString(packageName); SNode clsType = SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.ClassifierType", null); clsType.setReference( "classifier", new DynamicReference("classifier", clsType, modelRef, t.getClassName())); System.out.println("Class type: " + t.getClassName()); return clsType; }
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 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; } }
public void execute_internal(EditorContext editorContext, SNode node) { SLinkOperations.setTarget( node, "removeHints", SConceptOperations.createNewNode( "jetbrains.mps.lang.editor.structure.ExplicitHintsSpecification", null), true); }
@Override public SNode getMethodType() { return SConceptOperations.createNewNode( SNodeOperations.asInstanceConcept( MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf940d6513eL, "jetbrains.mps.baseLanguage.structure.BooleanType"))); }
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 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; }
public static SNode sourceNodeQuery_1220269203624( final IOperationContext operationContext, final SourceSubstituteMacroNodeContext _context) { if ((SLinkOperations.getTarget(_context.getNode(), "condition", true) != null)) { return SLinkOperations.getTarget( SLinkOperations.getTarget(_context.getNode(), "condition", true), "body", true); } SNode statementList = SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.StatementList", null); SNode expressionStatement = SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.ExpressionStatement", null); SNode defaultCondition = SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.BooleanConstant", null); SPropertyOperations.set(defaultCondition, "value", "" + (false)); SLinkOperations.setTarget(expressionStatement, "expression", defaultCondition, true); ListSequence.fromList(SLinkOperations.getTargets(statementList, "statement", true)) .addElement(expressionStatement); return statementList; }
private SNode convertSolution(SolutionDescriptor source) { SNode result = SConceptOperations.createNewNode("jetbrains.mps.lang.project.structure.Solution", null); result.setId(SNodeId.fromString("~root")); SModelOperations.addRootNode(myModel, result); fill(result, source); SPropertyOperations.set(result, "dontLoadClasses", "" + source.isDontLoadClasses()); SPropertyOperations.set(result, "outputPath", source.getOutputPath()); SPropertyOperations.set(result, "solutionPath", myFile.getPath()); collectModels(result, source); return result; }
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(); } }
@Override protected void modifyPartToExtract() { SNode ret = SConceptOperations.createNewNode( SNodeOperations.asInstanceConcept( MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc67c7feL, "jetbrains.mps.baseLanguage.structure.ReturnStatement"))); SNode constant = SConceptOperations.createNewNode( SNodeOperations.asInstanceConcept( MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b201L, "jetbrains.mps.baseLanguage.structure.BooleanConstant"))); SPropertyOperations.set( constant, MetaAdapterFactory.getProperty( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b201L, 0xf8cc56b202L, "value"), "" + (false)); SLinkOperations.setTarget( ret, MetaAdapterFactory.getContainmentLink( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc67c7feL, 0xf8cc6bf96cL, "expression"), constant); ListSequence.fromList(this.myStatements).addElement(SNodeOperations.copyNode(ret)); SPropertyOperations.set( constant, MetaAdapterFactory.getProperty( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b201L, 0xf8cc56b202L, "value"), "" + (true)); for (SNode exitPoint : ListSequence.fromList(this.myAnalyzer.getIntenalExitPoints())) { SNodeOperations.replaceWithAnother(exitPoint, SNodeOperations.copyNode(ret)); } }
@Nullable @Override public SNode createNode(@NotNull String pattern) { SNode result = SConceptOperations.createNewNode( MetaAdapterFactory.getConcept( 0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x3ae0865e9a712712L, "jetbrains.mps.lang.editor.structure.ExplicitHintsSpecification")); SNode hintReference = SConceptOperations.createNewNode( MetaAdapterFactory.getConcept( 0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x5eadaecad41188dcL, "jetbrains.mps.lang.editor.structure.ConceptEditorHintDeclarationReference")); SLinkOperations.setTarget( hintReference, MetaAdapterFactory.getReferenceLink( 0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x5eadaecad41188dcL, 0x527faacef66db74dL, "hint"), myParameterObject); ListSequence.fromList( SLinkOperations.getChildren( result, MetaAdapterFactory.getContainmentLink( 0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x3ae0865e9a712712L, 0x3ae0865e9a71295bL, "hints"))) .addElement(hintReference); return result; }
public void execute(final SNode node, final EditorContext editorContext) { SNode newAnnotation = SNodeFactoryOperations.createNewNode( "jetbrains.mps.lang.test.structure.NodeOperationsContainer", null); AttributeOperations.setAttribute( node, new IAttributeDescriptor.NodeAttribute( "jetbrains.mps.lang.test.structure.NodeOperationsContainer"), newAnnotation); SNode warningCheck = SConceptOperations.createNewNode( "jetbrains.mps.lang.test.structure.NodeWarningCheckOperation", null); ListSequence.fromList(SLinkOperations.getTargets(newAnnotation, "nodeOperations", true)) .addElement(warningCheck); SelectionUtil.selectCell(editorContext, warningCheck, SelectionManager.LAST_EDITABLE_CELL); }
public void execute_internal(EditorContext editorContext, SNode node) { SLinkOperations.setTarget( node, MetaAdapterFactory.getContainmentLink( 0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xf9eaff2517L, 0x3ae0865e9aa67219L, "removeHints"), SConceptOperations.createNewNode( SNodeOperations.asInstanceConcept( MetaAdapterFactory.getConcept( 0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x3ae0865e9a712712L, "jetbrains.mps.lang.editor.structure.ExplicitHintsSpecification")))); }
public static SNode sourceNodeQuery_1219760682963( final IOperationContext operationContext, final SourceSubstituteMacroNodeContext _context) { if (SNodeOperations.isInstanceOf( _context.getNode(), "jetbrains.mps.quickQueryLanguage.structure.ReplaceModelQuery")) { return SLinkOperations.getTarget( SLinkOperations.getTarget( SNodeOperations.cast( _context.getNode(), "jetbrains.mps.quickQueryLanguage.structure.ReplaceModelQuery"), "replace", true), "body", true); } return SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.StatementList", null); }
public SNode resolveAnnotation(PsiAnnotation a) { String fqName = a.getQualifiedName(); // TODO q: handle this case? create dynamic reference? if (fqName == null) { return null; } System.out.println("Anno resolved: " + fqName); SNode anno = SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.AnnotationInstance", null); anno.setReference("annotation", new DynamicReference("annotation", anno, null, fqName)); return anno; }
public static SNode virtual_getStateType_314981645426570519(SNode thisNode) { if ((SLinkOperations.getTarget(thisNode, "stateTypeParameter", false) != null)) { SNode classifierType = SConceptOperations.createNewNode( "jetbrains.mps.baseLanguage.structure.ClassifierType", null); SLinkOperations.setTarget( classifierType, "classifier", SLinkOperations.getTarget(thisNode, "stateTypeParameter", false), false); return classifierType; } if (SPropertyOperations.getBoolean(thisNode, "isDebuggable")) { return new RunConfigurationDeclaration_Behavior.QuotationClass_ym0401_a0a0b0i().createNode(); } return new RunConfigurationDeclaration_Behavior.QuotationClass_ym0401_a0c0i().createNode(); }
public void test_unspecifiedChildren() throws Exception { this.addNodeById("8758390115029078425"); this.addNodeById("5815925154349132136"); this.addNodeById("2166349271756548530"); int initialSize = ListSequence.fromList( SNodeOperations.getChildren( SNodeOperations.cast( this.getNodeById("2166349271756548531"), "jetbrains.mps.lang.smodelTests.structure.Root"))) .count(); SNode unspecifiedChild = SConceptOperations.createNewNode( "jetbrains.mps.lang.smodelTests.structure.GrandChild", null); String unspecifiedChildRole = this.addUnspecifiedChild( SNodeOperations.cast( this.getNodeById("2166349271756548531"), "jetbrains.mps.lang.smodelTests.structure.Root"), unspecifiedChild); Assert.assertEquals( initialSize + 1, ListSequence.fromList( SNodeOperations.getChildren( SNodeOperations.cast( this.getNodeById("2166349271756548531"), "jetbrains.mps.lang.smodelTests.structure.Root"))) .count()); Iterable<SNode> unspecifiedChildren = ListSequence.fromList( SNodeOperations.getChildren( SNodeOperations.cast( this.getNodeById("2166349271756548531"), "jetbrains.mps.lang.smodelTests.structure.Root"))) .where( new IWhereFilter<SNode>() { public boolean accept(SNode it) { return (SNodeOperations.getContainingLinkDeclaration(it) == null); } }); Assert.assertEquals(1, Sequence.fromIterable(unspecifiedChildren).count()); SNode theChild = Sequence.fromIterable(unspecifiedChildren).first(); Assert.assertEquals(unspecifiedChildRole, SNodeOperations.getContainingLinkRole(theChild)); Assert.assertEquals(unspecifiedChild, theChild); }
private SNode convertDevkit(DevkitDescriptor source) { SNode result = SConceptOperations.createNewNode("jetbrains.mps.lang.project.structure.DevKit", null); result.setId(SNodeId.fromString("~root")); SModelOperations.addRootNode(myModel, result); fill(result, source); SPropertyOperations.set(result, "devkitPath", myFile.getPath()); for (ModuleReference ref : source.getExtendedDevkits()) { SLinkOperations.getTargets(result, "extendedDevkits", true).add(convert(ref)); } for (ModuleReference ref : source.getExportedLanguages()) { SLinkOperations.getTargets(result, "exportedLanguages", true).add(convert(ref)); } for (ModuleReference ref : source.getExportedSolutions()) { SLinkOperations.getTargets(result, "exportedSolutions", true).add(convert(ref)); } return result; }
public static SNode virtual_createCellModel_1238614099938( SNode thisNode, Map<SNode, SNode> partsToLinks) { SNode refNode = SConceptOperations.createNewNode( "jetbrains.mps.lang.editor.structure.CellModel_RefNode", null); SNode variableConcept = SNodeOperations.getAncestor( thisNode, "jetbrains.mpslite.structure.VariableConcept", false, false); SLinkOperations.setTarget( refNode, "relationDeclaration", SNodeOperations.cast( MapSequence.fromMap(partsToLinks) .get(SLinkOperations.getTarget(variableConcept, "typeConcept", true)), "jetbrains.mps.lang.structure.structure.LinkDeclaration"), false); return refNode; }
private static SNode createType_idhEwJimy(@NotNull SNode __thisNode__) { SNode type = SConceptOperations.createNewNode( SNodeOperations.asInstanceConcept( MetaAdapterFactory.getConcept( 0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x119240f9168L, "jetbrains.mps.lang.plugin.structure.GroupType"))); SLinkOperations.setTarget( type, MetaAdapterFactory.getReferenceLink( 0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x119240f9168L, 0x119240f916aL, "actionGroup"), __thisNode__); return type; }
public void execute(final SNode node, final EditorContext editorContext) { if (AttributeOperations.getAttribute( node, new IAttributeDescriptor.NodeAttribute( "jetbrains.mps.lang.editor.figures.structure.FigureParameterAttributeViewProperty")) != null) { AttributeOperations.setAttribute( node, new IAttributeDescriptor.NodeAttribute( "jetbrains.mps.lang.editor.figures.structure.FigureParameterAttributeViewProperty"), null); } else { AttributeOperations.setAttribute( node, new IAttributeDescriptor.NodeAttribute( "jetbrains.mps.lang.editor.figures.structure.FigureParameterAttributeViewProperty"), SConceptOperations.createNewNode( "jetbrains.mps.lang.editor.figures.structure.FigureParameterAttributeViewProperty", null)); } }
public void handleAction_impl( SNode parameterObject, SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) { SLinkOperations.setTarget( node, MetaAdapterFactory.getContainmentLink( 0x8585453e6bfb4d80L, 0x98deb16074f1d86cL, 0x11b01e7283dL, 0x75cf259aa047ff15L, "errorRef"), SConceptOperations.createNewNode( SNodeOperations.asInstanceConcept( MetaAdapterFactory.getConcept( 0x8585453e6bfb4d80L, 0x98deb16074f1d86cL, 0x3ee2cbee8b19b06dL, "jetbrains.mps.lang.test.structure.ReportErrorStatementReference")))); SLinkOperations.setTarget( SLinkOperations.getTarget( node, MetaAdapterFactory.getContainmentLink( 0x8585453e6bfb4d80L, 0x98deb16074f1d86cL, 0x11b01e7283dL, 0x75cf259aa047ff15L, "errorRef")), MetaAdapterFactory.getReferenceLink( 0x8585453e6bfb4d80L, 0x98deb16074f1d86cL, 0x6abc06f5f4afab9dL, 0x73a7cdcfba51f755L, "declaration"), parameterObject); }
public static List<SNode> virtual_getMacro_1107726059764558743(SNode thisNode) { if (ListSequence.fromList(SLinkOperations.getTargets(thisNode, "macro", true)).isNotEmpty()) { return SLinkOperations.getTargets(thisNode, "macro", true); } List<String> allMacroNames = IMacroHolder_Behavior.call_getAllMacroNames_1234975567387(thisNode, true); List<SNode> result = new ArrayList<SNode>(); for (String macroName : ListSequence.fromList(allMacroNames)) { SNode macro = SConceptOperations.createNewNode("jetbrains.mps.build.packaging.structure.Macro", null); SPropertyOperations.set(macro, "name", macroName); SPropertyOperations.set( macro, "path", BehaviorReflection.invokeVirtual( String.class, thisNode, "virtual_evaluateMacro_1234975967990", new Object[] {macroName}) .replace("\\", Util.SEPARATOR)); ListSequence.fromList(result).addElement(macro); } return result; }