1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-30 19:52:13 +01:00

Burn Bootloader was run in the UI thread, avoiding intermediate messages to be printed to IDE console

This commit is contained in:
Federico Fissore 2015-12-03 11:05:25 +01:00
parent 91245e2164
commit 66117a5cc0

View File

@ -2748,28 +2748,28 @@ public class Editor extends JFrame implements RunnerListener {
private void handleBurnBootloader() {
console.clear();
statusNotice(tr("Burning bootloader to I/O Board (this may take a minute)..."));
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
Uploader uploader = new SerialUploader();
if (uploader.burnBootloader()) {
statusNotice(tr("Done burning bootloader."));
} else {
statusError(tr("Error while burning bootloader."));
// error message will already be visible
}
} catch (PreferencesMapException e) {
statusError(I18n.format(
tr("Error while burning bootloader: missing '{0}' configuration parameter"),
e.getMessage()));
} catch (RunnerException e) {
statusError(e.getMessage());
} catch (Exception e) {
statusError(tr("Error while burning bootloader."));
e.printStackTrace();
new Thread(() -> {
try {
Uploader uploader = new SerialUploader();
if (uploader.burnBootloader()) {
SwingUtilities.invokeLater(() -> statusNotice(tr("Done burning bootloader.")));
} else {
SwingUtilities.invokeLater(() -> statusError(tr("Error while burning bootloader.")));
// error message will already be visible
}
} catch (PreferencesMapException e) {
SwingUtilities.invokeLater(() -> {
statusError(I18n.format(
tr("Error while burning bootloader: missing '{0}' configuration parameter"),
e.getMessage()));
});
} catch (RunnerException e) {
SwingUtilities.invokeLater(() -> statusError(e.getMessage()));
} catch (Exception e) {
SwingUtilities.invokeLater(() -> statusError(tr("Error while burning bootloader.")));
e.printStackTrace();
}
});
}).start();
}