altosui: eliminate menu bar, moving elements to buttons.
[fw/altos] / ao-tools / altosui / AltosConfig.java
index b7474f3b2fa56faea8ee6d14858da68916e064f1..09e204a9de3e9f7e7077937548d19c886f2db0f7 100644 (file)
@@ -28,20 +28,6 @@ import java.text.*;
 import java.util.prefs.*;
 import java.util.concurrent.LinkedBlockingQueue;
 
-import altosui.Altos;
-import altosui.AltosSerial;
-import altosui.AltosSerialMonitor;
-import altosui.AltosRecord;
-import altosui.AltosTelemetry;
-import altosui.AltosState;
-import altosui.AltosDeviceDialog;
-import altosui.AltosPreferences;
-import altosui.AltosLog;
-import altosui.AltosVoice;
-import altosui.AltosFlightStatusTableModel;
-import altosui.AltosFlightInfoTableModel;
-import altosui.AltosConfigUI;
-
 import libaltosJNI.*;
 
 public class AltosConfig implements Runnable, ActionListener {
@@ -245,10 +231,9 @@ public class AltosConfig implements Runnable, ActionListener {
                product = new string_ref("unknown");
 
                device = AltosDeviceDialog.show(owner, AltosDevice.product_any);
-               serial_line = new AltosSerial();
                if (device != null) {
                        try {
-                               serial_line.open(device);
+                               serial_line = new AltosSerial(device);
                                if (!device.matchProduct(AltosDevice.product_telemetrum))
                                        remote = true;
                                config_thread = new Thread(this);
@@ -259,6 +244,12 @@ public class AltosConfig implements Runnable, ActionListener {
                                                                            device.getPath()),
                                                              "Cannot open target device",
                                                              JOptionPane.ERROR_MESSAGE);
+                       } catch (AltosSerialInUseException si) {
+                               JOptionPane.showMessageDialog(owner,
+                                                             String.format("Device \"%s\" already in use",
+                                                                           device.getPath()),
+                                                             "Device in use",
+                                                             JOptionPane.ERROR_MESSAGE);
                        } catch (IOException ee) {
                                JOptionPane.showMessageDialog(owner,
                                                              device.getPath(),