Skip to content

Commit

Permalink
[FIX] ObeoNetwork#94 tool for stateMachine
Browse files Browse the repository at this point in the history
Add a feature tool for stateMachine creation
Display owned StateMachine in block
  • Loading branch information
fbats committed Feb 13, 2018
1 parent 1191b6b commit b5d24a3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
16 changes: 16 additions & 0 deletions plugins/org.obeonetwork.dsl.sysml.design/description/sysml.odesign
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@
<color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
</style>
</subNodeMappings>
<subNodeMappings name="BDD_StateMachine" detailDescriptions="//@ownedViewpoints[name='SysML']/@ownedRepresentations[name='Block%20Definition%20Diagram']/@defaultLayer/@toolSections.6/@ownedTools[name='Function%20description%20creation']" deletionDescription="//@ownedViewpoints[name='SysML']/@ownedRepresentations[name='Block%20Definition%20Diagram']/@defaultLayer/@toolSections.5/@subSections[name='BDD%20Delete%20Objects']/@ownedTools[name='Delete%20Function']" labelDirectEdit="//@ownedViewpoints[name='SysML']/@ownedRepresentations[name='Block%20Definition%20Diagram']/@defaultLayer/@toolSections.4/@ownedTools[name='Edit%20Function%20Name']" semanticCandidatesExpression="feature:ownedBehavior" domainClass="uml.StateMachine">
<style xsi:type="style:SquareDescription" labelExpression="service:computeUmlLabel" labelAlignment="LEFT">
<borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_blue']"/>
<labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_blue']"/>
</style>
</subNodeMappings>
<style xsi:type="style:FlatContainerStyleDescription" arcWidth="1" arcHeight="1" borderSizeComputationExpression="1" labelExpression="service:computeUmlLabel" tooltipExpression="feature:name" backgroundStyle="GradientTopToBottom" foregroundColor="//@userColorsPalettes[name='SysML%20Color%20Palette']/@entries[name='BlueBlock']">
<borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
Expand Down Expand Up @@ -568,6 +575,15 @@
</initialOperation>
</tools>
</ownedTools>
<ownedTools xsi:type="tool:NodeCreationDescription" name="BDD_Create_StateMachine" label="State Machine" nodeMappings="//@ownedViewpoints[name='SysML']/@ownedRepresentations[name='Block%20Definition%20Diagram']/@defaultLayer/@containerMappings[name='BDD_Block']/@subNodeMappings[name='BDD_StateMachine']">
<variable name="container"/>
<viewVariable name="containerView"/>
<initialOperation>
<firstModelOperations xsi:type="tool_1:CreateInstance" typeName="uml.StateMachine" referenceName="ownedBehavior">
<subModelOperations xsi:type="tool_1:SetValue" featureName="name" valueExpression="service:computeSysmlLabel"/>
</firstModelOperations>
</initialOperation>
</ownedTools>
<reusedTools xsi:type="tool:NodeCreationDescription" href="../../org.obeonetwork.dsl.uml2.design/description/uml2.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Class%20Diagram']/@defaultLayer/@toolSections.2/@ownedTools[name='Literal']"/>
</toolSections>
<toolSections name="Relationships" label="Relationships">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.util.UMLSwitch;

import com.google.common.base.Predicate;
Expand Down Expand Up @@ -160,6 +161,16 @@ public boolean apply(EObject input) {
return computeLabel(element, getUmlTypeName(element), predicate);
}

@Override
public String caseStateMachine(StateMachine element) {
final Predicate<EObject> predicate = new Predicate<EObject>() {
public boolean apply(EObject input) {
return input instanceof StateMachine;
}
};
return computeLabel(element, "stateMachine", predicate); //$NON-NLS-1$
}

/**
* Compute default label : name + number of existing element.
*
Expand Down

0 comments on commit b5d24a3

Please sign in to comment.