Skip to content

Commit

Permalink
Showing correct icon on main table linked files column (#6264)
Browse files Browse the repository at this point in the history
* Showing correct icon on main table linked files column

* Showing correct icon on both main table and linked files column

* Showing correct icon on both main table and linked file editor list

* delete the TODO comments

* add record in CHANGELOG.md
  • Loading branch information
leitianjian committed Apr 15, 2020
1 parent 6635ece commit de7deb2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue when importing into current library an erroneous message "import cancelled" is displayed even though import is successful. [#6266](https://github.com/JabRef/jabref/issues/6266)
- We fixed an issue where custom jstyles for Open/LibreOffice where not saved correctly. [#6170](https://github.com/JabRef/jabref/issues/6170)
- We fixed an issue where the INSPIRE fetcher was no longer working [#6229](https://github.com/JabRef/jabref/issues/6229)

- We fixed the display of icon both in the main table and linked file editor. [#6169](https://github.com/JabRef/jabref/issues/6169)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Set<ExternalFileType> getExternalFileTypeSelection() {
* @return The ExternalFileType registered, or null if none.
*/
public Optional<ExternalFileType> getExternalFileTypeByName(String name) {
Optional<ExternalFileType> externalFileType = externalFileTypes.stream().filter(type -> type.getExtension().equals(name)).findFirst();
Optional<ExternalFileType> externalFileType = externalFileTypes.stream().filter(type -> type.getName().equals(name)).findFirst();
if (externalFileType.isPresent()) {
return externalFileType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,10 @@ public Optional<Path> findIn(List<Path> directories) {
return linkedFile.findIn(directories);
}

/**
* TODO: Be a bit smarter and try to infer correct icon, for example using {@link
* org.jabref.gui.externalfiletype.ExternalFileTypes#getExternalFileTypeByName(String)}
*/
public JabRefIcon getTypeIcon() {
return IconTheme.JabRefIcons.PDF_FILE;
return externalFileTypes.fromLinkedFile(linkedFile, false)
.map(ExternalFileType::getIcon)
.orElse(IconTheme.JabRefIcons.FILE);
}

public void markAsAutomaticallyFound() {
Expand Down

0 comments on commit de7deb2

Please sign in to comment.