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();}?