EObject Transfer/Serialization [message #426361] |
Mon, 29 December 2008 11:51  |
Eclipse User |
|
|
|
Hi,
I'm using a treeviewer to show an instance of an EMF model.
I use a Transfer in which I serialize my EObjects by hand to drag and drop
objects (later copy/paste) inside my tree (and later possibly between
different trees).
I saw that there was a dedicated command for drag and drop in EMF (and
also a Copy/Paste), but I can't find how to integrate it in my structured
viewer (for which I have a dragnDrop support with
addDragSupport(int operations,
Transfer[] transferTypes,
DragSourceListener listener))
I don't fully understand what EMF API DragAndDropCommand does... what is
the "location", what's the difference between that and a MoveCommand? I
couldn't find a doc on that matter.
Am I missing something, is there a way to do DragAndDrop with
DragAndDropCommand in my tree, or to serialize and read serialized
EObjects?
Thanks in advance.
|
|
|
Re: EObject Transfer/Serialization [message #426362 is a reply to message #426361] |
Mon, 29 December 2008 12:13  |
Eclipse User |
|
|
|
Boudard,
Comments below.
Boudard wrote:
> Hi,
> I'm using a treeviewer to show an instance of an EMF model.
> I use a Transfer in which I serialize my EObjects by hand to drag and
> drop objects (later copy/paste) inside my tree (and later possibly
> between different trees).
> I saw that there was a dedicated command for drag and drop in EMF (and
> also a Copy/Paste), but I can't find how to integrate it in my
> structured viewer (for which I have a dragnDrop support with
> addDragSupport(int operations,
> Transfer[] transferTypes,
> DragSourceListener listener))
Drag and drop works in the basic generated editor...
>
> I don't fully understand what EMF API DragAndDropCommand does... what
> is the "location", what's the difference between that and a
> MoveCommand? I couldn't find a doc on that matter.
>
> Am I missing something, is there a way to do DragAndDrop with
> DragAndDropCommand in my tree, or to serialize and read serialized
> EObjects?
I'm not sure why you need to serialize at all if you're dragging and
dropping all in one view or editor.
I'd suggest generating the editor and studying how drag and drop is
supported in the tree view.
int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
viewer.addDragSupport(dndOperations, transfers, new
ViewerDragAdapter(viewer));
viewer.addDropSupport(dndOperations, transfers, new
EditingDomainViewerDropAdapter(editingDomain, viewer));
You likely can just reuse that...
>
> Thanks in advance.
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03511 seconds