public interface IndexingContext
Indexer
implementations can store additional items in the context to be shared with other indexers. For example, an indexer might run a lexer on the file contents and store the tokens in the context. Another indexer could then reuse these tokens without running another lexer. This is done by calling the get(java.lang.String)
and put(java.lang.String, java.lang.Object)
methods.Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get(java.lang.String key)
Get the context item with the given key.
|
java.lang.Object |
getFilterKey()
Get the key being used to filter results.
|
java.lang.Object |
getFilterValue()
Get the value used to filter results.
|
Node |
getNode()
Get the Node being indexed.
|
Project |
getProject()
Get the project being indexed.
|
TextBuffer |
getTextBuffer()
Get the text buffer containing the contents of the file being indexed.
|
long |
getTimestamp()
Get the time stamp of the file being indexed.
|
java.net.URL |
getURL()
Get the URL of the file being indexed.
|
Workspace |
getWorkspace()
Get the workspace being indexed.
|
void |
put(java.lang.String key, java.lang.Object item)
Add a context item with the given key.
|
Workspace getWorkspace()
null
if there is no workspace in the context being indexed. This typically only happens in test environments where there the test runs without any workspace.null
if there is no workspace associated with this contextProject getProject()
null
if there is no project in the context being indexed. This can happen, for example, when application level resources are being indexed.null
if there is no project associated with this contextNode getNode()
Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector)
. The return value is undefined during Indexer.startIndexing(oracle.ide.index.IndexingContext)
and Indexer.endIndexing(oracle.ide.index.IndexingContext)
.
Important Note: this method is provided only to provide contextual information to the Indexer
. The Indexer
implementation must not take any locks on the Node
. Doing so could lead to deadlock between the indexing thread and threads waiting for an index query result while holding a lock. The Indexer
must use the buffer returned by getTextBuffer()
to access the contents of the Node
.
The only exception to this is when the Node
being indexed is not a TextNode
. In that case, the Node
will be read locked at the time the Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector)
method is called, so the implementation can directly access the Node
contents.
java.net.URL getURL()
Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector)
. The return value is undefined during Indexer.startIndexing(oracle.ide.index.IndexingContext)
and Indexer.endIndexing(oracle.ide.index.IndexingContext)
.TextBuffer getTextBuffer()
Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector)
is called. This is only available during Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector)
. The return value is undefined during Indexer.startIndexing(oracle.ide.index.IndexingContext)
and Indexer.endIndexing(oracle.ide.index.IndexingContext)
. If the node being indexed is not a TextNode
, this will return null
.long getTimestamp()
Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector)
. The return value is undefined during Indexer.startIndexing(oracle.ide.index.IndexingContext)
and Indexer.endIndexing(oracle.ide.index.IndexingContext)
.java.lang.Object getFilterKey()
java.lang.Object getFilterValue()
getFilterKey()
and the value returned by this method.java.lang.Object get(java.lang.String key)
key
- the keyvoid put(java.lang.String key, java.lang.Object item)
key
- the keyitem
- the context item to be added