altosui: Display error dialog when AltOS JNI library can't be loaded
[fw/altos] / ao-tools / altosui / AltosDeviceDialog.java
index 3df4c6ebeb15c27e4176dc16ff1560bf5fdbe7b6..ec78e2889fcdef70f1ac37be7eb240f8705945d1 100644 (file)
@@ -49,10 +49,15 @@ public class AltosDeviceDialog extends JDialog implements ActionListener {
                        dialog.setVisible(true);
                        return value;
                } else {
-                       JOptionPane.showMessageDialog(frame,
-                                                     "No AltOS devices available",
-                                                     "No AltOS devices",
-                                                     JOptionPane.ERROR_MESSAGE);
+                       /* check for missing altos JNI library, which
+                        * will put up its own error dialog
+                        */
+                       if (AltosUI.load_library(frame)) {
+                               JOptionPane.showMessageDialog(frame,
+                                                             "No AltOS devices available",
+                                                             "No AltOS devices",
+                                                             JOptionPane.ERROR_MESSAGE);
+                       }
                        return null;
                }
        }