Home » Eclipse Projects » Sirius » Element Based Edge Creation Tool
Element Based Edge Creation Tool [message #1737783] |
Tue, 12 July 2016 16:38  |
Eclipse User |
|
|
|
Hello,
I am new to Sirius. I have looked through all the tutorials, examples and forums posts, but have not been able to solve my problem: Is there any detailed tutorial, that describes step by step how to make the creation tool for element based edges? All the tutorials only look at relation based edges.
What do I do wrong, when I have/do the following:
My model:
- classes: NodeSource, NodeTarget (each with variables: incomingArcs (type Arc), outgoingArcs (type Arc), name (type String))
- class: Arc (with variables: source (type NodeSource), target (type NodeTarget), name (type String) )
Now in detail, how I tried to model with Diagram Description in the Diagram.odesign file the relation:
1) New Diagram Element > Element Based Relation
Id: edge_arc
Label: Arc
Domain Class: Arc
Source: NodeSource
Source Finder Expression: feature:source
Target: NodeTarget
Targe Finder Expression: feature:target
2) New Element Creation > Edge Creation
Id: creation_arc
Edge Mapping: Arc
Begin > Change Context var:container > create Instance diagram.Arc > set source feature:source > set target feature:target
I am thinking, that I will have to set the source's outgoingArcs and the target's incomingArcs to the just created new Arc instance.
I hope, I explained it clear enough. I hope you can help me. Thank you in advance!
|
|
|
Re: Element Based Edge Creation Tool [message #1737799 is a reply to message #1737783] |
Wed, 13 July 2016 02:31   |
Eclipse User |
|
|
|
Le 12/07/2016 à 22:38, Xi Ng a écrit :
> Hello,
>
> I am new to Sirius. I have looked through all the tutorials, examples
> and forums posts, but have not been able to solve my problem: Is there
> any detailed tutorial, that describes step by step how to make the
> creation tool for element based edges? All the tutorials only look at
> relation based edges.
There is a sample of EdgeCreatationTool in the advanced tutorial:
https://wiki.eclipse.org/Sirius/Tutorials/AdvancedTutorial#Edge_Creation_Tool
It is a relation based edge, so the tool just have to set the
corresponding relation between both clicked elements. For the eleemnt
based case, it is sligtly different as you have to create the element
and store it in the model and then you need to set the references
between this element and its "source" and "target".
>
> What do I do wrong, when I have/do the following:
> My model: - classes: NodeSource, NodeTarget (each with variables:
> incomingArcs (type Arc), outgoingArcs (type Arc), name (type String))
> - class: Arc (with variables: source (type NodeSource), target (type
> NodeTarget), name (type String) )
>
> Now in detail, how I tried to model with Diagram Description in the
> Diagram.odesign file the relation:
>
> 1) New Diagram Element > Element Based Relation
> Id: edge_arc
> Label: Arc
> Domain Class: Arc
> Source: NodeSource
> Source Finder Expression: feature:source
> Target: NodeTarget
> Targe Finder Expression: feature:target
Do not forget to put a semantic candidates expression to indicate how to
look for Arc from the semantic element of the diagram. It will improve
performances on big modeles: if the semantic candidates is empty, Sirius
will iterate over all semantic models of the current resource set to
look for Arc elements.
>
> 2) New Element Creation > Edge Creation
> Id: creation_arc
> Edge Mapping: Arc
> Begin > Change Context var:container > create Instance diagram.Arc > set
> source feature:source > set target feature:target
Here you use feature:source and feature:target, so Sirius will look for
the value of the corresponding EReference on the current context, if
your setValue model operations are children of the createInstance task,
yout Arc has just been created and you are setting the current value
(null) to both references.
In the advanced tutorial, you might have missed that we use
var:source/var:target and not feature:, the var: interpreter allows us
to have access to variable set by Sirius, for the edge creation tool,
source and target correspond to the clicked semantic elements.
I think you just have to replace feature: by var: in your tool
>
> I am thinking, that I will have to set the source's outgoingArcs and the
> target's incomingArcs to the just created new Arc instance.
Are the source/outgoingArcs and target/incomingArcs set as eOpposite
EReferences in your metamodel ? If yes, EMF will do it for you.
> I hope, I explained it clear enough. I hope you can help me. Thank you
> in advance!
>
>
>
Regards
--
Maxime - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| | | | | | |
Re: Element Based Edge Creation Tool [message #1833018 is a reply to message #1826769] |
Wed, 30 September 2020 12:54  |
Eclipse User |
|
|
|
Hi Steve,
Since my last message I have tried to avoid using element based edges as much as possible however it seems there is no avoiding it. Would it be possible to have a step by step tutorial on how to create an element-based edge tool? I have one set up in my new editor that works just fine with the tree editor but I can't get the tool creation to work no matter what configuration I do. Any help would be greatly appreciated.
|
|
|
Goto Forum:
Current Time: Thu Jun 12 21:57:39 EDT 2025
Powered by FUDForum. Page generated in 0.10063 seconds
|