Display popup over RangeHighlighter on mouseover

Answered

I have added some RangeHighlighters to the editor and would like display some information in a popup when the user mouse overs the highlighter.

Something like this or similiar:

 

Is there a way to achieve this?  Thanks in advance!

 

1 comment
Comment actions Permalink

If your highlighter is generated from HighlightInfo, you can simply specify tooltip/description for it.
There's also com.intellij.codeInsight.preview.PreviewHintProvider that works on "Shift + mouse move" (ex: to show color by its defiinition).

Otherwise, you might need to register EditorMouseMotionListener and EditorMouseListener and show popup when EditorMouseEvent.getLogicalPosition points at your highlighter.
<editorFactoryMouseListener implementation="com.MyPluginListener"/>
<editorFactoryMouseMotionListener implementation="com.MyPluginListener"/>

You can use ImageOrColorPreviewManager and EditorMouseHoverPopupManager as an example.

0

Please sign in to leave a comment.