Because that's the code used in File -> Open for external files.
I tried using an ExternalFileEditorInput but it caused problems and would
not init the part properly. Nitind told me the file -> open code worked, so
I used it.
If you actually look at the JavaFileEditorInput code, it's at best a stub
implementation with default implementations. It is backed by a
JavaFileStorage object, who's javadoc describes it as: * A storage for
java.io.File.
So I think it is simply named improperly, or misleading. It is not an editor
input for java files, but rather, an editor input for java.io.File.
- Rob
On 11/30/06, Max Rydahl Andersen <max.andersen(a)jboss.com> wrote:
Hi Rob,
how come you are using JavaFileEditorInput for an xml file ?
just curious.
/max
------- Forwarded message -------
From: bugzilla-daemon(a)eclipse.org
To: max.andersen(a)jboss.com
Cc:
Subject: [Bug 166274] Opening external file in xml editor fails
Date: Thu, 30 Nov 2006 18:20:23 +0100
https://bugs.eclipse.org/bugs/show_bug.cgi?id=166274
Product/Component: Web Tools / wst.xml
------- Comment #4 from rob.stryker(a)jboss.com 2006-11-30 12:22 -------
I've switched my code to use that which the file -> open uses. Namely:
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
IWorkbenchPage page = win.getActivePage();
File file = new File("C:\\some\\file.xml");
IFileStore fileStore= EFS.getLocalFileSystem().fromLocalFile(file);
if( fileStore != null ) {
IEditorInput input = new JavaFileEditorInput(fileStore);
IEditorDescriptor desc = PlatformUI.getWorkbench().
getEditorRegistry().getDefaultEditor(file.getName());
page.openEditor(input, desc.getId());
}
This seems to work fine. Thanks for the help though =]
--
--
Max Rydahl Andersen
callto://max.rydahl.andersen
Hibernate
max(a)hibernate.org
http://hibernate.org
JBoss a division of Red Hat
max.andersen(a)jboss.com
_______________________________________________
jbosside-dev mailing list
jbosside-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbosside-dev