diff --git a/src/main/java/org/jabref/gui/actions/GenerateBibtexKeyAction.java b/src/main/java/org/jabref/gui/actions/GenerateBibtexKeyAction.java index 5fa5eb5e76c..a2844236efb 100644 --- a/src/main/java/org/jabref/gui/actions/GenerateBibtexKeyAction.java +++ b/src/main/java/org/jabref/gui/actions/GenerateBibtexKeyAction.java @@ -8,6 +8,7 @@ import org.jabref.gui.undo.NamedCompound; import org.jabref.gui.undo.UndoableKeyChange; import org.jabref.gui.util.BackgroundTask; +import org.jabref.gui.util.DefaultTaskExecutor; import org.jabref.logic.bibtexkeypattern.BibtexKeyGenerator; import org.jabref.logic.l10n.Localization; import org.jabref.model.entry.BibEntry; @@ -15,7 +16,7 @@ public class GenerateBibtexKeyAction implements BaseAction { private final DialogService dialogService; - private BasePanel basePanel; + private final BasePanel basePanel; private List entries; private boolean isCanceled; @@ -44,6 +45,7 @@ public static boolean confirmOverwriteKeys(DialogService dialogService) { Localization.lang("Cancel"), Localization.lang("Disable this confirmation dialog"), optOut -> Globals.prefs.putBoolean(JabRefPreferences.WARN_BEFORE_OVERWRITING_KEY, !optOut)); + } else { // Always overwrite keys by default return true; @@ -56,7 +58,7 @@ private void generateKeys() { entries.removeIf(BibEntry::hasCiteKey); // if we're going to override some cite keys warn the user about it } else if (entries.parallelStream().anyMatch(BibEntry::hasCiteKey)) { - boolean overwriteKeys = confirmOverwriteKeys(dialogService); + boolean overwriteKeys = DefaultTaskExecutor.runInJavaFXThread(() -> confirmOverwriteKeys(dialogService)); // The user doesn't want to override cite keys if (!overwriteKeys) {