rcp(插件开发)异常:Exception in thread "Thread-7" org.eclipse.swt.SWTException: Invalid thread access
2012-10-09 16:55
435 查看
原因: 产生的原因是RCP框架下,UI组件只能由UI线程来更新,禁止后台线程访问.,如 Timer 所触发的事件的处理代码; 用Job创建的分线程等. 由UI组件事情说触发的都是UI线程.
方法:只要把后台线程中涉及界面更新的代码交由UI线程处理即可.可以调用 Display.getDefault().asyncExec()来实现.
测试使用:
Display.getDefault().asyncExec(new Runnable(){
@Override
public void run() {
}
});
方法:只要把后台线程中涉及界面更新的代码交由UI线程处理即可.可以调用 Display.getDefault().asyncExec()来实现.
测试使用:
Display.getDefault().asyncExec(new Runnable(){
@Override
public void run() {
}
});
相关文章推荐
- Exception in thread "Timer-0" org.eclipse.swt.SWTException: Invalid thread access
- Exception in thread "Thread-0" org.eclipse.swt.SWTException: Invalid thread access. 错误解决
- 解决Eclipse异常关闭后重启报 org.eclipse.swt.SWTException: Invalid thread access 的问题
- SWT多线程异常--org.eclipse.swt.SWTException: Invalid thread access
- Exception in thread "main" org.hibernate.InvalidMappingException: Could not pars
- Exception in thread "main" org.hibernate.InvalidMappingException: Unable to read XML
- RCP中的org.eclipse.swt.SWTException: Invalid thread access 问题
- Exception in thread "main" org.hibernate.MappingException: invalid configuration
- Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not
- Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/jobs/Job
- Hadoop分布式集群 EclipseException in thread "main" org.apache.hadoop.mapreduce.lib.input.InvalidInputExce
- Junit测试出现异常:Exception in thread "main" java.lang.NoSuchMethodError: org.junit.runner.Description.cre
- SWT异常: org.eclipse.swt.SWTException: Invalid thread access
- Exception in thread "main" org.hibernate.MappingNotFoundException: resource: com.xzhl.user.model/Stu
- Exception in thread "main" java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()Z
- Win7下运行小雨伞tinyumbrella-5/6异常:Exception in thread "AWT-EventQueue-0"解决办法
- eclipse Exception in thread "http-bio-8080-exec-2" java.lang.OutOfMemoryError: PermGen space
- HIVE Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hive/ql/CommandNee
- Exception in thread "main" org.hibernate.MappingException
- Exception in thread "main" org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: