Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to reconnect the source of an edge
How to reconnect the source of an edge [message #1706356] Wed, 26 August 2015 09:08 Go to next message
Orso-Manuel Picon is currently offline Orso-Manuel PiconFriend
Messages: 6
Registered: August 2015
Junior Member
Hello,
I am discovering Sirius and I have finished the tutorial provided on the Eclipse page (basicFamily). I am now trying to expand the editor: notably the sections.
I would like to define a "Reconnect Edge" element edition where I could change the source of an edge (the tutorial explained only how to reconnect the target of the edge). But I still don't find the right feature names, or value expressions for it. It looks trickier than the reconnection of the target.
That is why I need help: thank you in advance,
Om.
Re: How to reconnect the source of an edge [message #1706480 is a reply to message #1706356] Thu, 27 August 2015 08:49 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi,

Then you have followed starter tutorial [1] and advanced tutorial [2].
In the advanced tutorial, you have done the target reconnection tool
which consists to update the Person.father reference. If you want to do
a source reconnection tool, it means you want to provide a tool to
affect the father to another person than the current one. To do that you
must update the semantic model to remove current Person.father reference
on the current person, i.e. variable element, and affect the father to
the new person, i.e. variable target.

Le 26/08/2015 20:56, Orso-Manuel Picon a écrit :
> Hello,
> I am discovering Sirius and I have finished the tutorial provided on the
> Eclipse page (basicFamily). I am now trying to expand the editor:
> notably the sections.
> I would like to define a "Reconnect Edge" element edition where I could
> change the source of an edge (the tutorial explained only how to
> reconnect the target of the edge). But I still don't find the right
> feature names, or value expressions for it. It looks trickier than the
> reconnection of the target.
> That is why I need help: thank you in advance,
> Om.


[1] https://wiki.eclipse.org/Sirius/Tutorials/4MinTutorial
[2] https://wiki.eclipse.org/Sirius/Tutorials/AdvancedTutorial

Best Regards.


--
Esteban Dugueperoux - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to reconnect the source of an edge [message #1709429 is a reply to message #1706356] Mon, 28 September 2015 11:38 Go to previous messageGo to next message
Thomas Driessen is currently offline Thomas DriessenFriend
Messages: 13
Registered: August 2013
Junior Member
Hi,

I'm also a little bit irritated by the reconnection of the source of an edge. The documentation of the variables states, that:

source: the object currently attached to the moved end
target: the object going to be attached to the moved end
element: the object attached to the other end

For a target reconnection this works perfectly, but when I do the same with the source, then "element" is the same as source.
Is this an intended behaviour? I would have assumed, that source/target are referring to the moving part of the edge and element refers to the part that stays the same.

Kind regards,
Thomas
Re: How to reconnect the source of an edge [message #1709430 is a reply to message #1709429] Mon, 28 September 2015 11:47 Go to previous messageGo to next message
Thomas Driessen is currently offline Thomas DriessenFriend
Messages: 13
Registered: August 2013
Junior Member
Meanwhile I've solved this by not using var:element, but [otherEnd.oclAsType(DNodeContainer).target/].
Nevertheless, this looks like a bug to me.

Kind regards,
Thomas
Re: How to reconnect the source of an edge [message #1710264 is a reply to message #1709430] Mon, 05 October 2015 15:24 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 503
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Thomas,

Le 28/09/2015 13:38, Thomas Driessen a écrit :
> Hi,
>
> I'm also a little bit irritated by the reconnection of the source of an
> edge. The documentation of the variables states, that:
>
> source: the object currently attached to the moved end
> target: the object going to be attached to the moved end
> element: the object attached to the other end

As written in the documentation (Sirius 3.0):
"The body of the tool is evaluated on the target semantic element of the
edge that the user wants to reconnect, with the following variables
available to describe the reconnection:"
. source: the semantic element which is pointed before the reconnect.
. target: the semantic element which is pointed after the reconnect.
. sourceView : the graphical element which is pointed before the
reconnect.
. targetView : the graphical element which is pointed after the reconnect.
. otherEnd : the edge end (graphical element) that has not changed
during the reconnection
. edgeView : the Edge after the graphical reconnection
. diagram : the current Diagram.
.element: the semantic element of the current edge.



>
> For a target reconnection this works perfectly, but when I do the same
> with the source, then "element" is the same as source. Is this an
> intended behaviour? I would have assumed, that source/target are
> referring to the moving part of the edge and element refers to the part
> that stays the same.
>
> Kind regards,
> Thomas
>


Le 28/09/2015 13:47, Thomas Driessen a écrit :
> Meanwhile I've solved this by not using var:element, but
> [otherEnd.oclAsType(DNodeContainer).target/].
> Nevertheless, this looks like a bug to me.

This is not a bug: I think that the edge you are trying to reconnect is
described by a Relation Based Edge Mapping: its semantic element is by
construction the same semantic element than the semantic element of its
source node.

So in your case source should be equals to element.
And if you need to use the semantic element of the other end, you wrote
the expected expression.


It you reconnect the target (reconnectionKind: target)
. the reconnection source (var:source, which I recommend to rename
into reconnectionSource and then access using var:reconnectionSource) is
the target node before the reconnection.
. the reconnection target (var:target, which I recommend to rename
into reconnectionTarget) is the target node after the reconnection
. the element and sourceNode of the edge will not change after
reconnection.
. otherEnd.target will be equal to element for a relation based edge

If you reconnect the source (reconnectionKind: source)
. the reconnection source (var:source) is the source node before the
reconnection.
.. the reconnection target (var:target) is the source node after the
reconnection
.. the semantic element of the edge and sourceNode of the edge will
changed after the reconnection.
.. otherEnd.target will not be equals to element (except if edge and
target node have the same semantic element).


>
> Kind regards, Thomas

Regards
--
Maxime - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to reconnect the source of an edge [message #1710557 is a reply to message #1710264] Wed, 07 October 2015 14:00 Go to previous messageGo to next message
Orso-Manuel Picon is currently offline Orso-Manuel PiconFriend
Messages: 6
Registered: August 2015
Junior Member
Hello,

I have to object that an expression like "[otherEnd.oclAsType(DNodeContainer).target/]" instead of "var:element" doesn't solve the issue, because it modifies a graphical element, and not a semantic one. Indeed, "otherEnd" is the edge end (graphical element) that has not changed during the reconnection.
And yet, we want here to reconnect edge's source and target, and save the modification in the semantic model.

Greetings,
Orso-Manuel
Re: How to reconnect the source of an edge [message #1710638 is a reply to message #1710557] Thu, 08 October 2015 07:13 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 503
Registered: July 2009
Location: Nantes, France
Senior Member
Hi

Le 07/10/2015 16:00, Orso-Manuel Picon a écrit :
> Hello,
>
> I have to object that an expression like
> "[otherEnd.oclAsType(DNodeContainer).target/]"

You should use
[otherEnd.oclAsType(viewpoint::DSemanticDecorator).target/] to be more
generic (and be able to handle list, container, nodes, edges).

It will give you the semantic element of the edge end that has not
changed during the reconnection

instead of "var:element"

var:element will give you the semantic element of the edge. If this is a
relation based edge it will be the same semantic element than the source
node of the edge. If this is an element based edge, then you might
retrieve the source/target semantic element using the same expression
than in the mapping

> doesn't solve the issue, because it modifies a graphical element, and
> not a semantic one. Indeed, "otherEnd" is the edge end (graphical
> element) that has not changed during the reconnection.

> And yet, we want here to reconnect edge's source and target, and save
> the modification in the semantic model.

It is recommended to define two reconnection tools, ie. one for "each
side" instead of a common reconnection tool with reconnectionKind=both :
Sirius will call the expected tool regarding the user reconnection side,
and you will not have to identify this reconnection side from the tool
model operations.

>
> Greetings,
> Orso-Manuel

Regards

--
Maxime - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to reconnect the source of an edge [message #1833495 is a reply to message #1710638] Wed, 14 October 2020 21:25 Go to previous messageGo to next message
Thomas Chiang is currently offline Thomas ChiangFriend
Messages: 43
Registered: March 2020
Member
Hi Maxime,

I am very confused. I have successfully specified a reconnect tool for the target of my relation based edges as specified in the tutorial. Then I try to do the same for the source.

ReconnectionKind = Source
Change Context = var:element
->Set = feature name, var:target

If as you say when we change the ReconnectionKind to source then this should work as expected, which is to say just like it did for ReconnectionKind = target. It does not however.

I have also tried using the OCL commands that we posted previously but I don't think I have been putting in the correct position or something else is wrong because they aren't working for me.

Any help would be fantastic.
Re: How to reconnect the source of an edge [message #1833655 is a reply to message #1833495] Tue, 20 October 2020 12:45 Go to previous message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 508
Registered: May 2011
Senior Member
Hello,

On a reconnect tool for the target of a relation based edge, the variable element and source will point to the same element (as it is not an element based edge). However, in a reconnect tool for the source, for the change context operation you will need to use var:target. Indeed, in a reconnect tool, the source variable and the target variable are related to the move itself (not the edge), this means that they are respectively the element you deconnected from and the element you connected to [1]. Note that depending on the reference you are reconnected, you may also need to change context to the source variable to unset/remove the old reference. You can find exemples of reconnect tool in EcoreTools or in the sample plugin org.eclipse.sirius.sample.ecore.design in the Sirius Git.

Best regards,
Steve
[1] https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#edge_tools


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:How To Use The Element Based Edge Creation Tool
Next Topic:Default copy/paste behaviour is overridden
Goto Forum:
  


Current Time: Sun Apr 11 20:14:27 GMT 2021

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

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

Back to the top