Integrate oXygen XML Editor into RCP application EditorPart

<oXygen/> general issues.
Along
Posts: 10

Integrate oXygen XML Editor into RCP application EditorPart

Wed Jun 01, 2016 7:39 pm

Hello,

I'm trying to integrate the oXygen XML editor into a RCP application. However, I am not trying to open directly the XML editor but rather I have a class which extends EditorPart and I want to open the oXygen text editor inside.

Code: Select all

IDE.openEditor(page, docInput, "com.xml.editors.OxygenEditor");

Code: Select all

public class OxygenEditor extends EditorPart {

   protected File tempFile = null;

   @Override
   public void doSave(IProgressMonitor monitor) {
      // Progress monitor during save with particular process
   }

   @Override
   public void init(IEditorSite site, IEditorInput input) throws PartInitException {
      setSite(site);
      setInput(input);
   }

   @Override
   public boolean isDirty() {
      return editor.isDirty();
   }

   @Override
   public boolean isSaveAsAllowed() {
      return true;
   }

   @Override
   public void createPartControl(Composite parent) {
      DocumentInput documentInput = ((DocumentInput) getEditorInput());
      String filename = documentInput.getTempFile().getAbsolutePath();
      tempFile =  documentInput.getTempFile();
      setPartName(filename );
      
      // How to init editor ??
   }

   @Override
   public void dispose() {
      super.dispose();
      tempFile.delete();
   }

}


The purpose of this is to override the super method saveAs() to compare the file I have send and the file modified in this editor and to do some specific process, so I have to do it this way.
But to do this I have to override the method createPartControl() and I don't know how to create the oXygen text editor from this point. Is there an API i could use to open it like it exist for Word with the OleFrame and OleControlSite class ?

Code: Select all

OleFrame frame = new OleFrame(parent, SWT.NONE);
OleControlSite clientSite = new OleControlSite(frame, SWT.NONE, "Word.Document", new File(filename));


For now I use this version of oXygen (com.oxygenxml.editor_18.0.0.v2016051118) that I have insert in the dropins folder of Eclipse because the install from the Update Site didn't work. Do I need to take something else to use the oXygen API ? I saw the oXygen SDK but I don't know if I need it or not.

Thanks for you help,
Along
Radu
Posts: 5757

Re: Integrate oXygen XML Editor into RCP application EditorPart

Thu Jun 02, 2016 9:59 am

Hi Along,

The Oxygen editor part which does XML editing only in the text editing mode should be this class com.oxygenxml.editor.editors.xml.XMLTextEditor.

There should be a method that you can overwrite called:

com.oxygenxml.editor.editors.OxygenBaseEditor.editorAbout2Save(boolean saveAs)

on which you can return true if you want to cancel the "save/save as" operation. You should also call the super implementation when you overwrite it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Along
Posts: 10

Re: Integrate oXygen XML Editor into RCP application EditorPart

Thu Jun 02, 2016 10:55 am

Hi Radu,

Thank you for you quick answer.

I would like to know how I can access the com.oxygenxml.editor.editors.xml.XMLTextEditor class. Indeed, I have the oXygen package in my Eclipse dropins folder so I can open those views. However, I can't find it (with the ctrl + alt + T "Open Type" dialog). Should I download and install the oXygen SDK ?

Thanks for you help,
Along
Radu
Posts: 5757

Re: Integrate oXygen XML Editor into RCP application EditorPart

Thu Jun 02, 2016 1:39 pm

Hi Along,

Here's how this is usually done:

1) You install the Oxygen plugin in Eclipse.
2) You create an Eclipse plugin project (or you already have one).
3) You add a dependency from your project to the Oxygen xml plugin.
4) After this you should be able to compile code which calls or extends classes from the Oxygen plugin.
Also the Eclipse runtime workbench should run with both your plugin and the Oxygen plugin so that you can test your work.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Along
Posts: 10

Re: Integrate oXygen XML Editor into RCP application EditorPart

Thu Jun 02, 2016 3:51 pm

Hi Radu,

