public abstract class Spacing
extends java.lang.Object
Block.getSpacing(Block, Block)
Constructor and Description |
---|
Spacing() |
Modifier and Type | Method and Description |
---|---|
static Spacing |
createDependentLFSpacing(int minSpaces,
int maxSpaces,
java.util.List<TextRange> dependency,
boolean keepLineBreaks,
int keepBlankLines)
Needed when implementing options like "Next line after '('" or "Place ')' on new line".
|
static Spacing |
createDependentLFSpacing(int minSpaces,
int maxSpaces,
TextRange dependency,
boolean keepLineBreaks,
int keepBlankLines)
Creates a spacing setting instance which inserts a line break if the specified text range also
contains a line break.
|
static Spacing |
createDependentLFSpacing(int minSpaces,
int maxSpaces,
TextRange dependencyRange,
boolean keepLineBreaks,
int keepBlankLines,
DependentSpacingRule rule)
Creates a spacing setting instance which uses settings from the given dependent spacing rule if the specified text range changes
its 'has line feed' status during formatting (new line feed is added and the range hasn't contained them before
or it contained line feed(s) and it was removed during formatting).
|
static Spacing |
createKeepingFirstColumnSpacing(int minSpaces,
int maxSpaces,
boolean keepLineBreaks,
int keepBlankLines)
Creates a spacing setting instance that keeps the second child on the first column if it was
there before the formatting, but may indent the second child if it was not in the first column.
|
static Spacing |
createSafeSpacing(boolean keepLineBreaks,
int keepBlankLines)
Creates a spacing setting instance which preserves the presence of spaces between the blocks but,
if spaces are present, may insert or delete the spaces.
|
static Spacing |
createSpacing(int minSpaces,
int maxSpaces,
int minLineFeeds,
boolean keepLineBreaks,
int keepBlankLines)
Creates a regular spacing setting instance.
|
static Spacing |
createSpacing(int minSpaces,
int maxSpaces,
int minLineFeeds,
boolean keepLineBreaks,
int keepBlankLines,
int prefLineFeeds)
Creates a regular spacing setting instance.
|
static Spacing |
getReadOnlySpacing()
Returns a spacing setting instance indicating that no line breaks or spaces can be
inserted or removed by the formatter between the specified two blocks.
|
public static Spacing createSpacing(int minSpaces, int maxSpaces, int minLineFeeds, boolean keepLineBreaks, int keepBlankLines)
minSpaces
- The minimum number of spaces that should be present between the blocks
to which the spacing setting instance is related. Spaces are inserted
if there are less than this amount of spaces in the document.maxSpaces
- The maximum number of spaces that should be present between the blocks
to which the spacing setting instance is related, or Integer.MAX_VALUE
if the number of spaces is not limited. Spaces are deleted if there are
more than this amount of spaces in the document.minLineFeeds
- The minimum number of line breaks that should be present between the blocks
to which the spacing setting instance is related.keepLineBreaks
- Whether the existing line breaks between the blocks should be preserved.keepBlankLines
- Whether the existing blank lines between the blocks should be preserved.public static Spacing createSpacing(int minSpaces, int maxSpaces, int minLineFeeds, boolean keepLineBreaks, int keepBlankLines, int prefLineFeeds)
minSpaces
- The minimum number of spaces that should be present between the blocks
to which the spacing setting instance is related. Spaces are inserted
if there are less than this amount of spaces in the document.maxSpaces
- The maximum number of spaces that should be present between the blocks
to which the spacing setting instance is related, or Integer.MAX_VALUE
if the number of spaces is not limited. Spaces are deleted if there are
more than this amount of spaces in the document.minLineFeeds
- The minimum number of line breaks that should be present between the blocks
to which the spacing setting instance is related.keepLineBreaks
- Whether the existing line breaks between the blocks should be preserved.keepBlankLines
- Whether the existing blank lines between the blocks should be preserved.public static Spacing getReadOnlySpacing()
public static Spacing createDependentLFSpacing(int minSpaces, int maxSpaces, TextRange dependency, boolean keepLineBreaks, int keepBlankLines)
minSpaces
- The minimum number of spaces that should be present between the blocks
to which the spacing setting instance is related. Spaces are inserted
if there are less than this amount of spaces in the document.maxSpaces
- The maximum number of spaces that should be present between the blocks
to which the spacing setting instance is related, or Integer.MAX_VALUE
if the number of spaces is not limited. Spaces are deleted if there are
more than this amount of spaces in the document.dependency
- The text range checked for the presence of line breaks.keepLineBreaks
- Whether the existing line breaks between the blocks should be preserved.keepBlankLines
- Whether the existing blank lines between the blocks should be preserved.public static Spacing createDependentLFSpacing(int minSpaces, int maxSpaces, java.util.List<TextRange> dependency, boolean keepLineBreaks, int keepBlankLines)
public static Spacing createDependentLFSpacing(int minSpaces, int maxSpaces, TextRange dependencyRange, boolean keepLineBreaks, int keepBlankLines, DependentSpacingRule rule)
minSpaces
- The minimum number of spaces that should be present between the blocks
to which the spacing setting instance is related. Spaces are inserted
if there are less than this amount of spaces in the document.maxSpaces
- The maximum number of spaces that should be present between the blocks
to which the spacing setting instance is related, or Integer.MAX_VALUE
if the number of spaces is not limited. Spaces are deleted if there are
more than this amount of spaces in the document.dependencyRange
- The text range checked for the presence of line breaks.keepLineBreaks
- Whether the existing line breaks between the blocks should be preserved.keepBlankLines
- Whether the existing blank lines between the blocks should be preserved.rule
- settings to use if dependent region changes its 'contains line feed' status during formattingpublic static Spacing createSafeSpacing(boolean keepLineBreaks, int keepBlankLines)
keepLineBreaks
- Whether the existing line breaks between the blocks should be preserved.keepBlankLines
- Whether the existing blank lines between the blocks should be preserved.public static Spacing createKeepingFirstColumnSpacing(int minSpaces, int maxSpaces, boolean keepLineBreaks, int keepBlankLines)
minSpaces
- The minimum number of spaces that should be present between the blocks
to which the spacing setting instance is related. Spaces are inserted
if there are less than this amount of spaces in the document.maxSpaces
- The maximum number of spaces that should be present between the blocks
to which the spacing setting instance is related, or Integer.MAX_VALUE
if the number of spaces is not limited. Spaces are deleted if there are
more than this amount of spaces in the document.keepLineBreaks
- Whether the existing line breaks between the blocks should be preserved.keepBlankLines
- Whether the existing blank lines between the blocks should be preserved.