public interface InlayModel
RangeMarker
with respect to document changes.
Editor.getInlayModel()
Modifier and Type | Interface and Description |
---|---|
static interface |
InlayModel.ChangeFlags
Flags provided by
InlayModel.Listener.onUpdated(Inlay, int) . |
static interface |
InlayModel.Listener |
static class |
InlayModel.SimpleAdapter
An adapter useful for the cases, when the same action is to be performed after custom visual element's adding, updating and removal.
|
Modifier and Type | Method and Description |
---|---|
<T extends EditorCustomElementRenderer> |
addAfterLineEndElement(int offset,
boolean relatesToPrecedingText,
T renderer)
Introduces a visual element, which will be displayed after the end of corresponding logical line.
|
<T extends EditorCustomElementRenderer> |
addBlockElement(int offset,
boolean relatesToPrecedingText,
boolean showAbove,
int priority,
T renderer)
Introduces a 'block' visual element at a given offset, its size and appearance is defined by the provided renderer.
|
<T extends EditorCustomElementRenderer> |
addInlineElement(int offset,
boolean relatesToPrecedingText,
T renderer)
Introduces an inline visual element at a given offset, its width and appearance is defined by the provided renderer.
|
default <T extends EditorCustomElementRenderer> |
addInlineElement(int offset,
T renderer)
Same as
addInlineElement(int, boolean, EditorCustomElementRenderer) , making created element associated with following text. |
void |
addListener(InlayModel.Listener listener,
Disposable disposable)
Adds a listener that will be notified after adding, updating and removal of custom visual elements.
|
void |
execute(boolean batchMode,
java.lang.Runnable operation)
Allows to perform a group of inlay operations (adding, disposing, updating) in a batch mode.
|
java.util.List<Inlay> |
getAfterLineEndElementsForLogicalLine(int logicalLine)
Returns after-line-end elements for a given logical line, in creation order (this is the order they are displayed in).
|
java.util.List<Inlay> |
getAfterLineEndElementsInRange(int startOffset,
int endOffset)
Returns a list of after-line-end elements for a given offset range (both limits are inclusive).
|
default <T> java.util.List<Inlay<? extends T>> |
getAfterLineEndElementsInRange(int startOffset,
int endOffset,
java.lang.Class<T> type)
Same as
getAfterLineEndElementsInRange(int, int) , but returned list contains only inlays with renderer of given type. |
java.util.List<Inlay> |
getBlockElementsForVisualLine(int visualLine,
boolean above)
Returns a list of block elements displayed for a given visual line in appearance order (top to bottom).
|
java.util.List<Inlay> |
getBlockElementsInRange(int startOffset,
int endOffset)
Returns a list of block elements for a given offset range (both limits are inclusive) in priority order
(higher priority ones appear first).
|
default <T> java.util.List<Inlay<? extends T>> |
getBlockElementsInRange(int startOffset,
int endOffset,
java.lang.Class<T> type)
Same as
getBlockElementsInRange(int, int) , but returned list contains only inlays with renderer of given type. |
Inlay |
getElementAt(java.awt.Point point)
Return a custom visual element at given coordinates in editor's coordinate space,
or
null if there's no element at given point. |
default <T> Inlay<? extends T> |
getElementAt(java.awt.Point point,
java.lang.Class<T> type)
Return a custom visual element with renderer of given type at given coordinates in editor's coordinate space,
or
null if there's no such element at given point. |
Inlay |
getInlineElementAt(VisualPosition visualPosition)
Return a custom visual element at at a given visual position.
|
java.util.List<Inlay> |
getInlineElementsInRange(int startOffset,
int endOffset)
Returns a list of inline elements for a given offset range (both limits are inclusive).
|
default <T> java.util.List<Inlay<? extends T>> |
getInlineElementsInRange(int startOffset,
int endOffset,
java.lang.Class<T> type)
Same as
getInlineElementsInRange(int, int) , but returned list contains only inlays with renderer of given type. |
default boolean |
hasBlockElements()
Tells whether there exists at least one block element currently.
|
boolean |
hasInlineElementAt(int offset)
Tells whether there exists an inline visual element at a given offset.
|
default boolean |
hasInlineElementAt(VisualPosition visualPosition)
Tells whether there exists an inline visual element at a given visual position.
|
default boolean |
hasInlineElements()
Tells whether there exists at least one inline element currently.
|
default boolean |
hasInlineElementsInRange(int startOffset,
int endOffset)
Tells whether given range of offsets (both sides inclusive) contains at least one inline element.
|
boolean |
isInBatchMode()
Tells whether the current code is executing as part of a batch inlay update operation.
|
void |
setConsiderCaretPositionOnDocumentUpdates(boolean enabled)
When text is inserted at inline element's offset, resulting element's position is determined by its
Inlay.isRelatedToPrecedingText() property. |
default <T extends EditorCustomElementRenderer> Inlay<T> addInlineElement(int offset, T renderer)
addInlineElement(int, boolean, EditorCustomElementRenderer)
, making created element associated with following text.<T extends EditorCustomElementRenderer> Inlay<T> addInlineElement(int offset, boolean relatesToPrecedingText, T renderer)
relatesToPrecedingText
- whether element is associated with preceding or following text
(see Inlay.isRelatedToPrecedingText()
)null
if requested element cannot be created, e.g. if corresponding functionality
is not supported by current editor instance.<T extends EditorCustomElementRenderer> Inlay<T> addBlockElement(int offset, boolean relatesToPrecedingText, boolean showAbove, int priority, T renderer)
relatesToPrecedingText
- whether element is associated with preceding or following text
(see Inlay.isRelatedToPrecedingText()
)showAbove
- whether element will be displayed above or below corresponding visual linepriority
- if multiple elements are requested to be displayed for the same visual line, this parameter defines the relative
positioning of such elements (larger priority value means the element will be rendered closer to the text)null
if requested element cannot be created, e.g. if corresponding functionality
is not supported by current editor instance.BlockInlayPriority
<T extends EditorCustomElementRenderer> Inlay<T> addAfterLineEndElement(int offset, boolean relatesToPrecedingText, T renderer)
relatesToPrecedingText
- whether element is associated with preceding or following text
(see Inlay.isRelatedToPrecedingText()
)null
if requested element cannot be created, e.g. if corresponding functionality
is not supported by current editor instance.java.util.List<Inlay> getInlineElementsInRange(int startOffset, int endOffset)
default <T> java.util.List<Inlay<? extends T>> getInlineElementsInRange(int startOffset, int endOffset, java.lang.Class<T> type)
getInlineElementsInRange(int, int)
, but returned list contains only inlays with renderer of given type.java.util.List<Inlay> getBlockElementsInRange(int startOffset, int endOffset)
default <T> java.util.List<Inlay<? extends T>> getBlockElementsInRange(int startOffset, int endOffset, java.lang.Class<T> type)
getBlockElementsInRange(int, int)
, but returned list contains only inlays with renderer of given type.java.util.List<Inlay> getBlockElementsForVisualLine(int visualLine, boolean above)
default boolean hasBlockElements()
default boolean hasInlineElementsInRange(int startOffset, int endOffset)
default boolean hasInlineElements()
boolean hasInlineElementAt(int offset)
default boolean hasInlineElementAt(VisualPosition visualPosition)
Inlay getInlineElementAt(VisualPosition visualPosition)
Inlay getElementAt(java.awt.Point point)
null
if there's no element at given point.default <T> Inlay<? extends T> getElementAt(java.awt.Point point, java.lang.Class<T> type)
null
if there's no such element at given point.java.util.List<Inlay> getAfterLineEndElementsInRange(int startOffset, int endOffset)
default <T> java.util.List<Inlay<? extends T>> getAfterLineEndElementsInRange(int startOffset, int endOffset, java.lang.Class<T> type)
getAfterLineEndElementsInRange(int, int)
, but returned list contains only inlays with renderer of given type.java.util.List<Inlay> getAfterLineEndElementsForLogicalLine(int logicalLine)
void setConsiderCaretPositionOnDocumentUpdates(boolean enabled)
Inlay.isRelatedToPrecedingText()
property. But to enable natural editing experience around inline elements (so that typed text
appears at caret visual position), caret position is also taken into account at document insertion. This method allows to disable
accounting for caret position, and can be useful for document modifications which don't originate directly from user actions.void execute(boolean batchMode, java.lang.Runnable operation)
Executed code should not perform document- or editor-related operations other than those operating on inlays. In particular, modifying document, querying or updating folding, soft-wrap or caret state, as well as performing editor coordinate transformations (e.g. visual to logical position conversions) might lead to incorrect results or throw an exception.
batchMode
- whether to enable batch mode for executed inlay operationsboolean isInBatchMode()
execute(boolean, Runnable)
void addListener(InlayModel.Listener listener, Disposable disposable)