Project: Eclipse_Platform_UI
Bug 261865 [CommonNavigator] Drag from Project Explorer to Package Explorer gets "assertion failed"
Reported: 2009-01-21 12:19:20 | Status: verified fixed

The CommonDropAdapter should be keeping track of the event.detail variable and setting it properly at the end. It currently does not do this all the time. If dragging from the project explorer, a JDT drag adapter checks this code in an assert to verify there is no more work to do. BasicSelectionTransferDragAdapter.dragFinished(etc) has the following code: public void dragFinished(DragSourceEvent event) { // Make sure we don't have to do any remaining work Assert.isTrue(event.detail != DND.DROP_MOVE); LocalSelectionTransfer.getInstance().setSelection(null); LocalSelectionTransfer.getInstance().setSelectionSetTime(0); } Currently, CommonDropAdapter only modifies this event.detail variable via the superclass, and even then, only in some situations. public void drop(DropTargetEvent event) { validateDrop(getCurrentTarget(), getCurrentOperation(), event.currentDataType); if (PluginTransfer.getInstance().isSupportedType(event.currentDataType)) super.drop(event); The superclass and the super-superclass execute the following line almost universally in this method: event.detail = DND.DROP_NONE; This command indicates the event no longer has any work to do. This line is missing from CommonDropAdapter.drop(DropTargetEvent event) in two places. Patch attached. The effect of this bug is that any time this bug is hit, an error dialog appears and something is logged to the error log. Very annoying for users.

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerDropAdapter.java bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant.java bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/dnd/NavigatorDnDService.java bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonDropAdapter.java bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonDropAdapterAssistant.java bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonViewer.java tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/SWTEventHelper.java tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/DnDTest.java tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/NavigatorTestBase.java tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/NavigatorTestSuite.java tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/extension/TestCopyDropAssistant.java