[solved] Common Navigator Drag and Drop [message #526030] |
Thu, 08 April 2010 14:50 |
Chris Messages: 12 Registered: September 2009 Location: Braunschweig |
Junior Member |
|
|
I want to drag a Node Object from my Common Navigator onto an EditPart.
It already works with a Palette of the GEF Editor.
My Node is as simle as it can be:
class Node {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
After googling and trying around for a day I am very confused about which steps to take in order to get the drag started with the correct Transfer Class and dragAssistant.
How do I accomplish a proper drag from the CN? Drop should work for it does with the Palette already.
Thanks for your help in advance.
Chris
[Updated on: Mon, 12 April 2010 09:35] Report message to a moderator
|
|
|
|
|
Re: Common Navigator Drag and Drop [message #526551 is a reply to message #526528] |
Mon, 12 April 2010 09:27 |
Chris Messages: 12 Registered: September 2009 Location: Braunschweig |
Junior Member |
|
|
Quick follow up.
I figured out how to solve my problem very painlessly:
by using the TemplateTransfer one can use the CN Nodes just like the GEF Palette.
- create a DragAdapterAssistant extending CommonDragAdapterAssistant
- as Transfer use the org.eclipse.gef.dnd.TemplateTransfer
- to transfer the data (template) use TemplateTransfer.getInstance().setTemplate(data)
- in plugin.xml add a dragAssistant to org.eclipse.ui.navigator.viewer and configure it with your viewerID and the new DragAdapterAssistant class
That is it.
|
|
|
Powered by
FUDForum. Page generated in 0.03466 seconds