Context menu howto

I'm trying to add a context menu to my plugin, as seen in IDEA all over the place. The problem is that i'm not being able to get the same Look&Feel than those in IDEA.

I've found two ways of getting context menu. Using JBPopupFactory.createActionGroupPopup or using JPopupMenu.
The JBPopupFactory.createActionGroupPopup gives a completly different look&feel from the IDEA default context menu. With JPopupMenu i get a correct look&feel but i can't associate a description to every action so that it shows up in the IDEA taskbar when a user hovers it.

Any ideas ?

1 comment
Comment actions Permalink

Hugo, the popups created by JBPopupFactory are those used e.g. for the popups in the Project Structure (Add...) configuration. You should create your popup menus with com.intellij.openapi.actionSystem.ActionManager#createActionPopupMenu and com.intellij.openapi.actionSystem.ActionPopupMenu#getComponent. This will make sure that e.g. each Action's description shows up in the statusbar.



Please sign in to leave a comment.