public class FormatterImpl extends FormatterEx
Constructor and Description |
---|
FormatterImpl() |
Modifier and Type | Method and Description |
---|---|
int |
adjustLineIndent(FormattingModel model,
CodeStyleSettings settings,
CommonCodeStyleSettings.IndentOptions indentOptions,
int offset,
TextRange affectedRange) |
void |
adjustLineIndentsForRange(FormattingModel model,
CodeStyleSettings settings,
CommonCodeStyleSettings.IndentOptions indentOptions,
TextRange rangeToAdjust) |
Alignment |
createAlignment(boolean applyToNonFirstBlocksOnLine,
Alignment.Anchor anchor) |
Alignment |
createChildAlignment(Alignment base) |
Wrap |
createChildWrap(Wrap parentWrap,
WrapType wrapType,
boolean wrapFirstElement) |
Spacing |
createDependentLFSpacing(int minSpaces,
int maxSpaces,
java.util.List<TextRange> dependentRegion,
boolean keepLineBreaks,
int keepBlankLines,
DependentSpacingRule rule) |
Spacing |
createDependentLFSpacing(int minSpaces,
int maxSpaces,
TextRange dependencyRange,
boolean keepLineBreaks,
int keepBlankLines,
DependentSpacingRule rule) |
FormattingModel |
createFormattingModelForPsiFile(PsiFile file,
Block rootBlock,
CodeStyleSettings settings) |
Spacing |
createKeepingFirstColumnSpacing(int minSpace,
int maxSpace,
boolean keepLineBreaks,
int keepBlankLines) |
Spacing |
createSafeSpacing(boolean shouldKeepLineBreaks,
int keepBlankLines) |
Spacing |
createSpacing(int minOffset,
int maxOffset,
int minLineFeeds,
boolean keepLineBreaks,
int keepBlankLines) |
Spacing |
createSpacing(int minSpaces,
int maxSpaces,
int minLineFeeds,
boolean keepLineBreaks,
int keepBlankLines,
int prefLineFeeds) |
Wrap |
createWrap(WrapType type,
boolean wrapFirstElement) |
void |
format(FormattingModel model,
CodeStyleSettings settings,
CommonCodeStyleSettings.IndentOptions indentOptions,
FormatTextRanges affectedRanges) |
void |
formatAroundRange(FormattingModel model,
CodeStyleSettings settings,
PsiFile file,
TextRange textRange) |
void |
formatWithoutModifications(FormattingDocumentModel model,
Block rootBlock,
CodeStyleSettings settings,
CommonCodeStyleSettings.IndentOptions indentOptions,
TextRange affectedRange) |
Indent |
getAbsoluteLabelIndent() |
Indent |
getAbsoluteNoneIndent() |
Indent |
getContinuationIndent(boolean relative) |
Indent |
getContinuationWithoutFirstIndent(boolean relative) |
Indent |
getIndent(Indent.Type type,
boolean relativeToDirectParent,
boolean enforceIndentToChildren) |
Indent |
getIndent(Indent.Type type,
int spaces,
boolean relativeToDirectParent,
boolean enforceIndentToChildren) |
Indent |
getLabelIndent() |
java.lang.String |
getLineIndent(FormattingModel model,
CodeStyleSettings settings,
CommonCodeStyleSettings.IndentOptions indentOptions,
int offset,
TextRange affectedRange) |
int |
getMinLineFeedsBeforeBlockAtOffset(FormattingModel model,
int offset)
Calculates minimum number of line feeds that should precede block starting at given offset, as dictated by formatting model.
|
Indent |
getNoneIndent() |
Indent |
getNormalIndent(boolean relative) |
Spacing |
getReadOnlySpacing() |
Indent |
getSmartIndent(Indent.Type type) |
Indent |
getSpaceIndent(int spaces,
boolean relative) |
int |
getSpacingForBlockAtOffset(FormattingModel model,
int offset)
Calculates minimum spacing, allowed by formatting model (in columns) for a block starting at given offset,
relative to its previous sibling block.
|
static java.lang.String |
getText(FormattingDocumentModel documentModel) |
boolean |
isDisabled() |
<T> T |
runWithFormattingDisabled(Computable<T> runnable) |
void |
setProgressTask(FormattingProgressTask progressIndicator) |
getInstance, getInstanceEx
public Alignment createAlignment(boolean applyToNonFirstBlocksOnLine, Alignment.Anchor anchor)
public Indent getNormalIndent(boolean relative)
public Indent getNoneIndent()
public void setProgressTask(FormattingProgressTask progressIndicator)
setProgressTask
in class FormatterEx
public int getSpacingForBlockAtOffset(FormattingModel model, int offset)
FormatterEx
-1
, if required block cannot be found at provided offset,
or spacing cannot be calculated due to some other reason.getSpacingForBlockAtOffset
in class FormatterEx
public int getMinLineFeedsBeforeBlockAtOffset(FormattingModel model, int offset)
FormatterEx
-1
, if required block cannot be found at provided offset,
or spacing cannot be calculated due to some other reason.getMinLineFeedsBeforeBlockAtOffset
in class FormatterEx
public Wrap createChildWrap(Wrap parentWrap, WrapType wrapType, boolean wrapFirstElement)
public Spacing createSpacing(int minOffset, int maxOffset, int minLineFeeds, boolean keepLineBreaks, int keepBlankLines)
public Spacing getReadOnlySpacing()
public Spacing createDependentLFSpacing(int minSpaces, int maxSpaces, TextRange dependencyRange, boolean keepLineBreaks, int keepBlankLines, DependentSpacingRule rule)
public Spacing createDependentLFSpacing(int minSpaces, int maxSpaces, java.util.List<TextRange> dependentRegion, boolean keepLineBreaks, int keepBlankLines, DependentSpacingRule rule)
public void format(FormattingModel model, CodeStyleSettings settings, CommonCodeStyleSettings.IndentOptions indentOptions, FormatTextRanges affectedRanges) throws IncorrectOperationException
format
in class FormatterEx
IncorrectOperationException
public void formatWithoutModifications(FormattingDocumentModel model, Block rootBlock, CodeStyleSettings settings, CommonCodeStyleSettings.IndentOptions indentOptions, TextRange affectedRange) throws IncorrectOperationException
IncorrectOperationException
public void adjustLineIndentsForRange(FormattingModel model, CodeStyleSettings settings, CommonCodeStyleSettings.IndentOptions indentOptions, TextRange rangeToAdjust)
adjustLineIndentsForRange
in class FormatterEx
public void formatAroundRange(FormattingModel model, CodeStyleSettings settings, PsiFile file, TextRange textRange)
formatAroundRange
in class FormatterEx
public int adjustLineIndent(FormattingModel model, CodeStyleSettings settings, CommonCodeStyleSettings.IndentOptions indentOptions, int offset, TextRange affectedRange) throws IncorrectOperationException
adjustLineIndent
in class FormatterEx
IncorrectOperationException
public java.lang.String getLineIndent(FormattingModel model, CodeStyleSettings settings, CommonCodeStyleSettings.IndentOptions indentOptions, int offset, TextRange affectedRange)
getLineIndent
in class FormatterEx
public static java.lang.String getText(FormattingDocumentModel documentModel)
public FormattingModel createFormattingModelForPsiFile(PsiFile file, Block rootBlock, CodeStyleSettings settings)
public Indent getSpaceIndent(int spaces, boolean relative)
public Indent getIndent(Indent.Type type, boolean relativeToDirectParent, boolean enforceIndentToChildren)
public Indent getSmartIndent(Indent.Type type)
public Indent getIndent(Indent.Type type, int spaces, boolean relativeToDirectParent, boolean enforceIndentToChildren)
public Indent getAbsoluteLabelIndent()
public Spacing createSafeSpacing(boolean shouldKeepLineBreaks, int keepBlankLines)
public Spacing createKeepingFirstColumnSpacing(int minSpace, int maxSpace, boolean keepLineBreaks, int keepBlankLines)
public Spacing createSpacing(int minSpaces, int maxSpaces, int minLineFeeds, boolean keepLineBreaks, int keepBlankLines, int prefLineFeeds)
public Indent getAbsoluteNoneIndent()
public Indent getLabelIndent()
public Indent getContinuationIndent(boolean relative)
public Indent getContinuationWithoutFirstIndent(boolean relative)
public boolean isDisabled()
isDisabled
in class FormatterEx
public <T> T runWithFormattingDisabled(Computable<T> runnable)