()
| 459 | |
| 460 | |
| 461 | public void rebuildModePopup() { |
| 462 | modePopup = new JMenu(); |
| 463 | ButtonGroup modeGroup = new ButtonGroup(); |
| 464 | for (final Mode m : base.getModeList()) { |
| 465 | JRadioButtonMenuItem item = new JRadioButtonMenuItem(m.getTitle()); |
| 466 | item.addActionListener(e -> { |
| 467 | if (!base.changeMode(m)) { |
| 468 | // Returns false if unable to change the mode in this window |
| 469 | // (which will open a new window with the new Mode), in which case |
| 470 | // re-select the menu item b/c Java changes it automatically. |
| 471 | reselectMode(); |
| 472 | } |
| 473 | }); |
| 474 | modePopup.add(item); |
| 475 | modeGroup.add(item); |
| 476 | if (mode == m) { |
| 477 | item.setSelected(true); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | modePopup.addSeparator(); |
| 482 | JMenuItem manageModes = new JMenuItem(Language.text("toolbar.manage_modes")); |
| 483 | manageModes.addActionListener(e -> ContributionManager.openModes()); |
| 484 | modePopup.add(manageModes); |
| 485 | |
| 486 | Toolkit.setMenuMnemsInside(modePopup); |
| 487 | } |
| 488 | |
| 489 | |
| 490 | // Re-select the old checkbox, because it was automatically |
no test coverage detected