Skip to content

Commit

Permalink
Fix Suggestion Provider for Crossref during autocompletion disable (#…
Browse files Browse the repository at this point in the history
…10829)

* #8145 Fix Suggestion Provider for Crossref during autocompletion disable

* #8145 Fix Test Cases Related Issue

* #8145 Removed unwanted commented code

* #8145 Added Changelog.md file

---------

Co-authored-by: Anish.Pal <[email protected]>
  • Loading branch information
pal-anish and Anish.Pal authored Feb 1, 2024
1 parent 86afd8e commit 4bd3771
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ 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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,21 @@ public SuggestionProviders(BibDatabase database, JournalAbbreviationRepository a
this.isEmpty = false;
}

public SuggestionProviders(BibDatabase database) {
this.database = database;
this.isEmpty = true;
}

public SuggestionProviders() {
this.isEmpty = true;
}

public SuggestionProvider<?> getForField(Field field) {
if (isEmpty || !autoCompletePreferences.getCompleteFields().contains(field)) {
Set<FieldProperty> fieldProperties = field.getProperties();
if (fieldProperties.contains(FieldProperty.SINGLE_ENTRY_LINK)) {
return new BibEntrySuggestionProvider(database);
}
return new EmptySuggestionProvider();
}

Expand Down

0 comments on commit 4bd3771

Please sign in to comment.