Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


oracle.javatools.editor.folding
Interface CodeFoldingModel

All Known Implementing Classes:
DefaultCodeFoldingModel

public interface CodeFoldingModel

The interface that defines the data model for a code editor that supports collapsible source code blocks.

Since:
10.1.3

Method Summary
 void addCodeFoldingModelListener(CodeFoldingModelListener listener)
          Adds a listener for changes to the data model.
 java.lang.String getAbbreviatedText(java.lang.Object block)
          Returns the abbreviated text to be used in place of the specified folding block when the block is collapsed.
 java.util.Iterator getChildren(java.lang.Object block)
          Returns an Iterator over the children of the specified folding block.
 java.lang.Object[] 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.
 java.lang.Object getFirstBlockAtLine(int line)
          Returns the first collapsible source code block at the specified line.
 java.lang.Object getParent(java.lang.Object block)
          Returns the parent block for the specified folding block.
 java.lang.Object getRoot()
          Returns the root block in the data model.
 java.lang.Object getSmallestEnclosingBlock(int offset)
          Returns the smallest collapsible source code block that contains the specified character offset.
 int[] getTextOffsets(java.lang.Object 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(java.lang.Object 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(java.lang.Object 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(java.lang.Object block, boolean isExpanded)
          Sets whether the specified folding block should be expanded.

 

Method Detail

readLock

void readLock()
Acquires a read lock on the model. If the lock is not available, then the current thread blocks until the lock is acquired. A lock must be acquired before querying the model.

readUnlock

void readUnlock()
Releases the previously acquired read lock on the model. The lock should always be released after the client has completed querying the model.

getRoot

java.lang.Object getRoot()
Returns the root block in the data model. This is typically an uncollapsible dummy node representing the contents of the entire source document.

The client must acquire a lock on the model before calling this method.

Returns:
the root block, or null if there is no root block in the model

getChildren

java.util.Iterator getChildren(java.lang.Object block)
Returns an 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.

Parameters:
block - the parent folding block from this data source
Returns:
an iterator over the children of the block; the return value must not be null.

getParent

java.lang.Object getParent(java.lang.Object block)
Returns the parent block for the specified folding block.

The client must acquire a lock on the model before calling this method.

Parameters:
block - the child folding block from this data source
Returns:
the parent block, or null if the specified block is the root

getSmallestEnclosingBlock

java.lang.Object getSmallestEnclosingBlock(int offset)
Returns the smallest collapsible source code block that contains the specified character offset.

The client must acquire a lock on the model before calling this method.

Parameters:
offset - the target character offset
Returns:
the smallest block containing the specified offset, or null if the model is empty or the offset is invalid

getFirstBlockAtLine

java.lang.Object getFirstBlockAtLine(int line)
Returns the first collapsible source code block at the specified line.

The client must acquire a lock on the model before calling this method.

Parameters:
line - the target line
Returns:
the first block at the specified line, or null if the model is empty or the offset is invalid

getCollapsedBlocks

java.lang.Object[] 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. If there are no collapsed blocks, an empty array should be returned.

The client must acquire a lock on the model before calling this method.

Returns:
the array of collapsed blocks; the return value must not be null

getTextOffsets

int[] getTextOffsets(java.lang.Object 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.

The client must acquire a lock on the model before calling this method.

Parameters:
block - a folding block from this data source
offsets - a two-element integer array; if null, a new array is allocated
Returns:
a two-element integer array, where the first integer is the start offset of the block and the second integer is is the end offset.

getToolTipText

java.lang.String getToolTipText(java.lang.Object block)
Returns the tooltip text to display when the mouse is hovering over the specified source code block and the block is collapsed. The text should correspond to text from the source document.

The client must acquire a lock on the model before calling this method.

Parameters:
block - the target source code block
Returns:
the tooltip text to display

getAbbreviatedText

java.lang.String getAbbreviatedText(java.lang.Object block)
Returns the abbreviated text to be used in place of the specified folding block when the block is collapsed. The length of the replacement text should be less than the length of uncollapsed text.

The client must acquire a lock on the model before calling this method.

Parameters:
block - a folding block from this data source
Returns:
the abbreviated text used in place of the collapsed folding block

isExpanded

boolean isExpanded(java.lang.Object block)
Returns whether the specified folding block is expanded.

This method may be called without acquiring a lock on the model.

Parameters:
block - a folding block from this data source
Returns:
true if the folding block is expanded

setExpanded

void setExpanded(java.lang.Object block,
                 boolean isExpanded)
Sets whether the specified folding block should be expanded.

This method may be called without acquiring a lock on the model.

Parameters:
block - a folding block from this data source
isExpanded - true if the folding block should be expanded

addCodeFoldingModelListener

void addCodeFoldingModelListener(CodeFoldingModelListener listener)
Adds a listener for changes to the data model.

This method may be called without acquiring a lock on the model.

Parameters:
listener - the listener to add

removeCodeFoldingModelListener

void removeCodeFoldingModelListener(CodeFoldingModelListener listener)
Removes a listener from the data model.

This method may be called without acquiring a lock on the model.

Parameters:
listener - the listener to remove

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


Copyright © 1997, 2012, Oracle. All rights reserved.