Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318181 - [Compatibility] NPE thrown when DND'ing text in the text editor
Summary: [Compatibility] NPE thrown when DND'ing text in the text editor
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.0 RC3   Edit
Assignee: Oleg Besedin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-28 10:10 EDT by Remy Suen CLA
Modified: 2010-07-27 14:26 EDT (History)
3 users (show)

See Also:
bokowski: review+
emoffatt: review+


Attachments
Patch (844 bytes, patch)
2010-07-21 10:57 EDT, Oleg Besedin CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2010-06-28 10:10:20 EDT
java.lang.NullPointerException
	at org.eclipse.ui.internal.EditorSiteDragAndDropServiceImpl$MergedDropTarget$1.dragLeave(EditorSiteDragAndDropServiceImpl.java:107)
	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.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:658)
Comment 1 Oleg Besedin CLA 2010-07-21 10:46:36 EDT
I'll take a look at this.
Comment 2 Oleg Besedin CLA 2010-07-21 10:57:30 EDT
Created attachment 174866 [details]
Patch

This is a fun patch - the one-line fix.

The problem was that WorkbenchWindowConfigurer#configureEditorAreaDropListener() method was left empty in the e4 version.

The 3.x method:
(1) sets the EditorAreaDropAdapter into the local variable, and
(2) adds it as a listener to pages->presentation->layout parts -> drop targets 

The (2) which would be a problem for e4 due to different internal structure. However, the (2) is not actually executed in the 3.x world: at the time the code is run, there are no workbench pages.

So, it is only (1) that is actually done in 3.x and that is the values needed by the EditorSiteDragAndDropServiceImpl which does:
 DropTargetListener editorSiteListener = winConfigurer.getDropTargetListener();

So, simply doing a single line of code (1) fixes the problem.



However, theirony is that
Comment 3 Oleg Besedin CLA 2010-07-21 10:59:36 EDT
Boris, Eric, could you review?
Comment 4 Oleg Besedin CLA 2010-07-21 11:02:41 EDT
(In reply to comment #2)
> However, theirony is that

Please ignore that line. One of those days I will join Bugzilla development with a single goal of finally adding ability to edit comments :-(.
Comment 5 Eric Moffatt CLA 2010-07-21 13:25:14 EDT
Looks good to me...

BTW, I'll fight any attempt to make Bugzilla comments editable...we'd end up in wikipedia-like change wars, revisionist history is a bad thing (tm) ;-)
Comment 6 Oleg Besedin CLA 2010-07-21 13:33:31 EDT
Patch applied to CVS Head.
Comment 7 Eric Moffatt CLA 2010-07-27 14:26:18 EDT
Verified on XP in I20100726-2152.