Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » [solved] Common Navigator Drag and Drop(I want to drag a custom Object to a GEF EditPart)
icon14.gif  [solved] Common Navigator Drag and Drop [message #526030] Thu, 08 April 2010 14:50 Go to next message
ChrisFriend
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 #526184 is a reply to message #526030] Fri, 09 April 2010 07:43 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Look at the org.eclipse.ui.navigator.viewer extension point and the dragAssistant description. You may not need a dragAssistant because it uses the LocalSelectionTransfer mechanism on the drag to capture your object.

Re: Common Navigator Drag and Drop [message #526528 is a reply to message #526184] Mon, 12 April 2010 08:00 Go to previous messageGo to next message
ChrisFriend
Messages: 12
Registered: September 2009
Location: Braunschweig
Junior Member
Thank you for pointing me into the correct dirction - the drag works fine.

The issue is the drop listener I am using on the EditPart. It uses the TemplateTransferDropTargetListener which did not accept the drag apparently.

Now I have to figure out to use Palette dnd and CN dnd at the same time.
Re: Common Navigator Drag and Drop [message #526551 is a reply to message #526528] Mon, 12 April 2010 09:27 Go to previous message
ChrisFriend
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.


  1. create a DragAdapterAssistant extending CommonDragAdapterAssistant
  2. as Transfer use the org.eclipse.gef.dnd.TemplateTransfer
  3. to transfer the data (template) use TemplateTransfer.getInstance().setTemplate(data)
  4. 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.




Previous Topic:How do I find out the style of an SWT part?
Next Topic:Adding a file menu item via an extension point
Goto Forum:
  


Current Time: Thu Apr 25 17:41:12 GMT 2024

Powered by FUDForum. Page generated in 0.03466 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top