com.intellij.openapi.editor.markup
Interface MarkupModel

All Superinterfaces:
UserDataHolder

public interface MarkupModel
extends UserDataHolder

Provides services for highlighting ranges of text in a document, painting markers on the gutter and so on, and for retrieving information about highlighted ranges.

See Also:
Editor.getMarkupModel(), Document.getMarkupModel(com.intellij.openapi.project.Project)

Method Summary
 RangeHighlighter addLineHighlighter(int line, int layer, TextAttributes textAttributes)
          Adds a highlighter covering the specified line in the document.
 RangeHighlighter addRangeHighlighter(int startOffset, int endOffset, int layer, TextAttributes textAttributes, HighlighterTargetArea targetArea)
          Adds a highlighter covering the specified range of the document, which can modify the attributes used for text rendering, add a gutter marker and so on.
 RangeHighlighter[] getAllHighlighters()
          Returns all highlighter instances contained in the model.
 Document getDocument()
          Returns the document to which the markup model is attached.
 void removeAllHighlighters()
          Removes all highlighter instances.
 void removeHighlighter(RangeHighlighter rangeHighlighter)
          Removes the specified highlighter instance.
 
Methods inherited from interface com.intellij.openapi.util.UserDataHolder
getUserData, putUserData
 

Method Detail

getDocument

@NotNull
Document getDocument()
Returns the document to which the markup model is attached.

Returns:
the document instance.

addRangeHighlighter

@NotNull
RangeHighlighter addRangeHighlighter(int startOffset,
                                             int endOffset,
                                             int layer,
                                             @Nullable
                                             TextAttributes textAttributes,
                                             HighlighterTargetArea targetArea)
Adds a highlighter covering the specified range of the document, which can modify the attributes used for text rendering, add a gutter marker and so on. Range highlighters are RangeMarker instances and use the same rules for tracking the range after document changes.

Parameters:
startOffset - the start offset of the range to highlight.
endOffset - the end offset of the range to highlight.
layer - relative priority of the highlighter (highlighters with higher layer number override highlighters with lower layer number; layer number values for standard IDEA highlighters are given in HighlighterLayer class)
textAttributes - the attributes to use for highlighting, or null if the highlighter does not modify the text attributes.
targetArea - type of highlighting (specific range or all full lines covered by the range).
Returns:
the highlighter instance.

addLineHighlighter

@NotNull
RangeHighlighter addLineHighlighter(int line,
                                            int layer,
                                            @Nullable
                                            TextAttributes textAttributes)
Adds a highlighter covering the specified line in the document.

Parameters:
line - the line number of the line to highlight.
layer - relative priority of the highlighter (highlighters with higher layer number override highlighters with lower layer number; layer number values for standard IDEA highlighters are given in HighlighterLayer class)
textAttributes - the attributes to use for highlighting, or null if the highlighter does not modify the text attributes.
Returns:
the highlighter instance.

removeHighlighter

void removeHighlighter(RangeHighlighter rangeHighlighter)
Removes the specified highlighter instance.

Parameters:
rangeHighlighter - the highlighter to remove.

removeAllHighlighters

void removeAllHighlighters()
Removes all highlighter instances.


getAllHighlighters

@NotNull
RangeHighlighter[] getAllHighlighters()
Returns all highlighter instances contained in the model.

Returns:
the array of highlighter instances.