Skip to content

Commit

Permalink
Resolves #3255 file open dialog should have "supported formates" file…
Browse files Browse the repository at this point in the history
…type
  • Loading branch information
stefan-kolb committed Oct 12, 2017
1 parent 6768ecb commit 5bd014f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/jabref/gui/importer/ImportFileFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public static FileChooser.ExtensionFilter convert(Importer format) {
public static FileChooser.ExtensionFilter convert(String description, Collection<Importer> formats) {
List<FileExtensions> extensions = formats.stream().map(Importer::getExtensions).collect(Collectors.toList());
List<String> flatExtensions = extensions.stream().flatMap(extList -> Arrays.stream(extList.getExtensions()))
.map(ending -> "*." + ending)
.collect(Collectors.toList());

return new FileChooser.ExtensionFilter(description, flatExtensions.toArray(new String[flatExtensions.size()]));
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/importer/ImportFormats.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void actionPerformed(ActionEvent e) {
DialogService ds = new FXDialogService();

FileChooser fs = ds.getConfiguredFileChooser(fileDialogConfiguration);
fs.getExtensionFilters().add(0, allImports);
fs.setSelectedExtensionFilter(allImports);
File f = DefaultTaskExecutor
.runInJavaFXThread(() -> fs.showOpenDialog(null));
Expand Down

0 comments on commit 5bd014f

Please sign in to comment.