Class BusyIndicator

    • Constructor Summary

      Constructors 
      Constructor Description
      BusyIndicator()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <V,​E extends java.lang.Exception>
      java.util.concurrent.CompletableFuture<V>
      compute​(SwtCallable<V,​E> action)
      If called from a Display thread use the given SwtCallable to produces a CompletableFuture providing busy feedback using the busy indicator while computation is running.
      static <V,​E extends java.lang.Exception>
      java.util.concurrent.CompletableFuture<V>
      compute​(SwtCallable<V,​E> action, java.util.concurrent.Executor executor)
      If called from a Display thread use the given SwtCallable to compute a CompletableFuture providing busy feedback using the busy indicator while computation is running.
      static <E extends java.lang.Exception>
      java.util.concurrent.CompletableFuture<?>
      execute​(SwtRunnable<E> action)
      If called from a Display thread use the given SwtRunnable to produces a CompletableFuture providing busy feedback using the busy indicator while execution is running.
      static <E extends java.lang.Exception>
      java.util.concurrent.CompletableFuture<?>
      execute​(SwtRunnable<E> action, java.util.concurrent.Executor executor)
      If called from a Display thread use the given SwtRunnable to produces a CompletableFuture providing busy feedback using the busy indicator while execution is running.
      static void showWhile​(Display display, java.lang.Runnable runnable)
      Runs the given Runnable while providing busy feedback using this busy indicator.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BusyIndicator

        public BusyIndicator()
    • Method Detail

      • showWhile

        public static void showWhile​(Display display,
                                     java.lang.Runnable runnable)
        Runs the given Runnable 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:
        java.lang.IllegalArgumentException -
        • ERROR_NULL_ARGUMENT - if the runnable is null
      • execute

        public static <E extends java.lang.Exception> java.util.concurrent.CompletableFuture<?> execute​(SwtRunnable<E> action)
        If called from a Display thread use the given SwtRunnable to produces a CompletableFuture providing busy feedback using the busy indicator while execution is running. If called from a non Display the execution is performed in place and the result returned as a CompletableFuture. It is therefore safe to call this method from any thread and the SwtCallable is always evaluated outside the UI. The ForkJoinPool.commonPool() is used to execute the computation in case this is called from a Display thread
        Parameters:
        action - the action that should be executed and produces a result of the CompletableFuture
        Since:
        3.123
      • execute

        public static <E extends java.lang.Exception> java.util.concurrent.CompletableFuture<?> execute​(SwtRunnable<E> action,
                                                                                                        java.util.concurrent.Executor executor)
        If called from a Display thread use the given SwtRunnable to produces a CompletableFuture providing busy feedback using the busy indicator while execution is running. If called from a non Display the execution is performed in place and the result returned as a CompletableFuture. It is therefore safe to call this method from any thread and the SwtCallable is 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 Display thread, passing a Display will throw an IllegalArgumentException as this will lead to a blocking UI and violates the contract of this method
        Since:
        3.123
      • compute

        public static <V,​E extends java.lang.Exception> java.util.concurrent.CompletableFuture<V> compute​(SwtCallable<V,​E> action)
        If called from a Display thread use the given SwtCallable to produces a CompletableFuture providing busy feedback using the busy indicator while computation is running. If called from a non Display the computation is performed in place and the result returned as a CompletableFuture. It is therefore safe to call this method from any thread and the SwtCallable is always evaluated outside the UI. The ForkJoinPool.commonPool() is used to execute the computation in case this is called from a Display thread
        Parameters:
        action - the action that should be executed and produces a result of the CompletableFuture
        Since:
        3.123
      • compute

        public static <V,​E extends java.lang.Exception> java.util.concurrent.CompletableFuture<V> compute​(SwtCallable<V,​E> action,
                                                                                                                java.util.concurrent.Executor executor)
        If called from a Display thread use the given SwtCallable to compute a CompletableFuture providing busy feedback using the busy indicator while computation is running. If called from a non Display the computation is performed in place and the result returned as a CompletableFuture. It is therefore safe to call this method from any thread and the SwtCallable is 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 Display thread, passing a Display will throw an IllegalArgumentException as this will lead to a blocking UI and violates the contract of this method
        Since:
        3.123