Class TrimmedMaxLineWidthDocument

java.lang.Object
org.eclipse.xtext.formatting2.internal.FormattableDocument
org.eclipse.xtext.formatting2.internal.SubDocument
com.regnosys.rosetta.formatting2.TrimmedMaxLineWidthDocument
All Implemented Interfaces:
org.eclipse.xtext.formatting2.IFormattableDocument, org.eclipse.xtext.formatting2.IFormattableSubDocument, org.eclipse.xtext.formatting2.internal.ICompositeTextReplacer, org.eclipse.xtext.formatting2.ITextReplacer

public class TrimmedMaxLineWidthDocument extends org.eclipse.xtext.formatting2.internal.SubDocument
A small modification to Xtext's `MaxLineWidthDocument`. In comparison, this subdocument allows you to format the next hidden region as well, but ignores it when checking applicability, i.e., you may add newlines, long comments, etc.
  • Field Summary

    Fields inherited from interface org.eclipse.xtext.formatting2.ITextReplacer

    GET_REGION
  • Constructor Summary

    Constructors
    Constructor
    Description
    TrimmedMaxLineWidthDocument(org.eclipse.xtext.formatting2.regionaccess.ISequentialRegion astRegion, org.eclipse.xtext.formatting2.IFormattableDocument parent, int maxLineWidth)
     
    TrimmedMaxLineWidthDocument(org.eclipse.xtext.formatting2.regionaccess.ITextSegment astRegion, org.eclipse.xtext.formatting2.regionaccess.ITextSegment formattableRegion, org.eclipse.xtext.formatting2.IFormattableDocument parent, int maxLineWidth)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addReplacer(org.eclipse.xtext.formatting2.ITextReplacer replacer)
     
    protected String
    applyTextReplacementsOnAstRegion(Iterable<org.eclipse.xtext.formatting2.regionaccess.ITextReplacement> replacements)
     
    org.eclipse.xtext.formatting2.ITextReplacerContext
    createReplacements(org.eclipse.xtext.formatting2.ITextReplacerContext context)
     
    protected void
    validate(org.eclipse.xtext.formatting2.internal.HiddenRegionReplacer replacer)
     
    protected void
    validate(org.eclipse.xtext.formatting2.ITextReplacer replacer)
     

    Methods inherited from class org.eclipse.xtext.formatting2.internal.SubDocument

    getFormatter, getRegion, getRequest, requireFitsInLine, requireFitsInLine, requireFitsInLine

    Methods inherited from class org.eclipse.xtext.formatting2.internal.FormattableDocument

    append, append, applyTextReplacements, createTextReplacerSet, format, formatConditionally, formatConditionally, getPreferences, getReplacers, getTextRegionAccess, interior, interior, interior, needsAutowrap, prepend, prepend, renderToTextReplacements, set, set, surround, surround, toString, withReplacerFilter

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.xtext.formatting2.IFormattableDocument

    append, append, format, formatConditionally, formatConditionally, interior, interior, interior, prepend, prepend, renderToTextReplacements, set, set, surround, surround, withReplacerFilter
  • Constructor Details

    • TrimmedMaxLineWidthDocument

      public TrimmedMaxLineWidthDocument(org.eclipse.xtext.formatting2.regionaccess.ISequentialRegion astRegion, org.eclipse.xtext.formatting2.IFormattableDocument parent, int maxLineWidth)
    • TrimmedMaxLineWidthDocument

      public TrimmedMaxLineWidthDocument(org.eclipse.xtext.formatting2.regionaccess.ITextSegment astRegion, org.eclipse.xtext.formatting2.regionaccess.ITextSegment formattableRegion, org.eclipse.xtext.formatting2.IFormattableDocument parent, int maxLineWidth)
  • Method Details

    • addReplacer

      public void addReplacer(org.eclipse.xtext.formatting2.ITextReplacer replacer)
      Specified by:
      addReplacer in interface org.eclipse.xtext.formatting2.internal.ICompositeTextReplacer
      Specified by:
      addReplacer in interface org.eclipse.xtext.formatting2.IFormattableDocument
      Overrides:
      addReplacer in class org.eclipse.xtext.formatting2.internal.FormattableDocument
    • createReplacements

      public org.eclipse.xtext.formatting2.ITextReplacerContext createReplacements(org.eclipse.xtext.formatting2.ITextReplacerContext context)
      Specified by:
      createReplacements in interface org.eclipse.xtext.formatting2.ITextReplacer
      Overrides:
      createReplacements in class org.eclipse.xtext.formatting2.internal.SubDocument
    • validate

      protected void validate(org.eclipse.xtext.formatting2.internal.HiddenRegionReplacer replacer) throws org.eclipse.xtext.formatting2.FormattingNotApplicableException
      Throws:
      org.eclipse.xtext.formatting2.FormattingNotApplicableException
    • validate

      protected void validate(org.eclipse.xtext.formatting2.ITextReplacer replacer) throws org.eclipse.xtext.formatting2.FormattingNotApplicableException
      Throws:
      org.eclipse.xtext.formatting2.FormattingNotApplicableException
    • applyTextReplacementsOnAstRegion

      protected String applyTextReplacementsOnAstRegion(Iterable<org.eclipse.xtext.formatting2.regionaccess.ITextReplacement> replacements)