Skip to content

Commit b4cece8

Browse files
author
dpolishc
committed
fixup! fixup! Duplicate check on import should be run in background Task JabRef#4963 (created background task for duplicate chec)
1 parent d249da1 commit b4cece8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java

+9-7
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,15 @@ private void initialize() {
108108
container.getStyleClass().add("entry-container");
109109
BindingsHelper.includePseudoClassWhen(container, entrySelected, addToggle.selectedProperty());
110110

111-
if (viewModel.hasDuplicate(entry)) {
112-
Button duplicateButton = IconTheme.JabRefIcons.DUPLICATE.asButton();
113-
duplicateButton.setTooltip(new Tooltip(Localization.lang("Possible duplicate of existing entry. Click to resolve.")));
114-
duplicateButton.setOnAction(event -> viewModel.resolveDuplicate(entry));
115-
container.getChildren().add(1, duplicateButton);
116-
}
117-
111+
Callable<Boolean> hasDuplicateEntryTask = () -> viewModel.hasDuplicate(entry);
112+
BackgroundTask.wrap(hasDuplicateEntryTask).onSuccess(e -> {
113+
if (e) {
114+
Button duplicateButton = IconTheme.JabRefIcons.DUPLICATE.asButton();
115+
duplicateButton.setTooltip(new Tooltip(Localization.lang("Possible duplicate of existing entry. Click to resolve.")));
116+
duplicateButton.setOnAction(event -> viewModel.resolveDuplicate(entry));
117+
container.getChildren().add(1, duplicateButton);
118+
}
119+
}).executeWith(Globals.TASK_EXECUTOR);
118120
return container;
119121
})
120122
.withOnMouseClickedEvent((entry, event) -> entriesListView.getCheckModel().toggleCheckState(entry))

0 commit comments

Comments
 (0)