public class InlayModelImpl extends java.lang.Object implements InlayModel, PrioritizedDocumentListener, Disposable, Dumpable
InlayModel.ChangeFlags, InlayModel.Listener, InlayModel.SimpleAdapter
Disposable.Parent
COMPARATOR
ARRAY_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, wait
addInlineElement, getElementAt
bulkUpdateFinished, bulkUpdateStarting
public int getPriority()
getPriority
in interface PrioritizedDocumentListener
public void beforeDocumentChange(DocumentEvent event)
DocumentListener
beforeDocumentChange
in interface DocumentListener
event
- the event containing the information about the change.public void documentChanged(DocumentEvent event)
DocumentListener
documentChanged
in interface DocumentListener
event
- the event containing the information about the change.public void dispose()
Disposable
dispose
in interface Disposable
public <T extends EditorCustomElementRenderer> Inlay<T> addInlineElement(int offset, boolean relatesToPrecedingText, T renderer)
InlayModel
addInlineElement
in interface InlayModel
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.public <T extends EditorCustomElementRenderer> Inlay<T> addBlockElement(int offset, boolean relatesToPrecedingText, boolean showAbove, int priority, T renderer)
InlayModel
addBlockElement
in interface InlayModel
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
public <T extends EditorCustomElementRenderer> Inlay<T> addAfterLineEndElement(int offset, boolean relatesToPrecedingText, T renderer)
InlayModel
addAfterLineEndElement
in interface InlayModel
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.public java.util.List<Inlay> getInlineElementsInRange(int startOffset, int endOffset)
InlayModel
getInlineElementsInRange
in interface InlayModel
public <T> java.util.List<Inlay<? extends T>> getInlineElementsInRange(int startOffset, int endOffset, java.lang.Class<T> type)
InlayModel
InlayModel.getInlineElementsInRange(int, int)
, but returned list contains only inlays with renderer of given type.getInlineElementsInRange
in interface InlayModel
public java.util.List<Inlay> getBlockElementsInRange(int startOffset, int endOffset)
InlayModel
getBlockElementsInRange
in interface InlayModel
public <T> java.util.List<Inlay<? extends T>> getBlockElementsInRange(int startOffset, int endOffset, java.lang.Class<T> type)
InlayModel
InlayModel.getBlockElementsInRange(int, int)
, but returned list contains only inlays with renderer of given type.getBlockElementsInRange
in interface InlayModel
public java.util.List<Inlay> getBlockElementsForVisualLine(int visualLine, boolean above)
InlayModel
getBlockElementsForVisualLine
in interface InlayModel
public int getHeightOfBlockElementsBeforeVisualLine(int visualLine)
public boolean hasBlockElements()
InlayModel
hasBlockElements
in interface InlayModel
public boolean hasInlineElementsInRange(int startOffset, int endOffset)
InlayModel
hasInlineElementsInRange
in interface InlayModel
public boolean hasInlineElements()
InlayModel
hasInlineElements
in interface InlayModel
public boolean hasInlineElementAt(int offset)
InlayModel
hasInlineElementAt
in interface InlayModel
public boolean hasInlineElementAt(VisualPosition visualPosition)
InlayModel
hasInlineElementAt
in interface InlayModel
public Inlay getInlineElementAt(VisualPosition visualPosition)
InlayModel
getInlineElementAt
in interface InlayModel
public Inlay getElementAt(java.awt.Point point)
InlayModel
null
if there's no element at given point.getElementAt
in interface InlayModel
public java.util.List<Inlay> getAfterLineEndElementsInRange(int startOffset, int endOffset)
InlayModel
getAfterLineEndElementsInRange
in interface InlayModel
InlayModel.addAfterLineEndElement(int, boolean, EditorCustomElementRenderer)
public <T> java.util.List<Inlay<? extends T>> getAfterLineEndElementsInRange(int startOffset, int endOffset, java.lang.Class<T> type)
InlayModel
InlayModel.getAfterLineEndElementsInRange(int, int)
, but returned list contains only inlays with renderer of given type.getAfterLineEndElementsInRange
in interface InlayModel
public java.util.List<Inlay> getAfterLineEndElementsForLogicalLine(int logicalLine)
InlayModel
getAfterLineEndElementsForLogicalLine
in interface InlayModel
InlayModel.addAfterLineEndElement(int, boolean, EditorCustomElementRenderer)
public boolean hasAfterLineEndElements()
public void setConsiderCaretPositionOnDocumentUpdates(boolean enabled)
InlayModel
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.setConsiderCaretPositionOnDocumentUpdates
in interface InlayModel
public void execute(boolean batchMode, java.lang.Runnable operation)
InlayModel
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.
execute
in interface InlayModel
batchMode
- whether to enable batch mode for executed inlay operationspublic boolean isInBatchMode()
InlayModel
isInBatchMode
in interface InlayModel
InlayModel.execute(boolean, Runnable)
public void addListener(InlayModel.Listener listener, Disposable disposable)
InlayModel
addListener
in interface InlayModel
public void validateState()