Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » is it possible to have different DND transfer types for different nodes in a tree?
is it possible to have different DND transfer types for different nodes in a tree? [message #441199] Wed, 11 August 2004 21:23 Go to next message
David Dean is currently offline David DeanFriend
Messages: 7
Registered: July 2009
Junior Member
I have a TreeViewer in which the nodes can represent different types of
data. Depending on which types of node are selected I want the viewer's
drag source to support a different array of Transfer objects,
appropriate for the selected node(s).

For instance, say that some nodes in my tree viewer have a Transfer type
of A and others have a type of B. Another view in my application can
accept both A & B. However if I call addDragSupport specifying both A &
B in the Transfer array then when I drag to the other view it always
assumes that the transfer type is the first matching type, which is not
necessarily the type supported by the selected node.

I tried to do this by calling TreeViewer.addDragSupport() in a selection
listener of the tree viewer. Unfortunately the DragSource class sets a
property on the control which "discourages", ie prevents doing this (it
causes an SWT error). It seems the intention is to only be able to call
addDragSupport once for a given control.

The only other option that I've thought of is to create a single
transfer type that contains all the variations of data types and then
let the target sort it out.

Anyone have any other ideas?

thx,

-David
Re: is it possible to have different DND transfer types for different nodes in a tree? [message #441435 is a reply to message #441199] Mon, 16 August 2004 08:38 Go to previous message
Eclipse UserFriend
Originally posted by: jeppenm.worldonline.dk

On Wed, 11 Aug 2004, David Dean wrote:

> I have a TreeViewer in which the nodes can represent different
> types of data. Depending on which types of node are selected I want
> the viewer's drag source to support a different array of Transfer
> objects, appropriate for the selected node(s).

You can delay the call to setTransfer until you receive a dragStart
event. When you receive a dragStart, call setTransfer with the transfer
type appropriate for the selection.

rgds
Jeppe
Previous Topic:java-gnome vs swt
Next Topic:import SWT app in another SWT app as popup
Goto Forum:
  


Current Time: Thu Sep 26 21:11:48 GMT 2024

Powered by FUDForum. Page generated in 0.03516 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top