public abstract class CustomFoldingBuilder extends FoldingBuilderEx implements PossiblyDumbAware
Constructor and Description |
---|
CustomFoldingBuilder() |
Modifier and Type | Method and Description |
---|---|
FoldingDescriptor [] |
buildFoldRegions(ASTNode node,
Document document)
Builds the folding regions for the specified node in the AST tree and its children.
|
FoldingDescriptor [] |
buildFoldRegions(PsiElement root,
Document document,
boolean quick)
Builds the folding regions for the specified node in the AST tree and its children.
|
protected abstract void |
buildLanguageFoldRegions(java.util.List<FoldingDescriptor> descriptors,
PsiElement root,
Document document,
boolean quick)
Implement this method to build language folding regions besides custom folding regions.
|
protected abstract java.lang.String |
getLanguagePlaceholderText(ASTNode node,
TextRange range) |
java.lang.String |
getPlaceholderText(ASTNode node)
Returns the text which is displayed in the editor for the folding region related to the
specified node when the folding region is collapsed.
|
java.lang.String |
getPlaceholderText(ASTNode node,
TextRange range)
Returns the text which is displayed in the editor for the folding region related to the
specified node when the folding region is collapsed.
|
boolean |
isCollapsedByDefault(ASTNode node)
Returns the default collapsed state for the folding region related to the specified node.
|
protected boolean |
isCustomFoldingCandidate(ASTNode node)
Checks if a node may contain custom folding tags.
|
boolean |
isCustomFoldingCandidate(PsiElement element) |
protected boolean |
isCustomFoldingRoot(ASTNode node)
Checks if the node is used as custom folding root.
|
protected static boolean |
isCustomRegionElement(PsiElement element) |
protected boolean |
isCustomRegionEnd(ASTNode node)
Returns true if the node corresponds to custom region end.
|
boolean |
isCustomRegionStart(ASTNode node)
Returns true if the node corresponds to custom region start.
|
boolean |
isDumbAware()
Checks if the folding ranges can be created in the Dumb Mode.
|
protected abstract boolean |
isRegionCollapsedByDefault(ASTNode node)
Returns the default collapsed state for the folding region related to the specified node.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isCollapsedByDefault
public final FoldingDescriptor [] buildFoldRegions(PsiElement root, Document document, boolean quick)
FoldingBuilderEx
buildFoldRegions
in class FoldingBuilderEx
root
- the element for which folding is requested.document
- the document for which folding is built. Can be used to retrieve line
numbers for folding regions.quick
- whether the result should be provided as soon as possible. Is true, when
an editor is opened and we need to auto-fold something immediately, like Java imports.
If true, one should perform no reference resolving and avoid complex checks if possible.public final FoldingDescriptor [] buildFoldRegions(ASTNode node, Document document)
FoldingBuilder
FoldingDescriptor
with similar AST node.buildFoldRegions
in interface FoldingBuilder
buildFoldRegions
in class FoldingBuilderEx
node
- the node for which folding is requested.document
- the document for which folding is built. Can be used to retrieve line
numbers for folding regions.protected abstract void buildLanguageFoldRegions(java.util.List<FoldingDescriptor> descriptors, PsiElement root, Document document, boolean quick)
descriptors
- The list of folding descriptors to store results to.root
- The root node for which the folding is requested.document
- The document for which folding is built.quick
- whether the result should be provided as soon as possible without reference resolving
and complex checks.public final java.lang.String getPlaceholderText(ASTNode node, TextRange range)
FoldingBuilderEx
getPlaceholderText
in class FoldingBuilderEx
node
- the node for which the placeholder text is requested.range
- text range within whole file to foldprotected abstract java.lang.String getLanguagePlaceholderText(ASTNode node, TextRange range)
public final java.lang.String getPlaceholderText(ASTNode node)
FoldingBuilder
getPlaceholderText
in interface FoldingBuilder
node
- the node for which the placeholder text is requested.public final boolean isCollapsedByDefault(ASTNode node)
FoldingBuilderEx
isCollapsedByDefault
in interface FoldingBuilder
isCollapsedByDefault
in class FoldingBuilderEx
node
- the node for which the collapsed state is requested.protected abstract boolean isRegionCollapsedByDefault(ASTNode node)
node
- the node for which the collapsed state is requested.public final boolean isCustomRegionStart(ASTNode node)
node
- The node which may contain custom region start.protected final boolean isCustomRegionEnd(ASTNode node)
node
- The node which may contain custom region endprotected static boolean isCustomRegionElement(PsiElement element)
protected boolean isCustomFoldingCandidate(ASTNode node)
node
- The node to check.public final boolean isCustomFoldingCandidate(PsiElement element)
protected boolean isCustomFoldingRoot(ASTNode node)
node
- The node to check.public boolean isDumbAware()
isDumbAware
in interface PossiblyDumbAware