altosui: Separate out log file choosing dialog to share with CSV generator
[fw/altos] / ao-tools / altosui / AltosUI.java
index 565866ea1f61a582065d2326cefa20e4d577580f..64f96cddce15139cfdf00e696bc90e9242eb2941 100644 (file)
@@ -41,7 +41,8 @@ import altosui.AltosVoice;
 import altosui.AltosFlightStatusTableModel;
 import altosui.AltosFlightInfoTableModel;
 import altosui.AltosChannelMenu;
-import altosui.AltosFlash;
+import altosui.AltosFlashUI;
+import altosui.AltosLogfileChooser;
 
 import libaltosJNI.*;
 
@@ -460,7 +461,7 @@ public class AltosUI extends JFrame {
        }
 
        void FlashImage() {
-               new AltosFlash(AltosUI.this);
+               new AltosFlashUI(AltosUI.this);
        }
 
        /*
@@ -529,17 +530,12 @@ public class AltosUI extends JFrame {
         * Replay a flight from telemetry data
         */
        private void Replay() {
-               JFileChooser    logfile_chooser = new JFileChooser();
+               AltosLogfileChooser chooser = new AltosLogfileChooser(
+                       AltosUI.this);
 
-               logfile_chooser.setDialogTitle("Select Flight Record File");
-               logfile_chooser.setFileFilter(new FileNameExtensionFilter("Flight data file", "eeprom", "telem"));
-               logfile_chooser.setCurrentDirectory(AltosPreferences.logdir());
-               int returnVal = logfile_chooser.showOpenDialog(AltosUI.this);
+               File file = chooser.runDialog();
 
-               if (returnVal == JFileChooser.APPROVE_OPTION) {
-                       File file = logfile_chooser.getSelectedFile();
-                       if (file == null)
-                               System.out.println("No file selected?");
+               if (file != null) {
                        String  filename = file.getName();
                        try {
                                FileInputStream replay = new FileInputStream(file);