why "FileEditorInput" not found? [message #526793] |
Mon, 12 April 2010 22:40 |
Yuzhang Han Messages: 19 Registered: September 2009 |
Junior Member |
|
|
Hi everybody,
I'm trying to open the default editor for a certain file programmatically (not a fresh issue) and stunned by a problem which is never encountered in any old posts related to this issue: the "FileEditorInput" class is not found. Is any one so kind to tell me where it went wrong? Perhaps which plugins I still lack? Many thanks...
My code is pasted as follows. FIY, I'm using Eclipse 3.5.2 - Modelling, and additionally installed feature org.eclilpse.platform v3.5.2 from "software update".
File file = new File(filename);
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
IEditorDescriptor desc = PlatformUI.getWorkbench().
getEditorRegistry().getDefaultEditor(file.getName());
try {
page.openEditor(new FileEditorInput(file), desc.getId()); //if I replaced "FileEditorInput" instance with "NullEditorInput", it would work correctly: an editor opened saying there is an exception because of the lack of an input file
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
[Updated on: Mon, 12 April 2010 22:45] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02700 seconds