Bug 261865 [CommonNavigator] Drag from Project Explorer to Package Explorer gets "assertion failed"
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.
bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonDropAdapterAssistant.java
* @param transferType
	 *            the current transfer type
	 * @return A status indicating whether the drop is valid.
	 */
	public abstract IStatus validateDrop(Object target, int operation,
			TransferData transferType);
	/**
	 * Carry out the DND operation.
	 * 
	 * @param aDropAdapter
	 *            The Drop Adapter contains information that has already been
	 *            parsed from the drop event.
	 * @param aDropTargetEvent
	 *            The drop target event.
	 * @param aTarget
	 *            The object being dragged onto
	 * @return A status indicating whether the drop completed OK.
	 */
	public abstract IStatus handleDrop(CommonDropAdapter aDropAdapter,
			DropTargetEvent aDropTargetEvent, Object aTarget);
	/**
	 * Clients may extend the supported transfer types beyond the default
	 * {@link LocalSelectionTransfer#getTransfer()} and
	 * {@link org.eclipse.ui.part.PluginTransfer#getInstance()} transfer types. When a transfer type
	 * other than one of these is encountered, the DND Service will query the
	 * <b>visible</b> and <b>active</b> descriptors that are <b>enabled</b>
	 * for the drop target of the current operation.
	 * 
	 * @param aTransferType
	 *            The transfer data from the drop operation