[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: SWT vs SWING/AWT Drag and drop
|
Thanks Duong!
This almost entirely works. I am only having an issue with the
generated Type Id in the SWT custom transfer class.
Re:
> protected static DataFlavor customFlavor = new DataFlavor
> (CustomClass.class,
> "A Custom Object");
and:
> private static final String MYTYPENAME = "A Custom Object";
> private static final int MYTYPEID = registerType (MYTYPENAME);
The problem is, in my Transfer class I have
/*
* Method declared on Transfer.
*/
@Override
protected int[] getTypeIds() {
return new int[] { TYPEID };
}
Unfortunately, when
ByteArrayTransfer:
abstract public boolean isSupportedType(TransferData transferData);
s being called, and trying to match TYPEID with the type (integer) that
gets defined by customFlavor.. the numbers do not match.
So, in my Transfer class TYPEID = 50031, and in customFlavor (when it
gets sent over the pipe to Transfer) the type = 49981. (not exact
numbers, but something like that).
If I manually change my custom Transfer:
/*
* Method declared on Transfer.
*/
@Override
protected int[] getTypeIds() {
return new int[] { TYPEID, 49981 };
}
then it will work.
I would like to correctly have TYPEID programatically generated at run
time, and it seems like I am just not passing the correct value for
MYTYPENAME.
Do I need MYTYPENAME to look something like, "Mime type/text...
class=custom.class"?
With this resolved - I think I will be fully satisfied with the
solution!
Thank you,
Sheldon