X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosFlashUI.java;h=f8c24b16c662a2498cb6b4570f087461f9c198f5;hb=2f2734bb418f5c3a89fa3f1bf1b98ce4cfe432e1;hp=3956ff20a94789d99148df23fdda1455e9aa0beb;hpb=1c344b760776cd5d8c0297d8db9bf02687381b4e;p=fw%2Faltos diff --git a/altosui/AltosFlashUI.java b/altosui/AltosFlashUI.java index 3956ff20..f8c24b16 100644 --- a/altosui/AltosFlashUI.java +++ b/altosui/AltosFlashUI.java @@ -21,15 +21,11 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; import java.util.concurrent.*; public class AltosFlashUI - extends JDialog + extends AltosDialog implements ActionListener { Container pane; @@ -161,7 +157,7 @@ public class AltosFlashUI boolean select_source_file() { JFileChooser hexfile_chooser = new JFileChooser(); - File firmwaredir = AltosPreferences.firmwaredir(); + File firmwaredir = AltosUIPreferences.firmwaredir(); if (firmwaredir != null) hexfile_chooser.setCurrentDirectory(firmwaredir); @@ -174,7 +170,7 @@ public class AltosFlashUI file = hexfile_chooser.getSelectedFile(); if (file == null) return false; - AltosPreferences.set_firmwaredir(file.getParentFile()); + AltosUIPreferences.set_firmwaredir(file.getParentFile()); return true; } @@ -234,30 +230,40 @@ public class AltosFlashUI public void run() { ui.flash = flash; ui.update_rom_config_info(current_config); - System.out.printf("Done updating rom config info\n"); await_rom_config.release(); } }); - System.out.printf("Waiting for rom configuration updates\n"); await_rom_config.acquire(); - System.out.printf("Got rom config update\n"); if (ui.rom_config != null) { - System.out.printf("rom_config not null\n"); flash.set_romconfig(ui.rom_config); flash.flash(); } - } catch (Exception ee) { + } catch (InterruptedException ee) { final Exception e = ee; - System.out.printf("exception %s\n", e.toString()); SwingUtilities.invokeLater(new Runnable() { public void run() { ui.exception(e); } }); + } catch (IOException ee) { + final Exception e = ee; + SwingUtilities.invokeLater(new Runnable() { + public void run() { + ui.exception(e); + } + }); + } catch (AltosSerialInUseException ee) { + final Exception e = ee; + SwingUtilities.invokeLater(new Runnable() { + public void run() { + ui.exception(e); + } + }); + } finally { + if (flash != null) + flash.close(); } - if (flash != null) - flash.close(); } public flash_task(AltosFlashUI in_ui) { @@ -280,7 +286,7 @@ public class AltosFlashUI if (!select_source_file()) return; build_dialog(); - flash_task f = new flash_task(this); + //flash_task f = new flash_task(this); } static void show(JFrame frame) {