Edge Creation Tool [message #1219320] |
Tue, 03 December 2013 05:38  |
Eclipse User |
|
|
|
Hello,
I have a simple EMF model :
- My object SCENARIO contains MODULES and FLUX
- FLUX contains a SOURCE attribute (a reference to a MODULE) and a TARGET attribute (a reference to another MODULE)
- the object FLUX modelise a flow data beetwin 2 modules
In my SIRIUS Diagram definition :
- I mapped a the Module object to a simple 'Node Mapping' object and a Flux object to an 'Element Based Edge'
- In my Edge Creation tool, when I try to create a new edge beetwin 2 modules. The current semantic context seems to be one of my linked modules. But the new instanciated flux object's container is Scenario object.
My question : how can I defined that the new mapped object has to be associate to my Scenario ?
Thanks for help
xmi file dump :
<?xml version="1.0" encoding="ASCII"?>
<Scenario xmi:version="2.0" xmlns:xmi="..." xmlns:xsi="..." xmlns="simulation" xsi:schemaLocation="Simulation.ecore">
<module ident="ID_MODULE_1" label="MODULE_1" description="Description du MODULE-1"/>
<module ident="ID_MODULE_2" label="MODULE_2" description="Description du MODULE-2"/>
<module ident="ID_MODULE_3" label="MODULE_3" description="Description MODULE_3"/>
<flux source="//@module.0" destination="//@module.1"/>
<flux source="//@module.1" destination="//@module.2"/>
</Scenario>
odesign file dump
<?xml version="1.0" encoding="UTF-8"?>
<description:Group xmi:version="2.0" xmlns:xmi="..." xmlns:xsi="..." xmlns:description="..." xmlns:style=".." xmlns:tool="..." name="Scenario" version="6.9.0.201308011200">
<ownedViewpoints name="SIQI_SIMU_SCENARIO_VP" modelFileExtension="">
<ownedRepresentations xsi:type="description:DiagramDescription" name="SIQI_SIMU_SCENARIO_DIAG" domainClass="simulation.Scenario">
<metamodel href="Simulation.ecore#/"/>
<defaultLayer name="SIQI_SIMU_SCENARIO_LAYER">
<nodeMappings name="MODULE_NODE" semanticCandidatesExpression="[module/]" semanticElements="feature:sortie" domainClass="simulation.Module">
<style xsi:type="style:SquareDescription" borderSizeComputationExpression="1" labelExpression="feature:label" tooltipExpression="feature:description" labelPosition="node" resizeKind="NSEW">
<borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
</style>
</nodeMappings>
<edgeMappings name="FLUX_DONNEES_ID" semanticCandidatesExpression="[flux/]" sourceMapping="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@nodeMappings[name='MODULE_NODE']" targetMapping="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@nodeMappings[name='MODULE_NODE']" targetFinderExpression="[destination/]" sourceFinderExpression="[source/]" domainClass="simulation.FluxDonnee" useDomainElement="true">
<style lineStyle="dash" sizeComputationExpression="2" routingStyle="manhattan">
<strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
<centerLabelStyleDescription>
<labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
</centerLabelStyleDescription>
</style>
</edgeMappings>
<toolSections>
<ownedTools xsi:type="tool:EdgeCreationDescription" name="CREATE_FLUX" edgeMappings="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@edgeMappings[name='FLUX_DONNEES_ID']">
<sourceVariable name="source_ed"/>
<targetVariable name="destination_ed"/>
<sourceViewVariable name="sourceView"/>
<targetViewVariable name="targetView"/>
<initialOperation>
<firstModelOperations xsi:type="tool:CreateInstance" typeName="simulation.FluxDonnee" referenceName="flux">
<subModelOperations xsi:type="tool:SetObject" featureName="destination" object="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@toolSections.0/@ownedTools[name='CREATE_FLUX']/@targetVariable"/>
<subModelOperations xsi:type="tool:SetObject" featureName="source" object="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@toolSections.0/@ownedTools[name='CREATE_FLUX']/@sourceVariable"/>
</firstModelOperations>
</initialOperation>
</ownedTools>
<ownedTools xsi:type="tool:NodeCreationDescription" name="CREATE_MODULE" forceRefresh="true" nodeMappings="//@ownedViewpoints[name='SIQI_SIMU_SCENARIO_VP']/@ownedRepresentations[name='SIQI_SIMU_SCENARIO_DIAG']/@defaultLayer/@nodeMappings[name='MODULE_NODE']">
<variable name="container"/>
<viewVariable name="containerView"/>
<initialOperation>
<firstModelOperations xsi:type="tool:CreateInstance" typeName="simulation.Module" referenceName="module">
<subModelOperations xsi:type="tool:SetValue" featureName="label" valueExpression="new module"/>
</firstModelOperations>
</initialOperation>
</ownedTools>
</toolSections>
</defaultLayer>
</ownedRepresentations>
</ownedViewpoints>
</description:Group>
|
|
|
|
|
|
Re: Edge Creation Tool [message #1219541 is a reply to message #1219537] |
Wed, 04 December 2013 09:09  |
Eclipse User |
|
|
|
Le 04/12/2013 14:55, Guillaume Prêcheur a écrit :
> I'm newby in sirius/Acceleo3 world, so I don't catch exatly why it's
> better to use the feature:source acceleo définition than the [source/]
> one ? time interpretation ?
Yes, it's mostly about execution time. Using Acceleo for expressions
allow for possibly very complex queries on your models, but its comes
with some up-front cost (mainly parsing and compilation). "feature:" is
very limited (only direct access to a named attribute or reference), but
has almost no overhead compared to calling eGet(featureName). When you
don't need the full power of a Acceleo and can use feature: instead, it
is always recommended to do so.
The same idea applies to "var:" (for direct access to a variable's
value) and "service:" (to invoke custom Java code). Both things can be
done through Acceleo too, but when your expression does nothing more,
using the special syntax will give you better performance.
See
http://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html, and
especially the section entitled "Using the Specialized interpreters" for
more details.
|
|
|
Powered by
FUDForum. Page generated in 0.07290 seconds