altos/stm32f4: Align stack to 8 bytes
[fw/altos] / micropeak / MicroFileChooser.java
index 0fd63a27469b74cd1194dab9249f947bca69c4a1..c7a6d782c7abc06ffe8a74973abc86d706951d10 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,7 +21,8 @@ package org.altusmetrum.micropeak;
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
-import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altosuilib_13.*;
 
 public class MicroFileChooser extends JFileChooser {
        JFrame  frame;
@@ -35,24 +37,12 @@ public class MicroFileChooser extends JFileChooser {
                return file;
        }
 
-       public InputStream runDialog() {
+       public File runDialog() {
                int     ret;
 
                ret = showOpenDialog(frame);
-               if (ret == APPROVE_OPTION) {
-                       file = getSelectedFile();
-                       if (file == null)
-                               return null;
-                       filename = file.getName();
-                       try {
-                               return new FileInputStream(file);
-                       } catch (FileNotFoundException fe) {
-                               JOptionPane.showMessageDialog(frame,
-                                                             fe.getMessage(),
-                                                             "Cannot open file",
-                                                             JOptionPane.ERROR_MESSAGE);
-                       }
-               }
+               if (ret == APPROVE_OPTION)
+                       return getSelectedFile();
                return null;
        }
 
@@ -61,5 +51,6 @@ public class MicroFileChooser extends JFileChooser {
                setDialogTitle("Select MicroPeak Data File");
                setFileFilter(new FileNameExtensionFilter("MicroPeak data file",
                                                          "mpd"));
+               setCurrentDirectory(AltosUIPreferences.last_logdir());
        }
 }