Package org.eclipse.xtext.util

Examples of org.eclipse.xtext.util.ReplaceRegion


   */
  @Override
  public ReplaceRegion serializeReplacement(EObject obj, SaveOptions options) {
    ICompositeNode node = NodeModelUtils.findActualNodeFor(obj);
    String text = serialize(obj);
    return new ReplaceRegion(node.getTotalOffset(), node.getTotalLength(), text);
  }
View Full Code Here


    final StringBuilder builder = new StringBuilder();
    internalFormat(dom, regionToFormat, formattingContext, builder);
    final String text = builder.toString();
    if(regionToFormat == null)
      regionToFormat = new TextRegion(0, text.length());
    return new ReplaceRegion(regionToFormat, text);
  }
View Full Code Here

    else if(text instanceof StringBuilder)
      textString = ((StringBuilder) text).toString();
    else
      textString = new StringBuilder(text).toString();

    return new ReplaceRegion(regionToFormat == null
        ? new TextRegion(0, text.length())
        : regionToFormat, textString);
  }
View Full Code Here

    ISerializationDiagnostic.Acceptor errors = ISerializationDiagnostic.EXCEPTION_THROWING_ACCEPTOR;
    DomModelSequenceAdapter acceptor = new DomModelSequenceAdapter(
      hiddenTokenHelper, commentConfiguration, lineSeparatorInformation, errors);
    EObject context = getContext(obj);
    serialize(obj, context, acceptor, errors);
    ReplaceRegion r = domFormatter.format(
      acceptor.getDomModel(), regionToFormat, formattingContextFactory.create(obj, formatting(options)), errors);
    writer.append(r.getText());
  }
View Full Code Here

      TextRegion regionToFormat = new TextRegion(replacementNode.getOffset(), replacementNode.getLength());

      // Override temporarily to have formatting turned on
      // GAH - this is just ridiculous internal DSL junk to set a single boolean
      options = SaveOptions.newBuilder().format().getOptions();
      ReplaceRegion r = domFormatter.format(
        root, regionToFormat,
        formattingContextFactory.create(obj.eResource().getContents().get(0), formatting(options)));
      // String text = serialize(obj.eContainer(), options, new TextRegion(node.getOffset(), node.getLength()));
      return new ReplaceRegion(node.getTotalOffset(), node.getTotalLength(), r.getText());
    }
    finally {
      if(alreadyEnteredResourceScope)
        resourceScope.exit();
    }
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.util.ReplaceRegion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.