From d2d84923df2c6c7d59559da8d583ae17dc803c3d Mon Sep 17 00:00:00 2001 From: "Anish.Pal" Date: Mon, 29 Jan 2024 13:21:23 +0530 Subject: [PATCH 1/4] #8145 Fix Suggestion Provider for Crossref during autocompletion disable --- src/main/java/org/jabref/gui/LibraryTab.java | 3 ++- .../org/jabref/gui/autocompleter/SuggestionProviders.java | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/LibraryTab.java b/src/main/java/org/jabref/gui/LibraryTab.java index 31c3c4bfc07..969b4897850 100644 --- a/src/main/java/org/jabref/gui/LibraryTab.java +++ b/src/main/java/org/jabref/gui/LibraryTab.java @@ -563,7 +563,8 @@ private void setupAutoCompletion() { suggestionProviders = new SuggestionProviders(getDatabase(), Globals.journalAbbreviationRepository, autoCompletePreferences); } else { // Create empty suggestion providers if auto-completion is deactivated - suggestionProviders = new SuggestionProviders(); +// suggestionProviders = new SuggestionProviders(); + suggestionProviders = new SuggestionProviders(getDatabase()); } searchAutoCompleter = new PersonNameSuggestionProvider(FieldFactory.getPersonNameFields(), getDatabase()); } diff --git a/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java b/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java index 06d2abef8a8..ff56f1b6fd7 100644 --- a/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java +++ b/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java @@ -22,12 +22,17 @@ public SuggestionProviders(BibDatabase database, JournalAbbreviationRepository a this.isEmpty = false; } - public SuggestionProviders() { + public SuggestionProviders(BibDatabase database) { + this.database = database; this.isEmpty = true; } public SuggestionProvider getForField(Field field) { if (isEmpty || !autoCompletePreferences.getCompleteFields().contains(field)) { + Set fieldProperties = field.getProperties(); + if (fieldProperties.contains(FieldProperty.SINGLE_ENTRY_LINK)) { + return new BibEntrySuggestionProvider(database); + } return new EmptySuggestionProvider(); } From 5436e69c920980068df1f106c814336a752e9ca9 Mon Sep 17 00:00:00 2001 From: "Anish.Pal" Date: Mon, 29 Jan 2024 15:35:08 +0530 Subject: [PATCH 2/4] #8145 Fix Test Cases Related Issue --- .../org/jabref/gui/autocompleter/SuggestionProviders.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java b/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java index ff56f1b6fd7..7aab315ed78 100644 --- a/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java +++ b/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java @@ -27,6 +27,10 @@ public SuggestionProviders(BibDatabase database) { this.isEmpty = true; } + public SuggestionProviders() { + this.isEmpty = true; + } + public SuggestionProvider getForField(Field field) { if (isEmpty || !autoCompletePreferences.getCompleteFields().contains(field)) { Set fieldProperties = field.getProperties(); @@ -35,6 +39,9 @@ public SuggestionProvider getForField(Field field) { } return new EmptySuggestionProvider(); } +// if (isEmpty || !autoCompletePreferences.getCompleteFields().contains(field)) { +// return new EmptySuggestionProvider(); +// } Set fieldProperties = field.getProperties(); if (fieldProperties.contains(FieldProperty.PERSON_NAMES)) { From 0c417fb62521b68ce8e93be0512f7aff3d412216 Mon Sep 17 00:00:00 2001 From: "Anish.Pal" Date: Tue, 30 Jan 2024 08:22:44 +0530 Subject: [PATCH 3/4] #8145 Removed unwanted commented code --- src/main/java/org/jabref/gui/LibraryTab.java | 3 +-- .../java/org/jabref/gui/autocompleter/SuggestionProviders.java | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/LibraryTab.java b/src/main/java/org/jabref/gui/LibraryTab.java index 969b4897850..8b670b4f43c 100644 --- a/src/main/java/org/jabref/gui/LibraryTab.java +++ b/src/main/java/org/jabref/gui/LibraryTab.java @@ -562,8 +562,7 @@ private void setupAutoCompletion() { if (autoCompletePreferences.shouldAutoComplete()) { suggestionProviders = new SuggestionProviders(getDatabase(), Globals.journalAbbreviationRepository, autoCompletePreferences); } else { - // Create empty suggestion providers if auto-completion is deactivated -// suggestionProviders = new SuggestionProviders(); + // Create suggestion providers with database for crossref if auto-completion is deactivated suggestionProviders = new SuggestionProviders(getDatabase()); } searchAutoCompleter = new PersonNameSuggestionProvider(FieldFactory.getPersonNameFields(), getDatabase()); diff --git a/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java b/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java index 7aab315ed78..7d023f4d815 100644 --- a/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java +++ b/src/main/java/org/jabref/gui/autocompleter/SuggestionProviders.java @@ -39,9 +39,6 @@ public SuggestionProvider getForField(Field field) { } return new EmptySuggestionProvider(); } -// if (isEmpty || !autoCompletePreferences.getCompleteFields().contains(field)) { -// return new EmptySuggestionProvider(); -// } Set fieldProperties = field.getProperties(); if (fieldProperties.contains(FieldProperty.PERSON_NAMES)) { From c5fd61fb0cc08dc08b14573de340c2315d6078fb Mon Sep 17 00:00:00 2001 From: "Anish.Pal" Date: Wed, 31 Jan 2024 04:37:36 +0530 Subject: [PATCH 4/4] #8145 Added Changelog.md file --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e91f5ae991..c83a4906cc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - The last page of a PDF is now indexed by the full text search. [#10193](https://github.com/JabRef/jabref/issues/10193) - We fixed an issue where the duplicate check did not take umlauts or other LaTeX-encoded characters into account. [#10744](https://github.com/JabRef/jabref/pull/10744) - We fixed the colors of the icon on hover for unset special fields. [#10431](https://github.com/JabRef/jabref/issues/10431) +- We fixed an issue where the CrossRef field did not work if autocompletion was disabled [#8145](https://github.com/JabRef/jabref/issues/8145) ### Removed