Community
Participate
Working Groups
I'm using (subclassing) ViewerDropAdapter to validate items to be dropped on a TreeViewer. Once I hover the mouse over a tree element for which ViewerDropAdapter.validateDrop() returns false, all subsequent calls to validateDrop() have operation == DND.DROP_NONE . That makes it difficult to determine what the user's intention was as far as dragging. In many cases, it means that the drag operation is effectively useless after hovering over such an element, as the user will be prevented from dropping the contents on any other element (even if normally valid!). ViewerDropAdapter.doDropValidation() calls validateDrop() with the current operation=event.detail every time; should it instead use operation=lastValidOperation?
I've hit the same issue and come to the same conclusion as to the fix. It seems likely this was the intention of lastValidOperation (the field name is confusing, it is the last operation that wasn't DND.DROP_NONE, stored irrespective of drop-validation). --- ViewerDropAdapter.java.orig 2008-06-09 10:54:02.439064468 +0100 +++ ViewerDropAdapter.java 2008-06-09 10:53:26.003236021 +0100 @@ -172,7 +172,7 @@ lastValidOperation = event.detail; } //valid drop and set event detail accordingly - if (validateDrop(currentTarget, event.detail, event.currentDataType)) { + if (validateDrop(currentTarget, lastValidOperation, event.currentDataType)) { currentOperation = lastValidOperation; } else { currentOperation = DND.DROP_NONE;
I'll mark this as a DUP of Bug 119014. That defect has more history and some reasonable ways to work around this. *** This bug has been marked as a duplicate of bug 119014 ***