How to navigate to custom side panel UI by clicking on a gutter icon


What I want to do is allow users to click a custom icons appearing in the gutter -- and have a clickable sub-menu pop up (kind of like a tooltip, only interactive). These gutter icons should only appear once the user has performed a certain action (which I call "GenerateVCsAction"). More than this, when users click an item in the list produced by one of the gutter icons, I want this to open a custom UI panel on the RHS side of the editor where I can insert some static text.

Here's what I've done so far:

  • I've made an action called GenerateVCsAction which extends AnAction (and implements DumbAware)
  • in this class I implement "actionPerformed(..)"
  • In actionPerformed(..) I run some tool and it gives me back a list of (VC)pairs object that contain this type of info: (location, shortexplanation, fullexplanation) -- where location is some Integer representing a line number and the explanation(s) are just strings
  • (still in actionPerformed) I then iterate over these pairs, doing the following: 
    for (VCPair p : pairs) {
    Integer l = p.location;
    String explanation = p.explanation;

    RangeHighlighter highlighter =
    markup.addLineHighlighter(location.getLine() - 1, HighlighterLayer.ELEMENT_UNDER_CARET, null);
    highlighter.setGutterIconRenderer(new GutterIconRenderer() {
    public Icon getIcon() {
    return Icons.VC;

    public String getTooltipText() {
    return explanation;

    public boolean equals(Object obj) {
    return false;

    public int hashCode() {
    return 0;

Here's an illustration of where the above has gotten me, and hopefully these pictures will help explain what exactly I want to do next:

The above seems to work all well and good. However,  there can be multiple "VCs" per line.. that is, line 4 could be home to an arbitrary number of these VC objects. So what I really want is for the tooltip that comes up to have an internal 'clickable list' of links.

For example, in the third image down, suppose line 8 has 4 VCs associated with it; so when users click-on/hover-over the gutter icon, I want some clickable list to pop up -- and clicking one of the four options would open the grey 'verifier' pane on the RHS and place some canned text into it.

From my understanding, tooltip text is always static, so how am I going to make that interactive? I looked at some existing 'gutter' examples which allow people to 'navigate' to super methods, etc. However, all those examples involve navigating to some PsiElement -- when all I really want to do with that list is click an option, popup a static pane on the right containing some text (based on this VC object my tool gave me in the VCGenAction)

Sorry if this is confusing, let me know if you need more details. Hopefully it's kind of clear what I want to accomplish (and where I've gotten). Anyone know of examples that might be more helpful?

Thanks for reading.

Comment actions Permalink

Ah,so  I'm thinking maybe getPopupMenuActions() in GutterIconRenderer might be what I'm looking for... I'll update this if I make some progress (though maybe it's not "the right way" to approach this). So question in the original post still stands.

Comment actions Permalink

Hi Daniel,

You should have a look at `com.intellij.openapi.editor.markup.GutterIconRenderer#getPopupMenuActions` or freshier `com.intellij.execution.lineMarker.RunLineMarkerContributor`. TBH I am not sure which is more suitable, but probably the latter.

You can check what it looks like in java tests, for example. Or gutter against `public static void main` method.


Comment actions Permalink


you can override com.intellij.openapi.editor.markup.GutterIconRenderer#getClickAction and show a popup there, creating it via JBPopupFactory (e.g. factory.createListPopup(factory.createActionsStep)).

To open a toolwindow pane, you need first to register that toolwindow (see ToolWindowFactory extension and its implementations for an example) and then activate it by using code similar to com.intellij.openapi.vcs.changes.SelectInChangesViewTarget#selectIn.

Comment actions Permalink

Thanks! I'll definitely take a look at the suggestions in a day or two.


Please sign in to leave a comment.