public class InlayModelImpl extends java.lang.Object implements InlayModel, PrioritizedDocumentListener, Disposable, Dumpable
InlayModel.ChangeFlags, InlayModel.Listener, InlayModel.SimpleAdapterDisposable.ParentCOMPARATORARRAY_FACTORY, EMPTY_ARRAY| 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.
|
void |
addListener(InlayModel.Listener listener,
Disposable disposable)
Adds a listener that will be notified after adding, updating and removal of custom visual elements.
|
void |
beforeDocumentChange(DocumentEvent event)
Called before the text of the document is changed.
|
void |
dispose()
Usually not invoked directly, see class javadoc.
|
void |
documentChanged(DocumentEvent event)
Called after the text of the document has been changed.
|
java.lang.String |
dumpState() |
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).
|
<T> java.util.List<Inlay<? extends T>> |
getAfterLineEndElementsInRange(int startOffset,
int endOffset,
java.lang.Class<T> type)
Same as
InlayModel.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).
|
<T> java.util.List<Inlay<? extends T>> |
getBlockElementsInRange(int startOffset,
int endOffset,
java.lang.Class<T> type)
Same as
InlayModel.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. |
int |
getHeightOfBlockElementsBeforeVisualLine(int visualLine) |
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).
|
<T> java.util.List<Inlay<? extends T>> |
getInlineElementsInRange(int startOffset,
int endOffset,
java.lang.Class<T> type)
Same as
InlayModel.getInlineElementsInRange(int, int), but returned list contains only inlays with renderer of given type. |
int |
getPriority() |
boolean |
hasAfterLineEndElements() |
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.
|
boolean |
hasInlineElementAt(VisualPosition visualPosition)
Tells whether there exists an inline visual element at a given visual position.
|
boolean |
hasInlineElements()
Tells whether there exists at least one inline element currently.
|
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. |
void |
validateState() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddInlineElement, getElementAtbulkUpdateFinished, bulkUpdateStartingpublic int getPriority()
getPriority in interface PrioritizedDocumentListenerpublic void beforeDocumentChange(DocumentEvent event)
DocumentListenerbeforeDocumentChange in interface DocumentListenerevent - the event containing the information about the change.public void documentChanged(DocumentEvent event)
DocumentListenerdocumentChanged in interface DocumentListenerevent - the event containing the information about the change.public void dispose()
Disposabledispose in interface Disposablepublic <T extends EditorCustomElementRenderer> Inlay<T> addInlineElement(int offset, boolean relatesToPrecedingText, T renderer)
InlayModeladdInlineElement in interface InlayModelrelatesToPrecedingText - 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.public <T extends EditorCustomElementRenderer> Inlay<T> addBlockElement(int offset, boolean relatesToPrecedingText, boolean showAbove, int priority, T renderer)
InlayModeladdBlockElement in interface InlayModelrelatesToPrecedingText - 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.BlockInlayPrioritypublic <T extends EditorCustomElementRenderer> Inlay<T> addAfterLineEndElement(int offset, boolean relatesToPrecedingText, T renderer)
InlayModeladdAfterLineEndElement in interface InlayModelrelatesToPrecedingText - 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.public java.util.List<Inlay> getInlineElementsInRange(int startOffset, int endOffset)
InlayModelgetInlineElementsInRange in interface InlayModelpublic <T> java.util.List<Inlay<? extends T>> getInlineElementsInRange(int startOffset, int endOffset, java.lang.Class<T> type)
InlayModelInlayModel.getInlineElementsInRange(int, int), but returned list contains only inlays with renderer of given type.getInlineElementsInRange in interface InlayModelpublic java.util.List<Inlay> getBlockElementsInRange(int startOffset, int endOffset)
InlayModelgetBlockElementsInRange in interface InlayModelpublic <T> java.util.List<Inlay<? extends T>> getBlockElementsInRange(int startOffset, int endOffset, java.lang.Class<T> type)
InlayModelInlayModel.getBlockElementsInRange(int, int), but returned list contains only inlays with renderer of given type.getBlockElementsInRange in interface InlayModelpublic java.util.List<Inlay> getBlockElementsForVisualLine(int visualLine, boolean above)
InlayModelgetBlockElementsForVisualLine in interface InlayModelpublic int getHeightOfBlockElementsBeforeVisualLine(int visualLine)
public boolean hasBlockElements()
InlayModelhasBlockElements in interface InlayModelpublic boolean hasInlineElementsInRange(int startOffset,
int endOffset)
InlayModelhasInlineElementsInRange in interface InlayModelpublic boolean hasInlineElements()
InlayModelhasInlineElements in interface InlayModelpublic boolean hasInlineElementAt(int offset)
InlayModelhasInlineElementAt in interface InlayModelpublic boolean hasInlineElementAt(VisualPosition visualPosition)
InlayModelhasInlineElementAt in interface InlayModelpublic Inlay getInlineElementAt(VisualPosition visualPosition)
InlayModelgetInlineElementAt in interface InlayModelpublic Inlay getElementAt(java.awt.Point point)
InlayModelnull if there's no element at given point.getElementAt in interface InlayModelpublic java.util.List<Inlay> getAfterLineEndElementsInRange(int startOffset, int endOffset)
InlayModelgetAfterLineEndElementsInRange in interface InlayModelInlayModel.addAfterLineEndElement(int, boolean, EditorCustomElementRenderer)public <T> java.util.List<Inlay<? extends T>> getAfterLineEndElementsInRange(int startOffset, int endOffset, java.lang.Class<T> type)
InlayModelInlayModel.getAfterLineEndElementsInRange(int, int), but returned list contains only inlays with renderer of given type.getAfterLineEndElementsInRange in interface InlayModelpublic java.util.List<Inlay> getAfterLineEndElementsForLogicalLine(int logicalLine)
InlayModelgetAfterLineEndElementsForLogicalLine in interface InlayModelInlayModel.addAfterLineEndElement(int, boolean, EditorCustomElementRenderer)public boolean hasAfterLineEndElements()
public void setConsiderCaretPositionOnDocumentUpdates(boolean enabled)
InlayModelInlay.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.setConsiderCaretPositionOnDocumentUpdates in interface InlayModelpublic void execute(boolean batchMode,
java.lang.Runnable operation)
InlayModelExecuted 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.
execute in interface InlayModelbatchMode - whether to enable batch mode for executed inlay operationspublic boolean isInBatchMode()
InlayModelisInBatchMode in interface InlayModelInlayModel.execute(boolean, Runnable)public void addListener(InlayModel.Listener listener, Disposable disposable)
InlayModeladdListener in interface InlayModelpublic void validateState()