1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-07 01:54:26 +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() { private void handleBurnBootloader() {
console.clear(); console.clear();
statusNotice(tr("Burning bootloader to I/O Board (this may take a minute)...")); statusNotice(tr("Burning bootloader to I/O Board (this may take a minute)..."));
SwingUtilities.invokeLater(new Runnable() { new Thread(() -> {
public void run() { try {
try { Uploader uploader = new SerialUploader();
Uploader uploader = new SerialUploader(); if (uploader.burnBootloader()) {
if (uploader.burnBootloader()) { SwingUtilities.invokeLater(() -> statusNotice(tr("Done burning bootloader.")));
statusNotice(tr("Done burning bootloader.")); } else {
} else { SwingUtilities.invokeLater(() -> statusError(tr("Error while burning bootloader.")));
statusError(tr("Error while burning bootloader.")); // error message will already be visible
// 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();
} }
} 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();
} }