Skip to content
Open
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 @@ -18,6 +18,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
### Fixed

- We fixed an issue where pressing <kbd>ESC</kbd> in the preferences dialog would not always close the dialog. [#8888](https://github.com/JabRef/jabref/issues/8888)
- We fixed the checkbox in merge dialog "Treat duplicates the same way" to make it functional. [#14224](https://github.com/JabRef/jabref/pull/14224)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public class DuplicateSearch extends SimpleCommand {
private final BibEntryTypesManager entryTypesManager;
private final TaskExecutor taskExecutor;

// For "apply to all entries" functionality.
private DuplicateResolverResult rememberedDecision;

public DuplicateSearch(Supplier<LibraryTab> tabSupplier,
DialogService dialogService,
StateManager stateManager,
Expand All @@ -83,6 +86,7 @@ public void execute() {
libraryAnalyzed.set(false);
autoRemoveExactDuplicates.set(false);
duplicateCount.set(0);
rememberedDecision = null;

if (entries.size() < 2) {
return;
Expand Down Expand Up @@ -160,9 +164,23 @@ private void askResolveStrategy(DuplicateSearchResult result, BibEntry first, Bi

dialog.titleProperty().bind(Bindings.concat(dialog.getTitle()).concat(" (").concat(duplicateProgress.getValue()).concat("/").concat(duplicateTotal).concat(")"));

DuplicateResolverResult resolverResult = dialogService.showCustomDialogAndWait(dialog)
.orElse(DuplicateResolverResult.BREAK);
DuplicateResolverResult resolverResult;

if (preferences.getMergeDialogPreferences().shouldMergeApplyToAllEntries() && rememberedDecision != null) {
resolverResult = rememberedDecision;
} else {
resolverResult = dialogService.showCustomDialogAndWait(dialog)
.orElse(DuplicateResolverResult.BREAK);

if (preferences.getMergeDialogPreferences().shouldMergeApplyToAllEntries()) {
rememberedDecision = resolverResult;
}
}

applyDecisionToResult(result, first, second, resolverResult, dialog);
}

private void applyDecisionToResult(DuplicateSearchResult result, BibEntry first, BibEntry second, DuplicateResolverResult resolverResult, DuplicateResolverDialog dialog) {
if ((resolverResult == DuplicateResolverResult.KEEP_LEFT)
|| (resolverResult == DuplicateResolverResult.AUTOREMOVE_EXACT)) {
result.remove(second);
Expand Down
Loading