Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 92802 - [DnD] Can't validate dragged items after hovering over an invalid item
Summary: [DnD] Can't validate dragged items after hovering over an invalid item
Status: RESOLVED DUPLICATE of bug 119014
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-26 12:34 EDT by Rob Joyce CLA
Modified: 2008-06-09 10:52 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Joyce CLA 2005-04-26 12:34:13 EDT
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?
Comment 1 Matt Hillsdon CLA 2008-06-09 05:59:08 EDT
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;
Comment 2 Eric Moffatt CLA 2008-06-09 10:52:57 EDT
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 ***