Package com.regnosys.rosetta.formatting2
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
ConstructorsConstructorDescriptionTrimmedMaxLineWidthDocument(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 TypeMethodDescriptionvoidaddReplacer(org.eclipse.xtext.formatting2.ITextReplacer replacer) protected StringapplyTextReplacementsOnAstRegion(Iterable<org.eclipse.xtext.formatting2.regionaccess.ITextReplacement> replacements) org.eclipse.xtext.formatting2.ITextReplacerContextcreateReplacements(org.eclipse.xtext.formatting2.ITextReplacerContext context) protected voidvalidate(org.eclipse.xtext.formatting2.internal.HiddenRegionReplacer replacer) protected voidvalidate(org.eclipse.xtext.formatting2.ITextReplacer replacer) Methods inherited from class org.eclipse.xtext.formatting2.internal.SubDocument
getFormatter, getRegion, getRequest, requireFitsInLine, requireFitsInLine, requireFitsInLineMethods 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, withReplacerFilterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
addReplacerin interfaceorg.eclipse.xtext.formatting2.internal.ICompositeTextReplacer- Specified by:
addReplacerin interfaceorg.eclipse.xtext.formatting2.IFormattableDocument- Overrides:
addReplacerin classorg.eclipse.xtext.formatting2.internal.FormattableDocument
-
createReplacements
public org.eclipse.xtext.formatting2.ITextReplacerContext createReplacements(org.eclipse.xtext.formatting2.ITextReplacerContext context) - Specified by:
createReplacementsin interfaceorg.eclipse.xtext.formatting2.ITextReplacer- Overrides:
createReplacementsin classorg.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
-