Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Create a custom DND transfer type or use String?
Create a custom DND transfer type or use String? [message #443337] Wed, 22 September 2004 22:10 Go to next message
Jelle Herold is currently offline Jelle HeroldFriend
Messages: 42
Registered: July 2009
Member
Hi!

I've got a dnd design issue here:

Suppose my application has a ComplexType class. The user needs to drag
instances of this class from one widget to another widget *within in my
application only* (It is not needed that the user can drag from this
application to another, or use the clipboard).

There is not obvious way to represent this object uniquely in a String.
That is, a string representation just wouldn't make any sense.

My question is, should I implement a custom transfer type that is
able to transfer objects of type ComplexType so that the dropRecieve()
method's event.data contains a reference to this complex type. And
since it doesn't make any sense to drag this data outside of the
implementation, how do I avoid writing javaToNative code etc..?

Or should I tag all objects with a unique ID String and use a hash to
look them up again in the drop recieving widget (this seems less work)?

Basicly I just want a easy way to dnd an (typed) object reference.



Sorry for the long rant and thanks ahead for any ideas,

cheers!
Jelle.
--
http://defekt.nl/
http://www.students.cs.uu.nl/people/jherold/
Re: Create a custom DND transfer type or use String? [message #443357 is a reply to message #443337] Thu, 23 September 2004 13:11 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Have a look at:

An example of a transfer that just drags around an id
(in org.eclipse.ui.ide)
org.eclipse.ui.views.navigator.LocalSelectionTransfer

or:

An example of passing "MyType" around where "MyType" is more complex than a
string
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet79.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup

"Jelle Herold" <jelle@defekt.nl> wrote in message
news:cist97$cb5$1@eclipse.org...
> Hi!
>
> I've got a dnd design issue here:
>
> Suppose my application has a ComplexType class. The user needs to drag
> instances of this class from one widget to another widget *within in my
> application only* (It is not needed that the user can drag from this
> application to another, or use the clipboard).
>
> There is not obvious way to represent this object uniquely in a String.
> That is, a string representation just wouldn't make any sense.
>
> My question is, should I implement a custom transfer type that is
> able to transfer objects of type ComplexType so that the dropRecieve()
> method's event.data contains a reference to this complex type. And
> since it doesn't make any sense to drag this data outside of the
> implementation, how do I avoid writing javaToNative code etc..?
>
> Or should I tag all objects with a unique ID String and use a hash to
> look them up again in the drop recieving widget (this seems less work)?
>
> Basicly I just want a easy way to dnd an (typed) object reference.
>
>
>
> Sorry for the long rant and thanks ahead for any ideas,
>
> cheers!
> Jelle.
> --
> http://defekt.nl/
> http://www.students.cs.uu.nl/people/jherold/
Previous Topic:It's not possible in Windows to move a tree item without
Next Topic:SWT Problems on Linux
Goto Forum:
  


Current Time: Thu Apr 25 11:45:07 GMT 2024

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

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

Back to the top