Thank you again for your quick answer. I have downloaded the jar and added in the build bath so my code could compile. For those interested, the editor looks like this :

Code: Select all

public class OxygenEditor extends EditorPart {

   protected File tempFile = null;
   protected XMLTextEditor editor;

   @Override
   public void doSave(IProgressMonitor monitor) {
      // Progress monitor during save with particular process
   }

   @Override
   public void init(IEditorSite site, IEditorInput input) throws PartInitException {
      setSite(site);
      setInput(input);
   }

   @Override
   public boolean isDirty() {
      return editor.isDirty();
   }

   @Override
   public boolean isSaveAsAllowed() {
      return true;
   }

   @Override
   public void createPartControl(Composite parent) {
      DocumentInput documentInput = ((DocumentInput) getEditorInput());
      tempFile =  documentInput.getTempFile();
      setPartName(documentInput.getAbsolutePath());

      editor = new XMLTextEditor();
      editor.createPartControl(parent);
      editor.setInput(documentInput);
   }

   @Override
   public void dispose() {
      super.dispose();
      tempFile.delete();
   }

}


However, I cannot extends my class directly with the XMLTextEditor because it says that "The hierarchy of the type OxygenXMLTextEditor is inconsistent". So I stay on this approach.
But now I have another issue : the XMLTextEditor.createPartControl() method throw a NullPointerException in the org.eclipse.ui.texteditor.AbstractTextEditor class. Do you know from what it could come from ? Maybe I don't have all the dependencies in my plugin project.

Thanks for you help,
Along
Radu
Posts: 5757

Re: Integrate oXygen XML Editor into RCP application EditorPart

Thu Jun 02, 2016 4:25 pm

Hi Along,

So:

However, I cannot extends my class directly with the XMLTextEditor because it says that "The hierarchy of the type OxygenXMLTextEditor is inconsistent". So I stay on this approach.


Could you post the full error message for this?
Probably you need to add more JAR libraries to the classpath used to compile your Java extension. The Oxygen plugin "lib" folder has a bunch of JAR libraries which you can add also to the classpath.

But now I have another issue : the XMLTextEditor.createPartControl() method throw a NullPointerException in the org.eclipse.ui.texteditor.AbstractTextEditor class. Do you know from what it could come from ? Maybe I don't have all the dependencies in my plugin project.


Could you paste the entire NullPointerException stack trace? I'm not sure that what you are trying to do (wrapping the editor part) will work.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Along
Posts: 10

Re: Integrate oXygen XML Editor into RCP application EditorPart

Thu Jun 02, 2016 4:52 pm

Hello Radu,

1) I cannot give you something else than this message because this is not an error during a code execution but rather an exception from Eclipse which prevent the code to compile. And there are no advice or solution given by Eclipse to resolve this issue.
For the libraries, I have added all the .jar from the oxygen-sdk-18.0.0.2-all.zip in another plug-in project and I have a dependency on it in my plug-in project with the editor class.

2) This is the full stack trace for the NullPointerException :

Code: Select all

java.lang.NullPointerException
   at org.eclipse.ui.texteditor.AbstractTextEditor.initializeDragAndDrop(AbstractTextEditor.java:3167)
   at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:3271)
   at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl(StatusTextEditor.java:53)
   at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:432)
   at com.oxygenxml.editor.editors.OxygenBaseEditor.createPartControl(Unknown Source)
   at com.oxygenxml.editor.editors.f.e.createPartControl(Unknown Source)
   at com.oxygenxml.editor.editors.xml.AbstractXMLTextEditor.createPartControl(Unknown Source)
   at com.oxygenxml.editor.editors.xml.XMLTextEditor.createPartControl(Unknown Source)
   at org.demo.oxygen.documentation.editor.editors.OxygenXMLTextEditor.createPartControl(OxygenXMLTextEditor.java:175)
   at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
   at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
   at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
   at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
   at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
   at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
   at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
   at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
   at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1254)
   at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1207)
   at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1606)
   at org.eclipse.ui.internal.PartStack.add(PartStack.java:497)
   at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
   at org.eclipse.ui.internal.PartStack.add(PartStack.java:483)
   at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
   at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
   at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
   at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
   at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:778)
   at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:677)
   at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:638)
   at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2860)
   at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2768)
   at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2760)
   at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2711)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
   at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2707)
   at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2691)
   at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2674)
   at org.eclipse.ui.ide.IDE.openEditor(IDE.java:439)
   at org.demo.oxygen.eclipse.EclPlatform$8$1.run(EclPlatform.java:2361)
   at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
   at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
   at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
   at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
   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:369)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
   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:620)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
   at org.eclipse.equinox.launcher.Main.main(Main.java:1384)


