Skip to content

Commit

Permalink
fixup! fixup! Duplicate check on import should be run in background T…
Browse files Browse the repository at this point in the history
…ask JabRef#4963 (created background task for duplicate chec)
  • Loading branch information
dpolishc committed May 18, 2019
1 parent d249da1 commit b4cece8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,15 @@ private void initialize() {
container.getStyleClass().add("entry-container");
BindingsHelper.includePseudoClassWhen(container, entrySelected, addToggle.selectedProperty());

if (viewModel.hasDuplicate(entry)) {
Button duplicateButton = IconTheme.JabRefIcons.DUPLICATE.asButton();
duplicateButton.setTooltip(new Tooltip(Localization.lang("Possible duplicate of existing entry. Click to resolve.")));
duplicateButton.setOnAction(event -> viewModel.resolveDuplicate(entry));
container.getChildren().add(1, duplicateButton);
}

Callable<Boolean> hasDuplicateEntryTask = () -> viewModel.hasDuplicate(entry);
BackgroundTask.wrap(hasDuplicateEntryTask).onSuccess(e -> {
if (e) {
Button duplicateButton = IconTheme.JabRefIcons.DUPLICATE.asButton();
duplicateButton.setTooltip(new Tooltip(Localization.lang("Possible duplicate of existing entry. Click to resolve.")));
duplicateButton.setOnAction(event -> viewModel.resolveDuplicate(entry));
container.getChildren().add(1, duplicateButton);
}
}).executeWith(Globals.TASK_EXECUTOR);
return container;
})
.withOnMouseClickedEvent((entry, event) -> entriesListView.getCheckModel().toggleCheckState(entry))
Expand Down

0 comments on commit b4cece8

Please sign in to comment.