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

Fix Suggestion Provider for Crossref during autocompletion disable #10829

Merged
merged 8 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading