【eclipse rcp】判断当前线程是否是界面线程
2013-10-28 09:55
176 查看
public static boolean isUIThread()
{
Object uiThread = null;
try
{
Class displayClass = Class.forName("org.eclipse.swt.widgets.Display");
Method getDefaultMethod = displayClass.getDeclaredMethod("getDefault", new Class[] {});
Object display = getDefaultMethod.invoke(null, new Object[] {});
Method getThreadMethod = displayClass.getDeclaredMethod("getThread", new Class[] {});
uiThread = getThreadMethod.invoke(display, new Object[] {});
}
catch (Exception e)
{
// log.warn("Could not determine UI thread using reflection", e);
}
return (Thread.currentThread() == uiThread);
}
{
Object uiThread = null;
try
{
Class displayClass = Class.forName("org.eclipse.swt.widgets.Display");
Method getDefaultMethod = displayClass.getDeclaredMethod("getDefault", new Class[] {});
Object display = getDefaultMethod.invoke(null, new Object[] {});
Method getThreadMethod = displayClass.getDeclaredMethod("getThread", new Class[] {});
uiThread = getThreadMethod.invoke(display, new Object[] {});
}
catch (Exception e)
{
// log.warn("Could not determine UI thread using reflection", e);
}
return (Thread.currentThread() == uiThread);
}
相关文章推荐
- Android判断当前界面是否是桌面(主页)
- Android 如何判断当前线程是否是主线程
- android判断当前界面是否是桌面(主页)
- Android 判断当前的界面是否是桌面的方法
- C#中如何判断当前线程是否为主线程
- C#中如何判断当前线程是否为主线程
- 判断当前线程是否UI线程
- Android中判断当前线程是否是主线程
- 如何在keyPressed事件中判断当前是否是SOFT1键以便响应回到上一界面?
- Android 判断当前线程是否是主线程的两种方法
- Android: 判断当前是否为锁屏界面(Keyguard)
- Android 判断当前网络连接是否可用、打开设置网络界面
- Android判断当前线程是否是主线程的方法
- Android 判断当前线程是否是主线程的两种方法
- [Android]判断当前界面是否是桌面
- Android判断当前线程是否是主线程的方法
- Android 如何判断当前线程是否是主线程
- Android 如何判断当前线程是否是主线程
- Android 如何判断当前线程是否是主线程
- Android 判断当前的界面是否是桌面的方法