It should be interesting from the line 9 : org.demo.oxygen.documentation.editor.editors.OxygenXMLTextEditor.createPartControl(OxygenXMLTextEditor.java:175)

Thanks for you help,
Along
Radu
Posts: 5757

Re: Integrate oXygen XML Editor into RCP application EditorPart

Fri Jun 03, 2016 10:26 am

Hi Along,

1) I cannot give you something else than this message because this is not an error during a code execution but rather an exception from Eclipse which prevent the code to compile. And there are no advice or solution given by Eclipse to resolve this issue.
For the libraries, I have added all the .jar from the oxygen-sdk-18.0.0.2-all.zip in another plug-in project and I have a dependency on it in my plug-in project with the editor class.


I tested the same thing on my side and I managed to compile a class which extends the com.oxygenxml.editor.editors.xml.XMLTextEditor[/b ]by adding this JAR library to the build path: [b]oxygen-annotations.jar. You should find the JAR in our SDK.
So besides adding that dependency on the Oxygen plugin and on the org.eclipse.ui.editors plugin which is used by ours, I added this extra JAR file to the build path and the compilation worked for me.

2) This is the full stack trace for the NullPointerException....


You can look at the Java sources for the AbstractTextEditor at line 3167. It calls something like "getSite().getService(..)" and probably "getSite()" return NULL because the part was nor properly initialized, maybe because when you receive the init() callback in the wrapper class you do not delegate it to the wrapped object.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Along
Posts: 10

Re: Integrate oXygen XML Editor into RCP application EditorPart

Fri Jun 03, 2016 12:06 pm

Hi Radu,

Thanks for your quick answer.

1) From what I understand, you modify the org.eclipse.ui.editors plug-in and you add in its dependencies the oxygen-annotations.jar ? Because I have done the same thing and it does not work.
I created another plug-in project to test it. Inside you have all .jar beginning with "oxygen" in their name + a classic .jar file that I created containing the project org.eclipse.ui.editors with the oxygen-annotations in its build path. But when I create standard java class and I try to extends the XMLTextEditor, I still have the same error message.


2) I modified the init() method of my custom class to include site and input objects to avoid a NullPointerException. It looks like that :

Code: Select all

@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
   setSite(site);
   setInput(input);
   editor = new XMLTextEditor();
   editor.init((IEditorSite) getSite(), input);
}

With this I suceeded to open the XMLTextEditor but I have several issues following this.

Firstly, I don't really know if it is really an issue but I have this message when I init the XMLTextEditor :

Code: Select all

Unknown protocol: bundleresource://615.fwk2071611785:1/ro/sync/util/Resource.class
Unknown protocol: bundleresource://615.fwk2071611785:1/ro/sync/util/Resource.class


Secondly, when my editor is open, all the text seems encoded or not interpreted (like this ���(�{�@�7���A#� T?ʽn���~c�?�) and I have a succession of messages and exceptions each time I try to modify the content :

Code: Select all

421 INFO [ main ] ro.sync.azcheck.ui.spellcontrol.hunspell.e - No system property showing where the application was installed. Using the working directory instead.
437 WARN [ main ] ro.sync.azcheck.ui.o - Could not create the AZCheck spell checker due to:java.lang.NoClassDefFoundError: azcheck/engine/SpellException


Code: Select all

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.ClassCastException: ro.sync.exml.SAIDEAccess cannot be cast to com.oxygenxml.editor.j)
   at org.eclipse.swt.SWT.error(SWT.java:4083)
   at org.eclipse.swt.SWT.error(SWT.java:3998)
   at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
   at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
   at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
   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:369)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
   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:620)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
   at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
