Package org.eclipse.swt.custom
Class BusyIndicator
java.lang.Object
org.eclipse.swt.custom.BusyIndicator
Support for showing a Busy Cursor during a long running process.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V,
E extends Exception>
CompletableFuture<V>compute
(SwtCallable<V, E> action) If called from aDisplay
thread use the givenSwtCallable
to produces aCompletableFuture
providing busy feedback using the busy indicator while computation is running.static <V,
E extends Exception>
CompletableFuture<V>compute
(SwtCallable<V, E> action, Executor executor) If called from aDisplay
thread use the givenSwtCallable
to compute aCompletableFuture
providing busy feedback using the busy indicator while computation is running.static <E extends Exception>
CompletableFuture<?>execute
(SwtRunnable<E> action) If called from aDisplay
thread use the givenSwtRunnable
to produces aCompletableFuture
providing busy feedback using the busy indicator while execution is running.static <E extends Exception>
CompletableFuture<?>execute
(SwtRunnable<E> action, Executor executor) If called from aDisplay
thread use the givenSwtRunnable
to produces aCompletableFuture
providing busy feedback using the busy indicator while execution is running.static void
Runs the givenRunnable
while providing busy feedback using this busy indicator.
-
Constructor Details
-
BusyIndicator
public BusyIndicator()
-
-
Method Details
-
showWhile
Runs the givenRunnable
while providing busy feedback using this busy indicator.- Parameters:
display
- the display on which the busy feedback should be displayed. If the display is null, the Display for the current thread will be used. If there is no Display for the current thread, the runnable code will be executed and no busy feedback will be displayed.runnable
- the runnable for which busy feedback is to be shown. Must not be null.- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the runnable is null
-
execute
If called from aDisplay
thread use the givenSwtRunnable
to produces aCompletableFuture
providing busy feedback using the busy indicator while execution is running. If called from a nonDisplay
the execution is performed in place and the result returned as aCompletableFuture
. It is therefore safe to call this method from any thread and theSwtCallable
is always evaluated outside the UI. TheForkJoinPool.commonPool()
is used to execute the computation in case this is called from aDisplay
thread- Parameters:
action
- the action that should be executed and produces a result of theCompletableFuture
- Since:
- 3.123
-
execute
public static <E extends Exception> CompletableFuture<?> execute(SwtRunnable<E> action, Executor executor) If called from aDisplay
thread use the givenSwtRunnable
to produces aCompletableFuture
providing busy feedback using the busy indicator while execution is running. If called from a nonDisplay
the execution is performed in place and the result returned as aCompletableFuture
. It is therefore safe to call this method from any thread and theSwtCallable
is always evaluated outside the UI.- Parameters:
action
- the action that should be executed and produces a result of theCompletableFuture
executor
- the Executor to perform the computation in case this is called from aDisplay
thread, passing aDisplay
will throw anIllegalArgumentException
as this will lead to a blocking UI and violates the contract of this method- Since:
- 3.123
-
compute
If called from aDisplay
thread use the givenSwtCallable
to produces aCompletableFuture
providing busy feedback using the busy indicator while computation is running. If called from a nonDisplay
the computation is performed in place and the result returned as aCompletableFuture
. It is therefore safe to call this method from any thread and theSwtCallable
is always evaluated outside the UI. TheForkJoinPool.commonPool()
is used to execute the computation in case this is called from aDisplay
thread- Parameters:
action
- the action that should be executed and produces a result of theCompletableFuture
- Since:
- 3.123
-
compute
public static <V,E extends Exception> CompletableFuture<V> compute(SwtCallable<V, E> action, Executor executor) If called from aDisplay
thread use the givenSwtCallable
to compute aCompletableFuture
providing busy feedback using the busy indicator while computation is running. If called from a nonDisplay
the computation is performed in place and the result returned as aCompletableFuture
. It is therefore safe to call this method from any thread and theSwtCallable
is always evaluated outside the UI.- Parameters:
action
- the action that should be executed and produces a result of theCompletableFuture
executor
- the Executor to perform the computation in case this is called from aDisplay
thread, passing aDisplay
will throw anIllegalArgumentException
as this will lead to a blocking UI and violates the contract of this method- Since:
- 3.123
-