public class DataLanguageBlockWrapper extends java.lang.Object implements ASTBlock, BlockEx, BlockWithParent
Modifier and Type | Method and Description |
---|---|
static DataLanguageBlockWrapper |
create(Block original,
Indent indent) |
Alignment |
getAlignment()
Returns an alignment object indicating how this block is aligned with other blocks.
|
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.
|
Indent |
getIndent()
Returns an indent object indicating how this block is indented relative
to its parent block.
|
Language |
getLanguage() |
ASTNode |
getNode() |
Block |
getOriginal() |
BlockWithParent |
getParent() |
Spacing |
getRightHandSpacing(DataLanguageBlockWrapper rightHandWrapper) |
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.
|
java.util.List<Block> |
getSubBlocks()
Returns the list of child blocks for the specified block.
|
TextRange |
getTextRange()
Returns the text range covered by the block.
|
Wrap |
getWrap()
Returns a wrap object indicating the conditions under which a line break
is inserted before this block when formatting, if the block extends beyond the
right margin.
|
boolean |
isIncomplete()
Checks if the current block is incomplete (contains elements that the user will
probably type but has not yet typed).
|
boolean |
isLeaf()
Returns true if the specified block may not contain child blocks.
|
void |
setParent(BlockWithParent parent) |
void |
setRightHandSpacing(DataLanguageBlockWrapper rightHandWrapper,
Spacing spacing) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getElementType, getNode, getPsiElement
getDebugName
public TextRange getTextRange()
Block
getTextRange
in interface Block
public java.util.List<Block> getSubBlocks()
Block
getSubBlocks()
is repeatedly called on a particular
Block
instance.
Even more Important:
If immutable list is returned (e.g. Collections.singletonList(xxx)
, you must mark this Block
class with com.intellij.formatting.ReadOnlyBlockContainer
marker interface.getSubBlocks
in interface Block
Block.isLeaf()
public Language getLanguage()
getLanguage
in interface BlockEx
public Wrap getWrap()
Block
getWrap
in interface Block
Wrap.createWrap(WrapType, boolean)
,
Wrap.createChildWrap(Wrap, WrapType, boolean)
public ChildAttributes getChildAttributes(int newChildIndex)
Block
getChildAttributes
in interface Block
newChildIndex
- the index where a new child is inserted.public Indent getIndent()
Block
getIndent
in interface Block
Indent.getContinuationWithoutFirstIndent()
public Alignment getAlignment()
Block
getAlignment
method
are aligned with each other.getAlignment
in interface Block
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 boolean isIncomplete()
Block
Block.getChildAttributes(int)
is called when Enter is pressed: if the block immediately before the cursor is incomplete,
the method is called for that block; otherwise, the method is called for the parent of that block.isIncomplete
in interface Block
public boolean isLeaf()
Block
Block.getSubBlocks()
.public Block getOriginal()
public java.lang.String toString()
toString
in class java.lang.Object
public static DataLanguageBlockWrapper create(Block original, Indent indent)
public BlockWithParent getParent()
getParent
in interface BlockWithParent
public void setParent(BlockWithParent parent)
setParent
in interface BlockWithParent
public void setRightHandSpacing(DataLanguageBlockWrapper rightHandWrapper, Spacing spacing)
public Spacing getRightHandSpacing(DataLanguageBlockWrapper rightHandWrapper)