Integrate XML Editor to a WebDav CMS

Oxygen general issues.
qinjin
Posts: 1
Joined: Thu Feb 13, 2014 1:03 pm

Integrate XML Editor to a WebDav CMS

Post by qinjin »

Hi,

We are currently testing if it is possible to integrate Oxygen XML editor to our Eclipse RCP application which works with a WebDav backend.

It works fine if I open and edit the local file via the following piece of code:

Code: Select all


final File localFile = new File(PathToALocalFile);
final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(page, localFile.toURI(), "com.oxygenxml.editor.editors.xml.XMLEditor", true);
However, when I use the same code to open a remote WebDav XML file (only URI is replaced), I got the following exceptions:

Code: Select all


org.eclipse.ui.PartInitException: CoreException opening the file store on the URI.
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:364)
....
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
at org.eclipse.ui.internal.WorkbenchWindow$13.run(WorkbenchWindow.java:1812)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1809)
....
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
....
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: org.eclipse.core.runtime.CoreException: No file system is defined for scheme: http
at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:55)
at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:50)
at org.eclipse.core.internal.filesystem.InternalFileSystemCore.getFileSystem(InternalFileSystemCore.java:65)
at org.eclipse.core.internal.filesystem.InternalFileSystemCore.getStore(InternalFileSystemCore.java:107)
at org.eclipse.core.filesystem.EFS.getStore(EFS.java:478)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:362)
Are there some configurations to tell the editor to work with WebDav? And How to integrate with the authentication for WebDav? Do you have tutorials or guides for WebDav integration?

Thanks!
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Integrate XML Editor to a WebDav CMS

Post by Radu »

Hi,

The root of the error is this one:

Code: Select all

Caused by: org.eclipse.core.runtime.CoreException: No file system is defined for scheme: http
at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:55)
at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:50)
at org.eclipse.core.internal.filesystem.InternalFileSystemCore.getFileSystem(InternalFileSystemCore.java:65)
at org.eclipse.core.internal.filesystem.InternalFileSystemCore.getStore(InternalFileSystemCore.java:107)
at org.eclipse.core.filesystem.EFS.getStore(EFS.java:478)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:362)
You can look at the Java sources for the method "org.eclipse.ui.ide.IDE.openEditor(IWorkbenchPage, URI, String, boolean)", they are something like:

Code: Select all

      public static IEditorPart openEditor(IWorkbenchPage page, URI uri,
String editorId, boolean activate) throws PartInitException {
// sanity checks
if (page == null) {
throw new IllegalArgumentException();
}

IFileStore fileStore;
try {
fileStore = EFS.getStore(uri);
} catch (CoreException e) {
throw new PartInitException(
IDEWorkbenchMessages.IDE_coreExceptionFileStore, e);
}
.................
and in your case it fails because there is no file store registered in Eclipse for the "http" URL.

You either create a file store for it or you create your own EditorInput implementation.
You can also use the com.oxygenxml.editor.urlsupport.URLEditorInput implementation which should be available in the Oxygen plugin JAR something like:

Code: Select all

IEditorInput input = new com.oxygenxml.editor.urlsupport.URLEditorInput(url);
// Try to open the input in the active page with the associated editor ID.
IDE.openEditor(
window.getActivePage(),
input,
IDE.getEditorDescriptor(url.getFile()).getId());
If you write us an email (support@oxygenxml.com) I could also give you the Java sources from our own URLEditorInput implementation and you can use them to create your own implementation.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply