* fine-tune file chooser behaviour
This commit is contained in:
parent
1c6fdc1a16
commit
a8b28ac8cd
|
@ -151,10 +151,8 @@ public class UserFiles {
|
|||
if (defaultFile != null) {
|
||||
if (folderMode && defaultFile.isDirectory()) {
|
||||
fileDialog.setDirectory(defaultFile.getPath());
|
||||
} else {
|
||||
if (defaultFile.getParentFile() != null) {
|
||||
} else if (defaultFile.getParentFile() != null && defaultFile.getParentFile().isDirectory()) {
|
||||
fileDialog.setDirectory(defaultFile.getParentFile().getPath());
|
||||
}
|
||||
fileDialog.setFile(defaultFile.getName());
|
||||
}
|
||||
}
|
||||
|
@ -271,12 +269,13 @@ 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());
|
||||
}
|
||||
}
|
||||
|
||||
if (multiSelection) {
|
||||
List<File> files = fileChooser.showOpenMultipleDialog(null);
|
||||
|
|
Loading…
Reference in New Issue