Example #1
0
 public static TextGenerationResult generateText(
     SNode node,
     boolean failIfNoTextgen,
     boolean withDebugInfo,
     @Nullable StringBuilder[] buffers) {
   if (canGenerateTextFor(node)) {
     return generateText(node, withDebugInfo, buffers);
   } else if (failIfNoTextgen) {
     String error = "Can't generate text from " + node;
     Message m = new Message(MessageKind.ERROR, error);
     if (node != null && node.getModel() != null && !node.getModel().isTransient()) {
       m.setHintObject(new jetbrains.mps.smodel.SNodePointer(node));
     }
     return new TextGenerationResult(
         node, NO_TEXTGEN, true, Collections.<IMessage>singleton(m), null, null, null, null);
   } else {
     return new TextGenerationResult(
         node, NO_TEXTGEN, false, Collections.<IMessage>emptyList(), null, null, null, null);
   }
 }
Example #2
0
 private static IMessage createMessage(
     @NotNull MessageKind kind, @NotNull String text, Throwable ex) {
   Message m = new Message(kind, ModuleMaker.class, text);
   m.setException(ex);
   return m;
 }
Example #3
0
 private static IMessage createMessage(
     @NotNull MessageKind kind, @NotNull String text, @Nullable Object hint) {
   Message m = new Message(kind, ModuleMaker.class, text);
   m.setHintObject(hint);
   return m;
 }