#1 openEditor error

open
nobody
None
7
2006-11-08
2006-11-08
No

The code below should open the editor associated with
the IFile, but currently it just opens an empty editor
containing a blue line and the message "ERROR".

Taken from the method gotoLine in
SequenceDiagramDebugView.java:

IWorkspaceRoot root =
ResourcesPlugin.getWorkspace().getRoot();
IProject prj = root.getProject(info.getProjectName());
IFolder src =
prj.getFolder("src").getFolder(info.getProjectName());
IFile file = src.getFile(info.getFileName());
try {
IDE.openEditor(wbp, file, true);
} catch (PartInitException e) {
e.printStackTrace();
}

For now, the method used to get around this is to have
an existing editor corresponding to the file already
open in the workspace and set to the active editor
(selected). The activeEditor is then retrieved from
the active workbench page, and it is casted to an
AbstractDecoratedTextEditor.

Discussion


Log in to post a comment.