You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/org/jabref/gui/util/BackgroundTask.java
+17-2Lines changed: 17 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,21 @@
30
30
* We cannot use {@link Task} directly since it runs certain update notifications on the JavaFX thread,
31
31
* and so makes testing harder.
32
32
* We take the opportunity and implement a fluid interface.
33
-
*
33
+
* <p>
34
+
* A task created here is to be submitted to {@link org.jabref.gui.Globals#TASK_EXECUTOR}: Use {@link TaskExecutor#execute(BackgroundTask)} to submit.
35
+
* <p>
36
+
* Example (for using the fluent interface)
37
+
* <pre>{@code
38
+
* BackgroundTask
39
+
* .wrap(() -> ...)
40
+
* .showToUser(true)
41
+
* .onRunning(() -> ...)
42
+
* .onSuccess(() -> ...)
43
+
* .onFailure(() -> ...)
44
+
* .executeWith(taskExecutor);
45
+
* }</pre>
46
+
* Background: The task executor one takes care to show it in the UI. See {@link org.jabref.gui.StateManager#addBackgroundTask(BackgroundTask, Task)} for details.
47
+
* <p>
34
48
* TODO: Think of migrating to <a href="https://github.com/ReactiveX/RxJava#simple-background-computation">RxJava</a>;
35
49
* <a href="https://www.baeldung.com/java-completablefuture">CompletableFuture</a> do not seem to support everything.
0 commit comments