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()) {
statusNotice(tr("Done burning bootloader.")); SwingUtilities.invokeLater(() -> statusNotice(tr("Done burning bootloader.")));
} else { } else {
statusError(tr("Error while burning bootloader.")); SwingUtilities.invokeLater(() -> statusError(tr("Error while burning bootloader.")));
// error message will already be visible // error message will already be visible
} }
} catch (PreferencesMapException e) { } catch (PreferencesMapException e) {
SwingUtilities.invokeLater(() -> {
statusError(I18n.format( statusError(I18n.format(
tr("Error while burning bootloader: missing '{0}' configuration parameter"), tr("Error while burning bootloader: missing '{0}' configuration parameter"),
e.getMessage())); e.getMessage()));
});
} catch (RunnerException e) { } catch (RunnerException e) {
statusError(e.getMessage()); SwingUtilities.invokeLater(() -> statusError(e.getMessage()));
} catch (Exception e) { } catch (Exception e) {
statusError(tr("Error while burning bootloader.")); SwingUtilities.invokeLater(() -> statusError(tr("Error while burning bootloader.")));
e.printStackTrace(); e.printStackTrace();
} }
} }).start();
});
} }