How to: Add clickable Icons (to sourcecode elements) inside the editor

I'm currently working on my first Plugin and looking for the best way to add icons inside the Editor. The user has to be able to click on that icon and then some code (or maybe AnAction) gets called.
My current implementation uses GutterIcons, but having Icons shown directly at the interesting position would be preferable.This position is currently being identified using a special DocComment inside the sourcecode, which gets folded to a single unicode character.

I want it to look and work similiar to this: Click on the icon next to Google and you get taken to their site.


At the moment i'm experimenting with Overlays, similiar to how AceJump shows its jump-targets. This way, however, I believe I have to manually manage the correct location of the icon all the time.
Especially if the user edits the sourcecode, switch editortabs, etc.

Is there a better way to add this feature than Overlays?

Thanks,
ps

1 comment
Comment actions Permalink

No, there is no better way. The only standard way to draw icons supported by the editor API is gutter icons.

0

Please sign in to leave a comment.