Hi,
i need to open a project in my RCP application from code. I've done with this function
@Override
public void run() {
IPath path = new Path("/MyReports/Coffee_4.jrxml");
IFile sampleFile = new FileTest(path,(Workspace)ResourcesPlugin.getWorkspace());
try {
EditorUtility.openInEditor(sampleFile, true);
} catch (PartInitException e) {
e.printStackTrace();
}
}
Where FileTest is a subclass of org.eclipse.core.internal.resources.File, since its constructor is protected. It works but i get a lot of "discouraged access" warnings, so probably this method isn't a clean one. Is there some other way to do this?
UPDATE:
I've found a more clean way with
@Override
public void run() {
IPath path = new Path("/MyReports/Coffee_4.jrxml");
IFile sampleFile = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
try {
EditorUtility.openInEditor(sampleFile, true);
} catch (PartInitException e) {
e.printStackTrace();
}
}
But i've still the same problem since even EditorUtility.openInEditor is discouraged
[Updated on: Mon, 21 January 2013 07:12]
Report message to a moderator