Error 'Received wrong transfer data.' [message #645020] |
Wed, 15 December 2010 09:08 |
Eclipse User |
|
|
|
Originally posted by: marius.groeger.googlemail.com
Hello,
I'm facing a very weird problem - both my own diagrams as well as the
stock ecore diagram editor through lots of 'Received wrong transfer
data.' errors into the Error Log view when I drag elements from the tree
view into the canvas.
I must have changed something which caused this, because it didn't
happen in the past. But I don't know. I just wanted to ask here on the
list if someone else stumbled across this problem and might give me a hint.
I did trace org.eclipse.jface.util.LocalSelectionTransfer#nativeToJava()
where the error is thrown, but I don't really have clue yet about DND
handling so I can't really tell what's going on here.
Thanks!
Marius
|
|
|
|
|
Re: Error 'Received wrong transfer data.' [message #645049 is a reply to message #645025] |
Wed, 15 December 2010 11:19 |
Eclipse User |
|
|
|
Originally posted by: marius.groeger.googlemail.com
On 15.12.2010 10:26, Tatiana Fesenko wrote:
> I'vehttps://bugs.eclipse.org/bugs/show_bug.cgi?id=327892 this problem on
> Linux. It was also discussed in
> http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg41423.html
> The problem is on OS side. It only corrupts early feedback, but it doesn't
> influence the result of drag-and-drop.
Thanks, and it is quite puzzling that this hasn't been fixed. I have now
researched the code a bit and while still being far from fully
understanding all the details I found that if one does the following
work-around, the error goes away. The work-around uses the fact that a
LocalSelectionTransfer is assumed, and that the unmarshalled result
would be the IStructuredSelection which is dragged:
protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
getDiagramGraphicalViewer().addDropTargetListener(
new DropTargetListener(getDiagramGraphicalViewer(),
LocalSelectionTransfer.getTransfer()) {
protected Object getJavaObject(TransferData data) {
return LocalSelectionTransfer.getTransfer()
.getSelection();
//.nativeToJava(data);
}
});
...
}
As you can see, I only replaced the .nativeToJava(data) with
..getSelection().
Regards
Marius
|
|
|
Powered by
FUDForum. Page generated in 0.03254 seconds