Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to realize drag and drop with outline TreeEditPart?
How to realize drag and drop with outline TreeEditPart? [message #182100] Thu, 10 April 2008 10:02 Go to next message
Li Junhong is currently offline Li JunhongFriend
Messages: 1012
Registered: July 2009
Senior Member
Hi all,

In the outline view, I have built a tree to reflect the diagram model. But
I need to add the drap and drop effect in this view, I've only done that
in SWT widgets before, but how to realize dnd with TreeEditPart?

Anyone can help me or give some suggestion? Thanks!!~

Li Junhong
Re: How to realize drag and drop with outline TreeEditPart? [message #182142 is a reply to message #182100] Thu, 10 April 2008 11:44 Go to previous message
urs zeidler is currently offline urs zeidlerFriend
Messages: 91
Registered: July 2009
Member
Li Junhong schrieb:
> Hi all,
>
> In the outline view, I have built a tree to reflect the diagram model.
> But I need to add the drap and drop effect in this view, I've only done
> that in SWT widgets before, but how to realize dnd with TreeEditPart?
>
> Anyone can help me or give some suggestion? Thanks!!~
>
> Li Junhong
>
If you work with 2.0x in 2.1 it should be generated
try this :

protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
getDiagramGraphicalViewer().addDropTargetListener(new
DiagramDropTargetListener(getDiagramGraphicalViewer(),
LocalSelectionTransfer.getTransfer()) {

protected Object getJavaObject(TransferData data) {
return LocalSelectionTransfer.getTransfer().nativeToJava(data);
}

@Override
protected List getObjectsBeingDropped() {
/* Get the selection from the transfer agent */
List fileList = new ArrayList();

fileList.add(LocalSelectionTransfer.getTransfer().getSelecti on());

if (fileList.size() > 0)
return fileList;

return null;
}

});
Previous Topic:NullPointerException for GraphicalEditPart.isSelectable
Next Topic:Starting thread after editor initialize
Goto Forum:
  


Current Time: Thu Mar 28 11:44:15 GMT 2024

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

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

Back to the top