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.jface/src/org/eclipse/jface/viewers/ViewerDropAdapter.java
*
     * @param event the event
     * @return one of the <code>LOCATION_* </code>constants defined in this class
     */
    protected int determineLocation(DropTargetEvent event) {
        if (!(event.item instanceof Item)) {
            return LOCATION_NONE;
        }
        Item item = (Item) event.item;
        Point coordinates = new Point(event.x, event.y);
        coordinates = viewer.getControl().toControl(coordinates);
        if (item != null) {
            Rectangle bounds = getBounds(item);
            if (bounds == null) {
                return LOCATION_NONE;
            }
            if ((coordinates.y - bounds.y) < 5) {
                return LOCATION_BEFORE;
            }
            if ((bounds.y + bounds.height - coordinates.y) < 5) {
                return LOCATION_AFTER;
            }
        }
        return LOCATION_ON;
    }
    /**
     * Returns the target item of the given drop event.
     *
     * @param event the event
     * @return The target of the drop, may be <code>null</code>.