Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » How to use Drag&Drop Feature?
How to use Drag&Drop Feature? [message #651491] Mon, 31 January 2011 11:56 Go to next message
Veit Hoffmann is currently offline Veit HoffmannFriend
Messages: 20
Registered: July 2009
Junior Member
Hi,

I'd like to add the possibility to Drag & Drop Elements from a standard
TreeViewer to a Diagram. I.e. I drag a BuisnessObject from the
TreeViewer to set an Attribute in another BusinessObject represented by
a PictogramElement in my Diagram.
I can create such a behaviour by adding a DropTargetListener to the
DiagramEditor and creating a Command in this Listener. But I have the
impression that this is not the way intended by the graphiti framework.
Is the DragAndDropFeature ment to be used in this case?
If so, how do I call a DragAndDropFeature in this case?
Re: How to use Drag&Drop Feature? [message #651507 is a reply to message #651491] Mon, 31 January 2011 13:01 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
What abaout using an AddFeature for that purpose? The feature would in this
case not really add something but simply change the attruibute of the other
BO.

Michael


"Veit Hoffmann" wrote in message news:ii67m8$ehd$1@news.eclipse.org...

Hi,

I'd like to add the possibility to Drag & Drop Elements from a standard
TreeViewer to a Diagram. I.e. I drag a BuisnessObject from the
TreeViewer to set an Attribute in another BusinessObject represented by
a PictogramElement in my Diagram.
I can create such a behaviour by adding a DropTargetListener to the
DiagramEditor and creating a Command in this Listener. But I have the
impression that this is not the way intended by the graphiti framework.
Is the DragAndDropFeature ment to be used in this case?
If so, how do I call a DragAndDropFeature in this case?
Re: How to use Drag&Drop Feature? [message #651686 is a reply to message #651507] Tue, 01 February 2011 09:51 Go to previous messageGo to next message
Veit Hoffmann is currently offline Veit HoffmannFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Michael,
that did the trick. Thank you very much. I couldn't use the
ObjectsTransferDropTargetListener because I used the wrong Type of
Transfer. After I changed this in the DragListener of my View everything
works fine.

Cheers

Veit

besides... Great Framework

Am 31.01.2011 14:01, schrieb Michael Wenz:
> What abaout using an AddFeature for that purpose? The feature would in
> this case not really add something but simply change the attruibute of
> the other BO.
>
> Michael
>
>
> "Veit Hoffmann" wrote in message news:ii67m8$ehd$1@news.eclipse.org...
>
> Hi,
>
> I'd like to add the possibility to Drag & Drop Elements from a standard
> TreeViewer to a Diagram. I.e. I drag a BuisnessObject from the
> TreeViewer to set an Attribute in another BusinessObject represented by
> a PictogramElement in my Diagram.
> I can create such a behaviour by adding a DropTargetListener to the
> DiagramEditor and creating a Command in this Listener. But I have the
> impression that this is not the way intended by the graphiti framework.
> Is the DragAndDropFeature ment to be used in this case?
> If so, how do I call a DragAndDropFeature in this case?
Re: How to use Drag&Drop Feature? [message #759158 is a reply to message #651686] Sun, 27 November 2011 04:53 Go to previous messageGo to next message
Patrick Talbot is currently offline Patrick TalbotFriend
Messages: 36
Registered: November 2011
Member
Sorry to revive that old post, but it seems that others succeeded where I'm failing right now:
I also tried to implement a View with a TreeViewer and setup a DragSourceListener.

That TreeViewer is diplaying nodes that are instances of IAdapter (that can be adpated to IResource/IFile or java.io.File)

But my DragSourceListener setDragData never gets called when I drop on the Graphiti editor, although I have set an AddFeature that accepts IResource/IFile or File...
Actually my FeatureProvider getAddFeature() is never called.

The same drop from standard Project Explorer or Navigator is working fine.

So what I suppose is that I have set the wrong Transfer type, but then what should it be?
I tried ResourceTransfer, FileTransfer, LocalSelectionTransfer, alone or combined, without success...

Can anyone tell me what I'm doing wrong?

Thanks in advance,
-Patrick
Re: How to use Drag&Drop Feature? [message #759762 is a reply to message #759158] Tue, 29 November 2011 21:06 Go to previous message
Patrick Talbot is currently offline Patrick TalbotFriend
Messages: 36
Registered: November 2011
Member
OK so (for anyone interested), in my case using LocalSelectionTransfer finally worked but I needed to have an AddFeature that would accept IAdaptable and not IResource...

I thought the dragSetData (where I convert the selection to a IResource[] using the IAdaptable interface) would be called for that but in fact dragSetData was not called because the test on the Transfer type is done beforehand.
Previous Topic:Diagram Editor and its API
Next Topic:Selection info for shape
Goto Forum:
  


Current Time: Thu Apr 25 08:02:11 GMT 2024

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

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

Back to the top