Dragging objects from the Outline view to a GEF editor? [message #96398] |
Tue, 30 September 2003 16:29  |
Eclipse User |
|
|
|
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 09:58   |
Eclipse User |
|
|
|
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 13:51   |
Eclipse User |
|
|
|
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] |
Wed, 01 October 2003 20:08  |
Eclipse User |
|
|
|
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");
> >>>> }
> >>>> }
> >>>
> >>>
> >>
> >
> >
>
|
|
|
Powered by
FUDForum. Page generated in 0.04977 seconds