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;
}
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;
}
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;
}
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;
}
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);
}
}
Aggregations