public abstract class TemplateLanguageBlock extends AbstractBlock implements BlockWithParent
EMPTY, myAlignment, myNode, myWrap
Modifier | Constructor and Description |
---|---|
protected |
TemplateLanguageBlock(ASTNode node,
Wrap wrap,
Alignment alignment,
TemplateLanguageBlockFactory blockFactory,
CodeStyleSettings settings,
java.util.List<DataLanguageBlockWrapper> foreignChildren) |
protected |
TemplateLanguageBlock(TemplateLanguageBlockFactory blockFactory,
CodeStyleSettings settings,
ASTNode node,
java.util.List<DataLanguageBlockWrapper> foreignChildren) |
Modifier and Type | Method and Description |
---|---|
protected java.util.List<Block> |
buildChildren() |
protected Alignment |
createChildAlignment(ASTNode child) |
protected Wrap |
createChildWrap(ASTNode child) |
java.util.List<DataLanguageBlockWrapper> |
getForeignChildren() |
Spacing |
getLeftNeighborSpacing(Block leftNeighbor,
DataLanguageBlockWrapper parent,
int thisBlockIndex)
Invoked when the current base language block is located inside a template data language block to determine the spacing before the current block.
|
BlockWithParent |
getParent() |
Spacing |
getRightNeighborSpacing(Block rightNeighbor,
DataLanguageBlockWrapper parent,
int thisBlockIndex)
Invoked when the current base language block is located inside a template data language block to determine the spacing after the current block.
|
CodeStyleSettings |
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 abstract IElementType |
getTemplateTextElementType() |
boolean |
isLeaf()
Returns true if the specified block may not contain child blocks.
|
boolean |
isRequiredRange(TextRange range)
Checks if DataLanguageBlockFragmentWrapper must be created for the given text range.
|
void |
setParent(BlockWithParent newParent) |
protected boolean |
shouldBuildBlockFor(ASTNode childNode) |
Wrap |
substituteTemplateChildWrap(DataLanguageBlockWrapper child,
Wrap childWrap) |
getAlignment, getChildAttributes, getChildIndent, getExtraRangesToFormat, getIndent, getNode, getSubBlocks, getTextRange, getWrap, isBuildIndentsOnly, isIncomplete, setBuildIndentsOnly, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getElementType, getNode, getPsiElement
getDebugName
protected TemplateLanguageBlock(TemplateLanguageBlockFactory blockFactory, CodeStyleSettings settings, ASTNode node, java.util.List<DataLanguageBlockWrapper> foreignChildren)
protected TemplateLanguageBlock(ASTNode node, Wrap wrap, Alignment alignment, TemplateLanguageBlockFactory blockFactory, CodeStyleSettings settings, java.util.List<DataLanguageBlockWrapper> foreignChildren)
protected java.util.List<Block> buildChildren()
buildChildren
in class AbstractBlock
protected boolean shouldBuildBlockFor(ASTNode childNode)
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 Spacing getRightNeighborSpacing(Block rightNeighbor, DataLanguageBlockWrapper parent, int thisBlockIndex)
rightNeighbor
- the block to the right of the current oneparent
- the parent blockthisBlockIndex
- the index of the current block in the parent block sub-blockspublic Spacing getLeftNeighborSpacing(Block leftNeighbor, DataLanguageBlockWrapper parent, int thisBlockIndex)
leftNeighbor
- the block to the left of the current one, or null if the current block is first childparent
- the parent blockthisBlockIndex
- the index of the current block in the parent block sub-blockspublic boolean isLeaf()
Block
Block.getSubBlocks()
.protected abstract IElementType getTemplateTextElementType()
public BlockWithParent getParent()
getParent
in interface BlockWithParent
public void setParent(BlockWithParent newParent)
setParent
in interface BlockWithParent
public boolean isRequiredRange(TextRange range)
range
- The range to check.public CodeStyleSettings getSettings()
public java.util.List<DataLanguageBlockWrapper> getForeignChildren()
public Wrap substituteTemplateChildWrap(DataLanguageBlockWrapper child, Wrap childWrap)