Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing correct icon on main table linked files column #6264

Merged
merged 7 commits into from
Apr 15, 2020
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also remove the above TODO

Copy link
Contributor Author

@leitianjian leitianjian Apr 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I get it. I will finish it in one hour. Many thanks for your instructions

.map(ExternalFileType::getIcon)
.orElse(IconTheme.JabRefIcons.FILE);
}

public void markAsAutomaticallyFound() {
Expand Down