Package com.e1c.g5.v8.dt.formatter.bsl
Class BslWhitespaceReplacer
java.lang.Object
org.eclipse.xtext.formatting2.internal.WhitespaceReplacer
com.e1c.g5.v8.dt.formatter.bsl.BslWhitespaceReplacer
- All Implemented Interfaces:
org.eclipse.xtext.formatting2.ITextReplacer
public class BslWhitespaceReplacer
extends org.eclipse.xtext.formatting2.internal.WhitespaceReplacer
WhitespaceReplacer that is able to perform force autowraps and manage
BslWrapWithIndentByOffset formatting-
Field Summary
Fields inherited from interface org.eclipse.xtext.formatting2.ITextReplacer
GET_REGION -
Constructor Summary
ConstructorsConstructorDescriptionBslWhitespaceReplacer(org.eclipse.xtext.formatting2.regionaccess.ITextSegment whitespace, org.eclipse.xtext.formatting2.IHiddenRegionFormatting formatting, Boolean spacesForTabs, int tabWidth) Same as calling this(whitespace, formatting, spacesForTabs, tabWidth, false)BslWhitespaceReplacer(org.eclipse.xtext.formatting2.regionaccess.ITextSegment whitespace, org.eclipse.xtext.formatting2.IHiddenRegionFormatting formatting, Boolean spacesForTabs, int tabWidth, boolean forceAutowrap) Calls super's constructor with given parameters -
Method Summary
Modifier and TypeMethodDescriptionprotected intcomputeNewLineCount(org.eclipse.xtext.formatting2.ITextReplacerContext context) org.eclipse.xtext.formatting2.ITextReplacerContextcreateReplacements(org.eclipse.xtext.formatting2.ITextReplacerContext context) Mainly copied fromWhitespaceReplacer. it can recognizeBslWrapWithIndentByOffsetand perform force wrappingvoidDoes not add newline for late calculated autowrap.protected intlogicalLength(String text, org.eclipse.xtext.formatting2.ITextReplacerContext context) The representation size of textbooleanWhether this replacer shall force autowrapvoidsetForceAutowrap(boolean forceAutowrap) Sets theforceAutowrap's valueMethods inherited from class org.eclipse.xtext.formatting2.internal.WhitespaceReplacer
computeNewIndentation, getFormatting, getRegion, toString, trailingNewLinesOfPreviousRegion
-
Constructor Details
-
BslWhitespaceReplacer
public BslWhitespaceReplacer(org.eclipse.xtext.formatting2.regionaccess.ITextSegment whitespace, org.eclipse.xtext.formatting2.IHiddenRegionFormatting formatting, Boolean spacesForTabs, int tabWidth) Same as calling this(whitespace, formatting, spacesForTabs, tabWidth, false)- Parameters:
whitespace- The region of replacement, cannot benullformatting- The formatting information, cannot benullspacesForTabs- Whether spaces shall be used for indentation, cannot benullThe- size of tab in symbols
-
BslWhitespaceReplacer
public BslWhitespaceReplacer(org.eclipse.xtext.formatting2.regionaccess.ITextSegment whitespace, org.eclipse.xtext.formatting2.IHiddenRegionFormatting formatting, Boolean spacesForTabs, int tabWidth, boolean forceAutowrap) Calls super's constructor with given parameters- Parameters:
whitespace- The region of replacement, cannot benullformatting- The formatting information, cannot benullspacesForTabs- Whether spaces shall be used for indentation, cannot benullThe- size of tab in symbolsforceAutowrap- Whether autowrap shall be forced by this replacer
-
-
Method Details
-
createReplacements
public org.eclipse.xtext.formatting2.ITextReplacerContext createReplacements(org.eclipse.xtext.formatting2.ITextReplacerContext context) Mainly copied fromWhitespaceReplacer. it can recognizeBslWrapWithIndentByOffsetand perform force wrapping- Specified by:
createReplacementsin interfaceorg.eclipse.xtext.formatting2.ITextReplacer- Overrides:
createReplacementsin classorg.eclipse.xtext.formatting2.internal.WhitespaceReplacer- Parameters:
context- The context to create replacements with, cannot benull- Returns:
- The next context, can be
null
-
needsForceAutowrap
public boolean needsForceAutowrap()Whether this replacer shall force autowrap- Returns:
- The
forceAutowrap's value
-
setForceAutowrap
public void setForceAutowrap(boolean forceAutowrap) Sets theforceAutowrap's value- Parameters:
forceAutowrap- The value to be set
-
enableNoNewLineForWrap
public void enableNoNewLineForWrap()Does not add newline for late calculated autowrap. Useful for comments wrapping as comment contains new line in its own region -
computeNewLineCount
protected int computeNewLineCount(org.eclipse.xtext.formatting2.ITextReplacerContext context) - Overrides:
computeNewLineCountin classorg.eclipse.xtext.formatting2.internal.WhitespaceReplacer
-
logicalLength
protected int logicalLength(String text, org.eclipse.xtext.formatting2.ITextReplacerContext context) The representation size of text- Parameters:
text- The text which logical length is evaluated, can benullcontext- The context to get preferences, cannot benull- Returns:
- The logical length of text which is its representation length
-