forked from JabRef/jabref
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix selecting custom export for copy to clipboard with uppercase file…
… ext (JabRef#6290) * Fix selecting custom export for copy to clpboard with uppercase file ext Fixes JabRef#6285 * fix annoying checkstyle * Pass some more globals show error dialog on ex instead of rethrowing * make checkstyle happy * implement enum analogous to InternalField logic * make new extensions lowercase
- Loading branch information
1 parent
2825c29
commit 5758f8b
Showing
8 changed files
with
97 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.jabref.logic.util; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Objects; | ||
|
||
public class UnknownFileType implements FileType { | ||
|
||
private final List<String> extensions; | ||
|
||
public UnknownFileType(String... extensions) { | ||
for (int i = 0; i < extensions.length; i++) { | ||
if (extensions[i].contains(".")) { | ||
extensions[i] = extensions[i].substring(extensions[i].indexOf('.') + 1); | ||
} | ||
extensions[i] = extensions[i].toLowerCase(Locale.ROOT); | ||
} | ||
this.extensions = Arrays.asList(extensions); | ||
} | ||
|
||
@Override | ||
public List<String> getExtensions() { | ||
return extensions; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof FileType)) { | ||
return false; | ||
} | ||
FileType other = (FileType) o; | ||
Collections.sort(extensions); | ||
Collections.sort(other.getExtensions()); | ||
return extensions.equals(other.getExtensions()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(extensions); | ||
} | ||
} |