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 generate bibtex key overwrite warning dialog #4418

Merged
merged 3 commits into from
Oct 27, 2018
Merged
Changes from 1 commit
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
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