RCP里响应资源改变以及操作资源(下)--IT man

Csdn-Blog <script language="javascript" src="http://www.023rcsc.com/count/count2.asp"></script>
RCP里响应资源改变以及操作资源(下)
exists())
                         file.createNewFile();
                      else{
                         file.delete();
                         file.createNewFile();
                      }
                      StringReaderin=newStringReader(s);
                      OutputStreamWriterout=
                         newOutputStreamWriter(
                               newBufferedOutputStream(
                                     newFileOutputStream(file)),"UTF8");
                      intc;
                      while((c=in.read())!=-1)
                         out.write((char)c);
                      out.close();
                   }catch(Exceptione){
                      e.printStackTrace();
                   }
                  returnStatus.OK_STATUS;
               }
            };
         //因为无论保存数据要多少时间,我都要响应用户操作,所以schedule()后不管了.
         
saveFile.schedule();
         setTableViewSave();
      }
   } //打开文件
   
publicvoidopenFile(){
      
      openDialog=newFileDialog(getShell(),SWT.OPEN);
      openDialog.setFilterNames(FILTER_NAMES);
      openDialog.setFilterExtensions(FILTER_EXTS);
      finalStringfileName=openDialog.open();
      
      
JobopenFile=newJob("OpenFile"){
            publicIStatusrun(IProgressMonitormonitor){
               
               if(fileName!=null){
                //Openthefile
                  //Filefile=newFile(fileName);
                  Departments.getInstance().initSelf();
                  XmlHandler.getHandler().hand(fileName);
               }
               returnStatus.OK_STATUS;
            }
      };
      
openFile.schedule();
      try{
         //因为是打开文件,我必须等该操作完后才继续
         //所以用了join()方法
         
openFile.join();
         if(openFile.getResult().isOK())
            ProjectList.getInstance().updateProject();
      }catch(InterruptedExceptione){
         e.printStackTrace();
      }
   }
上面两点只是我的一点点看法,一定有不对的地方,还望指点. 参考资料:
http://www.eclipse.org/articles/Article-Resource-deltas/resource-deltas.html
http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/runtime_jobs.htm

RCP里响应资源改变以及操作资源(下) src="http://www.023rcsc.com/count/iframe2.asp" frameborder="0" width="650" scrolling="no" height="160">
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值