Java Code Examples for org.eclipse.swt.widgets.Display.getThread()

The following are Jave code examples for showing how to use getThread() of the org.eclipse.swt.widgets.Display class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: convertigo-eclipse   File: ConvertigoPlugin.java   Source Code and License Vote up 6 votes
private static void messageBoxWithoutReturnCode(final String message, int options) {
	final Display display = getDisplay();
	
	Runnable runnable = new Runnable() {
		public void run() {
			try {
				messageBox(null, message, SWT.OK | SWT.ICON_INFORMATION);
			}
			catch (Exception e){
				ConvertigoPlugin.logException(e, "Error while trying to open message box");
			}
		};
	};
	
	if (display.getThread() != Thread.currentThread()) {
		display.asyncExec(runnable);		
	} else {
		display.syncExec(runnable);
	}
}
 
Example 2
Project: xcalendar   File: SwtUtils.java   Source Code and License Vote up 4 votes
public static boolean isUIThread(Display display) {
	return display.getThread() == Thread.currentThread();
}