[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: DND with two different costum classes
|
- From: duongn@xxxxxxxxxx (Duong Nguyen)
- Date: Fri, 18 Apr 2008 21:39:55 +0000 (UTC)
- Newsgroups: eclipse.platform.swt
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
Without some sample code, I'm not sure if I understand what you're doing.
You don't need to override isSupportedType to check for Foo or Bar. The
DropTargetAdapter and the DragSourceAdapter typically does not need to
check for instanceof Foo or Bar either.
FooTransfer and BarTransfer should implement validate(Object). You should
check whether the Object is Foo or Bar respectively in this method.
You can look at Snippet79 or Snippet171 for some custom transfer types.
Duong
Moritz Kreutzer wrote:
Hi everyone,
in my RCP app I want to implement a DND-mechanism in which i want to
transfer objects of two different costum classes (Foo and Bar). I already
implemented FooTransfer and BarTransfer which both extend
ByteArrayTransfer.
I also implemented a DropTargetAdapter (which is checking for the class
via (Foo|Bar)Transfer.getInstance().isSupportedType(event.currentDataType)
in drop()) and a DragSourceAdapter (which is checking via * instanceof
(Foo|Bar)).
They seem to work fine.
But, anyway, the whole mechanism doesn't work.
It seems like there is FooTransfer called everytime even if I want to
transfer a Bar.
My question: How do I "connect" the classes to the Transfer types?
(I already had a look at isSupportedType(TransferData) but I don't
understand how to check the TransferData for a class.)
Or how does this work at all?
Thanks in advance.
Regards, Moritz.