Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » DnD - several transfer classes?
DnD - several transfer classes? [message #448614] Wed, 12 January 2005 08:42 Go to next message
Eclipse UserFriend
Originally posted by: tom_edwards.hotmail.com

I already posted this question in the tool builders forum but now I
realise that this newsgroup might be more appropriate.

I have a question concerning Drag and Drop with jFace viewers. I have a
view with an jface tree viewer displaying DBCollection and DBObject
objects (DBCollection is a sub class of DBObject). Now I would like to
drag these object to table viewers located in other views. Some table
viewers only accept DBCollections whereas others only accept DBObjects
which are not DBCollections.

What I did is so far: I wrote my own transfer classes for DBObject and one
for DBCollection, but what happens is that always the DBObject transfer
class is used (probably since DBCollection is a sub class of DBObject). So
how can I manage to choose what transfer class should be used? Or is there
another solution to find out if the user is dragging an object of type
DBObject or DBCollection? Thanks for your help. In the tutorials I found
they always drag only objects of a single type.
Tom
Re: DnD - several transfer classes? [message #448621 is a reply to message #448614] Wed, 12 January 2005 13:50 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
When you are subclassing, you must be careful about a couple of things:

1) Each subclass must have a unique ID - you can not inherit the type name
or type id from the super.
2) Make sure you implement getInstance to return an instance of the correct
subclass
3) Be careful about calling super in javaToNative or nativeToJava - you may
need to provide additional methods that the subclass can override.

Here is a modified version of snippet79 which shows an example of this:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet171.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup

"Tom Edwards" <tom_edwards@hotmail.com> wrote in message
news:cs2nto$f38$1@www.eclipse.org...
>I already posted this question in the tool builders forum but now I realise
>that this newsgroup might be more appropriate.
>
> I have a question concerning Drag and Drop with jFace viewers. I have a
> view with an jface tree viewer displaying DBCollection and DBObject
> objects (DBCollection is a sub class of DBObject). Now I would like to
> drag these object to table viewers located in other views. Some table
> viewers only accept DBCollections whereas others only accept DBObjects
> which are not DBCollections.
>
> What I did is so far: I wrote my own transfer classes for DBObject and one
> for DBCollection, but what happens is that always the DBObject transfer
> class is used (probably since DBCollection is a sub class of DBObject). So
> how can I manage to choose what transfer class should be used? Or is there
> another solution to find out if the user is dragging an object of type
> DBObject or DBCollection? Thanks for your help. In the tutorials I found
> they always drag only objects of a single type.
> Tom
>
>
Previous Topic:DragAndDrop Source problem
Next Topic:SWT dll info
Goto Forum:
  


Current Time: Fri Apr 23 15:25:29 GMT 2021

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

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

Back to the top