NPE - Key combinations for submenu #PL-3527

This commit is contained in:
Yuriy Artamonov 2014-02-04 11:34:16 +00:00
parent 99deaae981
commit 0406a16cec
3 changed files with 2 additions and 5 deletions

View File

@ -70,8 +70,6 @@ public class MenuBuilder {
public void menuCanceled(MenuEvent e) {
}
});
assignShortcut(jMenu, item);
menuBar.add(jMenu);
createSubMenu(jMenu, item);
} else {
@ -128,7 +126,6 @@ public class MenuBuilder {
}
} else {
JMenu jChildMenu = new JMenu(MenuConfig.getMenuItemCaption(child.getId()));
assignShortcut(jChildMenu, child);
createSubMenu(jChildMenu, child);
if (!isMenuEmpty(jChildMenu)) {
items.add(new MenuItemContainer(jChildMenu));

View File

@ -161,7 +161,7 @@ public class MenuBuilder {
}
protected void assignShortcut(MenuBar.MenuItem menuItem, MenuItem item) {
if (item.getShortcut() != null) {
if (item.getShortcut() != null && menuItem.getCommand() != null) {
MenuShortcutAction shortcut = new MenuShortcutAction(menuItem, "shortcut_" + item.getId(), item.getShortcut());
appWindow.addAction(shortcut);
menuBar.setShortcut(menuItem, item.getShortcut());

View File

@ -156,7 +156,7 @@ public class MenuBuilder {
}
protected void assignShortcut(MenuBar.MenuItem menuItem, MenuItem item) {
if (item.getShortcut() != null) {
if (item.getShortcut() != null && menuItem.getCommand() != null) {
MenuShortcutAction shortcut = new MenuShortcutAction(menuItem, "shortcut_" + item.getId(), item.getShortcut());
appWindow.addAction(shortcut);
menuBar.setShortcut(menuItem, item.getShortcut());