學(xué)無止境 |
|
|||
日歷
統(tǒng)計(jì)
導(dǎo)航常用鏈接留言簿(2)隨筆分類隨筆檔案搜索最新評(píng)論
閱讀排行榜評(píng)論排行榜 |
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".
|
![]() |
|
Copyright © lucia | Powered by: 博客園 模板提供:滬江博客 |