public interface CodeFoldingModel<B>
Modifier and Type | Method and Description |
---|---|
void |
addCodeFoldingModelListener(CodeFoldingModelListener listener)
Adds a listener for changes to the data model.
|
java.lang.String |
getAbbreviatedText(B block)
Returns the abbreviated text to be used in place of the specified
folding block when the block is collapsed.
|
java.util.Iterator<B> |
getChildren(B block)
Returns an
Iterator over the children of the specified
folding block. |
B[] |
getCollapsedBlocks()
Returns the set of all collapsed blocks in the model; any collapsed
block that also has a collapsed ancestor must be excluded from the
return array.
|
B |
getFirstBlockAtLine(int line)
Returns the first collapsible source code block at the specified line.
|
B |
getParent(B block)
Returns the parent block for the specified folding block.
|
B |
getRoot()
Returns the root block in the data model.
|
B |
getSmallestEnclosingBlock(int offset)
Returns the smallest collapsible source code block that contains the
specified character offset.
|
int[] |
getTextOffsets(B block,
int[] offsets)
Stores the start and end character offsets of the specified block into
the specified two-element integer array, and returns that array; if
the specified array is
null , a new array is allocated. |
java.lang.String |
getToolTipText(B block)
Returns the tooltip text to display when the mouse is hovering over
the specified source code block and the block is collapsed.
|
boolean |
isExpanded(B block)
Returns whether the specified folding block is expanded.
|
void |
readLock()
Acquires a read lock on the model.
|
void |
readUnlock()
Releases the previously acquired read lock on the model.
|
void |
removeCodeFoldingModelListener(CodeFoldingModelListener listener)
Removes a listener from the data model.
|
void |
setExpanded(B block,
boolean isExpanded)
Sets whether the specified folding block should be expanded.
|
void readLock()
void readUnlock()
B getRoot()
The client must acquire a lock on the model before calling this method.
null
if there is no root
block in the modeljava.util.Iterator<B> getChildren(B block)
Iterator
over the children of the specified
folding block. The return value may not be null
; if the
block contains no children, an empty Iterator
should be
returned.
The client must acquire a lock on the model before calling this method.
block
- the parent folding block from this data sourcenull
.B getParent(B block)
The client must acquire a lock on the model before calling this method.
block
- the child folding block from this data sourcenull
if the specified
block is the rootB getSmallestEnclosingBlock(int offset)
The client must acquire a lock on the model before calling this method.
offset
- the target character offsetnull
if the model is empty or the offset is
invalidB getFirstBlockAtLine(int line)
The client must acquire a lock on the model before calling this method.
line
- the target linenull
if the model is empty or the offset is invalidB[] getCollapsedBlocks()
The client must acquire a lock on the model before calling this method.
null
int[] getTextOffsets(B block, int[] offsets)
null
, a new array is allocated.
The client must acquire a lock on the model before calling this method.
block
- a folding block from this data sourceoffsets
- a two-element integer array; if null
,
a new array is allocatedjava.lang.String getToolTipText(B block)
The client must acquire a lock on the model before calling this method.
block
- the target source code blockjava.lang.String getAbbreviatedText(B block)
The client must acquire a lock on the model before calling this method.
block
- a folding block from this data sourceboolean isExpanded(B block)
This method may be called without acquiring a lock on the model.
block
- a folding block from this data sourcetrue
if the folding block is expandedvoid setExpanded(B block, boolean isExpanded)
This method may be called without acquiring a lock on the model.
block
- a folding block from this data sourceisExpanded
- true
if the folding block should
be expandedvoid addCodeFoldingModelListener(CodeFoldingModelListener listener)
This method may be called without acquiring a lock on the model.
listener
- the listener to addvoid removeCodeFoldingModelListener(CodeFoldingModelListener listener)
This method may be called without acquiring a lock on the model.
listener
- the listener to remove