summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-25 16:28:04 -0800
committerKeith Packard <keithp@keithp.com>2010-11-25 16:30:19 -0800
commitadbb14c63d85b7a54223f88ac623571456f4a462 (patch)
tree45246d096b0626b13c78bd23a97d5205d10e4ff4
parent7f88520089660845009148b69bfcea6c9dff9672 (diff)
altosui: Remove gratuitous threading from device flashing UI
There's no need for a thread here, and swing doesn't want us to use one anyways. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altosui/AltosFlashUI.java83
1 files changed, 39 insertions, 44 deletions
diff --git a/altosui/AltosFlashUI.java b/altosui/AltosFlashUI.java
index f63097ac..0b61f041 100644
--- a/altosui/AltosFlashUI.java
+++ b/altosui/AltosFlashUI.java
@@ -30,7 +30,7 @@ import java.util.concurrent.LinkedBlockingQueue;
public class AltosFlashUI
extends JDialog
- implements Runnable, ActionListener
+ implements ActionListener
{
Container pane;
Box box;
@@ -64,47 +64,6 @@ public class AltosFlashUI
}
}
- public void run() {
- try {
- flash = new AltosFlash(file, debug_dongle);
- flash.addActionListener(this);
- AltosRomconfigUI romconfig_ui = new AltosRomconfigUI (frame);
-
- romconfig_ui.set(flash.romconfig());
- AltosRomconfig romconfig = romconfig_ui.showDialog();
-
- if (romconfig != null && romconfig.valid()) {
- flash.set_romconfig(romconfig);
- serial_value.setText(String.format("%d",
- flash.romconfig().serial_number));
- file_value.setText(file.toString());
- setVisible(true);
- flash.flash();
- flash = null;
- }
- } catch (FileNotFoundException ee) {
- JOptionPane.showMessageDialog(frame,
- "Cannot open image",
- file.toString(),
- JOptionPane.ERROR_MESSAGE);
- } catch (AltosSerialInUseException si) {
- JOptionPane.showMessageDialog(frame,
- String.format("Device \"%s\" already in use",
- debug_dongle.toShortString()),
- "Device in use",
- JOptionPane.ERROR_MESSAGE);
- } catch (IOException e) {
- JOptionPane.showMessageDialog(frame,
- e.getMessage(),
- file.toString(),
- JOptionPane.ERROR_MESSAGE);
- } catch (InterruptedException ie) {
- } finally {
- abort();
- }
- dispose();
- }
-
public void abort() {
if (flash != null)
flash.abort();
@@ -212,7 +171,43 @@ public class AltosFlashUI
if (file != null)
AltosPreferences.set_firmwaredir(file.getParentFile());
- thread = new Thread(this);
- thread.start();
+ try {
+ flash = new AltosFlash(file, debug_dongle);
+ flash.addActionListener(this);
+ AltosRomconfigUI romconfig_ui = new AltosRomconfigUI (frame);
+
+ romconfig_ui.set(flash.romconfig());
+ AltosRomconfig romconfig = romconfig_ui.showDialog();
+
+ if (romconfig != null && romconfig.valid()) {
+ flash.set_romconfig(romconfig);
+ serial_value.setText(String.format("%d",
+ flash.romconfig().serial_number));
+ file_value.setText(file.toString());
+ setVisible(true);
+ flash.flash();
+ flash = null;
+ }
+ } catch (FileNotFoundException ee) {
+ JOptionPane.showMessageDialog(frame,
+ "Cannot open image",
+ file.toString(),
+ JOptionPane.ERROR_MESSAGE);
+ } catch (AltosSerialInUseException si) {
+ JOptionPane.showMessageDialog(frame,
+ String.format("Device \"%s\" already in use",
+ debug_dongle.toShortString()),
+ "Device in use",
+ JOptionPane.ERROR_MESSAGE);
+ } catch (IOException e) {
+ JOptionPane.showMessageDialog(frame,
+ e.getMessage(),
+ file.toString(),
+ JOptionPane.ERROR_MESSAGE);
+ } catch (InterruptedException ie) {
+ } finally {
+ abort();
+ }
+ dispose();
}
} \ No newline at end of file