altosui: Output recorded clock tick in CSV files
[fw/altos] / altosui / AltosFlashUI.java
index 3874b5004995cb0269a612005b2949783f2747de..704ce35c9fca4227a830c60dd3a51525e0409ec8 100644 (file)
@@ -29,7 +29,7 @@ import java.util.prefs.*;
 import java.util.concurrent.*;
 
 public class AltosFlashUI
-       extends JDialog
+       extends AltosDialog
        implements ActionListener
 {
        Container       pane;
@@ -200,8 +200,8 @@ public class AltosFlashUI
        void exception (Exception e) {
                if (e instanceof FileNotFoundException) {
                        JOptionPane.showMessageDialog(frame,
-                                                     "Cannot open image",
-                                                     file.toString(),
+                                                     ((FileNotFoundException) e).getMessage(),
+                                                     "Cannot open file",
                                                      JOptionPane.ERROR_MESSAGE);
                } else if (e instanceof AltosSerialInUseException) {
                        JOptionPane.showMessageDialog(frame,
@@ -247,7 +247,15 @@ public class AltosFlashUI
                                        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;
                                System.out.printf("exception %s\n", e.toString());
                                SwingUtilities.invokeLater(new Runnable() {
@@ -255,9 +263,18 @@ public class AltosFlashUI
                                                        ui.exception(e);
                                                }
                                        });
+                       } catch (AltosSerialInUseException ee) {
+                               final Exception e = ee;
+                               System.out.printf("exception %s\n", e.toString());
+                               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) {