NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

<oXygen/> general issues.
SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

Post by SSC » Fri Jan 13, 2012 2:06 pm

Hi,

Here is the stacktrace of the error:

Code: Select all

11:51:42,579 312002 ERROR [ main ] com.oxygenxml.editor.editors.t - java.lang.NullPointerException
java.lang.NullPointerException
at org.eclipse.ui.internal.EditorSiteDragAndDropServiceImpl$1.dragLeave(EditorSiteDragAndDropServiceImpl.java:107)
at com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)
at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:70)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:403)
at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:258)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:119)
at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method)
at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:363)
at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:289)
at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java:172)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
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.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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
This Error occurs when I try to drag a tag element from the author view with "Full Tags" turned on.
As you see in the stacktrace, it is concering the Eclipse plugin version of Oxygen.
Can you eventually explain me which object is missing in the com.oxygenxml.editor.editors.t class during the drag?
Even though the drop of a tag element works well.
I can drop the element on the editor itself at another place or on a custom view and it works fine, but the NullPointerException occurs always.
Simon Scholz
vogella GmbH
http://www.vogella.com

Radu
Posts: 6589
Joined: Fri Jul 09, 2004 5:18 pm

Re: NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

Post by Radu » Fri Jan 13, 2012 4:02 pm

Hi Simon,

This NullPointerException was reported to us initially a year ago (for an Oxygen 12.1 distribution), the developer who reported it then had about the same use case, drag and drop to a custom view. It was back then displayed in the Eclipse error log and could not be reproduced on our side so finally I took the decision to catch it locally and only display an error message in the console, as the result did not break drag and drop in any way.
We have some complications in our code related to drag and drop in the Author page, as the Author page also needs to allow the default drop behavior to occur (when dropping a resource from the navigator to the Author page, the resource needs to be opened) so it is probably a bug on our side but we need a way to reproduce the behavior.

What exact distribution and version of Eclipse are you using? I can try again to reproduce this on our side using the same distribution.

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

SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Re: NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

Post by SSC » Mon Jan 16, 2012 9:27 am

We are using Eclipse 3.6 Helios for our client application.
The DnD NullPointerException is also thrown, when I drag a tag element only inside the editor to another position in the XML document.
So it really has nothing to do with our custom views and you should be able to reproduce the Exception.
What is the dragLeave method of the class t actually doing?
Simon Scholz
vogella GmbH
http://www.vogella.com

Radu
Posts: 6589
Joined: Fri Jul 09, 2004 5:18 pm

Re: NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

Post by Radu » Mon Jan 16, 2012 11:07 am

Hi,

I know that the problem is not in our code, but Eclipse has various distributions, with some plugins being available in one distribution and missing in the other like:

http://www.eclipse.org/downloads/

For example, internally we are using Eclipse Classic.

Can you give me a download link from the Eclipse web site to the Eclipse 3.6 kit that you are using?
Do you have other customizations (or plugins) like the German translations added to the Eclipse workbench?

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

SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Re: NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

Post by SSC » Mon Jan 16, 2012 5:35 pm

Hello,

Sorry for the delay.

We use the 3.6.2 Eclipse for RCP and RAP Developers version of Eclipse :
http://www.eclipse.org/downloads/packag ... helios/sr2

Of cause we have several customizations and supported languages, but I guess they do not change the DnD behavior.
In the Stacktrace of the NullPointerException none of our custom plugins are mentioned, so I would guess that our customizations do not cause that NullPointerException.
Simon Scholz
vogella GmbH
http://www.vogella.com

Radu
Posts: 6589
Joined: Fri Jul 09, 2004 5:18 pm

Re: NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

Post by Radu » Tue Jan 17, 2012 1:32 pm

Hi Simon,

Sorry, but I could not reproduce the problem.

