コード例 #1
0
 public void doGenerateText(SNode node) {
   if (getBuffer().hasPositionsSupport()) {
     TraceInfoGenerationUtil.createPositionInfo(this, node);
   }
   for (SNode item : SLinkOperations.getTargets(node, "item", true)) {
     if (item != ListSequence.fromList(SLinkOperations.getTargets(node, "item", true)).first()) {
       TextGenManager.instance()
           .appendNodeText(
               this.getContext(),
               this.getBuffer(),
               SLinkOperations.getTarget(node, "separator", true),
               this.getSNode());
     }
     TextGenManager.instance()
         .appendNodeText(this.getContext(), this.getBuffer(), item, this.getSNode());
   }
   if (getBuffer().hasPositionsSupport()) {
     {
       String traceableProperty = "";
       try {
         traceableProperty =
             BehaviorReflection.invokeVirtual(
                 String.class,
                 SNodeOperations.cast(
                     node, "jetbrains.mps.lang.traceable.structure.TraceableConcept"),
                 "virtual_getTraceableProperty_5067982036267369901",
                 new Object[] {});
       } catch (Throwable t) {
         LOG.error("Can't calculate traceable prorerty for a node " + node + ".", t);
       }
       TraceInfoGenerationUtil.fillPositionInfo(this, node, traceableProperty);
     }
   }
 }
コード例 #2
0
ファイル: GIndentBlock_TextGen.java プロジェクト: sprig/MPS
 public void doGenerateText(SNode node) {
   if (getBuffer().hasPositionsSupport()) {
     TraceInfoGenerationUtil.createPositionInfo(this, node);
   }
   this.increaseDepth();
   TextGenManager.instance()
       .appendNodeText(
           this.getContext(),
           this.getBuffer(),
           SLinkOperations.getTarget(node, "itemList", true),
           this.getSNode());
   this.decreaseDepth();
   if (getBuffer().hasPositionsSupport()) {
     {
       String traceableProperty = "";
       try {
         traceableProperty =
             BehaviorReflection.invokeVirtual(
                 String.class,
                 SNodeOperations.cast(
                     node, "jetbrains.mps.lang.traceable.structure.TraceableConcept"),
                 "virtual_getTraceableProperty_5067982036267369901",
                 new Object[] {});
       } catch (Throwable t) {
         if (LOG.isEnabledFor(Priority.ERROR)) {
           LOG.error("Can't calculate traceable prorerty for a node " + node + ".", t);
         }
       }
       TraceInfoGenerationUtil.fillPositionInfo(this, node, traceableProperty);
     }
   }
 }
コード例 #3
0
 public void doGenerateText(SNode node) {
   if (getBuffer().hasPositionsSupport()) {
     TraceInfoGenerationUtil.createUnitInfo(this, node);
   }
   if ((AttributeOperations.getAttribute(
           node,
           new IAttributeDescriptor.NodeAttribute(
               "jetbrains.mps.baseLanguage.javadoc.structure.ClassifierDocComment"))
       != null)) {
     appendNode(
         AttributeOperations.getAttribute(
             node,
             new IAttributeDescriptor.NodeAttribute(
                 "jetbrains.mps.baseLanguage.javadoc.structure.ClassifierDocComment")));
   }
   BaseLanguageTextGen.fileHeader(node, this);
   BaseLanguageTextGen.annotations(node, this);
   BaseLanguageTextGen.visibilityWithIndent(
       SLinkOperations.getTarget(node, "visibility", true), this);
   if (Classifier_Behavior.call_isInner_521412098689998677(node)
       && BehaviorReflection.invokeVirtual(
           Boolean.TYPE, node, "virtual_isStatic_7405920559687241224", new Object[] {})) {
     this.append("static ");
   }
   if (SPropertyOperations.getBoolean(node, "abstractClass")) {
     this.append("abstract ");
   }
   if (SPropertyOperations.getBoolean(node, "isFinal")) {
     this.append("final ");
   }
   this.append("class ");
   this.append(SPropertyOperations.getString(node, "name"));
   GenericDeclarationTextGen2.typeDeclarations(node, this);
   if ((SLinkOperations.getTarget(node, "superclass", true) != null)) {
     this.append(" extends ");
     appendNode(SLinkOperations.getTarget(node, "superclass", true));
   }
   if (ListSequence.fromList(SLinkOperations.getTargets(node, "implementedInterface", true))
       .isNotEmpty()) {
     this.append(" implements ");
     {
       Iterable<SNode> collection = SLinkOperations.getTargets(node, "implementedInterface", true);
       final SNode lastItem = Sequence.fromIterable(collection).last();
       for (SNode item : collection) {
         appendNode(item);
         if (item != lastItem) {
           append(", ");
         }
       }
     }
   }
   this.append(" ");
   BaseClassConceptTextGen.membersWithBrackets(node, true, this);
   this.appendNewLine();
   if (getBuffer().hasPositionsSupport()) {
     {
       String unitName = null;
       try {
         unitName =
             BehaviorReflection.invokeVirtual(
                 String.class,
                 SNodeOperations.cast(node, "jetbrains.mps.lang.traceable.structure.UnitConcept"),
                 "virtual_getUnitName_5067982036267369911",
                 new Object[] {});
       } catch (Throwable t) {
         if (LOG.isEnabledFor(Level.ERROR)) {
           LOG.error("Can't calculate unit name for a node " + node + ".", t);
         }
       }
       TraceInfoGenerationUtil.fillUnitInfo(this, node, unitName);
     }
   }
 }