* fine-tune file chooser behaviour

This commit is contained in:
Reinhard Pointner 2014-11-10 20:39:27 +00:00
parent 1c6fdc1a16
commit a8b28ac8cd
1 changed files with 5 additions and 6 deletions

View File

@ -151,10 +151,8 @@ public class UserFiles {
if (defaultFile != null) {
if (folderMode && defaultFile.isDirectory()) {
fileDialog.setDirectory(defaultFile.getPath());
} else {
if (defaultFile.getParentFile() != null) {
fileDialog.setDirectory(defaultFile.getParentFile().getPath());
}
} else if (defaultFile.getParentFile() != null && defaultFile.getParentFile().isDirectory()) {
fileDialog.setDirectory(defaultFile.getParentFile().getPath());
fileDialog.setFile(defaultFile.getName());
}
}
@ -271,11 +269,12 @@ public class UserFiles {
}
fileChooser.getExtensionFilters().add(new javafx.stage.FileChooser.ExtensionFilter(filter.toString(), globFilter));
}
if (defaultFile != null) {
if (defaultFile.getParentFile() != null) {
if (defaultFile.getParentFile() != null && defaultFile.getParentFile().isDirectory()) {
fileChooser.setInitialDirectory(defaultFile.getParentFile());
fileChooser.setInitialFileName(defaultFile.getName());
}
fileChooser.setInitialFileName(defaultFile.getName());
}
if (multiSelection) {