Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Reconnect Edge Tool - What is the Variable for "the previous target"?
Reconnect Edge Tool - What is the Variable for "the previous target"? [message #1832403] Thu, 17 September 2020 13:28 Go to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 206
Registered: May 2012
Senior Member
I'm trying to write a reconnect edge tool between two objects that have their inputs and outputs stored as bi-directional lists.

When editing the .odesign file, I can set and unset. So I believe I need to use a Service to help me.

Trouble is, when I reconnect an edge that existed between S1 and T1 and I want to connect S1 to T2, I need to do the following:

1) go to T1 and remove S1 from its input list (which will automatically remove T1 from S1's output list)
2) Go to T2 and add S1 to its input list (which will automatically add T2 to S1's output list)

Step 2) seems easier, because I've already done that when I created the edge to begin with. and the odesign set method seems to understand that it's adding an element to a list. Maybe unset understands removing an element from a list as well when the feature is a list - but I need to know what element to remove (the previous target)

I'm stuck on step 1 however. I can't figure out what the variable is called to send to my service for T1. I would call T1 the "previous target". That's not preTarget mind you - i.e. the evaluation candidate for the new Target, it's the "previous target" - like the target that existed in the previous connection.

element, source, and target variables seem to only be aware of what the new target is - but have no knowledge of what the previous target was.

Without that knowledge, I can't write the service.
Re: Reconnect Edge Tool - What is the Variable for "the previous target"? [message #1832414 is a reply to message #1832403] Thu, 17 September 2020 14:03 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 206
Registered: May 2012
Senior Member
Maybe this is telling me I compose my reconnect with a delete, followed by a new connect?
Re: Reconnect Edge Tool - What is the Variable for "the previous target"? [message #1832434 is a reply to message #1832414] Thu, 17 September 2020 20:19 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 544
Registered: July 2009
Senior Member
Hi.
It is normally possible to implement such a tool directly from the operations available in the odesign file, without resorting to Java code.

See https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#edge_tools in the section on "Reconnect edge" for a visual explanation of the various variables available.

For a concrete example, see https://wiki.eclipse.org/Sirius/Tutorials/AdvancedTutorial#Reconnect_Edge_Tool from the advanced tutorial, or the odesign for Ecore Tools (https://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/tree/org.eclipse.emf.ecoretools.design/description/ecore.odesign) and its tools named "ReconnectBiDirectionnalEReference Source" and "ReconnectBiDirectionnalEReference Target". While it is possible to define a reconnection tool that handles both sides of an edge, it can be confusing and difficult to maintain. It's usually a good idea to create separate tools (with different "Reconnection Kind") to handle both cases separately.

Hope this helps.


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Reconnect Edge Tool - What is the Variable for "the previous target"? [message #1833118 is a reply to message #1832434] Fri, 02 October 2020 15:42 Go to previous message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 206
Registered: May 2012
Senior Member
Thank you very much for the link. This helped a lot and I have it working now.

I did use a java services call to pass these mentioned variables to so I could debug through the process and make sure I understood what object each variable was referring to. I got all of them backwards at least once, so being able to step debug through it helped too.

But once I wrapped my head around it, I was able to do it, like you suggested, without the use of a java service.
Previous Topic:Element Based Edge Creation Tool
Next Topic:Programmaticaly changing location and size of diagram elements
Goto Forum:
  


Current Time: Fri Oct 23 08:30:27 GMT 2020

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

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

Back to the top