Search in sources :

Example 1 with TxtFileChooser

use of org.jwildfire.create.tina.swing.TxtFileChooser in project JWildfire by thargor6.

the class LeapMotionControllerHolder method stopLeapMotionListener.

public void stopLeapMotionListener() {
    try {
        try {
            if (leapMotionController != null && listener != null) {
                leapMotionController.removeListener(listener);
            }
        } finally {
            listener = null;
        }
        if (leapMotionEditorListenerThread != null) {
            leapMotionEditorListenerThread.signalCancel();
            leapMotionEditorListenerThread = null;
        }
        if (recorder != null && !recorder.isEmpty()) {
            tinaController.undoAction();
            applyMotionToFlame(recorder, tinaController.getCurrFlame());
            tinaController.refreshUI();
            if (doSave && StandardDialogs.confirm(rootPanel, "Do you want to save the recorded motion-data?")) {
                Prefs prefs = Prefs.getPrefs();
                JFileChooser chooser = new TxtFileChooser(prefs);
                if (prefs.getTinaRawMotionDataPath() != null) {
                    try {
                        chooser.setCurrentDirectory(new File(prefs.getTinaRawMotionDataPath()));
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                } else if (prefs.getTinaFlamePath() != null) {
                    try {
                        chooser.setCurrentDirectory(new File(prefs.getTinaFlamePath()));
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
                if (chooser.showOpenDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
                    try {
                        exportMotionToFile(chooser.getSelectedFile());
                    } catch (Exception ex) {
                        errorHandler.handleError(ex);
                    }
                }
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) TxtFileChooser(org.jwildfire.create.tina.swing.TxtFileChooser) Prefs(org.jwildfire.base.Prefs) File(java.io.File)

Aggregations

File (java.io.File)1 JFileChooser (javax.swing.JFileChooser)1 Prefs (org.jwildfire.base.Prefs)1 TxtFileChooser (org.jwildfire.create.tina.swing.TxtFileChooser)1