I will demonstrate a high level implementation for your requirement. You must take the following steps.
- first you need to make an entry in
Plugin.xmlfor the class, which extends
viewPartboth editorPartfor presentation and editor, respectively. - to represent the hierarchy, you need to load the tree structure information into
viewPart. - In node, double click Listener, you need to open the editor.
To open a file in an editor, use the following code to open an editor.
if (fileToOpen.exists() && fileToOpen.isFile()) {
String path =
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
URI fromString = org.eclipse.core.runtime.URIUtil.fromString("file://" + path);
try {
IEditorPart openEditor = IDE.openEditor(page, fromString, Editor.ID, true);
IEditorInput editorInput = openEditor.getEditorInput();
} catch ( PartInitException e ) {
}
}
source
share