Actions as popup menu
"linesb" <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.devel |
|---|---|
| Message-ID | <[email protected]> |
I am trying to output actions from a certain category inside a submenu from an RMB action. The code to present this menu is located inside a dummy action placed in the RMB actions section, example below:
Code:
@Override
public JMenuItem getPopupPresenter() {
final JMenu menu = new JMenu(getName());
menu.setEnabled(true);
List<? extends Action> actionsForPath = Utilities.actionsForPath("Actions/ConvertTextMenu/SubActions");
for (Action action : actionsForPath) {
menu.add(action);
}
return menu;
}
The actions are deriving from the CookieAction class and look as follows:
Code:
@ActionID(id = "package.action.ConvertTextActionLowercase", category = "ConvertTextMenu/SubActions")
@ActionRegistration(displayName = "#CTL_ConvertTextActionLowercase")
@ActionReference(path = "Shortcuts", name = "DSA-L")
@NbBundle.Messages(value = {"CTL_ConvertTextActionLowercase=To Lowercase"})
public class ConvertTextActionLowercase extends CookieAction
What the problem is that when these actions are output through the dummy action getPopupPresenter method, the shortcuts are not being shown.
I want the submenu to output the actions like this:
RMB -> Convert Text -> Convert To Lowercase (CTRL + U)
At the moment it only does this:
RMB -> Convert Text -> Convert To Lowercase