MCPcopy Index your code
hub / github.com/processing/processing / rebuildModePopup

Method rebuildModePopup

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

Source from the content-addressed store, hash-verified

532
533
534 public void rebuildModePopup() {
535 modePopup = new JMenu();
536 ButtonGroup modeGroup = new ButtonGroup();
537 for (final Mode m : base.getModeList()) {
538 JRadioButtonMenuItem item = new JRadioButtonMenuItem(m.getTitle());
539 item.addActionListener(new ActionListener() {
540 public void actionPerformed(ActionEvent e) {
541 if (!sketch.isModified()) {
542 if (!base.changeMode(m)) {
543 reselectMode();
544 Messages.showWarning(Language.text("warn.cannot_change_mode.title"),
545 Language.interpolate("warn.cannot_change_mode.body", m));
546 }
547 } else {
548 reselectMode();
549 Messages.showWarning("Save",
550 "Please save the sketch before changing the mode.");
551 }
552 }
553 });
554 modePopup.add(item);
555 modeGroup.add(item);
556 if (mode == m) {
557 item.setSelected(true);
558 }
559 }
560
561 modePopup.addSeparator();
562 JMenuItem addLib = new JMenuItem(Language.text("toolbar.add_mode"));
563 addLib.addActionListener(new ActionListener() {
564 public void actionPerformed(ActionEvent e) {
565 ContributionManager.openModes();
566 }
567 });
568 modePopup.add(addLib);
569
570 Toolkit.setMenuMnemsInside(modePopup);
571 }
572
573 // Re-select the old checkbox, because it was automatically
574 // updated by Java, even though the Mode could not be changed.

Callers 2

EditorMethod · 0.95
refreshContribsMethod · 0.80

Calls 6

textMethod · 0.95
setMenuMnemsInsideMethod · 0.95
getModeListMethod · 0.45
getTitleMethod · 0.45
addMethod · 0.45
setSelectedMethod · 0.45

Tested by

no test coverage detected