Search code examples
javaintellij-ideaintellij-pluginpopup-balloons

Show or open my plugin in IntelliJ


I'm developing a plugin for IntelliJ and the default state of the plugin is hide (like the others plugins - Maven Projects, Ant Build etc...)

My plugin uses the package com.intellij.openapi.ui.popup.BalloonBuilder to show a balloon on part of classes with some logic.

Now I want to add the functionality to show or open the plugin:

        builder.setClickHandler(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // Show or open the plugin
            }
        }, true);

How I do it?


Solution

  • The solution is call to show method on ToolWindow object:

    ToolWindow toolWindow = toolWindowManager.registerToolWindow("MyPlugin", myPanel, ToolWindowAnchor.RIGHT);
    
    builder.setClickHandler(new ActionListener() {
        @Override
            public void actionPerformed(ActionEvent e) {
                toolWindow.show(new Runnable() {
                        @Override
                            public void run() {
                                System.out.print("Showing the plugin!");
                            }
                    });
            }
    }, true);