mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
Disabling bootloader menu items when non-atmega8 selected.
This commit is contained in:
parent
dfdd7f5c02
commit
a9af6dbd60
@ -103,6 +103,9 @@ public class Editor extends JFrame
|
|||||||
RunButtonWatcher watcher;
|
RunButtonWatcher watcher;
|
||||||
//Runner runtime;
|
//Runner runtime;
|
||||||
|
|
||||||
|
|
||||||
|
JMenuItem burnBootloaderItem = null;
|
||||||
|
JMenuItem burnBootloaderParallelItem = null;
|
||||||
JMenuItem exportAppItem;
|
JMenuItem exportAppItem;
|
||||||
JMenuItem saveMenuItem;
|
JMenuItem saveMenuItem;
|
||||||
JMenuItem saveAsMenuItem;
|
JMenuItem saveAsMenuItem;
|
||||||
@ -724,6 +727,7 @@ public class Editor extends JFrame
|
|||||||
item.addActionListener(mml);
|
item.addActionListener(mml);
|
||||||
mcuGroup.add(item);
|
mcuGroup.add(item);
|
||||||
mcuMenu.add(item);
|
mcuMenu.add(item);
|
||||||
|
|
||||||
|
|
||||||
menu.add(mcuMenu);
|
menu.add(mcuMenu);
|
||||||
|
|
||||||
@ -748,22 +752,29 @@ public class Editor extends JFrame
|
|||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
item = new JMenuItem("Burn Bootloader");
|
burnBootloaderItem = new JMenuItem("Burn Bootloader");
|
||||||
item.addActionListener(new ActionListener() {
|
burnBootloaderItem.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
handleBurnBootloader(false);
|
handleBurnBootloader(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.add(item);
|
menu.add(burnBootloaderItem);
|
||||||
|
|
||||||
|
if (!Preferences.get("build.mcu").equals("atmega8"))
|
||||||
|
burnBootloaderItem.setEnabled(false);
|
||||||
|
|
||||||
if (!Base.isMacOS()) {
|
if (!Base.isMacOS()) {
|
||||||
item = new JMenuItem("Burn Bootloader (parallel port)");
|
burnBootloaderParallelItem =
|
||||||
item.addActionListener(new ActionListener() {
|
new JMenuItem("Burn Bootloader (parallel port)");
|
||||||
|
burnBootloaderParallelItem.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
handleBurnBootloader(true);
|
handleBurnBootloader(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.add(item);
|
menu.add(burnBootloaderParallelItem);
|
||||||
|
|
||||||
|
if (!Preferences.get("build.mcu").equals("atmega8"))
|
||||||
|
burnBootloaderParallelItem.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.addMenuListener(new MenuListener() {
|
menu.addMenuListener(new MenuListener() {
|
||||||
@ -775,6 +786,7 @@ public class Editor extends JFrame
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,6 +857,12 @@ public class Editor extends JFrame
|
|||||||
((JCheckBoxMenuItem) actionevent.getSource()).setState(true);
|
((JCheckBoxMenuItem) actionevent.getSource()).setState(true);
|
||||||
Preferences.set("build.mcu",
|
Preferences.set("build.mcu",
|
||||||
((JCheckBoxMenuItem) actionevent.getSource()).getLabel());
|
((JCheckBoxMenuItem) actionevent.getSource()).getLabel());
|
||||||
|
|
||||||
|
boolean bootloadingEnabled =
|
||||||
|
Preferences.get("build.mcu").equals("atmega8");
|
||||||
|
burnBootloaderItem.setEnabled(bootloadingEnabled);
|
||||||
|
if (burnBootloaderParallelItem != null)
|
||||||
|
burnBootloaderParallelItem.setEnabled(bootloadingEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2001,6 +2019,10 @@ public class Editor extends JFrame
|
|||||||
if(debugging)
|
if(debugging)
|
||||||
doStop();
|
doStop();
|
||||||
console.clear();
|
console.clear();
|
||||||
|
if (!Preferences.get("build.mcu").equals("atmega8")) {
|
||||||
|
error("Burn bootloader only works on ATmega8s. See the Arduino FAQ for more info.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
//String what = sketch.isLibrary() ? "Applet" : "Library";
|
//String what = sketch.isLibrary() ? "Applet" : "Library";
|
||||||
//message("Exporting " + what + "...");
|
//message("Exporting " + what + "...");
|
||||||
message("Burning bootloader to I/O Board (this may take a minute)...");
|
message("Burning bootloader to I/O Board (this may take a minute)...");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user