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.
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <V,E extends Exception> 
 CompletableFuture<V> compute(SwtCallable<V, E> action) If called from aDisplaythread use the givenSwtCallableto produces aCompletableFutureproviding 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 aDisplaythread use the givenSwtCallableto compute aCompletableFutureproviding busy feedback using the busy indicator while computation is running.static <E extends Exception>
 CompletableFuture<?> execute(SwtRunnable<E> action) If called from aDisplaythread use the givenSwtRunnableto produces aCompletableFutureproviding busy feedback using the busy indicator while execution is running.static <E extends Exception>
 CompletableFuture<?> execute(SwtRunnable<E> action, Executor executor) If called from aDisplaythread use the givenSwtRunnableto produces aCompletableFutureproviding busy feedback using the busy indicator while execution is running.static voidIf called from aDisplaythread, waits for the givenFutureto complete and provides busy feedback using the busy indicator.static voidRuns the givenRunnablewhile providing busy feedback using this busy indicator.
- 
Constructor Details- 
BusyIndicatorpublic BusyIndicator()
 
- 
- 
Method Details- 
showWhileRuns the givenRunnablewhile 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
 
 
- 
showWhileIf called from aDisplaythread, waits for the givenFutureto complete and provides busy feedback using the busy indicator. While waiting for completion, pending UI events are processed to prevent UI freeze. If there is noDisplayfor the current thread, theFuture.get()will be executed ignoring anyExecutionExceptionand no busy feedback will be displayed.- Parameters:
- future- the- Futurefor which busy feedback is to be shown.
- Since:
- 3.127
- Implementation Note:
- In some cases completion is detected by a regular timed wakeup of
           the Displaythread,for minimal latency pass aCompletableFutureor triggerDisplay.wake()as an external event.
 
- 
executeIf called from aDisplaythread use the givenSwtRunnableto produces aCompletableFutureproviding busy feedback using the busy indicator while execution is running. If called from a nonDisplaythe execution is performed in place and the result returned as aCompletableFuture. It is therefore safe to call this method from any thread and theSwtCallableis always evaluated outside the UI. TheForkJoinPool.commonPool()is used to execute the computation in case this is called from aDisplaythread- Parameters:
- action- the action that should be executed and produces a result of the- CompletableFuture
- Since:
- 3.123
 
- 
executepublic static <E extends Exception> CompletableFuture<?> execute(SwtRunnable<E> action, Executor executor) If called from aDisplaythread use the givenSwtRunnableto produces aCompletableFutureproviding busy feedback using the busy indicator while execution is running. If called from a nonDisplaythe execution is performed in place and the result returned as aCompletableFuture. It is therefore safe to call this method from any thread and theSwtCallableis always evaluated outside the UI.- Parameters:
- action- the action that should be executed and produces a result of the- CompletableFuture
- executor- the Executor to perform the computation in case this is called from a- Displaythread, passing a- Displaywill throw an- IllegalArgumentExceptionas this will lead to a blocking UI and violates the contract of this method
- Since:
- 3.123
 
- 
computeIf called from aDisplaythread use the givenSwtCallableto produces aCompletableFutureproviding busy feedback using the busy indicator while computation is running. If called from a nonDisplaythe computation is performed in place and the result returned as aCompletableFuture. It is therefore safe to call this method from any thread and theSwtCallableis always evaluated outside the UI. TheForkJoinPool.commonPool()is used to execute the computation in case this is called from aDisplaythread- Parameters:
- action- the action that should be executed and produces a result of the- CompletableFuture
- Since:
- 3.123
 
- 
computepublic static <V,E extends Exception> CompletableFuture<V> compute(SwtCallable<V, E> action, Executor executor) If called from aDisplaythread use the givenSwtCallableto compute aCompletableFutureproviding busy feedback using the busy indicator while computation is running. If called from a nonDisplaythe computation is performed in place and the result returned as aCompletableFuture. It is therefore safe to call this method from any thread and theSwtCallableis always evaluated outside the UI.- Parameters:
- action- the action that should be executed and produces a result of the- CompletableFuture
- executor- the Executor to perform the computation in case this is called from a- Displaythread, passing a- Displaywill throw an- IllegalArgumentExceptionas this will lead to a blocking UI and violates the contract of this method
- Since:
- 3.123
 
 
-