Class HiddenRegionReplacer
- java.lang.Object
-
- org.eclipse.xtext.formatting2.internal.HiddenRegionReplacer
-
- All Implemented Interfaces:
ITextReplacer
public class HiddenRegionReplacer extends java.lang.Object implements ITextReplacer
-
-
Field Summary
-
Fields inherited from interface org.eclipse.xtext.formatting2.ITextReplacer
GET_REGION
-
-
Constructor Summary
Constructors Constructor Description HiddenRegionReplacer(IHiddenRegion region, IHiddenRegionFormatting formatting)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapplyHiddenRegionFormatting(java.util.List<ITextReplacer> replacers)This method is called when we have multiple TextReplacers for this HiddenRegion because the HiddenRegion contains comments.protected voidapplyIndentation(java.util.List<ITextReplacer> replacers, IHiddenRegionFormatting separator)protected voidapplyPriorityAndDefaultFormatting(java.util.List<ITextReplacer> replacers, IHiddenRegionFormatting separator)protected voidapplySeparatorConfiguration(IHiddenRegionFormatting separator)Apply newline and space configuration to the first whitespace region that follows or contains a linewrap.ITextReplacerContextcreateReplacements(ITextReplacerContext context)Creates the real replacements for this region.protected java.util.List<ITextReplacer>createReplacers(AbstractFormatter2 formatter)protected WhitespaceReplacerfindWhitespaceThatSeparatesSemanticRegions(java.util.List<ITextReplacer> replacers)IHiddenRegionFormattinggetFormatting()IHiddenRegiongetRegion()The region this replace is responsible for.protected voidintroduceNewlinesAroundMLComments(java.util.List<ITextReplacer> replacers)java.lang.StringtoString()
-
-
-
Constructor Detail
-
HiddenRegionReplacer
public HiddenRegionReplacer(IHiddenRegion region, IHiddenRegionFormatting formatting)
-
-
Method Detail
-
applyHiddenRegionFormatting
protected void applyHiddenRegionFormatting(java.util.List<ITextReplacer> replacers)
This method is called when we have multiple TextReplacers for this HiddenRegion because the HiddenRegion contains comments. It applies the formatting configuration fromformattingto theWhitespaceReplacerthat surrounds the comment.
-
applyIndentation
protected void applyIndentation(java.util.List<ITextReplacer> replacers, IHiddenRegionFormatting separator)
- Since:
- 2.23
-
applySeparatorConfiguration
protected void applySeparatorConfiguration(IHiddenRegionFormatting separator)
Apply newline and space configuration to the first whitespace region that follows or contains a linewrap.- Since:
- 2.23
-
applyPriorityAndDefaultFormatting
protected void applyPriorityAndDefaultFormatting(java.util.List<ITextReplacer> replacers, IHiddenRegionFormatting separator)
- Since:
- 2.23
-
introduceNewlinesAroundMLComments
protected void introduceNewlinesAroundMLComments(java.util.List<ITextReplacer> replacers)
- Since:
- 2.23
-
createReplacements
public ITextReplacerContext createReplacements(ITextReplacerContext context)
Description copied from interface:ITextReplacerCreates the real replacements for this region. The given context may be altered and returned afterwards.- Specified by:
createReplacementsin interfaceITextReplacer
-
createReplacers
protected java.util.List<ITextReplacer> createReplacers(AbstractFormatter2 formatter)
-
findWhitespaceThatSeparatesSemanticRegions
protected WhitespaceReplacer findWhitespaceThatSeparatesSemanticRegions(java.util.List<ITextReplacer> replacers)
-
getFormatting
public IHiddenRegionFormatting getFormatting()
-
getRegion
public IHiddenRegion getRegion()
Description copied from interface:ITextReplacerThe region this replace is responsible for. All text replacements create by this replacer must be inside this region.- Specified by:
getRegionin interfaceITextReplacer
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-