Caused by: java.lang.ClassCastException: ro.sync.exml.SAIDEAccess cannot be cast to com.oxygenxml.editor.j
   at com.oxygenxml.editor.editors.eb$6.run(Unknown Source)
   at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
   at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
   ... 23 more


Globally, I don't know if I not use correctly the .jar of the oxygen-sdk or if I miss something.

Thanks for your help,
Along
Radu
Posts: 5757

Re: Integrate oXygen XML Editor into RCP application EditorPart

Fri Jun 03, 2016 2:59 pm

Hi Along,

You are probably doing something wrong, it looks like our Eclipse plugin does not start before yours although as yours depends on ours, it should.

I uploaded the project I tested with:

https://www.oxygenxml.com/forum/files/testEclipseProject.zip

It defined a new editor which extends the Oxygen editor and binds it to the extension "xml2" in the plugin.xml.
Also its Manifest.mf defines its dependencies.
Besides this, I right clicked the project, selected "Properties"->"Java Build path" and added a reference to the oxygen-annotations.jar JAR so you will have to do this on your side.
After this, the project compiled, I run it using the Runtime Workbench, I created a file with the "test.xml2" extension containing XML inside and the Oxygen editor was used for editing, syntax highlighting and it also provided its specific contextual menu actions.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Along
Posts: 10

Re: Integrate oXygen XML Editor into RCP application EditorPart

Fri Jun 03, 2016 5:49 pm

Hi Radu,

Thanks for your answer.

I have tried to import your project into a new workspace but after adding the oxygen-annotation to the build path, the project still doesn't compile. I need to add to dependencies the plugin org.eclipse.core.resources because, I don't know why but, he wants to access to the IFile class. And after that I have the same error message "The hierarchy of the type XMLEditor is inconsistent".
Did you use a specific configuration ?

