Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv

### Fixed

- We fixed the checkbox in merge dialog "Treat duplicates the same way" to make it functional.

### Removed

## [6.0-alpha.3] – 2025-10-30
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