[jbosside-dev] Fwd: [Bug 166274] Opening external file in xml editor fails

Max Rydahl Andersen max.andersen at jboss.com
Thu Nov 30 16:32:28 EST 2006


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




More information about the jbosstools-dev mailing list