What I did was to take an Eclipse 3.6.2, install an Oxygen 13.2 plugin in it in the "dropins" folder, created a sample Hello World plugin project and run it using the runtime workbench, with full logging enabled in Oxygen.
There was a lot of logging coming from Oxygen but the Null Pointer Exception did not appear when drag and dropping in the Author page.
Can you try such a simple procedure yourself? Do you obtain the problem on your side?
I'm sure the problem is real, any idea what else I can try on my side to reproduce it?

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

SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Re: NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

Post by SSC » Wed Jan 18, 2012 10:58 am

Hi Radu,

I realized that a new Eclipse Test Client does not throw that NullPointerException either.
I will have to pass that Issue to our system-architect, but with a low priority because DnD works well though having this NullPointerExeption.

I will inform you about any improvements concerning that issue.
Many thanks for your efforts so far. :)
Simon Scholz
vogella GmbH
http://www.vogella.com

SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Re: NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

Post by SSC » Fri Jun 15, 2012 10:51 am

Hello,

Now that I am analysing the DnD for the Editor, I found out that there is a standard DnD behavior for texteditors in Eclipse.

If you deselect the following checkbox, the NullPointerException won´t occur any more:
Preferneces -> General -> Editors -> Text Editors -> deselect checkbox "Enable drag and drop of text"

If this checkbox is deselected, the initializeDragAndDrop method of the org.eclipse.ui.texteditor.AbstractTextEditor will not invoke the installTextDragAndDrop(viewer) method:

Code: Select all


IPreferenceStore store= getPreferenceStore();
if (store != null && store.getBoolean(PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED)){
installTextDragAndDrop(viewer);
}
The installTextDragAndDrop method internally adds a org.eclipse.ui.internal.EditorSiteDragAndDropServiceImpl.MergedDropTarget, who´s secondary DropTargetListener is null, which finally causes the NullPointerException.
(see org.eclipse.ui.internal.EditorSiteDragAndDropServiceImpl in line 171)

Maybe this helps other customers of yours, for instance the one who had the same issue one your ago with Oxygen 12.1.

Best regards,

Simon
Simon Scholz
vogella GmbH
http://www.vogella.com

Radu
Posts: 6589
Joined: Fri Jul 09, 2004 5:18 pm

Re: NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

Post by Radu » Fri Jun 15, 2012 2:16 pm

Hi Simon,

In the Java sources we have for "org.eclipse.ui.texteditor.AbstractTextEditor.installTextDragAndDrop(ISourceViewer)" the dropTargetListener is not null, its implementation is the one which actually makes the copy operations when the text is dropped in the text page.
Maybe it depends on the used Eclipse version.

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

SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Re: NullPointerException in com.oxygenxml.editor.editors.t.dragLeave(Unknown Source)

Post by SSC » Fri Jun 15, 2012 2:36 pm

Hello Radu,

I think you mean the primary DropTargetListener of the org.eclipse.ui.internal.EditorSiteDragAndDropServiceImpl.MergedDropTarget.
This one is not null either in our code, but the secondary, which comes from the org.eclipse.ui.internal.WorkbenchWindowConfigurer in line 167 of the org.eclipse.ui.internal.EditorSiteDragAndDropServiceImpl, is null.

org.eclipse.ui.internal.EditorSiteDragAndDropServiceImpl#addMergedDropTarget(...)

Code: Select all


WorkbenchWindow ww = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
WorkbenchWindowConfigurer winConfigurer = ww.getWindowConfigurer();
Transfer[] editorSiteTransfers = winConfigurer.getTransfers();
DropTargetListener editorSiteListener = winConfigurer.getDropTargetListener();

// Create a new 'merged' drop Listener using combination of the desired
// transfers and the ones used by the EditorArea
MergedDropTarget newTarget = new MergedDropTarget(control, ops, transfers, listener,editorSiteOps, editorSiteTransfers, ditorSiteListener);
We currently use Eclipse 3.6 for our RCP client.

Even when I turn off the preference for the DnD of TextEditors, I am able to DnD textcontent, but the NullPointerException does not appear any more.

Regards,

Simon
Simon Scholz
vogella GmbH
http://www.vogella.com

Post Reply