首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

RCP 项目 JOB线程适用一例

2012-10-06 
RCP 项目 JOB线程实用一例private void initData() {// 初始化数据时,如果数据过多,则添加一个Job线程,提

RCP 项目 JOB线程实用一例

private void initData() {// 初始化数据时,如果数据过多,则添加一个Job线程,提高体验度.Job job = new Job("") {protected IStatus run(IProgressMonitor monitor) {// 在这里添加你的任务代码try {goodsTypes = goodsTypeService.getAllEntity(TGoodsType.class);} catch (RemoteException e) {e.printStackTrace();} catch (BusinessException e) {e.printStackTrace();}Display.getDefault().asyncExec(new Runnable() {public void run() {// 因为在JOB线程内不能操作UI线程,所有写在Display.getDefault().asyncExecgetTreeViewer().setInput(goodsTypes);getTreeViewer().expandToLevel(2);}});return Status.OK_STATUS;}};// 开启线程job.schedule();}
?

热点排行