diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bc2528ecbf0..dc427178bccd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ + # Changelog All notable changes to this project will be documented in this file. @@ -108,7 +109,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue with the Science Direct fetcher where PDFs could not be downloaded. Fixes [#5860](https://github.com/JabRef/jabref/issues/5860) - We fixed an issue with the Library of Congress importer. - We fixed the [link to the external libraries listing](https://github.com/JabRef/jabref/blob/master/external-libraries.md) in the about dialog - +- We fixed linked identifier icon inconsistency[#6705](https://github.com/JabRef/jabref/issues/6705) ### Removed - We removed the option of the "enforce legal key". [#6295](https://github.com/JabRef/jabref/issues/6295) diff --git a/src/main/java/org/jabref/gui/icon/IconTheme.java b/src/main/java/org/jabref/gui/icon/IconTheme.java index f7143eb71555..d0c39451d404 100644 --- a/src/main/java/org/jabref/gui/icon/IconTheme.java +++ b/src/main/java/org/jabref/gui/icon/IconTheme.java @@ -300,7 +300,9 @@ public enum JabRefIcons implements JabRefIcon { REMOVE_ABBREVIATION(MaterialDesignIcon.PLAYLIST_MINUS), NEW_ENTRY_FROM_PLAIN_TEXT(MaterialDesignIcon.PLUS_BOX), REMOTE_DATABASE(MaterialDesignIcon.DATABASE), - HOME(MaterialDesignIcon.HOME); + HOME(MaterialDesignIcon.HOME), + DATABASE(MaterialDesignIcon.DATABASE), + DATABASE_PLUS(MaterialDesignIcon.DATABASE_PLUS); private final JabRefIcon icon; diff --git a/src/main/java/org/jabref/gui/maintable/CellFactory.java b/src/main/java/org/jabref/gui/maintable/CellFactory.java index 29b164f657e8..ac7d3f005bb5 100644 --- a/src/main/java/org/jabref/gui/maintable/CellFactory.java +++ b/src/main/java/org/jabref/gui/maintable/CellFactory.java @@ -27,10 +27,14 @@ public CellFactory(ExternalFileTypes externalFileTypes, UndoManager undoManager) // icon.setToo(Localization.lang("Open") + " PDF"); TABLE_ICONS.put(StandardField.PDF, icon); - icon = IconTheme.JabRefIcons.WWW; + icon = IconTheme.JabRefIcons.DATABASE; // icon.setToolTipText(Localization.lang("Open") + " URL"); TABLE_ICONS.put(StandardField.URL, icon); + icon = IconTheme.JabRefIcons.DATABASE_PLUS; + // icon.setToolTipText(Localization.lang("Open") + " URL"); + TABLE_ICONS.put(StandardField.URLS, icon); + icon = IconTheme.JabRefIcons.WWW; // icon.setToolTipText(Localization.lang("Open") + " CiteSeer URL"); TABLE_ICONS.put(new UnknownField("citeseerurl"), icon); @@ -94,6 +98,7 @@ public CellFactory(ExternalFileTypes externalFileTypes, UndoManager undoManager) icon = printedViewModel.getIcon(); // icon.setToolTipText(printedViewModel.getLocalization()); TABLE_ICONS.put(SpecialField.PRINTED, icon); + } public Node getTableIcon(Field field) { diff --git a/src/main/java/org/jabref/gui/maintable/columns/LinkedIdentifierColumn.java b/src/main/java/org/jabref/gui/maintable/columns/LinkedIdentifierColumn.java index ea0ad5376b21..5b33d81f05bf 100644 --- a/src/main/java/org/jabref/gui/maintable/columns/LinkedIdentifierColumn.java +++ b/src/main/java/org/jabref/gui/maintable/columns/LinkedIdentifierColumn.java @@ -7,6 +7,7 @@ import javafx.scene.control.ContextMenu; import javafx.scene.control.MenuItem; import javafx.scene.control.Tooltip; +import javafx.scene.input.MouseButton; import org.jabref.gui.DialogService; import org.jabref.gui.desktop.JabRefDesktop; @@ -49,17 +50,31 @@ public LinkedIdentifierColumn(MainTableColumnModel model, this.setResizable(false); this.setCellValueFactory(cellData -> cellData.getValue().getLinkedIdentifiers()); new ValueTableCellFactory>() - .withGraphic(this::createIdentifierGraphic) + .withGraphic(values -> createIdentifierGraphic(values)) .withTooltip(this::createIdentifierTooltip) .withMenu(this::createIdentifierMenu) + .withOnMouseClickedEvent((entry, linkedFiles) -> event -> { + if ((event.getButton() == MouseButton.PRIMARY) && (linkedFiles.size() == 1)) { + // Open linked identifier directly only if 1 entry is preset + try { + for (Field field : linkedFiles.keySet()) { + JabRefDesktop.openExternalViewer(database, linkedFiles.get(field), field); + } + } catch (IOException e) { + dialogService.showErrorDialogAndWait(Localization.lang("Unable to open link."), e); + } + } + }) .install(this); } private Node createIdentifierGraphic(Map values) { - if (values.isEmpty()) { - return null; - } else { + if (values.size() > 1) { + return cellFactory.getTableIcon(StandardField.URLS); + } else if (values.size() == 1) { return cellFactory.getTableIcon(StandardField.URL); + } else { + return null; } } @@ -72,6 +87,10 @@ private String createIdentifierTooltip(Map values) { private ContextMenu createIdentifierMenu(BibEntryTableViewModel entry, Map values) { ContextMenu contextMenu = new ContextMenu(); + if (values.size() <= 1) { + return null; + } + values.keySet().forEach(field -> { MenuItem menuItem = new MenuItem(field.getDisplayName() + ": " + ControlHelper.truncateString(values.get(field), -1, "...", ControlHelper.EllipsisPosition.CENTER), diff --git a/src/main/java/org/jabref/model/entry/field/StandardField.java b/src/main/java/org/jabref/model/entry/field/StandardField.java index a6f0a998b5f0..5e3fcf8d16a9 100644 --- a/src/main/java/org/jabref/model/entry/field/StandardField.java +++ b/src/main/java/org/jabref/model/entry/field/StandardField.java @@ -123,6 +123,7 @@ public enum StandardField implements Field { TYPE("type", FieldProperty.TYPE), URI("uri", "URI"), URL("url", "URL", FieldProperty.EXTERNAL, FieldProperty.VERBATIM), + URLS("urls", "URLS", FieldProperty.VERBATIM), URLDATE("urldate", FieldProperty.DATE), VENUE("venue"), VERSION("version"),