public class LexerEditorHighlighter extends java.lang.Object implements EditorHighlighter, PrioritizedDocumentListener
Modifier and Type | Class and Description |
---|---|
class |
LexerEditorHighlighter.HighlighterIteratorImpl |
static class |
LexerEditorHighlighter.InvalidStateException |
protected static interface |
LexerEditorHighlighter.TokenProcessor |
Modifier and Type | Field and Description |
---|---|
protected java.lang.CharSequence |
myText |
COMPARATOR
ARRAY_FACTORY, EMPTY_ARRAY
Constructor and Description |
---|
LexerEditorHighlighter(SyntaxHighlighter highlighter,
EditorColorsScheme scheme) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkContentIsEqualTo(java.lang.CharSequence sequence) |
HighlighterIterator |
createIterator(int startOffset) |
protected SegmentArrayWithData |
createSegments() |
protected DataStorage |
createStorage()
Defines how to pack/unpack and store highlighting states.
|
protected LexerEditorHighlighter.TokenProcessor |
createTokenProcessor(int startIndex,
SegmentArrayWithData segments,
java.lang.CharSequence myText) |
void |
documentChanged(DocumentEvent e)
Called after the text of the document has been changed.
|
java.util.List<TextAttributes> |
getAttributesForPreviousAndTypedChars(Document document,
int offset,
char c) |
HighlighterClient |
getClient() |
protected Document |
getDocument() |
protected Lexer |
getLexer() |
int |
getPriority() |
EditorColorsScheme |
getScheme() |
SegmentArrayWithData |
getSegments() |
SyntaxHighlighter |
getSyntaxHighlighter() |
protected boolean |
hasAdditionalData(int segmentIndex) |
boolean |
isPlain() |
boolean |
isValid() |
void |
setColorScheme(EditorColorsScheme scheme) |
void |
setEditor(HighlighterClient editor) |
void |
setText(java.lang.CharSequence text) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
beforeDocumentChange, bulkUpdateFinished, bulkUpdateStarting
public LexerEditorHighlighter(SyntaxHighlighter highlighter, EditorColorsScheme scheme)
protected SegmentArrayWithData createSegments()
protected DataStorage createStorage()
By default a editor highlighter uses ShortBasedStorage
implementation which
serializes information about element type to be highlighted with elements' indices (IElementType.getIndex()
)
and deserializes ids back to IElementType
using element types registry IElementType.find(short)
.
If you need to store more information during syntax highlighting or
if your element types cannot be restored from IElementType.getIndex()
,
you can implement you own storage and override this method.
As an example, see TextMateHighlightingLexer
,
that lexes files with unregistered (without index) element types and its
data storage (TextMateLexerDataStorage
serializes/deserializes them to/from strings. The storage is created in TextMateEditorHighlighterProvider.TextMateLexerEditorHighlighter
public boolean isPlain()
protected final Document getDocument()
public final boolean checkContentIsEqualTo(java.lang.CharSequence sequence)
public EditorColorsScheme getScheme()
protected Lexer getLexer()
public void setEditor(HighlighterClient editor)
setEditor
in interface EditorHighlighter
public void setColorScheme(EditorColorsScheme scheme)
setColorScheme
in interface EditorHighlighter
public HighlighterIterator createIterator(int startOffset)
createIterator
in interface EditorHighlighter
public boolean isValid()
public void documentChanged(DocumentEvent e)
DocumentListener
documentChanged
in interface DocumentListener
e
- the event containing the information about the change.protected boolean hasAdditionalData(int segmentIndex)
public int getPriority()
getPriority
in interface PrioritizedDocumentListener
public HighlighterClient getClient()
public void setText(java.lang.CharSequence text)
setText
in interface EditorHighlighter
protected LexerEditorHighlighter.TokenProcessor createTokenProcessor(int startIndex, SegmentArrayWithData segments, java.lang.CharSequence myText)
public SyntaxHighlighter getSyntaxHighlighter()
public java.util.List<TextAttributes> getAttributesForPreviousAndTypedChars(Document document, int offset, char c)
public java.lang.String toString()
toString
in class java.lang.Object
public SegmentArrayWithData getSegments()