public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlock, ReservedWrapsProvider
Modifier and Type | Field and Description |
---|---|
protected AlignmentStrategy |
myAlignmentStrategy |
protected Alignment |
myChildAlignment |
protected Indent |
myChildIndent |
protected CommonCodeStyleSettings.IndentOptions |
myIndentSettings |
protected JavaCodeStyleSettings |
myJavaSettings |
protected Alignment |
myReservedAlignment |
protected Alignment |
myReservedAlignment2 |
protected CommonCodeStyleSettings |
mySettings |
protected boolean |
myUseChildAttributes |
EMPTY, myAlignment, myNode, myWrap
Modifier | Constructor and Description |
---|---|
protected |
AbstractJavaBlock(ASTNode node,
Wrap wrap,
Alignment alignment,
Indent indent,
CommonCodeStyleSettings settings,
JavaCodeStyleSettings javaSettings,
FormattingMode formattingMode) |
protected |
AbstractJavaBlock(ASTNode node,
Wrap wrap,
AlignmentStrategy alignmentStrategy,
Indent indent,
CommonCodeStyleSettings settings,
JavaCodeStyleSettings javaSettings,
FormattingMode formattingMode) |
protected |
AbstractJavaBlock(ASTNode node,
Wrap wrap,
Indent indent,
CommonCodeStyleSettings settings,
JavaCodeStyleSettings javaSettings,
JavaWrapManager wrapManager,
AlignmentStrategy alignmentStrategy,
FormattingMode formattingMode) |
Modifier and Type | Method and Description |
---|---|
protected Wrap |
arrangeChildWrap(ASTNode child,
Wrap defaultWrap) |
protected Alignment |
chooseAlignment(Alignment alignment,
Alignment alignment2,
ASTNode child) |
protected ASTNode |
composeCodeBlock(java.util.List<? super Block> result,
ASTNode child,
Indent indent,
int childrenIndent,
Wrap childWrap) |
static Alignment |
createAlignment(Alignment base,
boolean alignOption,
Alignment defaultAlignment) |
static Alignment |
createAlignment(boolean alignOption,
Alignment defaultAlignment) |
protected Alignment |
createChildAlignment() |
protected Wrap |
createChildWrap() |
SyntheticCodeBlock |
createCodeBlockBlock(java.util.List<Block> localResult,
Indent indent,
int childrenIndent) |
Block |
createJavaBlock(ASTNode child,
CommonCodeStyleSettings settings,
JavaCodeStyleSettings javaSettings,
Indent indent,
Wrap wrap,
Alignment alignment,
FormattingMode formattingMode) |
Block |
createJavaBlock(ASTNode child,
CommonCodeStyleSettings settings,
JavaCodeStyleSettings javaSettings,
Indent indent,
Wrap wrap,
AlignmentStrategy alignmentStrategy,
FormattingMode formattingMode) |
protected static Indent |
createNormalIndent() |
protected static Indent |
createNormalIndent(int baseChildrenIndent) |
ChildAttributes |
getChildAttributes(int newChildIndex)
Returns the alignment and indent attributes which are applied to a new block inserted at
the specified position in the list of children of this block.
|
protected Indent |
getChildIndent() |
protected Indent |
getCodeBlockChildExternalIndent(int newChildIndex) |
protected Indent |
getCodeBlockExternalIndent() |
protected Indent |
getCodeBlockInternalIndent(int baseChildrenIndent) |
ASTNode |
getFirstTreeNode() |
protected FormattingMode |
getFormattingMode() |
Indent |
getIndent()
Returns an indent object indicating how this block is indented relative
to its parent block.
|
AbstractJavaBlock |
getParentBlock() |
Wrap |
getReservedWrap(IElementType elementType)
Note: this method is considered to be a legacy heritage and is assumed to be removed as soon as formatting processing
is refactored
|
CommonCodeStyleSettings |
getSettings() |
Spacing |
getSpacing(Block child1,
Block child2)
Returns a spacing object indicating what spaces and/or line breaks are added between two
specified children of this block.
|
protected ChildAlignmentStrategyProvider |
getStrategyProvider() |
protected static ASTNode |
getTreeNode(Block block) |
protected Alignment |
getUsedAlignment(int newChildIndex) |
protected boolean |
isAfter(int newChildIndex,
IElementType [] elementTypes) |
boolean |
isLeaf()
Returns true if the specified block may not contain child blocks.
|
protected static boolean |
isRBrace(ASTNode child) |
protected static boolean |
isStatement(ASTNode child,
ASTNode parentNode) |
static Block |
newJavaBlock(ASTNode child,
CommonCodeStyleSettings settings,
JavaCodeStyleSettings javaSettings,
FormattingMode formattingMode) |
static Block |
newJavaBlock(ASTNode child,
CommonCodeStyleSettings settings,
JavaCodeStyleSettings javaSettings,
Indent indent,
Wrap wrap,
AlignmentStrategy strategy,
FormattingMode formattingMode) |
protected ASTNode |
processChild(java.util.List<Block> result,
ASTNode child,
AlignmentStrategy alignmentStrategy,
Wrap defaultWrap,
Indent childIndent) |
protected ASTNode |
processChild(java.util.List<Block> result,
ASTNode child,
AlignmentStrategy alignmentStrategy,
Wrap defaultWrap,
Indent childIndent,
int childOffset) |
protected ASTNode |
processChild(java.util.List<Block> result,
ASTNode child,
Alignment defaultAlignment,
Wrap defaultWrap,
Indent childIndent) |
void |
setParentBlock(AbstractJavaBlock parentBlock) |
void |
setReservedWrap(Wrap reservedWrap,
IElementType operationType)
Defines contract for associating operation type and particular wrap instance.
|
buildChildren, getAlignment, getExtraRangesToFormat, getNode, getSubBlocks, getTextRange, getWrap, isBuildIndentsOnly, isIncomplete, setBuildIndentsOnly, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getElementType, getNode, getPsiElement
getDebugName
protected final CommonCodeStyleSettings mySettings
protected final JavaCodeStyleSettings myJavaSettings
protected final CommonCodeStyleSettings.IndentOptions myIndentSettings
protected Indent myChildIndent
protected Alignment myChildAlignment
protected boolean myUseChildAttributes
protected final AlignmentStrategy myAlignmentStrategy
protected Alignment myReservedAlignment
protected Alignment myReservedAlignment2
protected AbstractJavaBlock(ASTNode node, Wrap wrap, Alignment alignment, Indent indent, CommonCodeStyleSettings settings, JavaCodeStyleSettings javaSettings, FormattingMode formattingMode)
protected AbstractJavaBlock(ASTNode node, Wrap wrap, AlignmentStrategy alignmentStrategy, Indent indent, CommonCodeStyleSettings settings, JavaCodeStyleSettings javaSettings, FormattingMode formattingMode)
protected AbstractJavaBlock(ASTNode node, Wrap wrap, Indent indent, CommonCodeStyleSettings settings, JavaCodeStyleSettings javaSettings, JavaWrapManager wrapManager, AlignmentStrategy alignmentStrategy, FormattingMode formattingMode)
public Block createJavaBlock(ASTNode child, CommonCodeStyleSettings settings, JavaCodeStyleSettings javaSettings, Indent indent, Wrap wrap, Alignment alignment, FormattingMode formattingMode)
public Block createJavaBlock(ASTNode child, CommonCodeStyleSettings settings, JavaCodeStyleSettings javaSettings, Indent indent, Wrap wrap, AlignmentStrategy alignmentStrategy, FormattingMode formattingMode)
public static Block newJavaBlock(ASTNode child, CommonCodeStyleSettings settings, JavaCodeStyleSettings javaSettings, FormattingMode formattingMode)
public static Block newJavaBlock(ASTNode child, CommonCodeStyleSettings settings, JavaCodeStyleSettings javaSettings, Indent indent, Wrap wrap, AlignmentStrategy strategy, FormattingMode formattingMode)
protected static boolean isRBrace(ASTNode child)
public Spacing getSpacing(Block child1, Block child2)
Block
getSpacing
in interface Block
child1
- the first child for which spacing is requested;
null
if given 'child2'
block is the first document blockchild2
- the second child for which spacing is requested.Spacing.createSpacing(int, int, int, boolean, int)
,
Spacing.getReadOnlySpacing()
public ASTNode getFirstTreeNode()
getFirstTreeNode
in interface JavaBlock
public Indent getIndent()
Block
getIndent
in interface Block
getIndent
in class AbstractBlock
Indent.getContinuationWithoutFirstIndent()
protected Wrap createChildWrap()
protected Alignment createChildAlignment()
protected Alignment chooseAlignment(Alignment alignment, Alignment alignment2, ASTNode child)
protected ASTNode processChild(java.util.List<Block> result, ASTNode child, Alignment defaultAlignment, Wrap defaultWrap, Indent childIndent)
protected ASTNode processChild(java.util.List<Block> result, ASTNode child, AlignmentStrategy alignmentStrategy, Wrap defaultWrap, Indent childIndent)
protected ASTNode processChild(java.util.List<Block> result, ASTNode child, AlignmentStrategy alignmentStrategy, Wrap defaultWrap, Indent childIndent, int childOffset)
public static Alignment createAlignment(boolean alignOption, Alignment defaultAlignment)
public static Alignment createAlignment(Alignment base, boolean alignOption, Alignment defaultAlignment)
protected Indent getCodeBlockInternalIndent(int baseChildrenIndent)
protected static Indent createNormalIndent()
protected static Indent createNormalIndent(int baseChildrenIndent)
protected Indent getCodeBlockExternalIndent()
protected Indent getCodeBlockChildExternalIndent(int newChildIndex)
public Wrap getReservedWrap(IElementType elementType)
getReservedWrap
in interface ReservedWrapsProvider
elementType
- target element typenull
all the timepublic void setReservedWrap(Wrap reservedWrap, IElementType operationType)
getReservedWrap(IElementType)
call if given operation type is used as an argument there.
Default implementation (setReservedWrap(Wrap, IElementType)
) does nothing.
Note: this method is considered to be a legacy heritage and is assumed to be removed as soon as formatting processing
is refactoredreservedWrap
- reserved wrap instanceoperationType
- target operation type to associate with the given wrap instancepublic ChildAttributes getChildAttributes(int newChildIndex)
Block
getChildAttributes
in interface Block
getChildAttributes
in class AbstractBlock
newChildIndex
- the index where a new child is inserted.protected Indent getChildIndent()
getChildIndent
in class AbstractBlock
public CommonCodeStyleSettings getSettings()
protected boolean isAfter(int newChildIndex, IElementType [] elementTypes)
protected Alignment getUsedAlignment(int newChildIndex)
public boolean isLeaf()
Block
Block.getSubBlocks()
.protected ASTNode composeCodeBlock(java.util.List<? super Block> result, ASTNode child, Indent indent, int childrenIndent, Wrap childWrap)
protected ChildAlignmentStrategyProvider getStrategyProvider()
public AbstractJavaBlock getParentBlock()
public void setParentBlock(AbstractJavaBlock parentBlock)
public SyntheticCodeBlock createCodeBlockBlock(java.util.List<Block> localResult, Indent indent, int childrenIndent)
protected FormattingMode getFormattingMode()