- I tried with both standard eclipse and eclipse for rcp and rap developers, version Luna (4.4.2) 64 bits.
- I have the default eclipse home target platform.
- As I said before, I extracted the com.oxygenxml.editor_18.0.0.v2016051118.zip package in the dropins folder of Eclipse (because the install from update site won't succeed) and I used the oxygen-annotations.jar from the oxygen-sdk in the build path of your project.
- I kept the included Eclipse jdk.

Thanks for you help,
Along
Radu
Posts: 5757

Re: Integrate oXygen XML Editor into RCP application EditorPart

Mon Jun 06, 2016 12:11 pm

Hi Along,

I downloaded Eclipse for RCP and RAP Developers and imported the same project that I gave to you in it.
The compilation reported a problem:

Code: Select all

The hierarchy of the type XMLEditor is inconsistent


so I looked in the Eclipse Problems view where I found the following error:

Code: Select all

The project was not built since its build path is incomplete. Cannot find the class file for org.eclipse.core.resources.IFile.


So I added one more dependency for my project on the org.eclipse.core.resources bundle. After this, my Manifest.mf looked like this:

Code: Select all

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Zuzu
Bundle-SymbolicName: TestEditor;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: zuzu.Activator
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 org.eclipse.jface.text,
 org.eclipse.ui.editors,
 com.oxygenxml.editor;bundle-version="18.0.0",
 org.eclipse.core.resources;bundle-version="3.9.1"
Bundle-ActivationPolicy: lazy


and the code compiled, the runtime workbench opened the sample editor type for an XML with the extension "xml2".

If it still does not work for you, please look in the Problems view, it should show you more details.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Along
Posts: 10

Re: Integrate oXygen XML Editor into RCP application EditorPart

Mon Jun 06, 2016 3:46 pm

Hi Radu,

Thank you for your answer.

I already use the "Problems view" so I have already resolve the import of the plugin org.eclipse.core.resources. However, I still have the error "The hierarchy of the type XMLEditor is inconsistent" and I don't have messages in the "Problems view" since then.

From what I have seen on stackoverflow, the message "The hierarchy of the type XMLEditor is inconsistent" is displayed because I try to use a library which I don't have.

I don't understand when the problem comes from. I tried with jdk 6, 7 and 8. I tried with an Eclipse Luna and an Eclipse Mars (I could get the XML Editor from the update site on Mars distribution). I even tried on another computer. But the result is always the same.

Do you have any idea what could it be ?

Thanks for your help,
Along
Radu
Posts: 5757

Re: Integrate oXygen XML Editor into RCP application EditorPart

Mon Jun 06, 2016 4:14 pm

Hi Along,

So your experiments were with the small sample project I sent you, right?
Also, could you double check that you added in the project build path a reference to the oxygen-annotations.jar?
Sorry but I'm running out of ideas, what operating system are you using?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Along
Posts: 10

Re: Integrate oXygen XML Editor into RCP application EditorPart

Mon Jun 06, 2016 6:18 pm

Hi Radu,

Indeed, I tried with your sample project. I made a reference in the build path to the oxygen-annotations.jar (the path redirect to my Desktop where the .jar is) and I my operating system is Windows seven.
My manifest is the same a yours.

Thanks for you help,
Along
Radu
Posts: 5757

Re: Integrate oXygen XML Editor into RCP application EditorPart

Tue Jun 07, 2016 11:46 am

Hi Along,

So today I opened the same project I tested yesterday with in Eclipse Luna and I obtained the same error message you did, message that I did not receive yesterday.
Bad news is that I have no idea why the error marker is reported, I just cannot find enough details to help me investigate it.
Good news is that despite of this error marker present, the Problems view shows no problem and the compilation seems to work, the runtime workbench also works.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Along
Posts: 10

Re: Integrate oXygen XML Editor into RCP application EditorPart

Tue Jun 07, 2016 12:13 pm

Hi Radu,

In my case, I can also open the runtime workbench but I can't open the .xml2 file with your editor, only those native from Eclipse.
Also, since the class doesn't compile, I can't override method from Editor part such as saveAs() or isDirty() as I have show you in the first messages.

I tried to extend this editor with Eclipse native editors and it works fine. The error message only appear when I try to extend it with an oXygen editor. I tried to add several others libraries but it didn't help.

Thanks for your help,
Along
Radu
Posts: 5757

Re: Integrate oXygen XML Editor into RCP application EditorPart

Tue Jun 07, 2016 2:50 pm

Hi Along,

So after you right click the project, Run as->Eclipse application and start the runtime workbench, right click the "filename.xml2" file and choose "Open with" you don't see a "Sample XML Editor" entry there, right? Because this works on my side. Also I added logging in my extension:

Code: Select all

public class XMLEditor extends XMLTextEditor {
   public XMLEditor() {
      System.err.println("CONSTUCTOR CALLED");
   }
   
   /**
      * @see com.oxygenxml.editor.editors.OxygenBaseEditor#isDirty()
      */
     @Override
     public boolean isDirty() {
        System.err.println("IS DIRTY CALLED");
       return super.isDirty();
     }
    
     @Override
     public boolean editorAbout2Save(boolean saveAs){
        System.err.println("ABOUT TO SAVE");
        return true;
     }

}


and despite of those markers the logging is shown in the console when running the runtime workbench.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Along
Posts: 10

Re: Integrate oXygen XML Editor into RCP application EditorPart

Tue Jun 07, 2016 4:36 pm

Hi Radu,

Actually it was my mistake, I can open .xml files with the new Editor. I will try to work from this and your sample. It is a little bothersome that it does not compile but I can work with it for now.
From that I can get the editedFile in the about2Save() method.

Thank you for your time and your support !

Regards,
Along
Radu
Posts: 5757

Re: Integrate oXygen XML Editor into RCP application EditorPart

Tue Jun 07, 2016 7:38 pm

Hi Along,

I will also add an issue on our side to see why Eclipse signals that problem. Again, it is not a Java compilation problem, if it were, the runtime workbench would not work at all, it is just some custom problem reporting done by Eclipse.

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

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 3 guests