[JFace] - Programmatically launching an editor throws an exception. [message #114241] |
Thu, 21 August 2003 19:13  |
Eclipse User |
|
|
|
I am trying to create an editor on a file within a perspective but I get
an error of type org.eclipse.ui.PartInitException.
The message that the error gives me also makes no sense:
IWAW0109E Failed to create model.
The code I am using to create the error is given below:
public void performAction(String name)
{
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkbench bench = PlatformUI.getWorkbench();
IWorkspaceRoot rootSpace = workspace.getRoot();
IWorkbenchPage activePage;
IFile resourceToEdit = null;
try {
IResource[] projects = rootSpace.members();
for ( int i = 0; i < projects.length; i++ )
{
try {
IProject project =(IProject)projects[i];
resourceToEdit = project.getFile(name);
if ( resourceToEdit != null )
{
activePage =
bench.getActiveWorkbenchWindow().getActivePage();
activePage.openEditor(resourceToEdit);
}
} catch ( CoreException ce ) {
System.out.println(ce.getClass().getName() + " " +
ce.getMessage());
resourceToEdit = null;
continue;
}
}
} catch ( CoreException ce ) {
System.out.println("Core Exception while getting the projects");
}
}
The name passed in is <filename>.htm
Any ideas on what the error means or a possible solution are greatly
appreciated.
Thanks.
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09979 seconds