Skip to content

Commit

Permalink
Some OS didn't show directories when a file type was selected in the …
Browse files Browse the repository at this point in the history
…import dialog
  • Loading branch information
chriba committed Aug 19, 2016
1 parent fc0129e commit 81d51a9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ class ImportFileFilter extends FileFilter implements Comparable<ImportFileFilter

private final ImportFormat format;
private final String name;
private final FileNameExtensionFilter filextFilter;
private final FileNameExtensionFilter extensionFilter;


public ImportFileFilter(ImportFormat format) {
this.format = format;
FileExtensions extensions = format.getExtensions();
this.name = extensions.getDescription();
filextFilter = new FileNameExtensionFilter(extensions.getDescription(), extensions.getExtensions());
this.extensionFilter = new FileNameExtensionFilter(extensions.getDescription(), extensions.getExtensions());
}

public ImportFormat getImportFormat() {
Expand All @@ -43,7 +43,7 @@ public ImportFormat getImportFormat() {

@Override
public boolean accept(File file) {
return filextFilter.accept(file);
return (file != null) && (file.isDirectory() || extensionFilter.accept(file));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import javax.swing.Action;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;

import javax.swing.filechooser.FileFilter;

import net.sf.jabref.Globals;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sf/jabref/logic/util/FileExtensions.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public enum FileExtensions {
//important: No dot before the extension!
BIBTEX_DB(String.format("%1s %2s", "BibTex", Localization.lang("Database")), "bib"),
BIBTEXML(Localization.lang("%0 file", "BibTeXML"), "bibx"),
BIBTEXML(Localization.lang("%0 file", "BibTeXML"), "bibx", "xml"),
BILBIOSCAPE(Localization.lang("%0 file", "Biblioscape"), "txt"),
COPAC(Localization.lang("%0 file", "Copac"), "txt"),
ENDNOTE(Localization.lang("%0 file", "Endnote/Refer"), "ref", "enw"),
Expand Down

0 comments on commit 81d51a9

Please sign in to comment.