|
Re: How to drag a treemenu item from a TreeViewer to the Graphical viewer [message #194568 is a reply to message #194345] |
Fri, 02 September 2005 06:17 |
Eclipse User |
|
|
|
Originally posted by: mail4zlq.gmail.com
At first you define you "Transfers",and then you "addDragSupport" for
the TreeViewer.Like this:
//support for drag & drop
Transfer[] outTransfers = new Transfer[] {
LocalSelectionTransfer.getInstance(),
ResourceTransfer.getInstance(),
FileTransfer.getInstance()
};
Transfer[] inTransfers = new Transfer[] {
LocalSelectionTransfer.getInstance(),
FileTransfer.getInstance()
};
int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT;
fViewer.addDragSupport(operations, outTransfers, this);
fViewer.addDropSupport(operations, inTransfers, this);
Sai 写道:
> Hi
> I need to drop an Item from TreeViewer to a GraphicalViewer
>
> I am able to drag and drop a file from eclipse package explorer or a
> desktop to the Graphical Viewer.
>
> Please help
>
> Sai
>
|
|
|
Re: How to drag a treemenu item from a TreeViewer to the Graphical viewer [message #194861 is a reply to message #194568] |
Tue, 06 September 2005 14:33 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
That's for the JFace TreeViewer, not the GEF one; however the concept is the
same: to define a transfer and then add drag and drop listeners to the
source and target respectively. Sai, look at the ediagram example which
does what you want. In particular, look at OutlineToDiagramTransfer,
OutlineDragSourceListener and DiagramDropTargetListener.
"Alex.zhang" <mail4zlq@gmail.com> wrote in message
news:df8qpo$it6$1@news.eclipse.org...
> At first you define you "Transfers",and then you "addDragSupport" for
> the TreeViewer.Like this:
> //support for drag & drop
> Transfer[] outTransfers = new Transfer[] {
> LocalSelectionTransfer.getInstance(),
> ResourceTransfer.getInstance(),
> FileTransfer.getInstance()
> };
>
> Transfer[] inTransfers = new Transfer[] {
> LocalSelectionTransfer.getInstance(),
> FileTransfer.getInstance()
> };
>
> int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT;
>
> fViewer.addDragSupport(operations, outTransfers, this);
> fViewer.addDropSupport(operations, inTransfers, this);
>
> Sai ??:
> > Hi
> > I need to drop an Item from TreeViewer to a GraphicalViewer
> >
> > I am able to drag and drop a file from eclipse package explorer or a
> > desktop to the Graphical Viewer.
> >
> > Please help
> >
> > Sai
> >
|
|
|
Powered by
FUDForum. Page generated in 0.02830 seconds