JFace DnD issues [message #297731] |
Wed, 18 January 2006 18:51  |
Eclipse User |
|
|
|
Originally posted by: ross.goldberg.hcmny.com
I am having an issue using JFace DnD for TableViewers on Windows XP,
Eclipse 3.1, and Java 1.5.0.
I am allowing users to drag and drop rows from one TableViewer to another
using DragSourceListener & ViewerDropAdapter. Rows can only be dropped on
rows in the other TableViewer if certain values are the same in both of
the rows. If the drop isn't permitted, ViewerDropAdapter.validateDrop
returns false and whenever the pointer hovers over a non-droppable row in
the target TableViewer, it changes to a no-drop pointer (circle with a
diagnal line through it).
Everything was working fine; now, however, I get the no-drop symbol even
if the DnD should be permitted on a row. Even though validateDrop returns
true (which I've verified with printlns), I still get the no-drop pointer,
and drops fail.
If I press the CTRL button during a drag, however, everything works (i.e.
I get a copy pointer over droppable rows, and drops work on these rows).
Everything works on all subsequent drags without me touching the CTRL key.
I've opened up to instances of my app, and CTRL must be held down once
per instance (i.e. if I press CTRL while dragging in instance 1, I still
need to press CTRL while dragging in instance 2 for everything to work in
instance 2).
I have implemented this using a SerializableTransfer class that I wrote
myself. DND.DROP_COPY is the only supported operation.
SerializableTransfer is the only supported drop transfer type; both
SerializableTransfer & TextTransfer are supported drag transfer types
(TextTransfer is only used to other programs, e.g. Excel, not to the other
TableViewer). I have tried setting the event.detail = DND.DROP_COPY in
dragStart, but this didn't help.
Any insights are much appreciated.
Ross
|
|
|
Re: JFace DnD issues [message #297769 is a reply to message #297731] |
Thu, 19 January 2006 10:08  |
Eclipse User |
|
|
|
A bit of a guess:
I am assuming you are using ViewerDropAdapter, since you mention JFace; my guess won't make quite as
much sense if you aren't, bt I think it might still be relevant.
I had a similar problem in a similar context; the solution was to allow DND.DROP_DEFAULT, and then
at the very start of my OVERRIDES of the methods DropTargetListener#dragEnter(DropTargetEvent) and
DropTargetListener#dragOperationChanged(DropTargetEvent), test the DropTargetEvent.detail (and any
other conditions relevant), and if the DropTargetEvent.detail is DND.DROP_DEFAULT, set it to the
desired function (DND.DROP_MOVE or whatever).
HTH,
Paul
|
|
|
Powered by
FUDForum. Page generated in 0.06001 seconds