Package org.eclipse.handly.util
Class UiSynchronizer
- java.lang.Object
-
- org.eclipse.handly.util.UiSynchronizer
-
public abstract class UiSynchronizer extends java.lang.Object
Allows to execute runnables in the user-interface thread.- Restriction:
- This class is not intended to be extended by clients.
-
-
Constructor Summary
Constructors Constructor Description UiSynchronizer()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
asyncExec(java.lang.Runnable runnable)
Causes therun()
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.static UiSynchronizer
getDefault()
Returns a default instance of the synchronizer, ornull
if it is not available at this time (e.g., when running headless).abstract java.lang.Thread
getThread()
Returns the user-interface thread the synchronizer uses to execute runnables.abstract void
syncExec(java.lang.Runnable runnable)
Causes therun()
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.
-
-
-
Method Detail
-
getDefault
public static UiSynchronizer getDefault()
Returns a default instance of the synchronizer, ornull
if it is not available at this time (e.g., when running headless).
-
getThread
public abstract java.lang.Thread getThread()
Returns the user-interface thread the synchronizer uses to execute runnables.- Returns:
- the user-interface thread (not
null
) - Throws:
java.lang.IllegalStateException
- if the synchronizer can no longer be accessed (e.g., the underlying display has been disposed)
-
asyncExec
public abstract void asyncExec(java.lang.Runnable runnable)
Causes therun()
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
- code to run on the user-interface thread (notnull
)- Throws:
java.lang.IllegalStateException
- if the synchronizer can no longer be accessed (e.g., the underlying display has been disposed)
-
syncExec
public abstract void syncExec(java.lang.Runnable runnable) throws java.util.concurrent.ExecutionException
Causes therun()
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
- code to run on the user-interface thread (notnull
)- Throws:
java.lang.IllegalStateException
- if the synchronizer can no longer be accessed (e.g., the underlying display has been disposed)java.util.concurrent.ExecutionException
- if an exception occurred when executing the runnable
-
-