Skip to content

Commit 089291f

Browse files
committed
First set fetcherWorker properties, then start the worker
1 parent 1a3fa12 commit 089291f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/java/org/jabref/gui/EntryTypeViewModel.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ protected Optional<BibEntry> call() throws FetcherException {
142142
}
143143

144144
public void runFetcherWorker() {
145-
searchSuccesfulProperty.set(false);
146-
searchingProperty().setValue(true);
147-
taskExecutor.execute(fetcherWorker);
145+
fetcherWorker.setOnRunning(event -> searchingProperty().setValue(true));
146+
148147
fetcherWorker.setOnFailed(event -> {
148+
searchSuccesfulProperty.set(false);
149149
Throwable exception = fetcherWorker.getException();
150150
String fetcherExceptionMessage = exception.getMessage();
151151
String fetcher = selectedItemProperty().getValue().getName();
@@ -159,7 +159,7 @@ public void runFetcherWorker() {
159159
dialogService.showInformationDialogAndWait(Localization.lang("Failed to import by ID"), Localization.lang("Error message %0", fetcherExceptionMessage));
160160
}
161161

162-
LOGGER.error(String.format("Exception during fetching when using fetcher '%s' with entry id '%s'.", fetcher, searchId), exception);
162+
LOGGER.error("Exception during fetching when using fetcher '{}' with entry id '{}'.", fetcher, searchId, exception);
163163

164164
searchingProperty.set(false);
165165
fetcherWorker = new FetcherWorker();
@@ -204,10 +204,11 @@ public void runFetcherWorker() {
204204
searchSuccesfulProperty.set(true);
205205
}
206206
}
207-
fetcherWorker = new FetcherWorker();
208207

209208
focusAndSelectAllProperty.set(true);
210-
searchingProperty().setValue(false);
209+
searchingProperty().set(false);
210+
fetcherWorker = new FetcherWorker();
211211
});
212+
taskExecutor.execute(fetcherWorker);
212213
}
213214
}

0 commit comments

Comments
 (0)