Operation acton: how to get to the semantic element [message #1713461] |
Wed, 04 November 2015 09:40 |
Wilbert Alberts Messages: 209 Registered: June 2010 |
Senior Member |
|
|
Hi,
I've created various editors using Sirius by now. However there is something that keeps bogging me.
When you create a OperationAction, a variable ( by default called 'views') is defined that provides the elements on which the OperationAction is to be performed. Actually, the views variable is a set of RepresentationElements (so nodes/edges or anything else on a diagram that has been selected).
Typically, you want the operation to act on the semantic element represented by the RepresentationElements in view. In general, I do this like:
| Container Views Variable 'views'
| begin
|- For tg // views.target
|- - // do something with tg
So I dereference the views variable by the 'target' property. This property is provided as views typically is a set of DSemanticDecorators. However, when I validate the odesign model, a warning is created stating that 'target' is unknown. A better expression would be: views.oclAsType(DSemanticDecorator).target. This however requires me to add a dependency on the Sirius metamodel.
Why isn't an additional variable created that holds the semantic elements on which the operation is to be invoked? If you have a node creation tool for instance, also two variables exist: one representing the container (as semantic element) and one representing the containerView (the graphical element representing the container). A similar approach for the OperationAction sounds reasonable to me.
What do you think?
Greetings,
Wilbert
|
|
|
Re: Operation acton: how to get to the semantic element [message #1713572 is a reply to message #1713461] |
Thu, 05 November 2015 09:07 |
Esteban Dugueperoux Messages: 472 Registered: July 2009 |
Senior Member |
|
|
Hi Wilbert,
I understand your remarks, you can raise a bugzilla about either have
Sirius metamodels available natively or have a new variable for this tool.
Best Regards.
Le 04/11/2015 10:40, Wilbert Alberts a écrit :
> Hi,
>
> I've created various editors using Sirius by now. However there is
> something that keeps bogging me.
>
> When you create a OperationAction, a variable ( by default called
> 'views') is defined that provides the elements on which the
> OperationAction is to be performed. Actually, the views variable is a
> set of RepresentationElements (so nodes/edges or anything else on a
> diagram that has been selected).
>
> Typically, you want the operation to act on the semantic element
> represented by the RepresentationElements in view. In general, I do this
> like:
>
> | Container Views Variable 'views'
> | begin
> |- For tg // views.target
> |- - // do something with tg
>
>
> So I dereference the views variable by the 'target' property. This
> property is provided as views typically is a set of DSemanticDecorators.
> However, when I validate the odesign model, a warning is created stating
> that 'target' is unknown. A better expression would be:
> views.oclAsType(DSemanticDecorator).target. This however requires me to
> add a dependency on the Sirius metamodel.
>
> Why isn't an additional variable created that holds the semantic
> elements on which the operation is to be invoked? If you have a node
> creation tool for instance, also two variables exist: one representing
> the container (as semantic element) and one representing the
> containerView (the graphical element representing the container). A
> similar approach for the OperationAction sounds reasonable to me.
>
> What do you think?
>
> Greetings,
> Wilbert
>
>
--
Esteban Dugueperoux - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03195 seconds