Drag and drop from a TreeViewer [message #249038] |
Fri, 22 May 2009 19:56  |
Eclipse User |
|
|
|
I have a graphical editor with a TreeViewer in a panel on the right-hand
side (similar to GraphicalEditorWithPalette). I want to be able to drag
and drop items from the tree onto the main panel. This will create a new
figure that corresponds to the model object from the tree.
The various classes I have include:
Foo (the model object of the items in the tree)
FooEditPart (extends AbstractTreeEditPart - edit part in the tree)
FooView (the model object of the figure in the diagram)
FooViewEditPart (edit part for the figure)
DiagramEditPart (edit part of the diagram itself)
DiagramXYLayoutEditPolicy (handles layout of the diagram)
Now, if I use the palette, I can get the layout edit policy to handle
create commands, so I know that part works. The problem is that the
palette only lets me create a new FooView object - I need to pass the Foo
object to the FooView. In other words, when I drag a Foo from the tree, I
want the create request to be populated with the Foo.
What I can't work out is where the request gets created, and how do I
populate it with the selected Foo from the tree?
(I can work out how to do this with native drag-and-drop, but that seems a
bit unnecessary if I can do it all with GEF's normal support).
|
|
|
|
Powered by
FUDForum. Page generated in 0.04980 seconds