Search in sources :

Example 36 with Preferences

use of java.util.prefs.Preferences in project jgnash by ccavanaugh.

the class DatabasePathAction method getFileToSave.

public static File getFileToSave() {
    final ResourceBundle resources = ResourceUtils.getBundle();
    final FileChooser fileChooser = configureFileChooser();
    fileChooser.setTitle(resources.getString("Title.NewFile"));
    final File file = fileChooser.showSaveDialog(MainView.getPrimaryStage());
    if (file != null) {
        Preferences pref = Preferences.userNodeForPackage(DatabasePathAction.class);
        pref.put(LAST_DIR, file.getParentFile().getAbsolutePath());
    }
    return file;
}
Also used : FileChooser(javafx.stage.FileChooser) ResourceBundle(java.util.ResourceBundle) Preferences(java.util.prefs.Preferences) File(java.io.File)

Example 37 with Preferences

use of java.util.prefs.Preferences in project jgnash by ccavanaugh.

the class DatabasePathAction method getFileToOpen.

public static File getFileToOpen() {
    final ResourceBundle resources = ResourceUtils.getBundle();
    final FileChooser fileChooser = configureFileChooser();
    fileChooser.setTitle(resources.getString("Title.Open"));
    final File file = fileChooser.showOpenDialog(MainView.getPrimaryStage());
    if (file != null) {
        Preferences pref = Preferences.userNodeForPackage(DatabasePathAction.class);
        pref.put(LAST_DIR, file.getParentFile().getAbsolutePath());
    }
    return file;
}
Also used : FileChooser(javafx.stage.FileChooser) ResourceBundle(java.util.ResourceBundle) Preferences(java.util.prefs.Preferences) File(java.io.File)

Example 38 with Preferences

use of java.util.prefs.Preferences in project jgnash by ccavanaugh.

the class ExecuteJavaScriptAction method configureFileChooser.

private static FileChooser configureFileChooser() {
    final Preferences pref = Preferences.userNodeForPackage(ExecuteJavaScriptAction.class);
    final FileChooser fileChooser = new FileChooser();
    fileChooser.setInitialDirectory(new File(pref.get(LAST_DIR, System.getProperty("user.home"))));
    fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("JavaScript Files", "*.js"));
    fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("All Files", "*.*"));
    return fileChooser;
}
Also used : FileChooser(javafx.stage.FileChooser) Preferences(java.util.prefs.Preferences) File(java.io.File)

Example 39 with Preferences

use of java.util.prefs.Preferences in project jgnash by ccavanaugh.

the class ExportAccountsAction method configureFileChooser.

private static FileChooser configureFileChooser() {
    final Preferences pref = Preferences.userNodeForPackage(ExportAccountsAction.class);
    final FileChooser fileChooser = new FileChooser();
    fileChooser.setInitialDirectory(new File(pref.get(LAST_DIR, System.getProperty("user.home"))));
    fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter(ResourceUtils.getString("Label.XMLFiles") + " (*.xml)", "*.xml", "*.XML"));
    return fileChooser;
}
Also used : FileChooser(javafx.stage.FileChooser) Preferences(java.util.prefs.Preferences) File(java.io.File)

Example 40 with Preferences

use of java.util.prefs.Preferences in project jgnash by ccavanaugh.

the class ExportAccountsAction method showAndWait.

public static void showAndWait() {
    final ResourceBundle resources = ResourceUtils.getBundle();
    final FileChooser fileChooser = configureFileChooser();
    fileChooser.setTitle(resources.getString("Title.SelFile"));
    final File file = fileChooser.showSaveDialog(MainView.getPrimaryStage());
    if (file != null) {
        Preferences pref = Preferences.userNodeForPackage(ExportAccountsAction.class);
        pref.put(LAST_DIR, file.getParentFile().getAbsolutePath());
        final ExportTask exportTask = new ExportTask(Paths.get(FileUtils.stripFileExtension(file.getAbsolutePath()) + ".xml"));
        new Thread(exportTask).start();
        MainView.getInstance().setBusy(exportTask);
    }
}
Also used : FileChooser(javafx.stage.FileChooser) ResourceBundle(java.util.ResourceBundle) Preferences(java.util.prefs.Preferences) File(java.io.File)

Aggregations

Preferences (java.util.prefs.Preferences)291 BackingStoreException (java.util.prefs.BackingStoreException)49 File (java.io.File)45 ResourceBundle (java.util.ResourceBundle)24 FileChooser (javafx.stage.FileChooser)21 ArrayList (java.util.ArrayList)17 FXML (javafx.fxml.FXML)16 IOException (java.io.IOException)14 JFileChooser (javax.swing.JFileChooser)12 List (java.util.List)8 SwingWorker (javax.swing.SwingWorker)8 FileNameExtensionFilter (javax.swing.filechooser.FileNameExtensionFilter)7 Engine (jgnash.engine.Engine)7 AutoCompletePreferences (org.jabref.logic.autocompleter.AutoCompletePreferences)6 FieldContentParserPreferences (org.jabref.logic.bibtex.FieldContentParserPreferences)6 LatexFieldFormatterPreferences (org.jabref.logic.bibtex.LatexFieldFormatterPreferences)6 BibtexKeyPatternPreferences (org.jabref.logic.bibtexkeypattern.BibtexKeyPatternPreferences)6 CleanupPreferences (org.jabref.logic.cleanup.CleanupPreferences)6 ImportFormatPreferences (org.jabref.logic.importer.ImportFormatPreferences)6 JournalAbbreviationPreferences (org.jabref.logic.journals.JournalAbbreviationPreferences)6