diff options
| author | Mickael LANOE | 2015-03-13 15:18:29 +0000 |
|---|---|---|
| committer | Mickael LANOE | 2015-03-19 12:32:38 +0000 |
| commit | bf0c67f1f57ac2310fe330fc0f21f3aeeff2cb4f (patch) | |
| tree | a60016d58053ef006c5e22c1afc292f659024035 | |
| parent | e7d0fd6932a2b077841ba2716fe595f0fb0dbab6 (diff) | |
| download | org.eclipse.sirius-bf0c67f1f57ac2310fe330fc0f21f3aeeff2cb4f.tar.gz org.eclipse.sirius-bf0c67f1f57ac2310fe330fc0f21f3aeeff2cb4f.tar.xz org.eclipse.sirius-bf0c67f1f57ac2310fe330fc0f21f3aeeff2cb4f.zip | |
[432133] Add the plugin org.eclipse.sirius.tests.sample.scxml.design
Add a plugin that contains a VSM for the SCXML MM generated with the W3C
XSD files.
This plugin is used for testing semantic models conform to MM generated
with XSD.
Bug: 432133
Change-Id: I48051ade9e0bce628d7fdd0d03eb0a13f6b42907
Signed-off-by: Mickael LANOE <mickael.lanoe@obeo.fr>
12 files changed, 532 insertions, 0 deletions
diff --git a/packaging/org.eclipse.sirius.tests.parent/pom.xml b/packaging/org.eclipse.sirius.tests.parent/pom.xml index 389cc7d541..2c87d1cab6 100644 --- a/packaging/org.eclipse.sirius.tests.parent/pom.xml +++ b/packaging/org.eclipse.sirius.tests.parent/pom.xml @@ -73,6 +73,7 @@ <module>../../plugins/org.eclipse.sirius.tests.sample.migration.design</module> <module>../../plugins/org.eclipse.sirius.tests.sample.component</module> <module>../../plugins/org.eclipse.sirius.tests.sample.scxml</module> + <module>../../plugins/org.eclipse.sirius.tests.sample.scxml.design</module> <module>../../plugins/org.eclipse.sirius.tests.junit</module> <module>../../plugins/org.eclipse.sirius.tests.tree</module> <module>../../plugins/org.eclipse.sirius.tests.swtbot</module> diff --git a/packaging/org.eclipse.sirius.tests/feature.xml b/packaging/org.eclipse.sirius.tests/feature.xml index 7132b89f1c..c093fbea22 100644 --- a/packaging/org.eclipse.sirius.tests/feature.xml +++ b/packaging/org.eclipse.sirius.tests/feature.xml @@ -115,6 +115,13 @@ modelers, using JUnit or SWTbot. Install this if you want to write automated tes unpack="false"/> <plugin + id="org.eclipse.sirius.tests.sample.scxml.design" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin id="org.eclipse.sirius.tests.junit" download-size="0" install-size="0" diff --git a/plugins/org.eclipse.sirius.tests.sample.scxml.design/.classpath b/plugins/org.eclipse.sirius.tests.sample.scxml.design/.classpath new file mode 100644 index 0000000000..751c8f2e50 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.sample.scxml.design/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.eclipse.sirius.tests.sample.scxml.design/.project b/plugins/org.eclipse.sirius.tests.sample.scxml.design/.project new file mode 100644 index 0000000000..50690a9ed3 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.sample.scxml.design/.project @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.sirius.tests.sample.scxml.design</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.acceleo.ide.ui.acceleoBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.acceleo.ide.ui.acceleoNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + </natures> +</projectDescription> + diff --git a/plugins/org.eclipse.sirius.tests.sample.scxml.design/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.tests.sample.scxml.design/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..d57b59a87b --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.sample.scxml.design/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.sirius.tests.sample.scxml.design;singleton:=true +Bundle-Version: 3.0.0.qualifier +Bundle-ClassPath: . +Bundle-Activator: org.eclipse.sirius.tests.sample.scxml.design.Activator +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.core.resources, + org.eclipse.sirius, + org.eclipse.sirius.common.acceleo.mtl, + org.eclipse.sirius.tests.sample.scxml, + org.eclipse.sirius.common +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-Localization: plugin diff --git a/plugins/org.eclipse.sirius.tests.sample.scxml.design/build.properties b/plugins/org.eclipse.sirius.tests.sample.scxml.design/build.properties new file mode 100644 index 0000000000..fa4bec54b3 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.sample.scxml.design/build.properties @@ -0,0 +1,18 @@ +# ==================================================================== +# Copyright (c) 2015 Obeo. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Obeo - initial API and implementation +# ==================================================================== +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + description/,\ + plugin.xml,\ + plugin.properties +customBuildCallbacks = build.acceleo diff --git a/plugins/org.eclipse.sirius.tests.sample.scxml.design/description/scxml.odesign b/plugins/org.eclipse.sirius.tests.sample.scxml.design/description/scxml.odesign new file mode 100644 index 0000000000..4b4d949643 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.sample.scxml.design/description/scxml.odesign @@ -0,0 +1,196 @@ +<?xml version="1.0" encoding="UTF-8"?> +<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:tool="http://www.eclipse.org/sirius/diagram/description/tool/1.1.0" xmlns:tool_1="http://www.eclipse.org/sirius/description/tool/1.1.0" name="scxml" version="10.0.0.201411061000"> + <ownedViewpoints name="SCXML Diagram"> + <ownedRepresentations xsi:type="description_1:DiagramDescription" name="Diagram" initialisation="true" domainClass="scxml.ScxmlScxmlType"> + <defaultLayer name="Default"> + <nodeMappings name="Initial" preconditionExpression="[initial.oclIsUndefined()->first()=false/]" semanticCandidatesExpression="[thisEObject/]" domainClass="scxml.ScxmlScxmlType"> + <style xsi:type="style:EllipseNodeDescription" showIcon="false" labelExpression="" 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> + <nodeMappings name="Final" labelDirectEdit="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.0/@ownedTools[name='EditID']" semanticCandidatesExpression="[thisEObject.eContents()/]" domainClass="scxml.ScxmlFinalType"> + <style xsi:type="style:EllipseNodeDescription" labelExpression="feature:id" 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='green']"/> + </style> + </nodeMappings> + <edgeMappings name="InitialTransition" sourceMapping="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Initial']" targetMapping="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='State'] //@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Parallel']" targetFinderExpression="[eContents()->select(e|(e.oclIsKindOf(scxml::ScxmlStateType) and e.oclAsType(scxml::ScxmlStateType).id=self.initial->first().toString()) or (e.oclIsKindOf(scxml::ScxmlParallelType) and e.oclAsType(scxml::ScxmlParallelType).id=self.initial->first().toString()))/]" sourceFinderExpression="[thisEObject/]" domainClass="scxml.ScxmlScxmlType" useDomainElement="true"> + <style targetArrow="InputFillClosedArrow" sizeComputationExpression="2"> + <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> + <edgeMappings name="Transition" labelDirectEdit="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.0/@ownedTools[name='EditTransitionLabel']" sourceMapping="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='State'] //@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Parallel']" targetMapping="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='State'] //@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Parallel'] //@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Final']" targetFinderExpression="[eContainer(scxml::ScxmlScxmlType).eAllContents()->select(e|(e.oclIsKindOf(scxml::ScxmlStateType) and e.oclAsType(scxml::ScxmlStateType).id=self.target->first().toString()) or (e.oclIsKindOf(scxml::ScxmlParallelType) and e.oclAsType(scxml::ScxmlParallelType).id=self.target->first().toString()) or (e.oclIsKindOf(scxml::ScxmlFinalType) and e.oclAsType(scxml::ScxmlFinalType).id=self.target->first().toString()))/]" sourceFinderExpression="feature:eContainer" domainClass="scxml.ScxmlTransitionType" useDomainElement="true"> + <style targetArrow="InputFillClosedArrow" sizeComputationExpression="2"> + <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/> + <centerLabelStyleDescription labelExpression="[(if (cond.oclIsUndefined() or cond='') then '' else ('['+cond+']') endif) + event/]"> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + </centerLabelStyleDescription> + </style> + </edgeMappings> + <edgeMappings name="SubInitialTransition" sourceMapping="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='State']/@subNodeMappings[name='SubInitial']" targetMapping="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='State'] //@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Parallel']" targetFinderExpression="[eContents()->select(e|(e.oclIsKindOf(scxml::ScxmlStateType) and e.oclAsType(scxml::ScxmlStateType).id=self.initial1->first().toString()) or (e.oclIsKindOf(scxml::ScxmlParallelType) and e.oclAsType(scxml::ScxmlParallelType).id=self.initial1->first().toString()))/]" sourceFinderExpression="[thisEObject/]" domainClass="scxml.ScxmlStateType" useDomainElement="true"> + <style targetArrow="InputFillClosedArrow" sizeComputationExpression="2"> + <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> + <containerMappings name="State" labelDirectEdit="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.0/@ownedTools[name='EditID']" semanticCandidatesExpression="[thisEObject.eContents()/]" domainClass="scxml.ScxmlStateType" reusedNodeMappings="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Final']" reusedContainerMappings="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='State'] //@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Parallel'] //@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Datamodel']"> + <subNodeMappings name="SubInitial" preconditionExpression="[initial1.oclIsUndefined()->first()=false/]" semanticCandidatesExpression="[thisEObject/]" domainClass="scxml.ScxmlStateType"> + <style xsi:type="style:EllipseNodeDescription" labelExpression="" 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> + </subNodeMappings> + <style xsi:type="style:FlatContainerStyleDescription" arcWidth="10" arcHeight="10" borderSizeComputationExpression="1" labelExpression="feature:id" roundedCorner="true"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + <foregroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + </style> + </containerMappings> + <containerMappings name="Parallel" labelDirectEdit="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.0/@ownedTools[name='EditID']" semanticCandidatesExpression="[thisEObject.eContents()/]" domainClass="scxml.ScxmlParallelType" reusedContainerMappings="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Parallel'] //@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='State'] //@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Datamodel']"> + <style xsi:type="style:FlatContainerStyleDescription" arcWidth="10" arcHeight="10" labelExpression="feature:id" roundedCorner="true"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='red']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + <foregroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + </style> + </containerMappings> + <containerMappings name="Datamodel" semanticCandidatesExpression="[thisEObject.eContents()/]" domainClass="scxml.ScxmlDatamodelType" childrenPresentation="List"> + <subNodeMappings name="Data" labelDirectEdit="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.0/@ownedTools[name='EditDataLabel']" semanticCandidatesExpression="feature:eAllContents" domainClass="scxml.ScxmlDataType"> + <style xsi:type="style:SquareDescription" showIcon="false" labelExpression="[id + ' = ' + expr/]" 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> + </subNodeMappings> + <style xsi:type="style:ShapeContainerStyleDescription" labelExpression="Datamodel"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_yellow']"/> + </style> + </containerMappings> + <toolSections name="Tools"> + <ownedTools xsi:type="tool:ContainerCreationDescription" name="StateCreation" containerMappings="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='State']"> + <variable name="container"/> + <viewVariable name="containerView"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:CreateInstance" typeName="scxml.ScxmlStateType" referenceName="state" variableName=""> + <subModelOperations xsi:type="tool_1:SetValue" featureName="id" valueExpression="['State' + eContainer(scxml::ScxmlScxmlType).eAllContents(scxml::ScxmlStateType)->size()/]"/> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool:ContainerCreationDescription" name="ParallelCreation" containerMappings="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Parallel']"> + <variable name="container"/> + <viewVariable name="containerView"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:CreateInstance" typeName="scxml.ScxmlParallelType" referenceName="parallel" variableName=""> + <subModelOperations xsi:type="tool_1:SetValue" featureName="id" valueExpression="['Parallel' + eContainer(scxml::ScxmlScxmlType).eAllContents(scxml::ScxmlParallelType)->size()/]"/> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool:ContainerCreationDescription" name="DatamodelCreation" precondition="[eContents(scxml::ScxmlDatamodelType)->size()=0/]" containerMappings="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Datamodel']"> + <variable name="container"/> + <viewVariable name="containerView"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:CreateInstance" typeName="scxml.ScxmlDatamodelType" referenceName="datamodel"/> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool:DirectEditLabel" name="EditID"> + <mask mask="{0}"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:SetValue" featureName="id" valueExpression="var:0"/> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool:NodeCreationDescription" name="DataCreation" nodeMappings="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Datamodel']/@subNodeMappings[name='Data']"> + <variable name="container"/> + <viewVariable name="containerView"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:CreateInstance" typeName="scxml.ScxmlDataType" referenceName="data"> + <subModelOperations xsi:type="tool_1:SetValue" featureName="id" valueExpression="['var' + eContainer(scxml::ScxmlScxmlType).eAllContents(scxml::ScxmlDataType)->size()/]"/> + <subModelOperations xsi:type="tool_1:SetValue" featureName="expr" valueExpression="null"/> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool:DirectEditLabel" name="EditDataLabel"> + <mask mask="{0}"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="[self/]"> + <subModelOperations xsi:type="tool_1:SetValue" featureName="id" valueExpression="[getDataID(arg0)/]"/> + <subModelOperations xsi:type="tool_1:SetValue" featureName="expr" valueExpression="[getDataExpression(arg0)/]"/> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool:NodeCreationDescription" name="FinalCreation" nodeMappings="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Final']"> + <variable name="container"/> + <viewVariable name="containerView"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:CreateInstance" typeName="scxml.ScxmlFinalType" referenceName="final"> + <subModelOperations xsi:type="tool_1:SetValue" featureName="id" valueExpression="['final' + eContainer(scxml::ScxmlScxmlType).eAllContents(scxml::ScxmlFinalType)->size()/]"/> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool_1:OperationAction" name="SetInitial" label="Define as initial" precondition="[(oclIsKindOf(scxml::ScxmlStateType) or oclIsKindOf(scxml::ScxmlParallelType)) and eContainer().oclIsKindOf(scxml::ScxmlScxmlType)/]"> + <view name="views"> + <subVariables xsi:type="tool_1:AcceleoVariable" name="nameInitial" computationExpression="[(if self.target.oclIsKindOf(scxml::ScxmlStateType) then self.target.oclAsType(scxml::ScxmlStateType).id else self.target.oclAsType(scxml::ScxmlParallelType).id endif)/]"/> + </view> + <initialOperation> + <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="[eContainer().oclAsType(scxml::ScxmlScxmlType)/]"> + <subModelOperations xsi:type="tool_1:SetValue" featureName="initial" valueExpression="var:nameInitial"/> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool_1:OperationAction" name="SetSubInitial" label="Define as initial" precondition="[(oclIsKindOf(scxml::ScxmlStateType) or oclIsKindOf(scxml::ScxmlParallelType)) and eContainer().oclIsKindOf(scxml::ScxmlStateType)/]"> + <view name="views"> + <subVariables xsi:type="tool_1:AcceleoVariable" name="nameInitial" computationExpression="[(if self.target.oclIsKindOf(scxml::ScxmlStateType) then self.target.oclAsType(scxml::ScxmlStateType).id else self.target.oclAsType(scxml::ScxmlParallelType).id endif)/]"/> + </view> + <initialOperation> + <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="[eContainer().oclAsType(scxml::ScxmlStateType)/]"> + <subModelOperations xsi:type="tool_1:SetValue" featureName="initial1" valueExpression="var:nameInitial"/> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool:EdgeCreationDescription" name="TransitionCreation" edgeMappings="//@ownedViewpoints[name='SCXML%20Diagram']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='Transition']"> + <sourceVariable name="sourceObj"/> + <targetVariable name="targetObj"/> + <sourceViewVariable name="sourceView"/> + <targetViewVariable name="targetView"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:CreateInstance" typeName="scxml.ScxmlTransitionType" referenceName="transition"> + <subModelOperations xsi:type="tool_1:Switch"> + <cases conditionExpression="[targetObj.oclIsKindOf(scxml::ScxmlParallelType)/]"> + <subModelOperations xsi:type="tool_1:SetValue" featureName="target" valueExpression="[targetObj.oclAsType(scxml::ScxmlParallelType).id/]"/> + </cases> + <cases conditionExpression="[targetObj.oclIsKindOf(scxml::ScxmlFinalType)/]"> + <subModelOperations xsi:type="tool_1:SetValue" featureName="target" valueExpression="[targetObj.oclAsType(scxml::ScxmlFinalType).id/]"/> + </cases> + <default> + <subModelOperations xsi:type="tool_1:SetValue" featureName="target" valueExpression="[targetObj.oclAsType(scxml::ScxmlStateType).id/]"/> + </default> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool:DirectEditLabel" name="EditTransitionLabel"> + <mask mask="{0}"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="[self/]"> + <subModelOperations xsi:type="tool_1:SetValue" featureName="event" valueExpression="[getTransitionEvent(arg0)/]"/> + <subModelOperations xsi:type="tool_1:SetValue" featureName="cond" valueExpression="[getTransitionCondition(arg0)/]"/> + </firstModelOperations> + </initialOperation> + </ownedTools> + </toolSections> + </defaultLayer> + </ownedRepresentations> + <ownedJavaExtensions qualifiedClassName="org.eclipse.sirius.tests.sample.scxml.design.LabelParser"/> + </ownedViewpoints> +</description:Group> diff --git a/plugins/org.eclipse.sirius.tests.sample.scxml.design/plugin.properties b/plugins/org.eclipse.sirius.tests.sample.scxml.design/plugin.properties new file mode 100644 index 0000000000..1d649c6afb --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.sample.scxml.design/plugin.properties @@ -0,0 +1,12 @@ +# ==================================================================== +# Copyright (c) 2015 Obeo. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Obeo - initial API and implementation +# ==================================================================== +pluginName = Scxml VSM +providerName = Eclipse Modeling Project diff --git a/plugins/org.eclipse.sirius.tests.sample.scxml.design/plugin.xml b/plugins/org.eclipse.sirius.tests.sample.scxml.design/plugin.xml new file mode 100644 index 0000000000..2475c65571 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.sample.scxml.design/plugin.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.0"?> +<!-- + Copyright (c) 2015 Obeo. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Obeo - Initial API and implementation +--> +<plugin> + <extension point="org.eclipse.sirius.componentization"> + <component class="org.eclipse.sirius.tests.sample.scxml.design.Activator" + id="org.eclipse.sirius.tests.sample.scxml.design" + name="scxml"> + </component> + </extension> +</plugin> diff --git a/plugins/org.eclipse.sirius.tests.sample.scxml.design/pom.xml b/plugins/org.eclipse.sirius.tests.sample.scxml.design/pom.xml new file mode 100644 index 0000000000..6ee0742b31 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.sample.scxml.design/pom.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2015 Obeo. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Obeo - Initial API and implementation +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.sirius</groupId> + <artifactId>sirius-tests-parent</artifactId> + <version>3.0.0-SNAPSHOT</version> + <relativePath>../../packaging/org.eclipse.sirius.tests.parent</relativePath> + </parent> + + <artifactId>org.eclipse.sirius.tests.sample.scxml.design</artifactId> + <packaging>eclipse-plugin</packaging> + <version>3.0.0-SNAPSHOT</version> + +</project> diff --git a/plugins/org.eclipse.sirius.tests.sample.scxml.design/src/org/eclipse/sirius/tests/sample/scxml/design/Activator.java b/plugins/org.eclipse.sirius.tests.sample.scxml.design/src/org/eclipse/sirius/tests/sample/scxml/design/Activator.java new file mode 100644 index 0000000000..c87c6603d0 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.sample.scxml.design/src/org/eclipse/sirius/tests/sample/scxml/design/Activator.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2015 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.sample.scxml.design; + +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.sirius.business.api.componentization.ViewpointRegistry; +import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle. + */ +public class Activator extends AbstractUIPlugin { + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.sirius.tests.sample.scxml.design"; + + // The shared instance + private static Activator plugin; + + private static Set<Viewpoint> viewpoints; + + /** + * The constructor. + */ + public Activator() { + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + viewpoints = new HashSet<Viewpoint>(); + viewpoints.addAll(ViewpointRegistry.getInstance().registerFromPlugin(PLUGIN_ID + "/description/scxml.odesign")); + } + + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + if (viewpoints != null) { + for (final Viewpoint viewpoint : viewpoints) { + ViewpointRegistry.getInstance().disposeFromPlugin(viewpoint); + } + viewpoints.clear(); + viewpoints = null; + } + super.stop(context); + } + + /** + * Returns the shared instance. + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } +} diff --git a/plugins/org.eclipse.sirius.tests.sample.scxml.design/src/org/eclipse/sirius/tests/sample/scxml/design/LabelParser.java b/plugins/org.eclipse.sirius.tests.sample.scxml.design/src/org/eclipse/sirius/tests/sample/scxml/design/LabelParser.java new file mode 100644 index 0000000000..79c81dd602 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.sample.scxml.design/src/org/eclipse/sirius/tests/sample/scxml/design/LabelParser.java @@ -0,0 +1,122 @@ +/******************************************************************************* + * Copyright (c) 2015 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.sample.scxml.design; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.eclipse.sirius.tests.sample.scxml.ScxmlDataType; +import org.eclipse.sirius.tests.sample.scxml.ScxmlTransitionType; + +/** + * Label parser. + * + * @author Benjamin GROUHAN + * + */ +public class LabelParser { + /** + * Transition labels are in the form : "[cond]event" where [cond] and event + * are optionnal. + */ + private static Pattern REGEX1 = Pattern.compile("^(\\s*\\[\\s*\\w+\\s*\\])?\\s*[\\w\\.]*\\s*$"); + + /** + * Data labels are in the form : "id=expr". + */ + private static Pattern REGEX2 = Pattern.compile("^\\s*\\w+\\s*=\\s*\\w+\\s*$"); + + /** + * Default constructor. + */ + public LabelParser() { + } + + /** + * Get the transition event from the label. + * + * @param transition + * the current transition + * @param label + * the label to parse + * @return the transition event + */ + public String getTransitionEvent(ScxmlTransitionType transition, String label) { + String ret = transition.getEvent(); + Matcher m = REGEX1.matcher(label); + if (m.matches()) { + String event = label.substring(label.indexOf("]") + 1); + ret = event.trim(); + } + return ret; + } + + /** + * Get the transition condition from the label. + * + * @param transition + * the current transition + * @param label + * the label to parse + * @return the transition condition + */ + public String getTransitionCondition(ScxmlTransitionType transition, String label) { + String ret = transition.getCond(); + Matcher m = REGEX1.matcher(label); + if (m.matches()) { + if (label.indexOf("[") < 0) { + ret = ""; + } else { + String cond = label.substring(label.indexOf("[") + 1, label.indexOf("]")); + ret = cond.trim(); + } + } + return ret; + } + + /** + * Get the data id from the label. + * + * @param data + * the current data + * @param label + * the label to parse + * @return the data id + */ + public String getDataID(ScxmlDataType data, String label) { + String ret = data.getId(); + Matcher m = REGEX2.matcher(label); + if (m.matches()) { + String id = label.substring(0, label.indexOf("=")); + ret = id.trim(); + } + return ret; + } + + /** + * Get the data expression from the label. + * + * @param data + * the current data + * @param label + * the label to parse + * @return the data expression + */ + public String getDataExpression(ScxmlDataType data, String label) { + String ret = data.getExpr(); + Matcher m = REGEX2.matcher(label); + if (m.matches()) { + String expr = label.substring(label.indexOf("=") + 1); + ret = expr.trim(); + } + return ret; + } +} |
