Class ProgressMonitorAwareExecutor


  • public final class ProgressMonitorAwareExecutor
    extends Object
    Provides utility method to synchronously execute task with an ability to check provided progress monitor cancellation status. May be usefull for long-running operations that are not controlled by client, such as external processes execution, to provide an ability to cancel this operation from UI.
    • Method Detail

      • syncExec

        public static void syncExec​(FailableRunnable task,
                                    org.eclipse.core.runtime.IProgressMonitor monitor)
                             throws ExecutionException
        Synchronously exectute the provided task with awaring of provided progress monitor state.

        Provided monitor will be used to check cancellation status. If monitor will be cancelled then task execution will be also cancelled and execution will be returned to the caller thread. If monitor is already cancelled, then provided task will not be executed.

        May be usefull for long-running operations that are not controlled by client, such as external processes execution, to provide an ability to cancel this operation from UI.

        Parameters:
        task - the runnable to run with ability to throw an exception, cannot be null
        monitor - the progress monitor to check cancellation status, cannot be null
        Throws:
        ExecutionException - if provided task execution error occurred; thrown execution will be applied as cause to the execution excetion
        See Also:
        FailableRunnable