Home » Eclipse Projects » GEF » Drag and Drop Java Resources, 2nd attempt
Drag and Drop Java Resources, 2nd attempt [message #117545] |
Fri, 13 February 2004 05:58  |
Eclipse User |
|
|
|
I asked this a few weeks ago but unfortunately nobody followed up on it,
so here goes my second attempt :). Unfortunately digging deeper did not
reveal any new experiences.
Hi Gurus,
Short:
- How can I *copy* resources instead of moving them (I know DND.DROP_COPY)?
- What Transfer do I have to use to be able to drag Java Resources
(IJavaElements, e.g. IType, ICompilationUnit, etc.) from the package
explorer over to a GEF editor?
Longer:
I am currently struggling with GEF's drag and drop. I have read the
article "Using Native Drag and Drop with GEF"
( http://www.eclipse.org/articles/Article-GEF-dnd/GEF-dnd.html) and
adopted it to our code. Dragging over filenames works just fine. What
I actually want to do is to be able to drag Java Resources
(IJavaElements, e.g. IType, ICompilationUnit, etc.) over to our GEF
editor. So I found ResourceTransfer and adopted the code to use that (I
also found a JavaElementTransfer which (name) seems even better but that
was in a package with "internal" in its name so I guess I better don't
use it(?)). Problem is now, whenever I drag from the package explorer
to the GEF editor, the resource is *moved*, not copied. I can say
getCurrentEvent().detail = DND.DROP_COPY;
in either or both handleDragOver() and handleDrop(), it doesn't matter.
I have found the thread
http://dev.eclipse.org/newslists/news.eclipse.tools.gef/msg0 1419.html
and there Eric Bordeau writes that putting DND.DROP_COPY in the detail
field ensures that the resource is copied. But that doesn't work for
me. I am using the M5 eclipse milestone together with GEF from January,
13th on Linux GTK. Maybe things are broken with these versions?
Second questions is how to drag Java Resources from a package explorer
to a GEF editor. Is there only ResourceTransfer? If so, is there a
better way than walking down the JDT model to map IResources to
IJavaElements? Some IJavaElement.mapResourceToJavaElement() method I
overlooked?
advTHANKSance, Thomas.
--
Thomas Maier <Thomas.Maier@uni-kassel.de>
|
|
|
Re: Drag and Drop Java Resources, 2nd attempt [message #117600 is a reply to message #117545] |
Fri, 13 February 2004 14:29   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
> I asked this a few weeks ago but unfortunately nobody followed up on it,
> so here goes my second attempt :). Unfortunately digging deeper did not
> reveal any new experiences.
>
> Hi Gurus,
>
> Short:
> - How can I *copy* resources instead of moving them (I know
DND.DROP_COPY)?
> - What Transfer do I have to use to be able to drag Java Resources
> (IJavaElements, e.g. IType, ICompilationUnit, etc.) from the package
> explorer over to a GEF editor?
That sounds like an eclipse.tools.jdt question to me.
> also found a JavaElementTransfer which (name) seems even better but that
> was in a package with "internal" in its name so I guess I better don't
> use it(?)). Problem is now, whenever I drag from the package explorer
> to the GEF editor, the resource is *moved*, not copied. I can say
>
> getCurrentEvent().detail = DND.DROP_COPY;
What if you hold down CONTROL modifier while dragging?
> in either or both handleDragOver() and handleDrop(), it doesn't matter.
> I have found the thread
> http://dev.eclipse.org/newslists/news.eclipse.tools.gef/msg0 1419.html
Does it work properly on windows?
|
|
|
Re: Drag and Drop Java Resources, 2nd attempt [message #117669 is a reply to message #117600] |
Mon, 16 February 2004 03:48  |
Eclipse User |
|
|
|
Randy Hudson wrote:
>>Short:
>>- How can I *copy* resources instead of moving them (I know
>
> DND.DROP_COPY)?
>
>>- What Transfer do I have to use to be able to drag Java Resources
>>(IJavaElements, e.g. IType, ICompilationUnit, etc.) from the package
>>explorer over to a GEF editor?
>
>
> That sounds like an eclipse.tools.jdt question to me.
Thanks for following up Randy. After having pushed the send button I
had the same idea :). I posted it there, too, but no response, yet.
>
>>also found a JavaElementTransfer which (name) seems even better but that
>>was in a package with "internal" in its name so I guess I better don't
>>use it(?)). Problem is now, whenever I drag from the package explorer
>>to the GEF editor, the resource is *moved*, not copied. I can say
>>
>>getCurrentEvent().detail = DND.DROP_COPY;
>
>
> What if you hold down CONTROL modifier while dragging?
No difference.
>
>
>>in either or both handleDragOver() and handleDrop(), it doesn't matter.
>> I have found the thread
>> http://dev.eclipse.org/newslists/news.eclipse.tools.gef/msg0 1419.html
>
>
> Does it work properly on windows?
Unfortunately I have to wait until Wednesday to check this because I do
not have any Windows boxes here.
Regards, Thomas.
--
Thomas Maier <Thomas.Maier@uni-kassel.de>
|
|
|
Goto Forum:
Current Time: Mon Jun 02 03:43:32 EDT 2025
Powered by FUDForum. Page generated in 0.03671 seconds
|