altosui: Open serial device at 'new' time. Prohibit duplicate opens.
[fw/altos] / ao-tools / altosui / AltosUI.java
index 9ab451defca7847e24354195809dad779f2b8231..0d8f0e8d30d48bb6ca89c09e47a555495bd37929 100644 (file)
@@ -56,6 +56,12 @@ public class AltosUI extends JFrame {
                                                                    device.getPath()),
                                                      "Cannot open target device",
                                                      JOptionPane.ERROR_MESSAGE);
+               } catch (AltosSerialInUseException si) {
+                       JOptionPane.showMessageDialog(AltosUI.this,
+                                                     String.format("Device \"%s\" already in use",
+                                                                   device.getPath()),
+                                                     "Device in use",
+                                                     JOptionPane.ERROR_MESSAGE);
                } catch (IOException ee) {
                        JOptionPane.showMessageDialog(AltosUI.this,
                                                      device.getPath(),