From a9b542374c2cf7d6b7f64dde1146491d947a1b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mochnack=C3=BD?= Date: Sun, 29 Sep 2024 10:28:57 +0200 Subject: [PATCH 1/4] Add a "view as BibTeX" option before importing an entry from the citation relation tab #11826 --- CHANGELOG.md | 1 + .../jabref/gui/entryeditor/EntryEditor.java | 5 ++ .../org/jabref/gui/entryeditor/SourceTab.java | 12 +++++ .../CitationRelationsTab.java | 54 +++++++++++++++++++ src/main/resources/l10n/JabRef_en.properties | 5 ++ 5 files changed, 77 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75c4c7e1552..6a76f711399 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv ### Added +- We added a "view as BibTeX" option before importing an entry from the citation relation tab. [#11826](https://github.com/JabRef/jabref/issues/11826) - We added probable search hits instead of exact matches. Sorting by hit score can be done by the new score table column. [#11542](https://github.com/JabRef/jabref/pull/11542) - We added support finding LaTeX-encoded special characters based on plain Unicode and vice versa. [#11542](https://github.com/JabRef/jabref/pull/11542) - When a search hits a file, the file icon of that entry is changed accordingly. [#11542](https://github.com/JabRef/jabref/pull/11542) diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java index 7e99897cadb..3a55ae29395 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java @@ -69,6 +69,7 @@ import com.tobiasdiez.easybind.EasyBind; import com.tobiasdiez.easybind.Subscription; import jakarta.inject.Inject; +import org.fxmisc.richtext.CodeArea; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -474,4 +475,8 @@ public void nextPreviewStyle() { public void previousPreviewStyle() { this.previewTabs.forEach(OffersPreview::previousPreviewStyle); } + + public CodeArea getEntrySource(BibEntry entry) { + return sourceTab.getEntryCodeArea(entry); + } } diff --git a/src/main/java/org/jabref/gui/entryeditor/SourceTab.java b/src/main/java/org/jabref/gui/entryeditor/SourceTab.java index 6161e3a24ed..d01c9eee7d1 100644 --- a/src/main/java/org/jabref/gui/entryeditor/SourceTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/SourceTab.java @@ -347,4 +347,16 @@ private void listenForSaveKeybinding(KeyEvent event) { } }); } + + public CodeArea getEntryCodeArea(BibEntry entry) { + CodeArea ca = new CodeArea(); + try { + ca.appendText(getSourceString(entry, mode, fieldPreferences)); + } catch ( + IOException ex) { + ca = null; + LOGGER.debug("Incorrect entry", ex); + } + return ca; + } } diff --git a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java index f6f8e9ca111..ddedebf31ca 100644 --- a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java @@ -4,6 +4,7 @@ import java.net.URI; import java.util.Arrays; import java.util.List; +import java.util.function.Supplier; import javax.swing.undo.UndoManager; @@ -12,11 +13,15 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.css.PseudoClass; +import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.control.Button; +import javafx.scene.control.ButtonType; +import javafx.scene.control.DialogPane; import javafx.scene.control.Label; import javafx.scene.control.ProgressIndicator; +import javafx.scene.control.ScrollPane; import javafx.scene.control.SplitPane; import javafx.scene.control.ToggleButton; import javafx.scene.control.Tooltip; @@ -29,11 +34,14 @@ import org.jabref.gui.LibraryTab; import org.jabref.gui.StateManager; import org.jabref.gui.desktop.os.NativeDesktop; +import org.jabref.gui.entryeditor.EntryEditor; import org.jabref.gui.entryeditor.EntryEditorTab; import org.jabref.gui.entryeditor.citationrelationtab.semanticscholar.CitationFetcher; import org.jabref.gui.entryeditor.citationrelationtab.semanticscholar.SemanticScholarFetcher; import org.jabref.gui.icon.IconTheme; import org.jabref.gui.preferences.GuiPreferences; +import org.jabref.gui.undo.RedoAction; +import org.jabref.gui.undo.UndoAction; import org.jabref.gui.util.NoSelectionModel; import org.jabref.gui.util.ViewModelListCellFactory; import org.jabref.logic.database.DuplicateCheck; @@ -51,6 +59,8 @@ import com.tobiasdiez.easybind.EasyBind; import org.controlsfx.control.CheckListView; +import org.fxmisc.flowless.VirtualizedScrollPane; +import org.fxmisc.richtext.CodeArea; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,6 +84,9 @@ public class CitationRelationsTab extends EntryEditorTab { private final BibEntryRelationsRepository bibEntryRelationsRepository; private final CitationsRelationsTabViewModel citationsRelationsTabViewModel; private final DuplicateCheck duplicateCheck; + private EntryEditor entryEditor; + + private StateManager stateManager; public CitationRelationsTab(DialogService dialogService, BibDatabaseContext databaseContext, @@ -87,6 +100,7 @@ public CitationRelationsTab(DialogService dialogService, this.databaseContext = databaseContext; this.preferences = preferences; this.libraryTab = libraryTab; + this.stateManager = stateManager; this.taskExecutor = taskExecutor; setText(Localization.lang("Citation relations")); setTooltip(new Tooltip(Localization.lang("Show articles related by citation"))); @@ -254,6 +268,15 @@ private void styleFetchedListView(CheckListView listView) vContainer.getChildren().addLast(openWeb); } + Button showEntrySource = IconTheme.JabRefIcons.SOURCE.asButton(); + showEntrySource.setTooltip(new Tooltip(Localization.lang("Show %0 source", databaseContext.getMode().getFormattedName()))); + showEntrySource.setOnMouseClicked(event -> { + this.entryEditor = createEntryEditor(); + showEntrySourceDialog(this.entryEditor.getEntrySource(entry.entry())); + }); + + vContainer.getChildren().addLast(showEntrySource); + hContainer.getChildren().addAll(entryNode, separator, vContainer); hContainer.getStyleClass().add("entry-container"); @@ -270,6 +293,37 @@ private void styleFetchedListView(CheckListView listView) listView.setSelectionModel(new NoSelectionModel<>()); } + private EntryEditor createEntryEditor() { + Supplier tabSupplier = () -> this.libraryTab; + return new EntryEditor(this.libraryTab, + // Actions are recreated here since this avoids passing more parameters and the amount of additional memory consumption is neglegtable. + new UndoAction(tabSupplier, dialogService, stateManager), + new RedoAction(tabSupplier, dialogService, stateManager)); + } + + private void showEntrySourceDialog(CodeArea codeArea) { + if (codeArea == null) { + dialogService.showWarningDialogAndWait(Localization.lang("BibTeX source", databaseContext.getMode().getFormattedName()), Localization.lang("Could not load %0 source", databaseContext.getMode().getFormattedName())); + } else { + String title = Localization.lang("BibTeX of that entry"); + + codeArea.setWrapText(true); + codeArea.setPadding(new Insets(0, 10, 0, 10)); + codeArea.showParagraphAtTop(0); + + ScrollPane scrollPane = new ScrollPane(); + scrollPane.setFitToWidth(true); + scrollPane.setFitToHeight(true); + scrollPane.setContent(new VirtualizedScrollPane<>(codeArea)); + + DialogPane dialogPane = new DialogPane(); + dialogPane.setPrefSize(800, 400); + dialogPane.setContent(scrollPane); + + dialogService.showCustomDialogAndWait(title, dialogPane, ButtonType.OK); + } + } + /** * Method to style heading labels * diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 2ec8827add2..b5df5c1e3e2 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2782,3 +2782,8 @@ Warning\:\ The\ selected\ directory\ is\ not\ a\ valid\ directory.=Warning: The Currently\ selected\ JStyle\:\ '%0' = Currently selected JStyle: '%0' Currently\ selected\ CSL\ Style\:\ '%0' = Currently selected CSL Style: '%0' Store\ url\ for\ downloaded\ file=Store url for downloaded file + +BibTeX\ of\ that\ entry=BibTeX of that entry +Could\ not\ load\ %0\ source=Could not load %0 source +BibTeX\ source=BibTeX source +Show\ %0\ source=Show %0 source From bfe9dc9e325c149654d799d99d9f81a9e83e564c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mochnack=C3=BD?= Date: Sun, 29 Sep 2024 17:16:29 +0200 Subject: [PATCH 2/4] Correction of created errors #11826 --- .../jabref/gui/entryeditor/EntryEditor.java | 5 -- .../org/jabref/gui/entryeditor/SourceTab.java | 12 ---- .../CitationRelationsTab.java | 63 ++++++++++--------- src/main/resources/l10n/JabRef_en.properties | 5 -- 4 files changed, 34 insertions(+), 51 deletions(-) diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java index 3a55ae29395..7e99897cadb 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java @@ -69,7 +69,6 @@ import com.tobiasdiez.easybind.EasyBind; import com.tobiasdiez.easybind.Subscription; import jakarta.inject.Inject; -import org.fxmisc.richtext.CodeArea; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -475,8 +474,4 @@ public void nextPreviewStyle() { public void previousPreviewStyle() { this.previewTabs.forEach(OffersPreview::previousPreviewStyle); } - - public CodeArea getEntrySource(BibEntry entry) { - return sourceTab.getEntryCodeArea(entry); - } } diff --git a/src/main/java/org/jabref/gui/entryeditor/SourceTab.java b/src/main/java/org/jabref/gui/entryeditor/SourceTab.java index d01c9eee7d1..6161e3a24ed 100644 --- a/src/main/java/org/jabref/gui/entryeditor/SourceTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/SourceTab.java @@ -347,16 +347,4 @@ private void listenForSaveKeybinding(KeyEvent event) { } }); } - - public CodeArea getEntryCodeArea(BibEntry entry) { - CodeArea ca = new CodeArea(); - try { - ca.appendText(getSourceString(entry, mode, fieldPreferences)); - } catch ( - IOException ex) { - ca = null; - LOGGER.debug("Incorrect entry", ex); - } - return ca; - } } diff --git a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java index ddedebf31ca..b40be634892 100644 --- a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java @@ -1,10 +1,10 @@ package org.jabref.gui.entryeditor.citationrelationtab; import java.io.IOException; +import java.io.StringWriter; import java.net.URI; import java.util.Arrays; import java.util.List; -import java.util.function.Supplier; import javax.swing.undo.UndoManager; @@ -40,15 +40,18 @@ import org.jabref.gui.entryeditor.citationrelationtab.semanticscholar.SemanticScholarFetcher; import org.jabref.gui.icon.IconTheme; import org.jabref.gui.preferences.GuiPreferences; -import org.jabref.gui.undo.RedoAction; -import org.jabref.gui.undo.UndoAction; import org.jabref.gui.util.NoSelectionModel; import org.jabref.gui.util.ViewModelListCellFactory; +import org.jabref.logic.bibtex.BibEntryWriter; +import org.jabref.logic.bibtex.FieldWriter; import org.jabref.logic.database.DuplicateCheck; +import org.jabref.logic.exporter.BibWriter; import org.jabref.logic.l10n.Localization; +import org.jabref.logic.os.OS; import org.jabref.logic.util.BackgroundTask; import org.jabref.logic.util.TaskExecutor; import org.jabref.model.database.BibDatabaseContext; +import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.database.BibDatabaseModeDetection; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibEntryTypesManager; @@ -269,10 +272,9 @@ private void styleFetchedListView(CheckListView listView) } Button showEntrySource = IconTheme.JabRefIcons.SOURCE.asButton(); - showEntrySource.setTooltip(new Tooltip(Localization.lang("Show %0 source", databaseContext.getMode().getFormattedName()))); + showEntrySource.setTooltip(new Tooltip(Localization.lang("%0 source", databaseContext.getMode().getFormattedName()))); showEntrySource.setOnMouseClicked(event -> { - this.entryEditor = createEntryEditor(); - showEntrySourceDialog(this.entryEditor.getEntrySource(entry.entry())); + showEntrySourceDialog(entry.entry()); }); vContainer.getChildren().addLast(showEntrySource); @@ -293,35 +295,38 @@ private void styleFetchedListView(CheckListView listView) listView.setSelectionModel(new NoSelectionModel<>()); } - private EntryEditor createEntryEditor() { - Supplier tabSupplier = () -> this.libraryTab; - return new EntryEditor(this.libraryTab, - // Actions are recreated here since this avoids passing more parameters and the amount of additional memory consumption is neglegtable. - new UndoAction(tabSupplier, dialogService, stateManager), - new RedoAction(tabSupplier, dialogService, stateManager)); + private String getSourceString(BibEntry entry, BibDatabaseMode type) throws IOException { + StringWriter writer = new StringWriter(); + BibWriter bibWriter = new BibWriter(writer, OS.NEWLINE); + FieldWriter fieldWriter = FieldWriter.buildIgnoreHashes(this.preferences.getFieldPreferences()); + new BibEntryWriter(fieldWriter, new BibEntryTypesManager()).write(entry, bibWriter, type); + return writer.toString(); } - private void showEntrySourceDialog(CodeArea codeArea) { - if (codeArea == null) { - dialogService.showWarningDialogAndWait(Localization.lang("BibTeX source", databaseContext.getMode().getFormattedName()), Localization.lang("Could not load %0 source", databaseContext.getMode().getFormattedName())); - } else { - String title = Localization.lang("BibTeX of that entry"); + private void showEntrySourceDialog(BibEntry entry) { + CodeArea ca = new CodeArea(); + try { + ca.appendText(getSourceString(entry, databaseContext.getMode())); + } catch (IOException e) { + LOGGER.warn("Incorrect entry, could not load source:", e); + return; + } - codeArea.setWrapText(true); - codeArea.setPadding(new Insets(0, 10, 0, 10)); - codeArea.showParagraphAtTop(0); + ca.setWrapText(true); + ca.setPadding(new Insets(0, 10, 0, 10)); + ca.showParagraphAtTop(0); - ScrollPane scrollPane = new ScrollPane(); - scrollPane.setFitToWidth(true); - scrollPane.setFitToHeight(true); - scrollPane.setContent(new VirtualizedScrollPane<>(codeArea)); + ScrollPane scrollPane = new ScrollPane(); + scrollPane.setFitToWidth(true); + scrollPane.setFitToHeight(true); + scrollPane.setContent(new VirtualizedScrollPane<>(ca)); - DialogPane dialogPane = new DialogPane(); - dialogPane.setPrefSize(800, 400); - dialogPane.setContent(scrollPane); + DialogPane dialogPane = new DialogPane(); + dialogPane.setPrefSize(800, 400); + dialogPane.setContent(scrollPane); + String title = Localization.lang("%0 source", "Show BibTeX"); - dialogService.showCustomDialogAndWait(title, dialogPane, ButtonType.OK); - } + dialogService.showCustomDialogAndWait(title, dialogPane, ButtonType.OK); } /** diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index b5df5c1e3e2..2ec8827add2 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2782,8 +2782,3 @@ Warning\:\ The\ selected\ directory\ is\ not\ a\ valid\ directory.=Warning: The Currently\ selected\ JStyle\:\ '%0' = Currently selected JStyle: '%0' Currently\ selected\ CSL\ Style\:\ '%0' = Currently selected CSL Style: '%0' Store\ url\ for\ downloaded\ file=Store url for downloaded file - -BibTeX\ of\ that\ entry=BibTeX of that entry -Could\ not\ load\ %0\ source=Could not load %0 source -BibTeX\ source=BibTeX source -Show\ %0\ source=Show %0 source From e45203dc7bf9c834aa89a7c2a97f7b72f8b5d791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mochnack=C3=BD?= Date: Sun, 29 Sep 2024 18:44:02 +0200 Subject: [PATCH 3/4] Fix problems #11826 --- .../CitationRelationsTab.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java index b40be634892..0ab0b1dc7be 100644 --- a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java @@ -33,8 +33,8 @@ import org.jabref.gui.DialogService; import org.jabref.gui.LibraryTab; import org.jabref.gui.StateManager; +import org.jabref.gui.collab.entrychange.PreviewWithSourceTab; import org.jabref.gui.desktop.os.NativeDesktop; -import org.jabref.gui.entryeditor.EntryEditor; import org.jabref.gui.entryeditor.EntryEditorTab; import org.jabref.gui.entryeditor.citationrelationtab.semanticscholar.CitationFetcher; import org.jabref.gui.entryeditor.citationrelationtab.semanticscholar.SemanticScholarFetcher; @@ -43,6 +43,7 @@ import org.jabref.gui.util.NoSelectionModel; import org.jabref.gui.util.ViewModelListCellFactory; import org.jabref.logic.bibtex.BibEntryWriter; +import org.jabref.logic.bibtex.FieldPreferences; import org.jabref.logic.bibtex.FieldWriter; import org.jabref.logic.database.DuplicateCheck; import org.jabref.logic.exporter.BibWriter; @@ -87,9 +88,7 @@ public class CitationRelationsTab extends EntryEditorTab { private final BibEntryRelationsRepository bibEntryRelationsRepository; private final CitationsRelationsTabViewModel citationsRelationsTabViewModel; private final DuplicateCheck duplicateCheck; - private EntryEditor entryEditor; - - private StateManager stateManager; + private final BibEntryTypesManager entryTypesManager; public CitationRelationsTab(DialogService dialogService, BibDatabaseContext databaseContext, @@ -103,12 +102,12 @@ public CitationRelationsTab(DialogService dialogService, this.databaseContext = databaseContext; this.preferences = preferences; this.libraryTab = libraryTab; - this.stateManager = stateManager; this.taskExecutor = taskExecutor; setText(Localization.lang("Citation relations")); setTooltip(new Tooltip(Localization.lang("Show articles related by citation"))); - this.duplicateCheck = new DuplicateCheck(new BibEntryTypesManager()); + this.entryTypesManager = new BibEntryTypesManager(); + this.duplicateCheck = new DuplicateCheck(entryTypesManager); this.bibEntryRelationsRepository = new BibEntryRelationsRepository(new SemanticScholarFetcher(preferences.getImporterPreferences()), new BibEntryRelationsCache()); citationsRelationsTabViewModel = new CitationsRelationsTabViewModel(databaseContext, preferences, undoManager, stateManager, dialogService, fileUpdateMonitor, taskExecutor); @@ -272,7 +271,7 @@ private void styleFetchedListView(CheckListView listView) } Button showEntrySource = IconTheme.JabRefIcons.SOURCE.asButton(); - showEntrySource.setTooltip(new Tooltip(Localization.lang("%0 source", databaseContext.getMode().getFormattedName()))); + showEntrySource.setTooltip(new Tooltip(Localization.lang("%0 source", "BibTeX"))); showEntrySource.setOnMouseClicked(event -> { showEntrySourceDialog(entry.entry()); }); @@ -295,18 +294,21 @@ private void styleFetchedListView(CheckListView listView) listView.setSelectionModel(new NoSelectionModel<>()); } - private String getSourceString(BibEntry entry, BibDatabaseMode type) throws IOException { + /** + * @implNote This code is similar to {@link PreviewWithSourceTab#getSourceString(BibEntry, BibDatabaseMode, FieldPreferences, BibEntryTypesManager)}. + */ + private String getSourceString(BibEntry entry, BibDatabaseMode type, FieldPreferences fieldPreferences, BibEntryTypesManager entryTypesManager) throws IOException { StringWriter writer = new StringWriter(); BibWriter bibWriter = new BibWriter(writer, OS.NEWLINE); - FieldWriter fieldWriter = FieldWriter.buildIgnoreHashes(this.preferences.getFieldPreferences()); - new BibEntryWriter(fieldWriter, new BibEntryTypesManager()).write(entry, bibWriter, type); + FieldWriter fieldWriter = FieldWriter.buildIgnoreHashes(fieldPreferences); + new BibEntryWriter(fieldWriter, entryTypesManager).write(entry, bibWriter, type); return writer.toString(); } private void showEntrySourceDialog(BibEntry entry) { CodeArea ca = new CodeArea(); try { - ca.appendText(getSourceString(entry, databaseContext.getMode())); + ca.appendText(getSourceString(entry, databaseContext.getMode(), preferences.getFieldPreferences(), this.entryTypesManager)); } catch (IOException e) { LOGGER.warn("Incorrect entry, could not load source:", e); return; @@ -324,7 +326,7 @@ private void showEntrySourceDialog(BibEntry entry) { DialogPane dialogPane = new DialogPane(); dialogPane.setPrefSize(800, 400); dialogPane.setContent(scrollPane); - String title = Localization.lang("%0 source", "Show BibTeX"); + String title = Localization.lang("Show BibTeX source"); dialogService.showCustomDialogAndWait(title, dialogPane, ButtonType.OK); } From cbf35b60d7a9e4ab0e0bf7e1fe64e6a849ae0b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mochnack=C3=BD?= Date: Sun, 29 Sep 2024 20:28:57 +0200 Subject: [PATCH 4/4] Fix: Issuance of an instance #11826 --- src/main/java/org/jabref/gui/entryeditor/EntryEditor.java | 2 +- .../citationrelationtab/CitationRelationsTab.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java index 7e99897cadb..88c282366f2 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java @@ -299,7 +299,7 @@ private List createTabs() { tabs.add(new FileAnnotationTab(libraryTab.getAnnotationCache())); tabs.add(new SciteTab(preferences, taskExecutor, dialogService)); tabs.add(new CitationRelationsTab(dialogService, databaseContext, - undoManager, stateManager, fileMonitor, preferences, libraryTab, taskExecutor)); + undoManager, stateManager, fileMonitor, preferences, libraryTab, taskExecutor, bibEntryTypesManager)); tabs.add(new RelatedArticlesTab(buildInfo, databaseContext, preferences, dialogService, taskExecutor)); sourceTab = new SourceTab( databaseContext, diff --git a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java index 0ab0b1dc7be..3ab2a167b9c 100644 --- a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java @@ -97,7 +97,8 @@ public CitationRelationsTab(DialogService dialogService, FileUpdateMonitor fileUpdateMonitor, GuiPreferences preferences, LibraryTab libraryTab, - TaskExecutor taskExecutor) { + TaskExecutor taskExecutor, + BibEntryTypesManager bibEntryTypesManager) { this.dialogService = dialogService; this.databaseContext = databaseContext; this.preferences = preferences; @@ -106,7 +107,7 @@ public CitationRelationsTab(DialogService dialogService, setText(Localization.lang("Citation relations")); setTooltip(new Tooltip(Localization.lang("Show articles related by citation"))); - this.entryTypesManager = new BibEntryTypesManager(); + this.entryTypesManager = bibEntryTypesManager; this.duplicateCheck = new DuplicateCheck(entryTypesManager); this.bibEntryRelationsRepository = new BibEntryRelationsRepository(new SemanticScholarFetcher(preferences.getImporterPreferences()), new BibEntryRelationsCache());