2012-03-12 74 views

回答

0

如果你使用HelpContentsAction那麼你會得到Eclipse的幫助。如果你想顯示你自己的文件,然後創建你自己的動作(如果你願意,你可以重用圖標和文本)。

使用IWorkbenchPageopenEditor(IEditorInput input, String editorId)方法打開PDF文件:

org.eclipse.core.resources.IFile workspaceFile; 
java.io.File externalFile; 

//PDF in workspace 
IEditorInput input = new FileEditorInput(workspaceFile); 
//or external 
IFileSystem fs = org.eclipse.core.filesystem.EFS.getLocalFileSystem(); 
IFileStore fileStore = fs.fromLocalFile(externalFile); 
input = new FileStoreEditorInput(fileStore); 

IWorkbenchPage page = 
    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); 
page.openEditor(input, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); 
相關問題