MCPcopy Create free account
hub / github.com/benfry/processing4 / rebuildModePopup

Method rebuildModePopup

app/src/processing/app/ui/Editor.java:461–487  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 2

EditorMethod · 0.95
refreshContribsMethod · 0.80

Calls 9

reselectModeMethod · 0.95
textMethod · 0.95
openModesMethod · 0.95
setMenuMnemsInsideMethod · 0.95
getModeListMethod · 0.80
changeModeMethod · 0.80
setSelectedMethod · 0.80
getTitleMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected