org.netbeans.modules.lexer/2 1.39.1 1

org.netbeans.spi.lexer
Class MutableTextInput<I>

java.lang.Object
  extended by org.netbeans.spi.lexer.MutableTextInput<I>

public abstract class MutableTextInput<I>
extends Object

Mutable attributed character sequence allowing to listen for changes in its text.

The input can temporarily be made inactive which leads to dropping of all the present tokens for the input until the input becomes active again.


Constructor Summary
MutableTextInput()
           
 
Method Summary
protected abstract  InputAttributes inputAttributes()
          Get lexer-specific information about this input or null if there is no specific information.
protected abstract  I inputSource()
          Get object that logically provides the text for this mutable text input.
protected abstract  boolean isReadLocked()
          Called by infrastructure to check if the underlying input source is currently read-locked by the current thread.
protected abstract  boolean isWriteLocked()
          Called by infrastructure to check if the underlying input source is currently write-locked by the current thread.
protected abstract  Language<?> language()
          Get the language suitable for lexing of this input.
protected abstract  CharSequence text()
          Get the character sequence provided and maintained by this input.
 TokenHierarchyControl<I> tokenHierarchyControl()
          Get token hierarchy control for this mutable text input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutableTextInput

public MutableTextInput()
Method Detail

language

protected abstract Language<?> language()
Get the language suitable for lexing of this input.

Returns:
language language by which the text of this input should be lexed.
This method is only checked upon creation of token hierarchy.
If this method returns null the token hierarchy cannot be created and will be returned as null upon asking until this method will return non-null value.

text

protected abstract CharSequence text()
Get the character sequence provided and maintained by this input.


inputAttributes

protected abstract InputAttributes inputAttributes()
Get lexer-specific information about this input or null if there is no specific information.
The attributes are typically retrieved by the lexer.


inputSource

protected abstract I inputSource()
Get object that logically provides the text for this mutable text input.
For example it may be a swing text document instance Document in case the result of text() is the content of the document.

Returns:
non-null mutable input source.

isReadLocked

protected abstract boolean isReadLocked()
Called by infrastructure to check if the underlying input source is currently read-locked by the current thread.
This method is only called when turning on the logger for token hierarchy updates: -J-Dorg.netbeans.lib.lexer.TokenHierarchyUpdate.level=FINE
It is expected that if write-lock means read-lock too i.e. if isWriteLocked() returns true that this method will also return true automatically.
The following operations require read-locking:

Returns:
true if the underlying input source is read-locked by the current thread (or if unsure e.g. if there is a read-lock present but it's not possible to determine whether it was this or other thread that performed the locking).
Returning false means that the input source is surely unlocked which will be reported as a serious error by the infrastructure.

isWriteLocked

protected abstract boolean isWriteLocked()
Called by infrastructure to check if the underlying input source is currently write-locked by the current thread.
This method is only called when turning on the logger for token hierarchy updates: -J-Dorg.netbeans.lib.lexer.TokenHierarchyUpdate.level=FINE
The following operations require write-locking:

Returns:
true if the underlying input source is write-locked by the current thread (or if unsure). Returning false means that the input source is surely unlocked which will be reported as a serious error by the infrastructure.

tokenHierarchyControl

public final TokenHierarchyControl<I> tokenHierarchyControl()
Get token hierarchy control for this mutable text input.
Each mutable text input can hold it in a specific way e.g. swing document can use getProperty(TokenHierarchyControl.class).


org.netbeans.modules.lexer/2 1.39.1 1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.