Home » Eclipse Projects » Sirius » How to reconnect the source of an edge
|
Re: How to reconnect the source of an edge [message #1706480 is a reply to message #1706356] |
Thu, 27 August 2015 08:49 |
Esteban Dugueperoux 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 #1710264 is a reply to message #1709430] |
Mon, 05 October 2015 15:24 |
|
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 #1710638 is a reply to message #1710557] |
Thu, 08 October 2015 07:13 |
|
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 #1833655 is a reply to message #1833495] |
Tue, 20 October 2020 12:45 |
|
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 Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Goto Forum:
Current Time: Thu Sep 26 02:27:41 GMT 2024
Powered by FUDForum. Page generated in 0.06123 seconds
|