学无止境  
日历
<2005年9月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
统计
  • 随笔 - 9
  • 文章 - 0
  • 评论 - 2
  • 引用 - 0

导航

常用链接

留言簿(2)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 
Recently I had a problem in converting java.io.File to IFile for external files. The external files sind the files which are not located in the eclipse workspace. So they are not eclipse "resources" and can not be converted into IFile instances. With the following code you can solve this problem:

                 IEditorInput input= createEditorInput(selectedFile);
                 String editorId= getEditorId(selectedFile);
                 IWorkbenchPage page= fWindow.getActivePage();
                 try {
                     page.openEditor(input, editorId);
                 } catch (PartInitException e) {
                     //EditorsPlugin.log(e.getStatus());
                 }

This idea comes from org.eclipse.ui.internal.editors.text.OpenExternalFileAction. In this class you can also find the implementation for the methods "createEditorInput" and "getEditorId".
posted on 2005-09-21 17:50 lucia 阅读(577) 评论(0)  编辑  收藏 所属分类: Eclipse Plugin

只有注册用户登录后才能发表评论。


网站导航:
 
 
Copyright © lucia Powered by: 博客园 模板提供:沪江博客