Skip to content

Commit

Permalink
Fix generate bibtex key overwrite warning dialog
Browse files Browse the repository at this point in the history
Fixes #4417
  • Loading branch information
Siedlerchr committed Oct 27, 2018
1 parent 940fa2c commit 8d579f8
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
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;
import org.jabref.preferences.JabRefPreferences;

public class GenerateBibtexKeyAction implements BaseAction {
private final DialogService dialogService;
private BasePanel basePanel;
private final BasePanel basePanel;
private List<BibEntry> entries;
private boolean isCanceled;

Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 8d579f8

Please sign in to comment.