1 | public void setEditAddEnabled(boolean enabled) {↵ | | 1 | public void setEditAddEnabled(boolean enabled) {↵
|
2 | // There was a NPE being thrown without the null check here.. JKB↵ | | 2 | // There was a NPE being thrown without the null check here.. JKB↵
|
3 | if (edit_add != null) {↵ | | 3 | if (edit_add != null) {↵
|
4 | edit_add.setEnabled(enabled);↵ | | 4 | edit_add.setEnabled(enabled);↵
|
5 | }↵ | | 5 | }↵
|
6 | // If we are enabling the Edit-->Add menu item, then we also need to↵ | | 6 | // If we are enabling the Edit-->Add menu item, then we also need to↵
|
7 | // enable the Edit menu. The Edit menu may already be enabled, but↵ | | 7 | // enable the Edit menu. The Edit menu may already be enabled, but↵
|
8 | // there's no harm it trying to enable it again.↵ | | 8 | // there's no harm it trying to enable it again.↵
|
9 | if (enabled) {↵ | | 9 | if (enabled) {↵
|
10 | setEditEnabled(true);↵ | | 10 | setEditEnabled(true);↵
|
11 | } else {↵ | | 11 | } else {↵
|
12 | // If we are disabling the Edit-->Add menu item and the↵ | | 12 | // If we are disabling the Edit-->Add menu item and the↵
|
13 | // Edit-->Remove menu item is disabled, then we also need to↵ | | 13 | // Edit-->Remove menu item is disabled, then we also need to↵
|
14 | // disable the Edit menu.↵ | | 14 | // disable the Edit menu.↵
|
15 | // The Java Look and Feel Guidelines say to disable a menu if all↵ | | 15 | // The Java Look and Feel Guidelines say to disable a menu if all↵
|
16 | // menu items are disabled.↵ | | 16 | // menu items are disabled.↵
|
17 | if (!edit_remove.isEnabled()) {↵ | | 17 | if (!edit_remove.isEnabled()) {↵
|
18 | editMenu.setEnabled(false);↵ | | 18 | editMenu.setEnabled(false);↵
|
19 | | | 19 |
|