diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a8e89ffe47..9b80005b94d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue where the entry preview highlight was not working when searching before opening the entry editor. [#11659](https://github.com/JabRef/jabref/pull/11659) - We fixed an issue where text in Dark mode inside "Citation information" was not readable. [#11512](https://github.com/JabRef/jabref/issues/11512) - We fixed an issue where the selection of an entry in the table lost after searching for a group. [#3176](https://github.com/JabRef/jabref/issues/3176) +- We fixed the non-functionality of the option "Automatically sync bibliography when inserting citations" in the OpenOffice panel, when enabled in case of JStyles. [#11684](https://github.com/JabRef/jabref/issues/11684) ### Removed diff --git a/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTab.java b/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTab.java index bf9f2410e06..fd151b3ec20 100644 --- a/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTab.java @@ -27,7 +27,7 @@ public class LatexCitationsTab extends EntryEditorTab { - public static final String NAME = "LaTeX Citations"; + public static final String NAME = "LaTeX citations"; private final LatexCitationsTabViewModel viewModel; private final GridPane searchPane; private final ProgressIndicator progressIndicator; diff --git a/src/main/java/org/jabref/gui/openoffice/OOBibBase.java b/src/main/java/org/jabref/gui/openoffice/OOBibBase.java index 8c1b6233ce4..2a19cfe7149 100644 --- a/src/main/java/org/jabref/gui/openoffice/OOBibBase.java +++ b/src/main/java/org/jabref/gui/openoffice/OOBibBase.java @@ -68,11 +68,8 @@ public class OOBibBase { private final DialogService dialogService; - // After inserting a citation, if ooPrefs.getSyncWhenCiting() returns true, shall we also update the bibliography? - private final boolean refreshBibliographyDuringSyncWhenCiting; - // Shall we add "Cited on pages: ..." to resolved bibliography entries? - private final boolean alwaysAddCitedOnPages; + private final boolean alwaysAddCitedOnPages; // TODO (see comment above) private final OOBibBaseConnect connection; @@ -86,7 +83,6 @@ public OOBibBase(Path loPath, DialogService dialogService) this.dialogService = dialogService; this.connection = new OOBibBaseConnect(loPath, dialogService); - this.refreshBibliographyDuringSyncWhenCiting = false; this.alwaysAddCitedOnPages = false; } @@ -576,27 +572,19 @@ public void guiActionInsertEntry(List entries, } /* - * For sync we need a FunctionalTextViewCursor. + * For sync we need a FunctionalTextViewCursor and an open database. */ OOResult fcursor = null; if (syncOptions.isPresent()) { fcursor = getFunctionalTextViewCursor(doc, errorTitle); - if (testDialog(errorTitle, fcursor.asVoidResult())) { - return; - } - } - - syncOptions - .map(e -> e.setUpdateBibliography(this.refreshBibliographyDuringSyncWhenCiting)) - .map(e -> e.setAlwaysAddCitedOnPages(this.alwaysAddCitedOnPages)); - - if (syncOptions.isPresent()) { - if (testDialog(databaseIsRequired(syncOptions.get().databases, + if (testDialog(errorTitle, fcursor.asVoidResult()) || testDialog(databaseIsRequired(syncOptions.get().databases, OOError::noDataBaseIsOpenForSyncingAfterCitation))) { return; } } + syncOptions.map(e -> e.setAlwaysAddCitedOnPages(this.alwaysAddCitedOnPages)); // TODO: Provide option to user: this is always false + try { UnoUndo.enterUndoContext(doc, "Insert citation"); @@ -873,7 +861,7 @@ public void guiActionUpdateDocument(List databases, OOStyle style) Update.SyncOptions syncOptions = new Update.SyncOptions(databases); syncOptions .setUpdateBibliography(true) - .setAlwaysAddCitedOnPages(this.alwaysAddCitedOnPages); + .setAlwaysAddCitedOnPages(this.alwaysAddCitedOnPages); // TODO: Provide option to user: this is always false unresolvedKeys = Update.synchronizeDocument(doc, frontend, jStyle, fcursor.get(), syncOptions); } finally { diff --git a/src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java b/src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java index 4e51e6ec5c1..c4416876ed8 100644 --- a/src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java +++ b/src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java @@ -553,6 +553,10 @@ private void pushEntries(CitationType citationType, boolean addPageInfo) { ? Optional.of(new Update.SyncOptions(getBaseList())) : Optional.empty(); + // Sync options are non-null only when "Automatically sync bibliography when inserting citations" is enabled + if (syncOptions.isPresent() && preferencesService.getOpenOfficePreferences().getSyncWhenCiting()) { + syncOptions.get().setUpdateBibliography(true); + } ooBase.guiActionInsertEntry(entries, bibDatabaseContext, entryTypesManager,