[jbosside-dev] Fwd: [Bug 166274] Opening external file in xml editor fails
Rob Stryker
rob.stryker at jboss.com
Thu Nov 30 19:03:24 EST 2006
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 at jboss.com> wrote:
>
> Hi Rob,
>
> how come you are using JavaFileEditorInput for an xml file ?
>
> just curious.
>
> /max
>
> ------- Forwarded message -------
> From: bugzilla-daemon at eclipse.org
> To: max.andersen at 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 at 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 at hibernate.org
> http://hibernate.org
>
> JBoss a division of Red Hat
> max.andersen at jboss.com
>
> _______________________________________________
> jbosside-dev mailing list
> jbosside-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosside-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20061130/00f6a314/attachment.html
More information about the jbosstools-dev
mailing list