|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.javatools.editor.folding.DefaultCodeFoldingModel
public class DefaultCodeFoldingModel
A simple data model that describes the collapsible source code blocks in the code editor. The collapsible code blocks are arranged in a tree hierarchy. Code blocks are expected to be discrete; a parent should fully contain each of its children, and siblings should not overlap.
| Field Summary | |
|---|---|
protected BasicDocument |
document |
protected javax.swing.event.EventListenerList |
listenerList |
protected ReadWriteLock |
lock |
protected static int |
MAX_TOOLTIP_LENGTH |
protected static java.lang.Object[] |
NO_BLOCKS |
protected DefaultFoldingBlock |
root |
| Constructor Summary | |
|---|---|
DefaultCodeFoldingModel(BasicDocument document) |
|
| Method Summary | |
|---|---|
void |
addCodeFoldingModelListener(CodeFoldingModelListener listener)Adds a listener for changes to the data model. |
protected void |
fireStructureChanged(FoldingBlock block) |
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 parent)Returns an Iterator over the children of the specified folding block. |
CodeFoldingModelListener[] |
getCodeFoldingModelListeners() |
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. |
protected void |
getCollapsedDescendants(FoldingBlock block, java.util.Collection collapsed) |
BasicDocument |
getDocument() |
protected FoldingBlock |
getEnclosingDescendant(FoldingBlock block, int offset) |
java.lang.Object |
getFirstBlockAtLine(int line)Returns the first collapsible source code block at the specified line. |
protected FoldingBlock |
getFirstDescendantAtLine(FoldingBlock block, int line) |
protected int |
getLineCount() |
protected int |
getLineEndOffset(int line) |
protected int |
getLineFromOffset(int offset) |
protected int |
getLineStartOffset(int line) |
java.lang.Object |
getParent(java.lang.Object child)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. |
void |
insertUpdate(int offset, int length) |
protected void |
insertUpdateChildren(DefaultFoldingBlock block, int offset, int length) |
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 |
reload() |
void |
removeCodeFoldingModelListener(CodeFoldingModelListener listener)Removes a listener from the data model. |
void |
removeUpdate(int offset, int length) |
protected void |
removeUpdateChildren(DefaultFoldingBlock block, int offset, int length) |
void |
setExpanded(java.lang.Object block, boolean isExpanded)Sets whether the specified folding block should be expanded. |
void |
setRoot(java.lang.Object root) |
protected void |
writeLock() |
protected void |
writeUnlock() |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int MAX_TOOLTIP_LENGTH
protected static final java.lang.Object[] NO_BLOCKS
protected DefaultFoldingBlock root
protected BasicDocument document
protected javax.swing.event.EventListenerList listenerList
protected ReadWriteLock lock
| Constructor Detail |
|---|
public DefaultCodeFoldingModel(BasicDocument document)
| Method Detail |
|---|
public BasicDocument getDocument()
public void reload()
public void setRoot(java.lang.Object root)
public CodeFoldingModelListener[] getCodeFoldingModelListeners()
public void insertUpdate(int offset,
int length)
public void removeUpdate(int offset,
int length)
protected void insertUpdateChildren(DefaultFoldingBlock block,
int offset,
int length)
protected void removeUpdateChildren(DefaultFoldingBlock block,
int offset,
int length)
public void readLock()
CodeFoldingModelreadLock in interface CodeFoldingModelpublic void readUnlock()
CodeFoldingModelreadUnlock in interface CodeFoldingModelpublic java.lang.Object getRoot()
CodeFoldingModelThe client must acquire a lock on the model before calling this method.
getRoot in interface CodeFoldingModelnull if there is no root block in the modelpublic java.lang.Object getSmallestEnclosingBlock(int offset)
CodeFoldingModelThe client must acquire a lock on the model before calling this method.
getSmallestEnclosingBlock in interface CodeFoldingModeloffset - the target character offsetnull if the model is empty or the offset is invalidpublic java.lang.Object getFirstBlockAtLine(int line)
CodeFoldingModelThe client must acquire a lock on the model before calling this method.
getFirstBlockAtLine in interface CodeFoldingModelline - the target linenull if the model is empty or the offset is invalidpublic java.lang.Object[] getCollapsedBlocks()
CodeFoldingModelThe client must acquire a lock on the model before calling this method.
getCollapsedBlocks in interface CodeFoldingModelnullpublic java.lang.String getToolTipText(java.lang.Object block)
CodeFoldingModelThe client must acquire a lock on the model before calling this method.
getToolTipText in interface CodeFoldingModelblock - the target source code blockpublic java.util.Iterator getChildren(java.lang.Object parent)
CodeFoldingModelIterator 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.
getChildren in interface CodeFoldingModelparent - the parent folding block from this data sourcenull.public java.lang.Object getParent(java.lang.Object child)
CodeFoldingModelThe client must acquire a lock on the model before calling this method.
getParent in interface CodeFoldingModelchild - the child folding block from this data sourcenull if the specified block is the root
public int[] getTextOffsets(java.lang.Object block,
int[] offsets)
CodeFoldingModelnull, a new array is allocated.
The client must acquire a lock on the model before calling this method.
getTextOffsets in interface CodeFoldingModelblock - a folding block from this data sourceoffsets - a two-element integer array; if null, a new array is allocatedpublic java.lang.String getAbbreviatedText(java.lang.Object block)
CodeFoldingModelThe client must acquire a lock on the model before calling this method.
getAbbreviatedText in interface CodeFoldingModelblock - a folding block from this data sourcepublic boolean isExpanded(java.lang.Object block)
CodeFoldingModelThis method may be called without acquiring a lock on the model.
isExpanded in interface CodeFoldingModelblock - a folding block from this data sourcetrue if the folding block is expanded
public void setExpanded(java.lang.Object block,
boolean isExpanded)
CodeFoldingModelThis method may be called without acquiring a lock on the model.
setExpanded in interface CodeFoldingModelblock - a folding block from this data sourceisExpanded - true if the folding block should be expandedpublic void addCodeFoldingModelListener(CodeFoldingModelListener listener)
CodeFoldingModelThis method may be called without acquiring a lock on the model.
addCodeFoldingModelListener in interface CodeFoldingModellistener - the listener to addpublic void removeCodeFoldingModelListener(CodeFoldingModelListener listener)
CodeFoldingModelThis method may be called without acquiring a lock on the model.
removeCodeFoldingModelListener in interface CodeFoldingModellistener - the listener to removeprotected void writeLock()
protected void writeUnlock()
protected int getLineFromOffset(int offset)
protected int getLineCount()
protected int getLineStartOffset(int line)
protected int getLineEndOffset(int line)
protected FoldingBlock getFirstDescendantAtLine(FoldingBlock block,
int line)
protected FoldingBlock getEnclosingDescendant(FoldingBlock block,
int offset)
protected void getCollapsedDescendants(FoldingBlock block,
java.util.Collection collapsed)
protected void fireStructureChanged(FoldingBlock block)
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||