org.eclipse.emf.compare.rcp.ui.internal.util

## Class SWTUtil

- java.lang.Object
- - org.eclipse.emf.compare.rcp.ui.internal.util.SWTUtil

    public final class SWTUtil
    extends Object

Utility class for running operation in the UI-Thread if not already within it.

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `safeAsyncExec(Runnable runnable)` Causes the run() method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity.
`static void` `safeRedraw(org.eclipse.swt.widgets.Control control, boolean async)` Run `Control.redraw()` on the given viewer.
`static void` `safeRefresh(org.eclipse.jface.viewers.Viewer viewer, boolean async, boolean checkDisposed)` Run `Viewer.refresh()` on the given viewer.
`static void` `safeSyncExec(Runnable runnable)` Causes the run() method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### safeAsyncExec

    public static void safeAsyncExec(Runnable runnable)

Causes the run() method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity. The caller of this method continues to run in parallel, and is not notified when the runnable has completed.

Parameters:
  `runnable` - runnable code to run on the user-interface thread.

#### safeSyncExec

    public static void safeSyncExec(Runnable runnable)

Causes the run() method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity. The thread which calls this method is suspended until the runnable completes.

Parameters:
  `runnable` - runnable code to run on the user-interface thread.

#### safeRefresh

    public static void safeRefresh(org.eclipse.jface.viewers.Viewer viewer,
                                   boolean async,
                                   boolean checkDisposed)

Run `Viewer.refresh()` on the given viewer.

Parameters:
  `viewer` - the viewer to refresh.
  `async` - whether the thread which calls this method is not suspended until the runnable completes.
  `checkDisposed` - whether the viewer's control dispose state has to be checked before refresh.

#### safeRedraw

    public static void safeRedraw(org.eclipse.swt.widgets.Control control,
                                  boolean async)

Run `Control.redraw()` on the given viewer.

Parameters:
  `redraw` - the control to redraw.
  `async` - whether the thread which calls this method is not suspended until the runnable completes.