| |
|
| java.lang.Object org.netbeans.spi.lexer.TokenHierarchyControl
TokenHierarchyControl | final public class TokenHierarchyControl (Code) | | Control class for managing token hierarchy of a mutable text input.
author: Miloslav Metelka version: 1.00 |
Method Summary | |
public boolean | isActive() Check whether the hierarchy is currently active or not. | public void | rebuild() Rebuild token hierarchy completely.
This may be necessary if lexing depends on some input properties
that get changed.
This method will drop all present tokens and let them to be lazily recreated.
This method should only be invoked under modification lock over the mutable
input source (e.g. | public void | setActive(boolean active) Making the token hierarchy inactive will release all the tokens in the hierarchy
so that there will be no tokens. | public void | textModified(int offset, int removedLength, CharSequence removedText, int insertedLength) Notify that the text of the mutable text input was modified.
This method should only be invoked under modification lock (write-lock)
over the mutable input source.
Parameters: offset - >=0 offset where the modification occurred. Parameters: removedLength - >=0 number of characters removed from the input. Parameters: removedText - text removed from the input. | public TokenHierarchy<I> | tokenHierarchy() Get token hierarchy managed by this control object. |
isActive | public boolean isActive()(Code) | | Check whether the hierarchy is currently active or not. Inactive hierarchy
does not hold any tokens and its
TokenHierarchy.tokenSequence returns null.
This method should only be invoked under read/write lock over the mutable input source.
true if the hierarchy is active or false when inactive. |
rebuild | public void rebuild()(Code) | | Rebuild token hierarchy completely.
This may be necessary if lexing depends on some input properties
that get changed.
This method will drop all present tokens and let them to be lazily recreated.
This method should only be invoked under modification lock over the mutable
input source (e.g. a document's write-lock).
Otherwise all the active token sequences would fail with
ConcurrentModificationException .
|
setActive | public void setActive(boolean active)(Code) | | Making the token hierarchy inactive will release all the tokens in the hierarchy
so that there will be no tokens. The hierarchy can be made active again
later.
Making the hierarchy inactive will free memory occupied by tokens. It can be done
e.g. once a document is not edited for a long time (and is not showing on screen).
This method should only be invoked under modification lock (write-lock)
over the mutable input source.
Parameters: active - whether the hierarchy should become active or inactive. |
textModified | public void textModified(int offset, int removedLength, CharSequence removedText, int insertedLength)(Code) | | Notify that the text of the mutable text input was modified.
This method should only be invoked under modification lock (write-lock)
over the mutable input source.
Parameters: offset - >=0 offset where the modification occurred. Parameters: removedLength - >=0 number of characters removed from the input. Parameters: removedText - text removed from the input. If it's not availableto determine the removed text then this parameter may be null. Providing of the removed text allows the incrementalalgorithm to use an efficient token validation if possible. Parameters: insertedLength - >=0 number of characters inserted at the offsetafter the removal. |
tokenHierarchy | public TokenHierarchy<I> tokenHierarchy()(Code) | | Get token hierarchy managed by this control object.
non-null token hierarchy. |
|
|
|