Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Dragging objects from the Outline view to a GEF editor?
Dragging objects from the Outline view to a GEF editor? [message #96398] Tue, 30 September 2003 20:29 Go to next message
Dirk Lemmermann is currently offline Dirk LemmermannFriend
Messages: 11
Registered: July 2009
Junior Member
Hi there,

Which steps are required so that I can drop ANY selection from ANY view onto
a GEF editor/viewer (especially from the outline view to the GEF editor)? I
have tried to attach a TransferDropTargetListener and use the
LocalSelectionTransfer instance to specify which type of transfers I am
interested in. For some reason, though, I never get the drop cursor on my
editor. What am I missing? It is my understanding that drag and drop
requires drag listeners on one view and drop listeners on the other view.
But do I have to attach these drag listeners on all other views myself?
Aren't they already initialized with a couple of drag listeners? How do I
find out which drag listeners (with which transfer type) are attached to
them?

Dirk

// in my editor
GetGraphicalViewer().addDropTargetListener(new MyListener());

// drop listener class
Class MyListener extends AbstractTransferDropTargetListener {
public MyListener(EditPartViewer viewer) {
super(viewer, LocalSelectionTransfer.getInstance());
}

public void handleDrop() {
System.out.println("Never get to see this system.out");
}
}
Re: Dragging objects from the Outline view to a GEF editor? [message #96474 is a reply to message #96398] Wed, 01 October 2003 02:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: selpin.yahoo.com

It seems that you only took care of the editor part, how about the viewer?
did you add the relevant DragSourceAdapter or DragSourceListener?



Dirk Lemmermann wrote:

> Hi there,

> Which steps are required so that I can drop ANY selection from ANY view onto
> a GEF editor/viewer (especially from the outline view to the GEF editor)? I
> have tried to attach a TransferDropTargetListener and use the
> LocalSelectionTransfer instance to specify which type of transfers I am
> interested in. For some reason, though, I never get the drop cursor on my
> editor. What am I missing? It is my understanding that drag and drop
> requires drag listeners on one view and drop listeners on the other view.
> But do I have to attach these drag listeners on all other views myself?
> Aren't they already initialized with a couple of drag listeners? How do I
> find out which drag listeners (with which transfer type) are attached to
> them?

> Dirk

> // in my editor
> GetGraphicalViewer().addDropTargetListener(new MyListener());

> // drop listener class
> Class MyListener extends AbstractTransferDropTargetListener {
> public MyListener(EditPartViewer viewer) {
> super(viewer, LocalSelectionTransfer.getInstance());
> }

> public void handleDrop() {
> System.out.println("Never get to see this system.out");
> }
> }
Re: Dragging objects from the Outline view to a GEF editor? [message #96503 is a reply to message #96474] Wed, 01 October 2003 06:10 Go to previous messageGo to next message
Dirk Lemmermann is currently offline Dirk LemmermannFriend
Messages: 11
Registered: July 2009
Junior Member
That's exactly my question. Do I need to add drag listeners myself to any
view that I want to support with drag operations? The Navigator for example
already supports dragging operations. Shouldn't I be able to drag something
from there to my viewer?

Dirk

On 10/1/03 4:05 AM, in article bldcpv$pv4$1@eclipse.org, "Evon"
<selpin@yahoo.com> wrote:

> It seems that you only took care of the editor part, how about the viewer?
> did you add the relevant DragSourceAdapter or DragSourceListener?
>
>
>
> Dirk Lemmermann wrote:
>
>> Hi there,
>
>> Which steps are required so that I can drop ANY selection from ANY view onto
>> a GEF editor/viewer (especially from the outline view to the GEF editor)? I
>> have tried to attach a TransferDropTargetListener and use the
>> LocalSelectionTransfer instance to specify which type of transfers I am
>> interested in. For some reason, though, I never get the drop cursor on my
>> editor. What am I missing? It is my understanding that drag and drop
>> requires drag listeners on one view and drop listeners on the other view.
>> But do I have to attach these drag listeners on all other views myself?
>> Aren't they already initialized with a couple of drag listeners? How do I
>> find out which drag listeners (with which transfer type) are attached to
>> them?
>
>> Dirk
>
>> // in my editor
>> GetGraphicalViewer().addDropTargetListener(new MyListener());
>
>> // drop listener class
>> Class MyListener extends AbstractTransferDropTargetListener {
>> public MyListener(EditPartViewer viewer) {
>> super(viewer, LocalSelectionTransfer.getInstance());
>> }
>
>> public void handleDrop() {
>> System.out.println("Never get to see this system.out");
>> }
>> }
>
>
Re: Dragging objects from the Outline view to a GEF editor? [message #96548 is a reply to message #96503] Wed, 01 October 2003 13:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

If you know the view already has a drag source for *exactly* the Transfer
you want, there is nothing to do. Otherwise, you need to add the
DragSourceListener yourself.

"Dirk Lemmermann" <dirk@dlsc.com> wrote in message
news:BBA03C6C.2223%dirk@dlsc.com...
> That's exactly my question. Do I need to add drag listeners myself to any
> view that I want to support with drag operations? The Navigator for
example
> already supports dragging operations. Shouldn't I be able to drag
something
> from there to my viewer?
>
> Dirk
>
> On 10/1/03 4:05 AM, in article bldcpv$pv4$1@eclipse.org, "Evon"
> <selpin@yahoo.com> wrote:
>
> > It seems that you only took care of the editor part, how about the
viewer?
> > did you add the relevant DragSourceAdapter or DragSourceListener?
> >
> >
> >
> > Dirk Lemmermann wrote:
> >
> >> Hi there,
> >
> >> Which steps are required so that I can drop ANY selection from ANY view
onto
> >> a GEF editor/viewer (especially from the outline view to the GEF
editor)? I
> >> have tried to attach a TransferDropTargetListener and use the
> >> LocalSelectionTransfer instance to specify which type of transfers I am
> >> interested in. For some reason, though, I never get the drop cursor on
my
> >> editor. What am I missing? It is my understanding that drag and drop
> >> requires drag listeners on one view and drop listeners on the other
view.
> >> But do I have to attach these drag listeners on all other views myself?
> >> Aren't they already initialized with a couple of drag listeners? How do
I
> >> find out which drag listeners (with which transfer type) are attached
to
> >> them?
> >
> >> Dirk
> >
> >> // in my editor
> >> GetGraphicalViewer().addDropTargetListener(new MyListener());
> >
> >> // drop listener class
> >> Class MyListener extends AbstractTransferDropTargetListener {
> >> public MyListener(EditPartViewer viewer) {
> >> super(viewer, LocalSelectionTransfer.getInstance());
> >> }
> >
> >> public void handleDrop() {
> >> System.out.println("Never get to see this system.out");
> >> }
> >> }
> >
> >
>
Re: Dragging objects from the Outline view to a GEF editor? [message #96649 is a reply to message #96548] Wed, 01 October 2003 17:51 Go to previous messageGo to next message
Dirk Lemmermann is currently offline Dirk LemmermannFriend
Messages: 11
Registered: July 2009
Junior Member
In the case of the (Java) Navigator I already know that it supports
dragging. Is it doucmented somehwere which view supports which drag
operation? Is it a problem if I add a second drag listener of the same type?
Will DnD events be created twice?

Dirk

On 10/1/03 3:58 PM, in article blemdn$cor$1@eclipse.org, "Randy Hudson"
<none@us.ibm.com> wrote:

> If you know the view already has a drag source for *exactly* the Transfer
> you want, there is nothing to do. Otherwise, you need to add the
> DragSourceListener yourself.
>
> "Dirk Lemmermann" <dirk@dlsc.com> wrote in message
> news:BBA03C6C.2223%dirk@dlsc.com...
>> That's exactly my question. Do I need to add drag listeners myself to any
>> view that I want to support with drag operations? The Navigator for
> example
>> already supports dragging operations. Shouldn't I be able to drag
> something
>> from there to my viewer?
>>
>> Dirk
>>
>> On 10/1/03 4:05 AM, in article bldcpv$pv4$1@eclipse.org, "Evon"
>> <selpin@yahoo.com> wrote:
>>
>>> It seems that you only took care of the editor part, how about the
> viewer?
>>> did you add the relevant DragSourceAdapter or DragSourceListener?
>>>
>>>
>>>
>>> Dirk Lemmermann wrote:
>>>
>>>> Hi there,
>>>
>>>> Which steps are required so that I can drop ANY selection from ANY view
> onto
>>>> a GEF editor/viewer (especially from the outline view to the GEF
> editor)? I
>>>> have tried to attach a TransferDropTargetListener and use the
>>>> LocalSelectionTransfer instance to specify which type of transfers I am
>>>> interested in. For some reason, though, I never get the drop cursor on
> my
>>>> editor. What am I missing? It is my understanding that drag and drop
>>>> requires drag listeners on one view and drop listeners on the other
> view.
>>>> But do I have to attach these drag listeners on all other views myself?
>>>> Aren't they already initialized with a couple of drag listeners? How do
> I
>>>> find out which drag listeners (with which transfer type) are attached
> to
>>>> them?
>>>
>>>> Dirk
>>>
>>>> // in my editor
>>>> GetGraphicalViewer().addDropTargetListener(new MyListener());
>>>
>>>> // drop listener class
>>>> Class MyListener extends AbstractTransferDropTargetListener {
>>>> public MyListener(EditPartViewer viewer) {
>>>> super(viewer, LocalSelectionTransfer.getInstance());
>>>> }
>>>
>>>> public void handleDrop() {
>>>> System.out.println("Never get to see this system.out");
>>>> }
>>>> }
>>>
>>>
>>
>
>
Re: Dragging objects from the Outline view to a GEF editor? [message #96680 is a reply to message #96649] Thu, 02 October 2003 00:08 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Dirk Lemmermann" <dirk@dlsc.com> wrote in message
news:BBA0E0AD.2236%dirk@dlsc.com...
> In the case of the (Java) Navigator I already know that it supports
> dragging. Is it doucmented somehwere which view supports which drag
Ask on eclipse.tools.jdt

> operation? Is it a problem if I add a second drag listener of the same
type?

Probably not. Both drag sources will be active during the drag, but when
the drop happens, the first one added will be the one performing setData.
We based our DelegatingDragSourceAdapter on JDT's :-).

> Will DnD events be created twice?
No

>
> Dirk
>
> On 10/1/03 3:58 PM, in article blemdn$cor$1@eclipse.org, "Randy Hudson"
> <none@us.ibm.com> wrote:
>
> > If you know the view already has a drag source for *exactly* the
Transfer
> > you want, there is nothing to do. Otherwise, you need to add the
> > DragSourceListener yourself.
> >
> > "Dirk Lemmermann" <dirk@dlsc.com> wrote in message
> > news:BBA03C6C.2223%dirk@dlsc.com...
> >> That's exactly my question. Do I need to add drag listeners myself to
any
> >> view that I want to support with drag operations? The Navigator for
> > example
> >> already supports dragging operations. Shouldn't I be able to drag
> > something
> >> from there to my viewer?
> >>
> >> Dirk
> >>
> >> On 10/1/03 4:05 AM, in article bldcpv$pv4$1@eclipse.org, "Evon"
> >> <selpin@yahoo.com> wrote:
> >>
> >>> It seems that you only took care of the editor part, how about the
> > viewer?
> >>> did you add the relevant DragSourceAdapter or DragSourceListener?
> >>>
> >>>
> >>>
> >>> Dirk Lemmermann wrote:
> >>>
> >>>> Hi there,
> >>>
> >>>> Which steps are required so that I can drop ANY selection from ANY
view
> > onto
> >>>> a GEF editor/viewer (especially from the outline view to the GEF
> > editor)? I
> >>>> have tried to attach a TransferDropTargetListener and use the
> >>>> LocalSelectionTransfer instance to specify which type of transfers I
am
> >>>> interested in. For some reason, though, I never get the drop cursor
on
> > my
> >>>> editor. What am I missing? It is my understanding that drag and drop
> >>>> requires drag listeners on one view and drop listeners on the other
> > view.
> >>>> But do I have to attach these drag listeners on all other views
myself?
> >>>> Aren't they already initialized with a couple of drag listeners? How
do
> > I
> >>>> find out which drag listeners (with which transfer type) are attached
> > to
> >>>> them?
> >>>
> >>>> Dirk
> >>>
> >>>> // in my editor
> >>>> GetGraphicalViewer().addDropTargetListener(new MyListener());
> >>>
> >>>> // drop listener class
> >>>> Class MyListener extends AbstractTransferDropTargetListener {
> >>>> public MyListener(EditPartViewer viewer) {
> >>>> super(viewer, LocalSelectionTransfer.getInstance());
> >>>> }
> >>>
> >>>> public void handleDrop() {
> >>>> System.out.println("Never get to see this system.out");
> >>>> }
> >>>> }
> >>>
> >>>
> >>
> >
> >
>
Previous Topic:feedback in tree viewers while dragging elements
Next Topic:setting page/editor label
Goto Forum:
  


Current Time: Thu Jul 18 23:24:11 GMT 2024

Powered by FUDForum. Page generated in 0.04413 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top