Problem dragging/dropping bookmarks [message #267400] |
Tue, 17 August 2004 17:17 |
Eclipse User |
|
|
|
Hi all,
I'm working on a plugin for 3.0 and would like to drag and drop
bookmarks onto one of my
views. I've subclassed ViewerDropAdapter and attached it to my view.
Unfortunately I'm getting a
ClassCastException before the code reaches the drop method. I tried adding
a FileTransfer to the
Transfer array and when I drag a resource from the Package Explorer I am
able to successfully
drop it onto my view.
I traced the execution in the debugger and it appears to be getting the
exception in the lazyInit()
method in MarkerTransfer. It has been passed an Object[] and it casts the
first element to an
IMarker. But the array that is passed contains a BookmarkMarker which
makes sense since that's
what I was dragging. However BookmarkMarker doesn't implement IMarker so
it gets the
exception. Here is the code snippet:
private void lazyInit(Object[] markers) {
if (workspace == null) {
if (markers != null && markers.length > 0) {
this.workspace = ((IMarker)markers[0].getResource().getWorkspace();
}
}
}
I couldn't run all my code in 2.1 but I tried a simple test and I didn't
encounter the exception
there. The code sequence is quite different though so I guess this area
changed. I tried searching
the bug database but couldn't find anything that looked like this so sorry
if it's in there already.
Any suggestions or workarounds would be much appreciated. Thanks.
-Ron Kadomiya
|
|
|
Powered by
FUDForum. Page generated in 0.04199 seconds