ISourceDocument Interface
- public interface ISourceDocument
extends IDocument
ISourceDocument should be implemented by all document types with text data that wish to perform basic
compiler-related functionality such as syntax coloring and parse tree support.
-
All Known Implementing Classes
-
DefaultSourceDocument
-
All Superinterfaces
-
ICookieSupport
, IDocument
, IDriverSupport
, IElement
, IPropertySupport
public static final String |
-
PROP_HAS_ERRORS
- This is a boolean property indicating whether the document contains any diagnostics
classified as errors.
|
public static final String |
-
PROP_HAS_WARNINGS
- This is a boolean property indicating whether the document contains any diagnostics
classified as warnings.
|
public static final String |
-
PROP_LAST_COMPILATION
- This property is the unique ID (a Long) of the last compiler request for which the IDE had received
a compiler compilation response for this file.
|
public static final String |
-
PROP_LAST_COMPILATION_REQUEST
- This property is the unique ID (a Long) of the last compilation request sent to the compiler.
|
public static final String |
-
PROP_LAST_COMPILATION_TIME
- This property is the time (in system milliseconds) of the last compiler response for this file.
|
public static final String |
-
PROP_MID_TWOWAY_EDIT
- This property indicates that a document is currently performing a two-way edit.
|
Methods from interface com.bea.ide.document.IDocument |
addElementChangeListener , getHandlerId , getIFile , getInputStream , getReader , getRootElement , getRootElement , getURI , getViewInfo , isBinary , isEditable , isModified , isReadOnly , makeEditable , onOpen , onRemove , onSave , reload , removeElementChangeListener , waitForRootElement
|
PROP_HAS_ERRORS
public static final String
PROP_HAS_ERRORS
- This is a boolean property indicating whether the document contains any diagnostics
classified as errors.
PROP_HAS_WARNINGS
public static final String
PROP_HAS_WARNINGS
- This is a boolean property indicating whether the document contains any diagnostics
classified as warnings.
PROP_LAST_COMPILATION
public static final String
PROP_LAST_COMPILATION
- This property is the unique ID (a Long) of the last compiler request for which the IDE had received
a compiler compilation response for this file. Note that unsolicited (dependency) compilations
will not set this property. If you need to know about every compilation, use the
PROP_LAST_COMPILATION_TIME property. Listening on this property is useful if an extension
requires finer-grained knowledge of compilation state than can be gained by listening to element
change events alone. When used with property
PROP_LAST_COMPILATION_REQUEST
, this property can be used to determine when the compiler
responds to specific compilation requests.
PROP_LAST_COMPILATION_REQUEST
public static final String
PROP_LAST_COMPILATION_REQUEST
- This property is the unique ID (a Long) of the last compilation request sent to the compiler.
Listening on this property is useful if an extension requires finer-grained knowledge of
compilation state than can be gained by listening to element change events alone. When used with
property
PROP_LAST_COMPILATION
, this property
can be used to determine when the compiler responds to specific compilation requests.
PROP_LAST_COMPILATION_TIME
public static final String
PROP_LAST_COMPILATION_TIME
- This property is the time (in system milliseconds) of the last compiler response for this file.
This property is useful for clients who need to be notified of every compilation response, including
those due to dependency changes. Clients who need to track specific requests and responses based
on user edits should use PROP_LAST_COMPILATION_REQUEST and PROP_LAST_COMPILATION, which maintain
comparable IDs.
PROP_MID_TWOWAY_EDIT
public static final String
PROP_MID_TWOWAY_EDIT
- This property indicates that a document is currently performing a two-way edit. Because two-way edits
require multiple interactions between the IDE and compiler threads, there is a short period of time
after the edit request during which the document does not fully reflect the change. This property can be
used to detect when two-way edits start and complete.
getElementFromOffset(int) Method
public IElement
getElementFromOffset(int offset)
Returns the smallest elemnt that encloses the specified offset. This method is expensive, and should be called
as sparingly as possible.
Parameters
-
offset
- a zero-based character index within the document.
Returns
- the parse tree element found at the specified offset. May return null if the document is not parsed
at the time that the method is called.
getSourceModel() Method
public ISourceModel
getSourceModel()
Returns the source model associated with this source document. Once the file is initially loaded, this method
should never return null.
getTokenFromOffset(int) Method
public IToken
getTokenFromOffset(int offset)
Returns the IToken object at the specified offset. This method should never return null,
though the token returned may simply indicate that the token information is currently unknown. Note that
there is no guarantee that sequential calls to getTokenFromOffset
will return the same object or
value, as compiler structures are possibly being rebuilt at any time.
Parameters
-
offset
- a zero-indexed character offset within a document.
Returns
- returns the IToken object at the specified offset.
mergeMetadata(ISourceElement) Method
public boolean mergeMetadata(ISourceElement
sourceRootElement)
mergeMetaData
is called by the IDE to indicate that a new parse tree is available due to a
recompile. Implementors guarantee that after the merge all elements with unchanged properties remain unchanged,
with the exception of range and compiler cookie information, and that appropriate change events are generated
for all elements that are not equivalent.