Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Drag and Drop Node to Node
Drag and Drop Node to Node [message #1749838] Tue, 13 December 2016 07:42 Go to next message
Tuan Hoang Anh is currently offline Tuan Hoang AnhFriend
Messages: 42
Registered: May 2015
Member
Hi,

I want to Drag a Bordered Node to another Bordered Node on diagram to create a connection between them. I tried with "Container Drop" Edition, but it seems only support to drop an element to a Container.

Could someone give me a hint?

Thanks and BRs,
Tuan Hoang
Re: Drag and Drop Node to Node [message #1749855 is a reply to message #1749838] Tue, 13 December 2016 09:26 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hello,

In your VSM, I guess that the mapping of the bordered node you drag, is not a child mapping of the targeted border node. Therefore, by default it is not evaluated as a valid target candidate (in opposition with the container that is a valid one). In your drop tool, in the containers list you should add the mapping of the targeted border node. Note that this means that in the operation processed by your drop tool, you will need first to test the newSemanticContainer to check if it was droped on the container or on the border node.

Regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Drag and Drop Node to Node [message #1749861 is a reply to message #1749855] Tue, 13 December 2016 09:52 Go to previous messageGo to next message
Tuan Hoang Anh is currently offline Tuan Hoang AnhFriend
Messages: 42
Registered: May 2015
Member
Hello Steve,

In my VSM, the Container, Bordered Node, and Container Drop are defined as below
-- Container Element
|-- Bordered Node Source
|-- Bordered Node Target
-- Container Drop Source To Target
_______________________________________________
ID* | Source To Target |
Drag Source* | Both |
Containers * | Element, Bordered Node Target|
Mappings | Bordered Node Source |
_____________|________________________________|

When I drag Bordered Node Source to Container Element, it works. I can get information about newSemanticContainer. But when I drag Bordered Node Source to Bordered Node Target, nothing happens.

Could you please give me some help?

Thanks and BRs,
Tuan Hoang
Re: Drag and Drop Node to Node [message #1749883 is a reply to message #1749861] Tue, 13 December 2016 14:14 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
In your Drop tool, under the "Begin" element, did you start by a switch or two ifs to check if the targeted element is a "Container" or if its a "Bordered Node Target", containing two different process, respectively moving inside the new container and referencing the targeted element?
You can also have 2 drop tool, one where Containers only contain Element and the other one with only Bordered Node Target. This way in the begin, you do not need to test the type of the targeted element.

Regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Drag and Drop Node to Node [message #1749938 is a reply to message #1749883] Wed, 14 December 2016 07:27 Go to previous messageGo to next message
Tuan Hoang Anh is currently offline Tuan Hoang AnhFriend
Messages: 42
Registered: May 2015
Member
I used the External Java Action:
External Java Action: Drop Source To Target
 - External Java Action Parameter: oldSemanticContainer
 - External Java Action Parameter: newSemanticContainer
 - External Java Action Parameter: element
 - External Java Action Parameter: newContainerView


But the code only works when I drag and drop the Bordered Source into Container element. When I drag Bordered Node Source into Bordered Node Target, it shows nothing.

Thanks and BRs,
Tuan Hoang
Re: Drag and Drop Node to Node [message #1750041 is a reply to message #1749938] Thu, 15 December 2016 12:10 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
My bad, I was confused with the extra mapping functionality of the creation tool. You can't use a drag and drop tool as you want by default. You will need a custom style to provide your own editpart having DragDropEditPolicy close to the SiriusContainerDropPolicy one. My opinion is that it is a bit overkill compare to a simple edge creation tool to add a reference between two border nodes.

Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Drag and Drop Node to Node [message #1750043 is a reply to message #1750041] Thu, 15 December 2016 12:16 Go to previous message
Tuan Hoang Anh is currently offline Tuan Hoang AnhFriend
Messages: 42
Registered: May 2015
Member
Steve Monnier wrote on Thu, 15 December 2016 12:10
My bad, I was confused with the extra mapping functionality of the creation tool. You can't use a drag and drop tool as you want by default. You will need a custom style to provide your own editpart having DragDropEditPolicy close to the SiriusContainerDropPolicy one. My opinion is that it is a bit overkill compare to a simple edge creation tool to add a reference between two border nodes.

Hi Steve,

I found the solution by combining the Edit Policy with Container Drop. I know that it's pretty easy if I use Edge Creation instead of Drag and Drop, but I don't want to add a tool in Palette.

Anw, Thanks for your support.

Best Regards,
Tuan Hoang
Previous Topic:Sirius graphical representation of an Xtext originated DSL model
Next Topic:I can't sort UML elements by type in model explorer or tables!
Goto Forum:
  


Current Time: Thu Apr 25 17:03:49 GMT 2024

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

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

Back to the top