Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344880

Summary: [CommonNavigator] ResourceDropAdapterAssistant fails when dropping into an empty area of Common Navigator even though the target is valid
Product: [Eclipse Project] Platform Reporter: Michael Xia <xiayun>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: prakash
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard: stalebug

Description Michael Xia CLA 2011-05-05 14:28:49 EDT
Build Identifier: M20100909-0800

The issue reported in #303691 still happens in the latest 3.6.1 release.  When we make the project as the root of CommonViewer, dragging a file from file system and dropping into an empty area of the view fails with NullPointerException.  In ResourceDropAdapterAssistant.handleDrop() method, the aDropAdapter parameter has current target being null since there is no tree item under the mouse target, and that's causing getActualTarget() to fail down the line, but the aTarget parameter does correctly points to the root IProject object, so that should be used as a backup option since the setup passed validateDrop() test.


Reproducible: Always
Comment 1 Michael Xia CLA 2011-05-05 14:30:08 EDT
Sorry, the bug report I was referring is https://bugs.eclipse.org/bugs/show_bug.cgi?id=303691.
Comment 2 Michael Xia CLA 2011-05-05 17:13:13 EDT
Here is an easier reproducible case:

1. Open Project Explorer or Package Explorer;
2. Right-click on a project and select Go Into so the view is now focused on the project;
3. Try to drag a file from desktop into an empty area of the view.

Expected result: the file is dropped into the project.
Actual result: the exception below.

!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant.getActualTarget(ResourceDropAdapterAssistant.java:336)
	at org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant.performFileDrop(ResourceDropAdapterAssistant.java:565)
	at org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant.handleDrop(ResourceDropAdapterAssistant.java:225)
	at org.eclipse.ui.navigator.CommonDropAdapter$1.run(CommonDropAdapter.java:194)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.navigator.CommonDropAdapter.performDrop(CommonDropAdapter.java:184)
	at org.eclipse.jface.viewers.ViewerDropAdapter.drop(ViewerDropAdapter.java:276)
	at org.eclipse.ui.part.PluginDropAdapter.drop(PluginDropAdapter.java:69)
	at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:90)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3776)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1187)
	at org.eclipse.swt.dnd.DropTarget.drop(DropTarget.java:715)
	at org.eclipse.swt.dnd.DropTarget.outlineView_acceptDrop_item_childIndex(DropTarget.java:733)
	at org.eclipse.swt.dnd.DropTarget.dropTargetProc(DropTarget.java:458)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.dnd.DropTarget.dndCallSuper(DropTarget.java:197)
	at org.eclipse.swt.dnd.DropTarget.performDragOperation(DropTarget.java:726)
	at org.eclipse.swt.dnd.DropTarget.dropTargetProc(DropTarget.java:443)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:4483)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4739)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:85)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3271)
	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)
Comment 3 Lars Vogel CLA 2019-11-14 02:17:56 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.