diff options
| author | Christian W. Damus | 2017-01-06 14:51:09 +0000 |
|---|---|---|
| committer | Christian W. Damus | 2017-01-10 19:59:14 +0000 |
| commit | 45850f5b77143dafbac7a9e5ab77fc332385718b (patch) | |
| tree | 2dbd619b1c58570f19e5a1d0d82138d2ef2445b5 | |
| parent | 2d669b9d9d93423b0804139050cb4323021a0aaa (diff) | |
| download | org.eclipse.papyrus-rt-45850f5b77143dafbac7a9e5ab77fc332385718b.tar.gz org.eclipse.papyrus-rt-45850f5b77143dafbac7a9e5ab77fc332385718b.tar.xz org.eclipse.papyrus-rt-45850f5b77143dafbac7a9e5ab77fc332385718b.zip | |
Bug 467545: [UML-RT] PapyrusRT shall provide a UML specific implementation to support redefinition
Integration of the UML-RT metamodel implementation into the Tooling UI:
diagram editors, Model Explorer, Properties View.
Visualization of inherited ports, parts, and connectors in Capsule Structure Diagram.
This is implemented using a new edit-policy class hierarchy, AbstractInheritanceEditPolicy
and its subclasses for nodes and edges, instead of the Papyrus synchronization framework
from the Mars release. The experimental diagram synchronization implementation in
Papyrus-RT is deleted from the repository.
Support exclusion of inherited members according to the UML-RT Profile Specification.
Excluded members are not shown in the Capsule Structure Diagram but are presented in the
Model Explorer and (optionally) the Properties View so that they may still be accessible
for re-inheritace.
Capsule and Protocol properties in the UML-RT tab of the Properties View are now built on
observable properties based on the façade API. Lists of ports, parts, and protool
messages support exclusion of inherited elements and re-inheritance of excluded or
redefined elements.
Model Explorer adds an optional (disabled by default) customization for presentation of
inherited elements.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=467545
Change-Id: I9e7ef37976d39782f085af5de4d1d85156792477
200 files changed, 14192 insertions, 2917 deletions
diff --git a/features/tooling/org.eclipse.papyrusrt.umlrt.tooling.feature/feature.xml b/features/tooling/org.eclipse.papyrusrt.umlrt.tooling.feature/feature.xml index ec6d3fa65..a4e13e3bb 100644 --- a/features/tooling/org.eclipse.papyrusrt.umlrt.tooling.feature/feature.xml +++ b/features/tooling/org.eclipse.papyrusrt.umlrt.tooling.feature/feature.xml @@ -33,14 +33,12 @@ <import plugin="org.eclipse.gmf.runtime.emf.type.core" version="1.9.0" match="compatible"/> <import plugin="org.eclipse.papyrus.infra.core.log" version="1.2.0" match="compatible"/> <import plugin="org.eclipse.papyrus.emf.facet.custom.ui" version="2.0.0" match="compatible"/> - <import plugin="org.eclipse.papyrusrt.umlrt.core.sync" version="0.8.0" match="compatible"/> <import plugin="org.eclipse.papyrus.infra.services.labelprovider" version="1.2.0" match="compatible"/> <import plugin="org.eclipse.papyrus.emf.facet.custom.core" version="2.0.0" match="compatible"/> <import plugin="org.eclipse.papyrus.infra.widgets" version="2.0.0" match="compatible"/> <import plugin="org.eclipse.papyrus.uml.modelexplorer" version="1.2.0" match="compatible"/> <import plugin="org.eclipse.papyrus.views.modelexplorer" version="2.0.0" match="compatible"/> <import plugin="org.eclipse.core.expressions" version="3.4.600" match="compatible"/> - <import plugin="org.eclipse.papyrus.infra.sync" version="1.2.0" match="compatible"/> <import plugin="org.eclipse.papyrus.infra.gmfdiag.common" version="2.0.0" match="compatible"/> <import plugin="org.eclipse.papyrus.infra.core" version="2.0.0" match="compatible"/> <import plugin="com.google.guava" version="11.0.0"/> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/META-INF/MANIFEST.MF b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/META-INF/MANIFEST.MF index 2ff28b9be..6f8d66f28 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/META-INF/MANIFEST.MF +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/META-INF/MANIFEST.MF @@ -20,18 +20,15 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.108.0,4.0.0)", org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.9.0,2.0.0)", org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrusrt.umlrt.core.sync;bundle-version="[0.8.0,1.0.0)", org.eclipse.papyrus.infra.services.labelprovider;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.emf.facet.custom.core;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.widgets;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.uml.modelexplorer;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.views.modelexplorer;bundle-version="[2.0.0,3.0.0)", org.eclipse.core.expressions;bundle-version="[3.4.600,4.0.0)", - org.eclipse.papyrus.infra.sync;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.core;bundle-version="[2.0.0,3.0.0)", com.google.guava;bundle-version="[11.0.0,16.0.0)", - org.eclipse.papyrusrt.umlrt.profile;bundle-version="[0.8.0,1.0.0)", org.eclipse.papyrusrt.umlrt.core;bundle-version="[0.8.0,1.0.0)", org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.uml.diagram.composite;bundle-version="[2.0.1,3.0.0)", @@ -46,7 +43,13 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.108.0,4.0.0)", org.eclipse.papyrus.infra.ui.emf;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.infra.hyperlink;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.uml.types.core;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.infra.emf.types;bundle-version="[2.0.0,3.0.0)" + org.eclipse.papyrusrt.umlrt.uml;bundle-version="[0.8.0,1.0.0)";visibility:=reexport, + org.eclipse.papyrus.uml.diagram.stereotype.edition;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.emf.types;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrusrt.umlrt.uml;bundle-version="[0.8.0,1.0.0)", + org.eclipse.papyrus.uml.diagram.stereotype.edition;bundle-version="[1.2.0,2.0.0)", + org.eclipse.e4.ui.css.core;bundle-version="[0.12.1,1.0.0)", + org.eclipse.papyrus.uml.diagram.css;bundle-version="[1.2.0,2.0.0)" Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.papyrusrt.umlrt.tooling.diagram.common, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.command, @@ -60,13 +63,16 @@ Export-Package: org.eclipse.papyrusrt.umlrt.tooling.diagram.common, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.figures, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.canonical;x-internal:=true, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.commands;x-internal:=true, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.css;x-internal:=true, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.drop;x-internal:=true, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies;x-internal:=true, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.stereotype;x-internal:=true, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.expressions;x-internal:=true, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.handlers;x-internal:=true, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.hyperlink;x-internal:=true, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.layout;x-internal:=true, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.provider;x-internal:=true, - org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync;x-internal:=true, - org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine;x-internal:=true, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.types.advice;x-internal:=true, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils;x-friends:="org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine", org.eclipse.papyrusrt.umlrt.tooling.diagram.common.locator, org.eclipse.papyrusrt.umlrt.tooling.diagram.common.provider, diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/css/capsulestructurediagram.css b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/css/capsulestructurediagram.css index 3c616f589..a91371b51 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/css/capsulestructurediagram.css +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/css/capsulestructurediagram.css @@ -8,7 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation - * Christian W. Damus - bugs 475905, 501081 + * Christian W. Damus - bugs 475905, 501081, 467545 * */ @@ -23,6 +23,9 @@ CompositeStructureDiagram{ [appliedStereotypes~="UMLRealTime::RTPort"]{ canonical:true; } +Port[isTypeRedefined=true] { + bold: true; +} [appliedStereotypes~="UMLRealTime::Capsule"]{ canonical:true; @@ -34,6 +37,9 @@ CompositeStructureDiagram{ maskLabel: name type multiplicity; elementIcon: false; } +Property[isTypeRedefined=true] { + bold: true; +} [appliedStereotypes~="UMLRealTime::RTConnector"]{ canonical:true; diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/elementtypes/uml-rt.capsulestructurediagram.elementtypesconfigurations b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/elementtypes/uml-rt.capsulestructurediagram.elementtypesconfigurations index 82e7c31ab..0736fef04 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/elementtypes/uml-rt.capsulestructurediagram.elementtypesconfigurations +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/elementtypes/uml-rt.capsulestructurediagram.elementtypesconfigurations @@ -46,4 +46,5 @@ <specializedTypesID>org.eclipse.papyrusrt.umlrt.core.RTConnector</specializedTypesID> <specializedTypesID>org.eclipse.papyrus.umldi.Connector_Edge</specializedTypesID> </elementTypeConfigurations> + <adviceBindingsConfigurations xsi:type="elementtypesconfigurations:AdviceBindingConfiguration" xmi:id="_eb_SoLMNEeaYnN97GmbpKg" identifier="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.deleteInheritedViews" description="Deletes view of inherited elements in capsule structure diagrams." editHelperAdviceClassName="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.types.advice.DeleteInheritedViewsAdvice"/> </elementtypesconfigurations:ElementTypeSetConfiguration> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/dtool16/reinherit_d.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/dtool16/reinherit_d.png Binary files differnew file mode 100644 index 000000000..ec474c970 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/dtool16/reinherit_d.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/dtool16/reinherit_d@2x.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/dtool16/reinherit_d@2x.png Binary files differnew file mode 100644 index 000000000..a1e462706 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/dtool16/reinherit_d@2x.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/etool16/reinherit.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/etool16/reinherit.png Binary files differnew file mode 100644 index 000000000..3f86044e3 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/etool16/reinherit.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/etool16/reinherit@2x.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/etool16/reinherit@2x.png Binary files differnew file mode 100644 index 000000000..e85329dba --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/icons/full/etool16/reinherit@2x.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/plugin.xml b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/plugin.xml index 5993cf68b..6e0de3ebc 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/plugin.xml +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/plugin.xml @@ -102,6 +102,15 @@ </decoratorProvider> </extension> <extension + point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders"> + <decoratorProvider + class="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.provider.RedefinitionDecoratorProvider"> + <Priority + name="Medium"> + </Priority> + </decoratorProvider> + </extension> + <extension point="org.eclipse.papyrus.infra.gmfdiag.canonical.strategies"> <semanticChildrenStrategy class="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.canonical.RTPartSemanticChildrenStrategy" @@ -114,9 +123,14 @@ <enablement> <with variable="editPart"> - <instanceof - value="org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeCompartmentEditPart"> - </instanceof> + <or> + <instanceof + value="org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeCompartmentEditPart"> + </instanceof> + <instanceof + value="org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart"> + </instanceof> + </or> </with> <with variable="element"> @@ -127,6 +141,44 @@ </with> </enablement> </semanticChildrenStrategy> + <visualChildrenStrategy + class="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.canonical.RTInheritableVisualChildrenStrategy" + priority="100"> + <enablement> + <with + variable="editPart"> + <or> + <instanceof + value="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPortEditPart"> + </instanceof> + <instanceof + value="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPropertyPartEditPart"> + </instanceof> + </or> + </with> + </enablement> + </visualChildrenStrategy> + <semanticChildrenStrategy + class="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.canonical.RTPortSemanticChildrenStrategy" + priority="10"> + <enablement> + <with + variable="editPart"> + <or> + <instanceof + value="org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart"> + </instanceof> + </or> + </with> + <with + variable="element"> + <test + property="org.eclipse.papyrus.uml.stereotype" + value="UMLRealTime::RTPort"> + </test> + </with> + </enablement> + </semanticChildrenStrategy> </extension> <extension point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders"> @@ -136,6 +188,22 @@ name="High"> </Priority> </editpolicyProvider> + <editpolicyProvider + class="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.RTExternalReferenceEditPolicyProvider"> + <Priority + name="High"> + </Priority> + <object id="RTPort" class="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPortEditPart"/> + <object id="CapsulePart" class="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPropertyPartEditPart"/> + <context + editparts="RTPort,CapsulePart"/> + </editpolicyProvider> + <editpolicyProvider + class="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.stereotype.RTAppliedStereotypeEditPolicyProvider"> + <Priority + name="High"> + </Priority> + </editpolicyProvider> </extension> <extension point="org.eclipse.papyrus.infra.hyperlink.hyperlinkContributor"> @@ -193,4 +261,96 @@ label="UML-RT Composite Structure Diagram"> </creationCommand> </extension> + + <extension + point="org.eclipse.core.expressions.propertyTesters"> + <propertyTester + class="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.expressions.EditPartPropertyTester" + id="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editPartProperties" + namespace="org.eclipse.papyrusrt.umlrt.tooling.diagram" + properties="isInherited" + type="org.eclipse.gef.EditPart"> + </propertyTester> + </extension> + + <extension + point="org.eclipse.ui.commands"> + <category + id="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.commands" + name="UML-RT Diagram Editing Commands" + description="Commands for editing of UML-RT diagrams in Papyrus-RT models."> + </category> + <command + id="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.toggleInheritView" + name="Follow Superclass View" + description="Toggles whether the view follows position, routing, and other layout characteristics of the corresponding view in the superclass diagram." + categoryId="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.commands"> + <state + id="org.eclipse.ui.commands.toggleState" + class="org.eclipse.jface.commands.ToggleState"> + </state> + </command> + </extension> + <extension + point="org.eclipse.ui.handlers"> + <handler + commandId="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.toggleInheritView" + class="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.handlers.ToggleInheritViewHandler"> + <enabledWhen> + <iterate operator="or" ifEmpty="false"> + <!-- The edit-part supports inheritance and the view is inherited or redefined. --> + <and> + <instanceof + value="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.IInheritableEditPart"> + </instanceof> + <test property="org.eclipse.papyrusrt.umlrt.tooling.diagram.isInherited"/> + </and> + </iterate> + </enabledWhen> + </handler> + </extension> + <extension + point="org.eclipse.ui.menus"> + <menuContribution + locationURI="popup:org.eclipse.papyrus.uml.diagram.ui.popupmenu.format?after=org.eclipse.papyrus.uml.diagram.menu.commands.CopyAppearancePropertiesCommand"> + <command + commandId="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.toggleInheritView" + icon="icons/full/etool16/reinherit.png" + disabledIcon="icons/full/dtool16/reinherit_d.png" + style="toggle"> + <visibleWhen + checkEnabled="true"> + </visibleWhen> + </command> + </menuContribution> + <menuContribution + locationURI="toolbar:org.eclipes.papyrus.menu.toolbar?after=org.eclipse.papyrus.uml.diagram.menu.commands.CopyAppearancePropertiesCommand"> + <command + commandId="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.toggleInheritView" + icon="icons/full/etool16/reinherit.png" + disabledIcon="icons/full/dtool16/reinherit_d.png" + style="toggle" + tooltip="Follow position, routing, etc. of the superclass view"> + <visibleWhen> + <and> + <with + variable="activeEditorId"> + <equals + value="org.eclipse.papyrus.infra.core.papyrusEditor"> + </equals> + </with> + </and> + </visibleWhen> + </command> + </menuContribution> + </extension> + + <extension + point="org.eclipse.papyrus.infra.gmfdiag.css.domElementAdapter"> + <!-- Teach the CSS engine how to resolve notation references to inherited elements. --> + <factory + factory="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.css.GMFUMLRTElementProviderFactory" + order="45"> + </factory> + </extension> </plugin> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/decorator/CapsulePartDecorator.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/decorator/CapsulePartDecorator.java index f2096e084..acaea64aa 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/decorator/CapsulePartDecorator.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/decorator/CapsulePartDecorator.java @@ -8,14 +8,13 @@ * * Contributors: * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation - * Christian W. Damus - bug 493869 + * Christian W. Damus - bugs 493869, 467545 *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.decorator; import org.eclipse.draw2d.Figure; import org.eclipse.draw2d.FlowLayout; import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; import org.eclipse.gef.EditPart; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator; @@ -50,7 +49,7 @@ public class CapsulePartDecorator extends AbstractDecorator { private static final Direction DECORATION_POSITION = Direction.NORTH_EAST; /** Offset of the decoration according to the Direction Corner */ - private static final int DECORATION_OFFSET = 3; + private static final int DECORATION_OFFSET = 5; private Image decoratorImage; @@ -104,14 +103,10 @@ public class CapsulePartDecorator extends AbstractDecorator { // Get MapMode final IMapMode mm = MapModeUtil.getMapMode(editPartFigure); // Set the size of the decorator figure - figure.setSize(mm.DPtoLP(DECORATION_SIZE_PX * figure.getChildren().size()) + 2, mm.DPtoLP(DECORATION_SIZE_PX)); + figure.setSize(mm.DPtoLP(DECORATION_SIZE_PX * figure.getChildren().size()) + DECORATION_OFFSET, mm.DPtoLP(DECORATION_SIZE_PX)); // Set the decoration with the custom locator. setDecoration(getDecoratorTarget().addShapeDecoration(figure, DECORATION_POSITION, -DECORATION_OFFSET, false)); - - - // Set the tool tip of the decoration - getDecoration().setToolTip(new Label("GMF Decorations")); } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/decorator/RedefinitionDecorator.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/decorator/RedefinitionDecorator.java new file mode 100644 index 000000000..fe689617f --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/decorator/RedefinitionDecorator.java @@ -0,0 +1,89 @@ +/***************************************************************************** + * Copyright (c) 2016, 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.decorator; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.ImageFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator; +import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget; +import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget.Direction; +import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode; +import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPortOnPartEditPart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTInheritanceKind; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.uml2.uml.Element; + +/** + * A decoration indicating that an element redefines an inherited element. + */ +public class RedefinitionDecorator extends AbstractDecorator { + + private static final ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin( + org.eclipse.papyrusrt.umlrt.tooling.ui.Activator.PLUGIN_ID, + "$nl$/icons/full/ovr16/redefinition_ovr.png"); //$NON-NLS-1$ + + private static final Direction DECORATION_POSITION = Direction.NORTH_EAST; + + private static final int DECORATION_OFFSET = 1; + + public RedefinitionDecorator(IDecoratorTarget decoratorTarget) { + super(decoratorTarget); + } + + @Override + public void activate() { + refresh(); + } + + @Override + public void refresh() { + removeDecoration(); + + EditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class); + + // Don't show the decorations on ports on parts, which are just too small + if ((editPart instanceof IGraphicalEditPart) + && !(editPart instanceof RTPortOnPartEditPart)) { + + IGraphicalEditPart graphical = (IGraphicalEditPart) editPart; + EObject semantic = graphical.resolveSemanticElement(); + + if (semantic instanceof Element) { + UMLRTInheritanceKind inheritance = UMLRTInheritanceKind.of((Element) semantic); + if (inheritance == UMLRTInheritanceKind.REDEFINED) { + // Create the icon figure + Image icon = ExtendedImageRegistry.INSTANCE.getImage(imageDescriptor); + IFigure iconFigure = new ImageFigure(icon); + Dimension iconSize = new Rectangle(icon.getBounds()).getSize(); + + // Set the size of the decorator figure + final IMapMode mm = MapModeUtil.getMapMode(graphical.getFigure()); + iconFigure.setSize(mm.DPtoLP(iconSize.width()), mm.DPtoLP(iconSize.height())); + + setDecoration(getDecoratorTarget().addShapeDecoration(iconFigure, DECORATION_POSITION, -DECORATION_OFFSET, false)); + getDecoration().setToolTip(new Label("Redefinition of an inherited element")); + } + } + } + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/IInheritableEditPart.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/IInheritableEditPart.java new file mode 100644 index 000000000..fb59e2fe3 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/IInheritableEditPart.java @@ -0,0 +1,277 @@ +/***************************************************************************** + * Copyright (c) 2016, 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts; + +import java.util.Optional; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.commands.Command; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.notation.BooleanValueStyle; +import org.eclipse.gmf.runtime.notation.NamedStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.tools.util.TypeUtils; +import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils.EditPartInheritanceUtils; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.UMLRTCapsuleStructureDiagramUtils; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.UMLRTEditPartUtils; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.uml2.uml.NamedElement; + +/** + * Protocol implemented by edit-parts that can visualize elements inherited + * from another diagram. + */ +public interface IInheritableEditPart extends IGraphicalEditPart { + default Optional<UMLRTNamedElement> getUMLRTElement() { + EObject semantic = resolveSemanticElement(); + return (semantic instanceof NamedElement) + ? Optional.ofNullable(UMLRTFactory.create((NamedElement) semantic)) + : Optional.empty(); + } + + /** + * Queries whether I track the visual state (position, routing, and more) of a + * corresponding view in the superclass diagram. + * + * @return whether I visually inherit the superclass view + */ + default boolean isInherited() { + boolean result; + + if (isDependentChild()) { + // I do not own my inheritance state + result = ((IInheritableEditPart) getParent()).isInherited(); + } else { + // First, check whether I have the style that overrides tracking the redefined view + result = StyleUtil.getInheritedStyle(getNotationView()) + .map(BooleanValueStyle::isBooleanValue) + // And if not barred by the style, can I actually inherit anything? + .orElseGet(this::canInherit); + } + + return result; + } + + /** + * Queries whether there is a view in the superclass diagram corresponding to + * me that I may track its position, routing, etc. + * + * @return whether I have a corresponding superclass view + */ + default boolean canInherit() { + boolean result; + + EditPart parent = getParent(); + IInheritableEditPart inheritableParent = TypeUtils.as(parent, IInheritableEditPart.class); + + // I can be visually inherited if either my semantic element is a redefinition + // or I am visualized on a view of a redefinition that, recursively, is inherited + if ((inheritableParent != null) && inheritableParent.isSemanticInherited()) { + // I present the inheritance of my parent because it is my parent that + // is inherited or redefined in the context of the diagram, not me + // (for example, the case of a port on a part) + result = inheritableParent.isInherited(); + } else { + // I can only be considered inherited if my element is a redefinition + result = isSemanticInherited(); + } + + return result; + } + + default boolean isSemanticInherited() { + return getUMLRTElement() + .map(UMLRTNamedElement::isInherited) + .orElse(false); + } + + /** + * In the case that I visualize an {@linkplain #isSemanticInherited() inherited element}, + * obtains the view in the diagram of the parent context that my view redefines. + * + * @return my redefined view, or {@code null} if my element is not inherited + * + * @see #isSemanticInherited() + */ + default View getRedefinedView() { + View result = null; + + if (isInherited()) { + View view = getNotationView(); + Optional<UMLRTNamedElement> redefinition; + View parentView; + + if (getParent() instanceof IInheritableEditPart) { + IInheritableEditPart part = (IInheritableEditPart) getParent(); + redefinition = part.getUMLRTElement(); + parentView = part.getRedefinedView(); + } else { + redefinition = getUMLRTElement(); + parentView = redefinition + .map(UMLRTNamedElement::getRedefinedElement) + .map(EditPartInheritanceUtils::getContextCapsule) + .map(UMLRTCapsule::toUML) + .map(UMLRTCapsuleStructureDiagramUtils::getCapsuleStructureDiagram) + .orElse(null); + } + + if (parentView != null) { + // Use the view's element directly because we always reference the + // root definition, at every level of inheritance + result = UMLRTEditPartUtils.findView(parentView, view.getType(), view.getElement()); + } + } + + return result; + } + + /** + * Queries whether I am a dependent child of an inheritable edit-part. + * Dependent children do not manage their visual inheritance on their own, but + * inherit strictly according to their parent edit-part. Floating labels + * are a good example of dependents. + * + * @return whether I am a dependent child edit-part + */ + default boolean isDependentChild() { + return this instanceof FloatingLabelEditPart; + } + + default Command getReifyViewCommand() { + return isDependentChild() + // A dependent child does not maintain its own inheritance state + ? ((IInheritableEditPart) getParent()).getReifyViewCommand() + : getUMLRTElement().map(rt -> { + // An EMFtoGMFCommandWrapper doesn't, itself, create a transaction + // so we need to put it in a transactional composite + CompositeTransactionalCommand cc = new CompositeTransactionalCommand(getEditingDomain(), "Redefine View"); + View view = getNotationView(); + + if (isInherited()) { + cc.add(EMFtoGMFCommandWrapper.wrap(StyleUtil.getCreateInheritedStyle(view))); + } + + return cc.isEmpty() ? null : new ICommandProxy(cc.reduce()); + }).orElse(null); + } + + default <T extends NamedElement> T resolveContext(Class<T> contextType) { + T result = null; + for (EditPart parent = getParent(); (result == null) && (parent != null); parent = parent.getParent()) { + EObject context = null; + + if (parent instanceof RTPropertyPartEditPart) { + context = ((RTPropertyPartEditPart) parent).getUMLRTElement() + .map(UMLRTCapsulePart.class::cast) + .map(UMLRTCapsulePart::getType) + .map(UMLRTCapsule::toUML) + .orElse(null); + } else if (parent instanceof IGraphicalEditPart) { + context = ((IGraphicalEditPart) parent).resolveSemanticElement(); + } else if (parent instanceof DiagramEditPart) { + DiagramEditPart diagram = (DiagramEditPart) parent; + context = EditPartInheritanceUtils.resolveSemanticElement(diagram.getDiagramView()); + } else if (parent instanceof DiagramRootEditPart) { + // We're looking up a connection edit part, probably + DiagramEditPart diagram = (DiagramEditPart) parent.getChildren().get(0); + context = EditPartInheritanceUtils.resolveSemanticElement(diagram.getDiagramView()); + } + + if (contextType.isInstance(context)) { + result = contextType.cast(context); + } + } + + return result; + } + + // + // Nested types + // + + class StyleUtil { + static final String INHERITED_STYLE = "papyrusrt.inherited"; //$NON-NLS-1$ + + static <T extends NamedStyle> Optional<T> getStyle(View view, String name, Class<T> type) { + return Optional.ofNullable(view.getNamedStyle(eClass(type), name)) + .map(type::cast); + } + + private static EClass eClass(Class<?> interface_) { + return (EClass) NotationPackage.eINSTANCE.getEClassifier(interface_.getSimpleName()); + } + + static <T extends NamedStyle> T demandStyle(View view, String name, Class<T> type) { + return getStyle(view, name, type).orElseGet(() -> createStyle(view, name, type)); + } + + private static <T extends NamedStyle> T createStyle(View view, String name, Class<T> type) { + T result = type.cast(view.createStyle(eClass(type))); + result.setName(name); + return result; + } + + private static <T extends NamedStyle> org.eclipse.emf.common.command.Command getCreateStyle(View view, String name, Class<T> type) { + T style = type.cast(EcoreUtil.create(eClass(type))); + style.setName(name); + + return AddCommand.create(EMFHelper.resolveEditingDomain(view), + view, NotationPackage.Literals.VIEW__STYLES, style); + } + + public static Optional<BooleanValueStyle> getInheritedStyle(View view) { + return Optional.ofNullable((BooleanValueStyle) view.getNamedStyle( + NotationPackage.Literals.BOOLEAN_VALUE_STYLE, + INHERITED_STYLE)); + } + + public static BooleanValueStyle demandInheritedStyle(View view) { + return getInheritedStyle(view).orElseGet(() -> { + BooleanValueStyle result = (BooleanValueStyle) view.createStyle(NotationPackage.Literals.BOOLEAN_VALUE_STYLE); + result.setName(INHERITED_STYLE); + return result; + }); + } + + public static org.eclipse.emf.common.command.Command getCreateInheritedStyle(View view) { + return getCreateStyle(view, INHERITED_STYLE, BooleanValueStyle.class); + } + + public static org.eclipse.emf.common.command.Command getDeleteStyle(View view, String name, Class<? extends NamedStyle> type) { + return getStyle(view, name, type) + .map(s -> RemoveCommand.create(EMFHelper.resolveEditingDomain(s), s)) + .orElse(null); + } + + public static org.eclipse.emf.common.command.Command getDeleteInheritedStyle(View view) { + return getDeleteStyle(view, INHERITED_STYLE, BooleanValueStyle.class); + } + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTClassCompositeEditPart.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTClassCompositeEditPart.java index 82dcff7f7..c73acaca8 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTClassCompositeEditPart.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTClassCompositeEditPart.java @@ -8,28 +8,37 @@ * * Contributors: * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation - * Christian W. Damus - bugs 472885, 496304, 500743 + * Christian W. Damus - bugs 472885, 496304, 500743, 467545 *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts; +import static org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.AbstractInheritanceEditPolicy.INHERITANCE_ROLE; + +import java.util.Optional; + import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.PositionConstants; import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPolicy; import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.tools.util.TypeUtils; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeNameEditPart; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.InheritanceEditPolicy; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.PortContainerEditPolicy; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.locator.RTPortPositionLocator; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.UMLRTCapsuleStructureDiagramUtils; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.UMLRTEditPartUtils; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; /** * The Class RTClassCompositeEditPart defines how an affixed Child node can be added in the Real Time Context. * A port can be added inside the Bounds instead of exclusively on the boundaries; */ -public class RTClassCompositeEditPart extends ClassCompositeEditPart { +public class RTClassCompositeEditPart extends ClassCompositeEditPart implements IInheritableEditPart { /** * Instantiates a new RT class composite edit part. @@ -44,6 +53,9 @@ public class RTClassCompositeEditPart extends ClassCompositeEditPart { @Override protected void createDefaultEditPolicies() { + // This needs to be ahead of the edit-policies that process user edit gestures + installEditPolicy(INHERITANCE_ROLE, new InheritanceEditPolicy()); + super.createDefaultEditPolicies(); // Custom arrange behaviour @@ -86,4 +98,36 @@ public class RTClassCompositeEditPart extends ClassCompositeEditPart { return false; } + /** + * I can inherit if I have a superclass. + */ + @Override + public boolean canInherit() { + org.eclipse.uml2.uml.Class class_ = TypeUtils.as(resolveSemanticElement(), org.eclipse.uml2.uml.Class.class); + return Optional.ofNullable(class_) + .map(UMLRTCapsule::getInstance) + .map(UMLRTCapsule::getSuperclass) + .isPresent(); + } + + /** + * My "redefined view" is actually a redefinition, but my superclass. + */ + @Override + public View getRedefinedView() { + View result = null; + + if (isInherited()) { + org.eclipse.uml2.uml.Class class_ = TypeUtils.as(resolveSemanticElement(), org.eclipse.uml2.uml.Class.class); + result = Optional.ofNullable(class_) + .map(UMLRTCapsule::getInstance) + .map(UMLRTCapsule::getSuperclass) + .map(UMLRTCapsule::toUML) + .map(UMLRTCapsuleStructureDiagramUtils::getCapsuleStructureDiagram) + .map(d -> UMLRTEditPartUtils.findView(d, VISUAL_ID, d.getElement())) + .orElse(null); + } + + return result; + } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTConnectorEditPart.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTConnectorEditPart.java new file mode 100644 index 000000000..4caaa3faa --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTConnectorEditPart.java @@ -0,0 +1,70 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts; + +import static org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.AbstractInheritanceEditPolicy.INHERITANCE_ROLE; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorEditPart; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.EdgeInheritanceEditPolicy; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.RTSemanticEditPolicy; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils.EditPartInheritanceUtils; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.UMLRTEditPartUtils; +import org.eclipse.uml2.uml.Connector; + +/** + * Controller for {@link Connector} views in UML-RT Capsule Structure Diagrams. + */ +public class RTConnectorEditPart extends ConnectorEditPart implements IInheritableEditPart { + + /** + * Initializes me with my connection view. + * + * @param view + * my connection view + */ + public RTConnectorEditPart(View view) { + super(view); + } + + @Override + protected void refreshForegroundColor() { + super.refreshForegroundColor(); + + // We present inherited connectors in a lighter colour + UMLRTEditPartUtils.updateForegroundColor(this, getPrimaryShape()); + } + + @Override + public EObject resolveSemanticElement() { + return EditPartInheritanceUtils.resolveSemanticElement(this, super.resolveSemanticElement()); + } + + @Override + public Object getAdapter(@SuppressWarnings("rawtypes") java.lang.Class key) { + return EditPartInheritanceUtils.getAdapter(this, key, super.getAdapter(key)); + } + + @Override + protected void createDefaultEditPolicies() { + // This needs to be ahead of the edit-policies that process user edit gestures + installEditPolicy(INHERITANCE_ROLE, new EdgeInheritanceEditPolicy()); + + super.createDefaultEditPolicies(); + + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RTSemanticEditPolicy()); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPortEditPart.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPortEditPart.java index 226d243ae..a5d2ec7d3 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPortEditPart.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPortEditPart.java @@ -9,24 +9,39 @@ * Contributors: * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 482694 : add listener on Multiplicity Bounds - * Christian W. Damus - bugs 489380, 483637, 496304, 495149 + * Christian W. Damus - bugs 489380, 483637, 496304, 495149, 467545 * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts; +import static org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.AbstractInheritanceEditPolicy.INHERITANCE_ROLE; + +import java.util.Objects; + import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.ecore.EObject; import org.eclipse.gef.EditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; import org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts.ResizablePortEditPart; +import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.BehaviorPortEditPolicy; +import org.eclipse.papyrusrt.umlrt.core.utils.UMLRTCommandUtils; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.figures.RTPortFigure; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.InheritanceEditPolicy; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.RTBehaviorPortEditPolicy; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.RTPortResizableEditPolicy; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.RTSemanticEditPolicy; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils.EditPartInheritanceUtils; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.UMLRTEditPartUtils; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.util.ReificationListener; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.MultiplicityElement; import org.eclipse.uml2.uml.Port; @@ -39,7 +54,7 @@ import org.eclipse.uml2.uml.ValueSpecification; * @author Céline JANSSENS * */ -public class RTPortEditPart extends ResizablePortEditPart implements IRTPortEditPart { +public class RTPortEditPart extends ResizablePortEditPart implements IRTPortEditPart, IInheritableEditPart { /** * @@ -63,6 +78,8 @@ public class RTPortEditPart extends ResizablePortEditPart implements IRTPortEdit Adapter multiplicityValueListener; + private ReificationListener reificationListener = this::reificationStateChanged; + /** * * Constructor. @@ -72,18 +89,35 @@ public class RTPortEditPart extends ResizablePortEditPart implements IRTPortEdit */ public RTPortEditPart(View view) { super(view); + } + @Override + public EObject resolveSemanticElement() { + return EditPartInheritanceUtils.resolveSemanticElement(this, super.resolveSemanticElement()); + } + @Override + public Object getAdapter(@SuppressWarnings("rawtypes") java.lang.Class key) { + return EditPartInheritanceUtils.getAdapter(this, key, super.getAdapter(key)); } - /** - * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#addSemanticListeners() - * - */ @Override - protected void addSemanticListeners() { + protected void createDefaultEditPolicies() { + // This needs to be ahead of the edit-policies that process user edit gestures + installEditPolicy(INHERITANCE_ROLE, new InheritanceEditPolicy()); + + super.createDefaultEditPolicies(); + + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RTSemanticEditPolicy()); + // Install a behavior-port edit policy that understands inheritance + installEditPolicy(BehaviorPortEditPolicy.BEHAVIOR_PORT, new RTBehaviorPortEditPolicy()); + } + + @Override + protected void addSemanticListeners() { super.addSemanticListeners(); + multiplicityValueListener = getMultiplicityListener(); getUMLElement().eAdapters().add(multiplicityValueListener); @@ -95,15 +129,13 @@ public class RTPortEditPart extends ResizablePortEditPart implements IRTPortEdit ((MultiplicityElement) getUMLElement()).getUpperValue().eAdapters().add(multiplicityValueListener); } - + getUMLRTElement().ifPresent(rt -> rt.addReificationListener(reificationListener)); } - /** - * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#removeSemanticListeners() - * - */ @Override protected void removeSemanticListeners() { + getUMLRTElement().ifPresent(rt -> rt.removeReificationListener(reificationListener)); + super.removeSemanticListeners(); Element element = getUMLElement(); @@ -152,7 +184,7 @@ public class RTPortEditPart extends ResizablePortEditPart implements IRTPortEdit } } - if (notifier instanceof ValueSpecification && ((ValueSpecification) notifier).eContainer().equals(getUMLElement())) { + if ((notifier instanceof ValueSpecification) && Objects.equals(((ValueSpecification) notifier).eContainer(), getUMLElement())) { refreshVisuals(); } @@ -230,6 +262,22 @@ public class RTPortEditPart extends ResizablePortEditPart implements IRTPortEdit } @Override + protected void refreshBackgroundColor() { + super.refreshBackgroundColor(); + + // We present inherited ports in a lighter colour + UMLRTEditPartUtils.updateBackgroundColor(this, getPrimaryShape()); + } + + @Override + protected void refreshForegroundColor() { + super.refreshForegroundColor(); + + // We present inherited ports in a lighter colour + UMLRTEditPartUtils.updateForegroundColor(this, getPrimaryShape()); + } + + @Override public boolean isPortOnPart() { return false; } @@ -238,4 +286,10 @@ public class RTPortEditPart extends ResizablePortEditPart implements IRTPortEdit public EditPolicy getPrimaryDragEditPolicy() { return new RTPortResizableEditPolicy(); } + + private void reificationStateChanged(UMLRTNamedElement element, boolean reified) { + if (reified && !UMLRTCommandUtils.isUndoRedoInProgress(element.toUML())) { + // TODO: Anything? + } + } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPortNameEditPart.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPortNameEditPart.java index 912397a9f..e9cc13bea 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPortNameEditPart.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPortNameEditPart.java @@ -13,16 +13,21 @@ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts; +import static org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.AbstractInheritanceEditPolicy.INHERITANCE_ROLE; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts.CustomPortNameEditPart; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.InheritanceEditPolicy; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.RTMaskLabelEditPolicy; /** * Custom name label edit part for ports to exclude certain multiplicity * values from display. */ -public class RTPortNameEditPart extends CustomPortNameEditPart { +public class RTPortNameEditPart extends CustomPortNameEditPart implements IInheritableEditPart { /** * Initializes me with my notation view. @@ -36,6 +41,9 @@ public class RTPortNameEditPart extends CustomPortNameEditPart { @Override protected void createDefaultEditPolicies() { + // This needs to be ahead of the edit-policies that process user edit gestures + installEditPolicy(INHERITANCE_ROLE, new InheritanceEditPolicy()); + super.createDefaultEditPolicies(); // Override the label presentation @@ -43,4 +51,32 @@ public class RTPortNameEditPart extends CustomPortNameEditPart { new RTMaskLabelEditPolicy()); } + @Override + public EObject resolveSemanticElement() { + EObject result; + + View view = getNotationView(); + if ((view == null) || !view.isSetElement()) { + result = ((IGraphicalEditPart) getParent()).resolveSemanticElement(); + } else { + result = super.resolveSemanticElement(); + } + + return result; + } + + @Override + public Object getAdapter(@SuppressWarnings("rawtypes") java.lang.Class key) { + Object result = super.getAdapter(key); + + if (result instanceof EObject) { + View view = getNotationView(); + if (result == view.getElement()) { + result = resolveSemanticElement(); + } + } + + return result; + } + } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPropertyPartEditPart.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPropertyPartEditPart.java index f53016867..7ec6e3a47 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPropertyPartEditPart.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPropertyPartEditPart.java @@ -8,27 +8,40 @@ * * Contributors: * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation - * Christian W. Damus - bugs 477819, 482599, 472885, 489939, 496304, 500743 + * Christian W. Damus - bugs 477819, 482599, 472885, 489939, 496304, 500743, 467545 * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts; +import static org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.AbstractInheritanceEditPolicy.INHERITANCE_ROLE; +import static org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.DrawFigureUtils.getLighterAlpha; + import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.PositionConstants; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.ecore.EObject; import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartEditPartCN; import org.eclipse.papyrusrt.umlrt.core.types.advice.CapsulePartEditHelperAdvice; +import org.eclipse.papyrusrt.umlrt.core.utils.UMLRTCommandUtils; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.providers.RTEditPartProvider; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.figures.RTPropertyPartFigure; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.InheritanceEditPolicy; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.PortContainerEditPolicy; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.RTSemanticEditPolicy; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils.EditPartInheritanceUtils; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.locator.RTPortPositionLocator; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.UMLRTEditPartUtils; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.util.ReificationListener; import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.LiteralUnlimitedNatural; import org.eclipse.uml2.uml.MultiplicityElement; import org.eclipse.uml2.uml.UMLPackage; import org.eclipse.uml2.uml.ValueSpecification; @@ -42,12 +55,12 @@ import org.eclipse.uml2.uml.ValueSpecification; * @author Céline JANSSENS * */ -public class RTPropertyPartEditPart extends PropertyPartEditPartCN { +public class RTPropertyPartEditPart extends PropertyPartEditPartCN implements IInheritableEditPart { /** * */ - private static final int LAYER_OPACITY = 0; + private static final int LAYER_OPACITY = 255; /** * Horizontal Offset @@ -74,6 +87,8 @@ public class RTPropertyPartEditPart extends PropertyPartEditPartCN { */ Adapter multiplicityValueListener; + private ReificationListener reificationListener = this::reificationStateChanged; + /** * Constructor. @@ -85,17 +100,32 @@ public class RTPropertyPartEditPart extends PropertyPartEditPartCN { } @Override + public EObject resolveSemanticElement() { + return EditPartInheritanceUtils.resolveSemanticElement(this, super.resolveSemanticElement()); + } + + @Override + public Object getAdapter(@SuppressWarnings("rawtypes") java.lang.Class key) { + return EditPartInheritanceUtils.getAdapter(this, key, super.getAdapter(key)); + } + + @Override protected void createDefaultEditPolicies() { + // This needs to be ahead of the edit-policies that process user edit gestures + installEditPolicy(INHERITANCE_ROLE, new InheritanceEditPolicy()); + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RTSemanticEditPolicy()); + // Custom arrange behaviour installEditPolicy(EditPolicy.CONTAINER_ROLE, new PortContainerEditPolicy()); } @Override protected void addSemanticListeners() { - super.addSemanticListeners(); + multiplicityValueListener = getMultiplicityListener(); if (hasNotationView() && getNotationView().isSetElement()) { @@ -112,11 +142,14 @@ public class RTPropertyPartEditPart extends PropertyPartEditPartCN { } } + getUMLRTElement().ifPresent(rt -> rt.addReificationListener(reificationListener)); } @Override protected void removeSemanticListeners() { + getUMLRTElement().ifPresent(rt -> rt.removeReificationListener(reificationListener)); + super.removeSemanticListeners(); // Only do this if we have a notation view that references an @@ -201,12 +234,14 @@ public class RTPropertyPartEditPart extends PropertyPartEditPartCN { @Override protected void refreshVisuals() { - if (hasNotationView() && getNotationView().isSetElement()) { - boolean isHash = 0 == ((MultiplicityElement) getUMLElement()).getLower(); + if (hasNotationView() && (getUMLElement() != null)) { + MultiplicityElement mult = (MultiplicityElement) getUMLElement(); + boolean isHash = 0 == mult.getLower(); getPrimaryShape().setHashed(isHash); // The edit part is displayed as a stack only if there can be more than one Capsule Part - boolean stack = 1 < ((MultiplicityElement) getUMLElement()).getUpper(); + int upper = mult.getUpper(); + boolean stack = (upper > 1) || (upper == LiteralUnlimitedNatural.UNLIMITED); getPrimaryShape().setStack(stack); } @@ -214,12 +249,30 @@ public class RTPropertyPartEditPart extends PropertyPartEditPartCN { getPrimaryShape().setXOffSet(X_OFFSET); getPrimaryShape().setYOffSet(Y_OFFSET); getPrimaryShape().setPathPattern(PATTERN_PATH); - getPrimaryShape().setLayerOpacity(LAYER_OPACITY); + getPrimaryShape().setLayerOpacity(isSemanticInherited() + ? getLighterAlpha(LAYER_OPACITY) + : LAYER_OPACITY); super.refreshVisuals(); } + @Override + protected void refreshBackgroundColor() { + super.refreshBackgroundColor(); + + // We present inherited parts in a lighter colour + UMLRTEditPartUtils.updateBackgroundColor(this, getPrimaryShape()); + } + + @Override + protected void refreshForegroundColor() { + super.refreshForegroundColor(); + + // We present inherited parts in a lighter colour + UMLRTEditPartUtils.updateForegroundColor(this, getPrimaryShape()); + } + /** * Overridden to install the {@link RTPortPositionLocator} as the constraint for port figures. */ @@ -244,4 +297,10 @@ public class RTPropertyPartEditPart extends PropertyPartEditPartCN { return result; } + + private void reificationStateChanged(UMLRTNamedElement element, boolean reified) { + if (reified && !UMLRTCommandUtils.isUndoRedoInProgress(element.toUML())) { + // TODO: Anything? + } + } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPropertyPartNameEditPartCN.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPropertyPartNameEditPartCN.java index 87b4f8ed6..6a2704912 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPropertyPartNameEditPartCN.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/RTPropertyPartNameEditPartCN.java @@ -13,6 +13,8 @@ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartNameEditPartCN; @@ -43,4 +45,32 @@ public class RTPropertyPartNameEditPartCN extends PropertyPartNameEditPartCN { new RTMaskLabelEditPolicy()); } + @Override + public EObject resolveSemanticElement() { + EObject result; + + View view = getNotationView(); + if ((view == null) || !view.isSetElement()) { + result = ((IGraphicalEditPart) getParent()).resolveSemanticElement(); + } else { + result = super.resolveSemanticElement(); + } + + return result; + } + + @Override + public Object getAdapter(@SuppressWarnings("rawtypes") java.lang.Class key) { + Object result = super.getAdapter(key); + + if (result instanceof EObject) { + View view = getNotationView(); + if (result == view.getElement()) { + result = resolveSemanticElement(); + } + } + + return result; + } + } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/providers/RTEditPartProvider.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/providers/RTEditPartProvider.java index e43f26999..1354603de 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/providers/RTEditPartProvider.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editparts/providers/RTEditPartProvider.java @@ -8,7 +8,7 @@ * * Contributors: * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation - * Christian W. Damus - bugs 490859, 489939, 496304, 475905, 501081 + * Christian W. Damus - bugs 490859, 489939, 496304, 475905, 501081, 467545 *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.providers; @@ -17,23 +17,22 @@ import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeCompar import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeNameEditPart; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorEditPart; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortNameEditPart; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartEditPartCN; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartNameEditPartCN; -import org.eclipse.papyrusrt.umlrt.core.utils.CapsulePartUtils; -import org.eclipse.papyrusrt.umlrt.core.utils.CapsuleUtils; -import org.eclipse.papyrusrt.umlrt.core.utils.RTPortUtils; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTClassCompositeCompartmentEditPart; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTClassCompositeEditPart; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTClassCompositeNameEditPart; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTConnectorEditPart; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPortEditPart; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPortNameEditPart; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPortOnPartEditPart; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPropertyPartEditPart; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPropertyPartNameEditPartCN; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Property; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.uml2.uml.NamedElement; /** @@ -58,6 +57,9 @@ public class RTEditPartProvider extends AbstractRTEditPartProvider { ifContainerView(PropertyPartEditPartCN.VISUAL_ID, RTPortOnPartEditPart.class), ifContainerView(ClassCompositeEditPart.VISUAL_ID, RTPortEditPart.class))); nodeMap.put(PortNameEditPart.VISUAL_ID, always(RTPortNameEditPart.class)); + + // Edges + edgeMap.put(ConnectorEditPart.VISUAL_ID, always(RTConnectorEditPart.class)); } /** @@ -65,9 +67,8 @@ public class RTEditPartProvider extends AbstractRTEditPartProvider { */ @Override protected boolean accept(EObject element) { - return ((element instanceof Classifier) && CapsuleUtils.isCapsule((Classifier) element)) - || ((element instanceof Property) && CapsulePartUtils.isCapsulePart((Property) element)) - || RTPortUtils.isRTPort(element); + return (element instanceof NamedElement) + && (UMLRTFactory.CapsuleFactory.create((NamedElement) element) != null); } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/figures/RTPropertyPartFigure.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/figures/RTPropertyPartFigure.java index 395d06359..cada9b8f7 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/figures/RTPropertyPartFigure.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/figures/RTPropertyPartFigure.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST. + * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation + * Christian W. Damus - bug 467545 *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.figures; @@ -122,7 +123,7 @@ public class RTPropertyPartFigure extends PropertyPartFigure implements IStacked public void paintHashPattern(final Graphics graphics) { if (hashed) { - DrawFigureUtils.paintPattern(this, graphics, getPathPattern()); + DrawFigureUtils.paintPattern(this, graphics, getLayerOpacity(), getPathPattern()); } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTClassSemanticChildrenStrategy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTClassSemanticChildrenStrategy.java index 986e24f7d..556ac74ef 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTClassSemanticChildrenStrategy.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTClassSemanticChildrenStrategy.java @@ -12,20 +12,26 @@ *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.canonical; -import java.util.Iterator; import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.composite.custom.canonical.StructuredClassifierSemanticChildrenStrategy; -import org.eclipse.papyrusrt.umlrt.core.utils.CapsulePartUtils; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart; import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.CapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.Property; /** * Semantic children strategy for parts in an RT composite, defining specific - * restrictions on the inclusion of parts. + * restrictions on the inclusion of parts and accounting for capsule structure + * inheritance. */ public class RTClassSemanticChildrenStrategy extends StructuredClassifierSemanticChildrenStrategy { @@ -39,19 +45,40 @@ public class RTClassSemanticChildrenStrategy extends StructuredClassifierSemanti */ @Override public List<? extends EObject> getCanonicalSemanticChildren(EObject semanticFromEditPart, View viewFromEditPart) { - List<? extends EObject> result = super.getCanonicalSemanticChildren(semanticFromEditPart, viewFromEditPart); - - if (result != null) { - // Remove plain attributes - for (Iterator<? extends EObject> iter = result.iterator(); iter.hasNext();) { - EObject next = iter.next(); - if ((next instanceof Property) && !(next instanceof Port)) { - Property part = (Property) next; - if (!CapsulePartUtils.isCapsulePart(part)) { - // Don't present it in the diagram - iter.remove(); - } - } + List<EObject> result = null; + + UMLRTCapsule capsule = UMLRTCapsule.getInstance((org.eclipse.uml2.uml.Class) semanticFromEditPart); + if (capsule != null) { + Stream<? extends UMLRTNamedElement> children; + + if (ClassCompositeEditPart.VISUAL_ID.equals(viewFromEditPart.getType())) { + // Yes, the CanonicalEditPolicy expects to get capsule-parts also + // for children of the capsule frame, even though they are created + // eventually as children of its structure compartment + children = Stream.concat( + capsule.getPorts().stream(), + capsule.getCapsuleParts().stream()); + } else if (ClassCompositeCompartmentEditPart.VISUAL_ID.equals(viewFromEditPart.getType())) { + children = capsule.getCapsuleParts().stream(); + } else { + children = Stream.empty(); + } + + result = children.map(UMLRTNamedElement::toUML) + .map(this::getRootDefinition) + .collect(Collectors.toList()); + } + + return result; + } + + protected EObject getRootDefinition(EObject element) { + EObject result = element; + + if (element instanceof NamedElement) { + UMLRTNamedElement rt = UMLRTFactory.create((NamedElement) element); + if (rt != null) { + result = rt.getRootDefinition().toUML(); } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTInheritableVisualChildrenStrategy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTInheritableVisualChildrenStrategy.java new file mode 100644 index 000000000..10bf17de8 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTInheritableVisualChildrenStrategy.java @@ -0,0 +1,42 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.canonical; + +import java.util.List; + +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.common.canonical.DefaultUMLVisualChildrenStrategy; + +/** + * Specialization of the default visual children strategy that accounts for the difference + * between the resolved semantic element and the referenced inherited semantic element. + */ +public class RTInheritableVisualChildrenStrategy extends DefaultUMLVisualChildrenStrategy { + + public RTInheritableVisualChildrenStrategy() { + super(); + } + + @Override + public List<? extends View> getCanonicalChildren(EditPart editPart, View view) { + List<? extends View> result = super.getCanonicalChildren(editPart, view); + + // Just filter out all children that inherit the semantic element + result.removeIf(v -> !v.isSetElement()); + + return result; + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTPartSemanticChildrenStrategy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTPartSemanticChildrenStrategy.java index fa4920e57..876429d04 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTPartSemanticChildrenStrategy.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTPartSemanticChildrenStrategy.java @@ -12,16 +12,22 @@ *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.canonical; -import java.util.Iterator; import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.util.TransactionUtil; import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.composite.custom.canonical.PropertyPartCompartmentSemanticChildrenStrategy; -import org.eclipse.papyrusrt.umlrt.core.utils.RTPortUtils; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.Port; +import org.eclipse.uml2.uml.Property; import org.eclipse.uml2.uml.UMLPackage; /** @@ -41,29 +47,40 @@ public class RTPartSemanticChildrenStrategy extends PropertyPartCompartmentSeman */ @Override public List<? extends EObject> getCanonicalSemanticChildren(EObject semanticFromEditPart, View viewFromEditPart) { - List<? extends EObject> result = super.getCanonicalSemanticChildren(semanticFromEditPart, viewFromEditPart); + List<EObject> result = null; - if (result != null) { - // Remove non-service ports - for (Iterator<? extends EObject> iter = result.iterator(); iter.hasNext();) { - EObject next = iter.next(); - if (next instanceof Port) { - Port port = (Port) next; + UMLRTCapsulePart capsulePart = UMLRTCapsulePart.getInstance((Property) semanticFromEditPart); + if ((capsulePart != null) && (capsulePart.getType() != null)) { + Stream<Port> ports = capsulePart.getType().getPorts().stream() + .peek(p -> watch(p, viewFromEditPart)) + .filter(p -> p.getKind().isExternal()) + .map(UMLRTPort::toUML); - if (!RTPortUtils.isService(port)) { - // Don't present it in the diagram - iter.remove(); - } + result = ports.map(this::getRootDefinition) + .collect(Collectors.toList()); + } + + return result; + } - // But, in any case, listen for changes of service-ness - DiagramEventBroker.getInstance(TransactionUtil.getEditingDomain(viewFromEditPart)) - .addNotificationListener(port, UMLPackage.Literals.PORT__IS_SERVICE, - new CanonicalRefreshListener<>(viewFromEditPart, port)); - } + protected EObject getRootDefinition(EObject element) { + EObject result = element; + + if (element instanceof NamedElement) { + UMLRTNamedElement rt = UMLRTFactory.create((NamedElement) element); + if (rt != null) { + result = rt.getRootDefinition().toUML(); } } return result; } + protected void watch(UMLRTPort port, View capsulePartView) { + Port uml = port.toUML(); + DiagramEventBroker.getInstance(TransactionUtil.getEditingDomain(capsulePartView)) + .addNotificationListener(uml, UMLPackage.Literals.PORT__IS_SERVICE, + new CanonicalRefreshListener<>(capsulePartView, uml)); + } + } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTPortSemanticChildrenStrategy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTPortSemanticChildrenStrategy.java new file mode 100644 index 000000000..299d62a7d --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/canonical/RTPortSemanticChildrenStrategy.java @@ -0,0 +1,243 @@ +/***************************************************************************** + * Copyright (c) 2016, 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.canonical; + +import static org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils.EditPartInheritanceUtils.getContextCapsule; +import static org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils.EditPartInheritanceUtils.resolvePort; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.canonical.strategy.ISemanticChildrenStrategy; +import org.eclipse.papyrus.infra.tools.util.TypeUtils; +import org.eclipse.papyrus.uml.diagram.composite.custom.canonical.StructuredClassifierSemanticChildrenStrategy; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTConnector; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.uml2.uml.Connector; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Port; +import org.eclipse.uml2.uml.Property; + +/** + * Semantic children strategy for parts in an RT composite, defining specific + * restrictions on the inclusion of parts and accounting for capsule structure + * inheritance. + */ +public class RTPortSemanticChildrenStrategy extends StructuredClassifierSemanticChildrenStrategy { + + public RTPortSemanticChildrenStrategy() { + super(); + } + + @Override + public Collection<? extends EObject> getCanonicalDependents(EObject semanticFromEditPart, View viewFromEditPart) { + Collection<? extends EObject> result = super.getCanonicalDependents(semanticFromEditPart, viewFromEditPart); + + UMLRTCapsule capsule = getContextCapsule(viewFromEditPart); + if (capsule != null) { + // Any change in the capsule could add/remove connectors, so we need to be + // prepared to refresh the port + if (result == null) { + result = Collections.singletonList(capsule.toUML()); + } else { + List<EObject> newResult = new ArrayList<>(result.size() + 1); + newResult.add(capsule.toUML()); + newResult.addAll(result); + result = newResult; + } + } + + return result; + } + + @Override + public List<? extends EObject> getCanonicalSemanticConnections(EObject semanticFromEditPart, View viewFromEditPart) { + List<EObject> result = null; + + UMLRTCapsule capsule = getContextCapsule(viewFromEditPart); + if (capsule != null) { + UMLRTPort port = resolvePort((Port) semanticFromEditPart, capsule, viewFromEditPart); + if (port != null) { + // Look for connectors that are not excluded, then + // get the root definitions back because those are what the + // inherited views actually reference + + List<UMLRTConnector> connectors; + Predicate<UMLRTConnector> partWithPortFilter = __ -> true; + Property partWithPort = TypeUtils.as(ViewUtil.getViewContainer(viewFromEditPart).getElement(), Property.class); + if (partWithPort != null) { + // Port on part + connectors = port.getOutsideConnectors(); + // But only on this part + UMLRTCapsulePart part = UMLRTCapsulePart.getInstance(partWithPort); + if (part != null) { + // The local definition, of course + UMLRTCapsulePart localPart = capsule.getRedefinitionOf(part); + partWithPortFilter = connector -> (connector.getSourcePartWithPort() == localPart) + || (connector.getTargetPartWithPort() == localPart); + } + } else { + // Port on capsule + connectors = port.getInsideConnectors(); + } + + result = connectors.stream() + .filter(partWithPortFilter) + .map(conn -> resolveConnector(conn, capsule)) + .filter(Objects::nonNull) + .map(this::getRootDefinition) + .distinct() + .collect(Collectors.toList()); + } + } + + return result; + } + + EObject resolveConnector(UMLRTConnector connector, UMLRTCapsule capsule) { + EObject result = connector.toUML(); + + if (connector.getCapsule() != capsule) { + // It's inherited? If it's excluded, then we want a null result + result = Optional.ofNullable(capsule.getRedefinitionOf(connector)) + .map(UMLRTConnector::toUML) + .orElse(null); + } else if (connector.isExcluded()) { + // If it is locally redefined but that is an exclusion, then + // we don't want it + result = null; + } + + return result; + } + + protected EObject getRootDefinition(EObject element) { + EObject result = element; + + if (element instanceof NamedElement) { + UMLRTNamedElement rt = UMLRTFactory.create((NamedElement) element); + if (rt != null) { + result = rt.getRootDefinition().toUML(); + } + } + + return result; + } + + @Override + public IGraphicalEditPart resolveSourceEditPart(EObject connectionElement, IGraphicalEditPart context) { + if (connectionElement instanceof Connector) { + // Resolve it in our inheriting Capsule context + connectionElement = resolveConnector((Connector) connectionElement, context); + } + + return super.resolveSourceEditPart(connectionElement, context); + } + + @Override + public IGraphicalEditPart resolveTargetEditPart(EObject connectionElement, IGraphicalEditPart context) { + if (connectionElement instanceof Connector) { + // Resolve it in our inheriting Capsule context + connectionElement = resolveConnector((Connector) connectionElement, context); + } + + return super.resolveTargetEditPart(connectionElement, context); + } + + private Connector resolveConnector(Connector umlConnector, IGraphicalEditPart context) { + Connector result = umlConnector; + + UMLRTConnector connector = UMLRTConnector.getInstance(umlConnector); + UMLRTCapsule capsule = getContextCapsule(context.getNotationView()); + if ((connector != null) && (capsule != null)) { + result = capsule.getRedefinitionOf(connector).toUML(); + } + + return result; + } + + + @Override + public Object getSource(EObject connectionElement) { + Object result = super.getSource(connectionElement); + + if (connectionElement instanceof Connector) { + Connector connector = (Connector) connectionElement; + + Object source = getPort(connector, + UMLRTConnector::getSource, UMLRTConnector::getSourcePartWithPort); + if (source != null) { + result = source; + } + } + + return result; + } + + private Object getPort(Connector uml, Function<UMLRTConnector, UMLRTPort> roleFunction, Function<UMLRTConnector, UMLRTCapsulePart> partWithPortFunction) { + Object result = null; + + UMLRTConnector connector = UMLRTConnector.getInstance(uml); + if (connector != null) { + UMLRTCapsule capsule = connector.getCapsule(); + if (capsule != null) { + UMLRTPort port = roleFunction.apply(connector); + if (port != null) { + UMLRTCapsulePart part = partWithPortFunction.apply(connector); + if (part == null) { + // It's just a port on the border of the capsule + result = capsule.getRedefinitionOf(port).toUML(); + } else { + // It's a port on a part + part = capsule.getRedefinitionOf(part); + port = part.getType().getRedefinitionOf(port); + result = ISemanticChildrenStrategy.createVisualStack(part.toUML(), port.toUML()); + } + } + } + } + + return result; + } + + @Override + public Object getTarget(EObject connectionElement) { + Object result = super.getTarget(connectionElement); + + if (connectionElement instanceof Connector) { + Object target = getPort((Connector) connectionElement, + UMLRTConnector::getTarget, UMLRTConnector::getTargetPartWithPort); + if (target != null) { + result = target; + } + } + + return result; + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/commands/ReifyInheritedElementCommand.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/commands/ReifyInheritedElementCommand.java new file mode 100644 index 000000000..67efcebbc --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/commands/ReifyInheritedElementCommand.java @@ -0,0 +1,57 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; + +/** + * A command that reifies a virtual inherited model element. + */ +public class ReifyInheritedElementCommand extends AbstractTransactionalCommand { + + private UMLRTNamedElement element; + + /** + * Initializes me with the UML-RT façade element to be reified. + * + * @param element + * the UML-RT façade element + */ + public ReifyInheritedElementCommand(UMLRTNamedElement element) { + super(TransactionUtil.getEditingDomain(element.toUML()), "Redefine Element", getWorkspaceFiles(element.toUML())); + + this.element = element; + } + + @Override + public void dispose() { + element = null; + super.dispose(); + } + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + if (element.isVirtualRedefinition()) { + element.reify(); + } + + return CommandResult.newOKCommandResult(); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/CSSDOMUMLRTSemanticElementHelper.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/CSSDOMUMLRTSemanticElementHelper.java new file mode 100644 index 000000000..3c894a065 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/CSSDOMUMLRTSemanticElementHelper.java @@ -0,0 +1,53 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.css; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.css.helper.CSSDOMUMLSemanticElementHelper; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils.EditPartInheritanceUtils; +import org.eclipse.papyrusrt.umlrt.uml.util.UMLRTExtensionUtil; +import org.eclipse.uml2.uml.Element; + +/** + * A specialized semantic-element helper that knows how to resolve view references to + * inherited semantic elements in the context of the subclass capsule. + */ +public class CSSDOMUMLRTSemanticElementHelper extends CSSDOMUMLSemanticElementHelper { + + private static final CSSDOMUMLRTSemanticElementHelper INSTANCE = new CSSDOMUMLRTSemanticElementHelper(); + + protected CSSDOMUMLRTSemanticElementHelper() { + super(); + } + + public static CSSDOMUMLRTSemanticElementHelper getInstance() { + return INSTANCE; + } + + @Override + public EObject findSemanticElement(EObject notationElement) { + EObject result = super.findSemanticElement(notationElement); + + if ((result instanceof Element) + && UMLRTExtensionUtil.hasUMLRTExtension((Element) result) + && (notationElement instanceof View)) { + + // Resolve the inherited/redefined element + result = EditPartInheritanceUtils.resolveSemanticElement((View) notationElement); + } + + return result; + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/GMFUMLRTElementAdapter.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/GMFUMLRTElementAdapter.java new file mode 100644 index 000000000..9564eeea1 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/GMFUMLRTElementAdapter.java @@ -0,0 +1,89 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.css; + +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; +import org.eclipse.papyrus.uml.diagram.css.dom.GMFUMLElementAdapter; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.uml2.uml.NamedElement; + +/** + * UML-RT implementation of the DOM element adapter for CSS. + */ +public class GMFUMLRTElementAdapter extends GMFUMLElementAdapter { + public static final String IS_TYPE_REDEFINED = "isTypeRedefined"; //$NON-NLS-1$ + + /** + * Initializes me. + * + * @param view + * my notation view + * @param engine + * my CSS engine + */ + public GMFUMLRTElementAdapter(View view, ExtendedCSSEngine engine) { + super(view, engine); + + // Replace the superclass helper with an inheritance-aware implementation + helper = CSSDOMUMLRTSemanticElementHelper.getInstance(); + } + + @Override + protected String doGetAttribute(String attr) { + String result = super.doGetAttribute(attr); + + if ((result == null) && (semanticElement instanceof NamedElement)) { + UMLRTNamedElement element; + + switch (attr) { + case IS_TYPE_REDEFINED: + element = UMLRTFactory.create((NamedElement) semanticElement); + if (element != null) { + result = isTypeRedefined(element); + } + break; + } + } + + return result; + } + + /** + * Obtains the value of the {@link #IS_TYPE_REDEFINED isTypeRedefined} attribute + * for an {@code element}. + * + * @param element + * an UML-RT element + * @return whether it redefines its inherited type + */ + protected String isTypeRedefined(UMLRTNamedElement element) { + boolean result = false; + + if (element.isRedefinition()) { + if (element instanceof UMLRTPort) { + UMLRTPort port = (UMLRTPort) element; + result = port.getType() != port.getRedefinedPort().getType(); + } else if (element instanceof UMLRTCapsulePart) { + UMLRTCapsulePart part = (UMLRTCapsulePart) element; + result = part.getType() != part.getRedefinedPart().getType(); + } + } + + return Boolean.toString(result); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/GMFUMLRTElementProvider.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/GMFUMLRTElementProvider.java new file mode 100644 index 000000000..e6a578a6a --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/GMFUMLRTElementProvider.java @@ -0,0 +1,43 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.css; + +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; +import org.eclipse.papyrus.uml.diagram.css.dom.GMFUMLElementProvider; +import org.w3c.dom.Element; + +/** + * A specialized CSS DOM element provider that knows how to resolve view references to + * inherited semantic elements in the context of the subclass capsule. + */ +public class GMFUMLRTElementProvider extends GMFUMLElementProvider { + + public GMFUMLRTElementProvider() { + super(); + } + + @Override + public Element getElement(Object element, @SuppressWarnings("restriction") org.eclipse.e4.ui.css.core.engine.CSSEngine engine) { + if (!(element instanceof View)) { + throw new IllegalArgumentException("Unknown element : " + element); //$NON-NLS-1$ + } + + if (!(engine instanceof ExtendedCSSEngine)) { + throw new IllegalArgumentException("Invalid CSS Engine : " + engine); //$NON-NLS-1$ + } + + return new GMFUMLRTElementAdapter((View) element, (ExtendedCSSEngine) engine); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/GMFUMLRTElementProviderFactory.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/GMFUMLRTElementProviderFactory.java new file mode 100644 index 000000000..1143abdcf --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/css/GMFUMLRTElementProviderFactory.java @@ -0,0 +1,35 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.css; + +import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram; +import org.eclipse.papyrus.infra.gmfdiag.css.provider.IPapyrusElementProvider; +import org.eclipse.papyrus.uml.diagram.css.dom.GMFUMLElementProviderFactory; + +/** + * A specialized CSS DOM element provider factory that creates providers that + * know understand the inheritance semantics of UML-RT diagrams. + */ +public class GMFUMLRTElementProviderFactory extends GMFUMLElementProviderFactory { + + public GMFUMLRTElementProviderFactory() { + super(); + } + + @Override + public IPapyrusElementProvider createProvider(CSSDiagram diagram) { + return new GMFUMLRTElementProvider(); + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/AbstractInheritanceEditPolicy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/AbstractInheritanceEditPolicy.java new file mode 100644 index 000000000..9f0ea0ed5 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/AbstractInheritanceEditPolicy.java @@ -0,0 +1,378 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies; + +import static org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil.getDiagramEditPart; + +import java.util.Collection; +import java.util.Optional; +import java.util.concurrent.Callable; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.Future; +import java.util.function.Consumer; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.util.EContentsEList.FeatureIterator; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.Request; +import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker; +import org.eclipse.gmf.runtime.diagram.core.listener.NotificationPreCommitListener; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx; +import org.eclipse.gmf.runtime.notation.Bendpoints; +import org.eclipse.gmf.runtime.notation.LayoutConstraint; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper; +import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.IInheritableEditPart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; + +/** + * An abstract edit policy that manages the graphical characteristics + * characteristics of inherited elements in a Capsule Composite Structure Diagram. + */ +public abstract class AbstractInheritanceEditPolicy<V extends View> extends GraphicalEditPolicyEx { + public static final String INHERITANCE_ROLE = "umlrtInheritance"; //$NON-NLS-1$ + + private final Class<V> viewType; + private final NotificationPreCommitListener redefinedViewListener; + private final CopyOnWriteArrayList<EObject> listeningTo = new CopyOnWriteArrayList<>(); + + private V redefinedView; + + private volatile Future<?> pendingRefresh; + + public AbstractInheritanceEditPolicy(Class<V> viewType) { + super(); + + this.viewType = viewType; + this.redefinedViewListener = this::redefinedViewChanged; + } + + IInheritableEditPart inheritableHost() { + return (IInheritableEditPart) getHost(); + } + + boolean isInherited() { + return getRedefinedElementView() != null; + } + + @Override + public void deactivate() { + setRedefinedElementView(null); + + super.deactivate(); + } + + V getRedefinedElementView() { + return redefinedView; + } + + private void setRedefinedElementView(V newRedefinedView) { + if (redefinedView != newRedefinedView) { + if (redefinedView != null) { + getEventBroker().ifPresent(this::removeUpdateListeners); + } + redefinedView = newRedefinedView; + if (redefinedView != null) { + getEventBroker().ifPresent(this::addUpdateListeners); + } + } + } + + protected final void addUpdateListeners(DiagramEventBroker broker) { + V redefined = getRedefinedElementView(); + listen(broker, redefined); + + // Only one level of contents depth for now + for (FeatureIterator<EObject> iter = (FeatureIterator<EObject>) redefined.eContents().iterator(); iter.hasNext();) { + EObject next = iter.next(); + if (shouldListen(redefined, (EReference) iter.feature())) { + listen(broker, next); + } + } + } + + /** + * Queries whether refresh of the visuals should be triggered by changes to objects + * contained in the host edit-part's view via the given {@code containment} reference, + * usually {@link LayoutConstraint}s, {@link Bendpoints}, and the like. + * + * @param view + * the redefined view to follow, from the superclass diagram + * @param containment + * a containment reference + * @return whether to track changes in this {@code containment} reference of the {@code view} + */ + protected abstract boolean shouldListen(V view, EReference containment); + + private boolean listen(DiagramEventBroker broker, EObject object) { + boolean result = listeningTo.addIfAbsent(object); + if (result) { + broker.addNotificationListener(object, redefinedViewListener); + } + return result; + } + + private boolean unlisten(DiagramEventBroker broker, EObject object) { + boolean result = listeningTo.remove(object); + if (result) { + broker.removeNotificationListener(object, redefinedViewListener); + } + return result; + } + + protected final void removeUpdateListeners(DiagramEventBroker broker) { + listeningTo.forEach(e -> broker.removeNotificationListener(e, redefinedViewListener)); + listeningTo.clear(); + } + + @SuppressWarnings("unchecked") + protected final Command redefinedViewChanged(Notification msg) { + if (!checkInheritance()) { + return null; + } + + CompoundCommand result = new CompoundCommand(); + + // We only listen to EObjects + EObject notifier = (EObject) msg.getNotifier(); + V redefined = getRedefinedElementView(); + + if ((notifier == redefined) || (notifier.eContainer() == redefined)) { + Object feature = msg.getFeature(); + if (feature instanceof EReference) { + EReference reference = (EReference) feature; + V view = getRedefinedElementView(); + if (reference.isContainment() && shouldListen(view, reference)) { + // We can't be responding to the broker if it isn't there + DiagramEventBroker broker = getEventBroker().get(); + + Consumer<EObject> processNew = added -> { + if (listen(broker, added)) { + Command refresh = update(view, added, reference, + msg.getPosition(), false); + if (refresh != null) { + result.append(refresh); + } + } + }; + + Consumer<EObject> processOld = removed -> { + if (unlisten(broker, removed)) { + Command refresh = update(view, removed, reference, + msg.getPosition(), true); + if (refresh != null) { + result.append(refresh); + } + } + }; + + // Discover changed targets for listening + switch (msg.getEventType()) { + case Notification.ADD: + processNew.accept((EObject) msg.getNewValue()); + break; + case Notification.ADD_MANY: + ((Collection<? extends EObject>) msg.getNewValue()).forEach(processNew); + break; + case Notification.REMOVE: + processOld.accept((EObject) msg.getOldValue()); + break; + case Notification.REMOVE_MANY: + ((Collection<? extends EObject>) msg.getOldValue()).forEach(processOld); + break; + case Notification.SET: + processOld.accept((EObject) msg.getOldValue()); + processNew.accept((EObject) msg.getNewValue()); + break; + // No RESOLVE because we don't have cross-resource containment in notation + } + } + } + } + + // Refresh this changed object, including other attributes of the view, itself + Command refresh = update(notifier); + if (refresh != null) { + result.append(refresh); + } + + if (result.canExecute()) { + // we will be changing something, so a refresh will be + // needed to repaint the diagram + postRefresh(); + } + + return result.isEmpty() ? null : result.unwrap(); + } + + protected Command update(V redefinedView, EObject contained, EReference containment, int position, boolean isRemoved) { + Command result = null; + + V view = getView(); + if (isRemoved) { + // In the general case, we want to remove the corresponding thing in our view + if (!containment.isMany()) { + // Easy case + EObject myContained = (EObject) view.eGet(containment); + if (myContained != null) { + result = RemoveCommand.create(getEditingDomain(), view, + containment, myContained); + } + } else { + @SuppressWarnings("unchecked") + EList<? extends EObject> myList = (EList<? extends EObject>) view.eGet(containment); + if ((position >= 0) && (position < myList.size())) { + result = RemoveCommand.create(getEditingDomain(), view, + containment, myList.get(position)); + } + } + } else { + // In the general case, we want to add the corresponding thing in our view + if (!containment.isMany()) { + // Easy case + EObject myContained = (EObject) view.eGet(containment); + EObject newContained = EcoreUtil.copy(contained); + if (myContained != null) { + result = SetCommand.create(getEditingDomain(), view, + containment, newContained); + } else { + result = AddCommand.create(getEditingDomain(), view, + containment, newContained); + } + } else { + @SuppressWarnings("unchecked") + EList<? extends EObject> myList = (EList<? extends EObject>) view.eGet(containment); + if ((position >= 0) && (position <= myList.size())) { + EObject newContained = EcoreUtil.copy(contained); + result = AddCommand.create(getEditingDomain(), view, + containment, newContained, position); + } + } + } + + return result; + + } + + protected abstract Command update(EObject inherited); + + private boolean checkInheritance() { + setRedefinedElementView(computeRedefinedElementView()); + return isInherited(); + } + + private V computeRedefinedElementView() { + return !inheritableHost().isInherited() + ? null + : viewType.cast(inheritableHost().getRedefinedView()); + } + + private Optional<DiagramEventBroker> getEventBroker() { + return Optional.ofNullable(((IGraphicalEditPart) getHost()).getEditingDomain()) + .map(DiagramEventBroker::getInstance); + } + + @Override + public org.eclipse.gef.commands.Command getCommand(Request request) { + org.eclipse.gef.commands.Command result = super.getCommand(request); + + if (isInherited()) { + if (isVisualEdit(request)) { + org.eclipse.gef.commands.Command reifyView = inheritableHost().getReifyViewCommand(); + if (reifyView != null) { + if (result != null) { + result = reifyView.chain(result); + } else { + result = reifyView; + } + } + } + } + + return result; + } + + protected abstract boolean isVisualEdit(Request request); + + @Override + public void refresh() { + checkInheritance(); + + if (isInherited()) { + refreshInheritance(); + } + + super.refresh(); + } + + protected final void refreshInheritance() { + CompoundCommand refresh = new CompoundCommand(); + + listeningTo.forEach(e -> { + Command update = update(e); + if (update != null) { + refresh.append(update); + } + }); + + if (refresh.canExecute()) { + CommandUtil.executeUnsafeCommand(refresh.unwrap(), getHost()); + } + } + + V getView() { + IGraphicalEditPart host = (IGraphicalEditPart) getHost(); + return viewType.cast(host.getNotationView()); + } + + Optional<UMLRTNamedElement> getUMLRTElement() { + return inheritableHost().getUMLRTElement(); + } + + protected TransactionalEditingDomain getEditingDomain() { + return ((IGraphicalEditPart) getHost()).getEditingDomain(); + } + + private void postRefresh() { + if (pendingRefresh == null) { + EditPart toRefresh = getHost(); + pendingRefresh = DiagramHelper.submit(toRefresh, new Callable<Void>() { + @Override + public Void call() throws Exception { + pendingRefresh = null; + + if (toRefresh.isActive()) { + // Work-around for targeted refresh of the edit-part + // not working for port shapes on the border + DiagramHelper.scheduleRefresh(getDiagramEditPart(toRefresh)); + } + + return null; + } + }); + } + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/EdgeInheritanceEditPolicy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/EdgeInheritanceEditPolicy.java new file mode 100644 index 000000000..9df63da09 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/EdgeInheritanceEditPolicy.java @@ -0,0 +1,165 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies; + +import java.util.Set; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.Request; +import org.eclipse.gef.RequestConstants; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionAnchorsCommand; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.IdentityAnchor; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.RelativeBendpoints; +import org.eclipse.gmf.runtime.notation.RoutingStyle; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; + +import com.google.common.collect.ImmutableSet; + +/** + * An edit policy that manages the location and size and other graphical + * characteristics of inherited elements in a Capsule Composite Structure Diagram. + */ +public class EdgeInheritanceEditPolicy extends AbstractInheritanceEditPolicy<Edge> { + private static final Set<EReference> CONTAINMENTS = ImmutableSet.of( + NotationPackage.Literals.EDGE__SOURCE_ANCHOR, + NotationPackage.Literals.EDGE__TARGET_ANCHOR, + NotationPackage.Literals.EDGE__BENDPOINTS); + + public EdgeInheritanceEditPolicy() { + super(Edge.class); + } + + @Override + protected boolean shouldListen(Edge view, EReference containment) { + return CONTAINMENTS.contains(containment); + } + + @Override + protected Command update(EObject inherited) { + ICommand result = null; + + if (inherited instanceof IdentityAnchor) { + IdentityAnchor anchor = (IdentityAnchor) inherited; + result = getUpdateCommand(anchor, + anchor.eContainmentFeature() == NotationPackage.Literals.EDGE__TARGET_ANCHOR); + } else if (inherited instanceof RelativeBendpoints) { + RelativeBendpoints bendpoints = (RelativeBendpoints) inherited; + result = getUpdateCommand(bendpoints); + } else if (inherited instanceof RoutingStyle) { + RoutingStyle routing = (RoutingStyle) inherited; + result = getUpdateCommand(routing); + } + + return (result == null) ? null : GMFtoEMFCommandWrapper.wrap(result); + } + + @Override + protected boolean isVisualEdit(Request request) { + return RequestConstants.REQ_CREATE_BENDPOINT.equals(request.getType()) + || RequestConstants.REQ_MOVE_BENDPOINT.equals(request.getType()); + } + + ICommand getUpdateCommand(IdentityAnchor anchor, boolean isTarget) { + IGraphicalEditPart host = (IGraphicalEditPart) getHost(); + Edge edge = getView(); + + TransactionalEditingDomain domain = host.getEditingDomain(); + ICommand result = null; + + if (!EcoreUtil.equals(anchor, isTarget ? edge.getTargetAnchor() : edge.getSourceAnchor())) { + SetConnectionAnchorsCommand command = new SetConnectionAnchorsCommand(domain, "Follow inherited anchor"); + command.setEdgeAdaptor(new EObjectAdapter(edge)); + if (isTarget) { + command.setNewTargetTerminal(anchor.getId()); + } else { + command.setNewSourceTerminal(anchor.getId()); + } + result = command; + } + + return ((result != null) && result.canExecute()) ? result : null; + } + + ICommand getUpdateCommand(RelativeBendpoints bendpoints) { + IGraphicalEditPart host = (IGraphicalEditPart) getHost(); + Edge edge = getView(); + + TransactionalEditingDomain domain = host.getEditingDomain(); + Command result = null; + + if (!EcoreUtil.equals(bendpoints, edge.getBendpoints())) { + result = SetCommand.create(domain, edge.getBendpoints(), NotationPackage.Literals.RELATIVE_BENDPOINTS__POINTS, bendpoints.getPoints()); + } + + return ((result != null) && result.canExecute()) + ? EMFtoGMFCommandWrapper.wrap(result) + : null; + } + + ICommand getUpdateCommand(RoutingStyle routing) { + IGraphicalEditPart host = (IGraphicalEditPart) getHost(); + Edge edge = getView(); + + TransactionalEditingDomain domain = host.getEditingDomain(); + Command result = null; + + RoutingStyle myRouting = (RoutingStyle) edge.getStyle(NotationPackage.Literals.ROUTING_STYLE); + if (myRouting != null) { + CompoundCommand cc = new CompoundCommand(); + + if (myRouting.getRouting() != routing.getRouting()) { + cc.append(SetCommand.create(domain, myRouting, NotationPackage.Literals.ROUTING_STYLE__ROUTING, routing.getRouting())); + } + if (myRouting.getJumpLinkStatus() != routing.getJumpLinkStatus()) { + cc.append(SetCommand.create(domain, myRouting, NotationPackage.Literals.ROUTING_STYLE__JUMP_LINK_STATUS, routing.getJumpLinkStatus())); + } + if (myRouting.getJumpLinkType() != routing.getJumpLinkType()) { + cc.append(SetCommand.create(domain, myRouting, NotationPackage.Literals.ROUTING_STYLE__JUMP_LINK_TYPE, routing.getJumpLinkType())); + } + if (myRouting.isJumpLinksReverse() != routing.isJumpLinksReverse()) { + cc.append(SetCommand.create(domain, myRouting, NotationPackage.Literals.ROUTING_STYLE__JUMP_LINKS_REVERSE, routing.isJumpLinksReverse())); + } + if (myRouting.isAvoidObstructions() != routing.isAvoidObstructions()) { + cc.append(SetCommand.create(domain, myRouting, NotationPackage.Literals.ROUTING_STYLE__AVOID_OBSTRUCTIONS, routing.isAvoidObstructions())); + } + if (myRouting.isClosestDistance() != routing.isClosestDistance()) { + cc.append(SetCommand.create(domain, myRouting, NotationPackage.Literals.ROUTING_STYLE__CLOSEST_DISTANCE, routing.isClosestDistance())); + } + if (myRouting.getRoundedBendpointsRadius() != routing.getRoundedBendpointsRadius()) { + cc.append(SetCommand.create(domain, myRouting, NotationPackage.Literals.ROUTING_STYLE__ROUNDED_BENDPOINTS_RADIUS, routing.getRoundedBendpointsRadius())); + } + if (myRouting.getSmoothness() != routing.getSmoothness()) { + cc.append(SetCommand.create(domain, myRouting, NotationPackage.Literals.ROUTING_STYLE__SMOOTHNESS, routing.getSmoothness())); + } + + result = cc.unwrap(); + } + + return ((result != null) && result.canExecute()) + ? EMFtoGMFCommandWrapper.wrap(result) + : null; + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/InheritanceEditPolicy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/InheritanceEditPolicy.java new file mode 100644 index 000000000..1d78f5faf --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/InheritanceEditPolicy.java @@ -0,0 +1,106 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies; + +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.Request; +import org.eclipse.gef.RequestConstants; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.notation.Bounds; +import org.eclipse.gmf.runtime.notation.Location; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; + +/** + * An edit policy that manages the location and size and other graphical + * characteristics of inherited elements in a Capsule Composite Structure Diagram. + */ +public class InheritanceEditPolicy extends AbstractInheritanceEditPolicy<Node> { + public InheritanceEditPolicy() { + super(Node.class); + } + + @Override + protected boolean shouldListen(Node view, EReference containment) { + return containment == NotationPackage.Literals.NODE__LAYOUT_CONSTRAINT; + } + + @Override + protected Command update(EObject inherited) { + Command result = null; + + if (inherited instanceof Bounds) { + ICommand bounds = getUpdateCommand((Bounds) inherited); + if (bounds != null) { + result = GMFtoEMFCommandWrapper.wrap(bounds); + } + } else if (inherited instanceof Location) { + // As for labels, for example + ICommand location = getUpdateCommand((Location) inherited); + if (location != null) { + result = GMFtoEMFCommandWrapper.wrap(location); + } + } + + return result; + } + + @Override + protected boolean isVisualEdit(Request request) { + return RequestConstants.REQ_MOVE.equals(request.getType()) + || RequestConstants.REQ_RESIZE.equals(request.getType()); + } + + ICommand getUpdateCommand(Bounds bounds) { + IGraphicalEditPart host = (IGraphicalEditPart) getHost(); + Node node = getView(); + + TransactionalEditingDomain domain = host.getEditingDomain(); + ICommand result = null; + + if (!EcoreUtil.equals(bounds, node.getLayoutConstraint())) { + result = new SetBoundsCommand(domain, "Follow inherited element", + new EObjectAdapter(node), + new Rectangle(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight())); + } + + return ((result != null) && result.canExecute()) ? result : null; + } + + ICommand getUpdateCommand(Location location) { + IGraphicalEditPart host = (IGraphicalEditPart) getHost(); + Node node = getView(); + + TransactionalEditingDomain domain = host.getEditingDomain(); + ICommand result = null; + + if (!EcoreUtil.equals(location, node.getLayoutConstraint())) { + result = new SetBoundsCommand(domain, "Follow inherited element", + new EObjectAdapter(node), + new Point(location.getX(), location.getY())); + } + + return ((result != null) && result.canExecute()) ? result : null; + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTBehaviorPortEditPolicy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTBehaviorPortEditPolicy.java new file mode 100644 index 000000000..b56bf8434 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTBehaviorPortEditPolicy.java @@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies; + +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.papyrus.infra.tools.util.TypeUtils; +import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.BehaviorPortEditPolicy; +import org.eclipse.uml2.uml.Port; + +/** + * Specialized behavior-port edit-policy that understands inheritance. + */ +public class RTBehaviorPortEditPolicy extends BehaviorPortEditPolicy { + + /** + * Initializes me. + */ + public RTBehaviorPortEditPolicy() { + super(); + } + + @Override + protected Port getUMLElement() { + return TypeUtils.as(((IGraphicalEditPart) getHost()).resolveSemanticElement(), Port.class); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTExternalReferenceEditPolicy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTExternalReferenceEditPolicy.java new file mode 100644 index 000000000..82bcde06b --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTExternalReferenceEditPolicy.java @@ -0,0 +1,107 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies; + +import java.lang.reflect.Proxy; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalReferenceEditPolicy; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.uml2.uml.NamedElement; + +/** + * A customization of the external reference edit-policy that understands + * inherited elements. + */ +public class RTExternalReferenceEditPolicy extends ExternalReferenceEditPolicy { + + public RTExternalReferenceEditPolicy() { + super(); + } + + @Override + protected boolean isExternalRef(View view) { + return super.isExternalRef(inheritableView(view)); + } + + EObject resolveElement(View view) { + EObject result = view.getElement(); + if (result instanceof NamedElement) { + UMLRTNamedElement rt = UMLRTFactory.create((NamedElement) result); + if (rt != null) { + EObject context = (view.eContainer() instanceof View) + ? ((View) view.eContainer()).getElement() + : null; + if (context instanceof NamedElement) { + UMLRTNamedElement rtContext = UMLRTFactory.create((NamedElement) context); + if (rtContext instanceof UMLRTCapsulePart) { + rtContext = ((UMLRTCapsulePart) rtContext).getType(); + } + + if (rtContext instanceof UMLRTCapsule) { + UMLRTCapsule capsule = (UMLRTCapsule) rtContext; + + // Find the redefining port or part + if (rt instanceof UMLRTPort) { + result = capsule.getPorts().stream() + .filter(p -> p.redefines(rt)) + .findAny() + .map(UMLRTNamedElement::toUML) + .orElse(rt.toUML()); + } else if (rt instanceof UMLRTCapsulePart) { + result = capsule.getCapsuleParts().stream() + .filter(p -> p.redefines(rt)) + .findAny() + .map(UMLRTNamedElement::toUML) + .orElse(rt.toUML()); + } + } + } + } + } + + return result; + } + + /** + * Create a dynamic proxy of a {@code view} that presents the correct resolved + * semantic element as its element. + * + * @param view + * a view + * @return the inheritable view proxy + */ + protected View inheritableView(View view) { + return (view == null) + ? null : (View) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[] { View.class }, + (proxy, method, args) -> { + switch (method.getName()) { + case "getElement": + return resolveElement(view); + case "eContainer": + EObject eContainer = view.eContainer(); + return (eContainer instanceof View) + ? inheritableView((View) eContainer) + : eContainer; + default: + return method.invoke(view, args); + } + }); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTExternalReferenceEditPolicyProvider.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTExternalReferenceEditPolicyProvider.java new file mode 100644 index 000000000..b664e5911 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTExternalReferenceEditPolicyProvider.java @@ -0,0 +1,70 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies; + +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; +import org.eclipse.gmf.runtime.common.core.service.IOperation; +import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation; +import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalReferenceEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.IRTPortEditPart; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPortEditPart; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPropertyPartEditPart; + +/** + * Provider of an external-reference edit policy that extends the Papyrus implementation + * to support inherited elements. + */ +public class RTExternalReferenceEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider { + + public RTExternalReferenceEditPolicyProvider() { + super(); + } + + @Override + public boolean provides(IOperation operation) { + CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation; + + try { + ServicesRegistry registry = ServiceUtilsForEditPart.getInstance().getServiceRegistry(epOperation.getEditPart()); + if (registry == null) { + return false; + } + + // Do I recognize this edit-part? + EditPart editPart = epOperation.getEditPart(); + return (editPart instanceof RTPortEditPart) + || (editPart instanceof RTPropertyPartEditPart); + } catch (ServiceException e) { + return false; + } + } + + @Override + public void createEditPolicies(EditPart editPart) { + if (editPart instanceof IRTPortEditPart && ((IRTPortEditPart) editPart).isPortOnPart()) { + // We will never need the decoration on these because of course the parent + // view is different to the parent element's view + editPart.removeEditPolicy(ExternalReferenceEditPolicy.EDIT_POLICY_ROLE); + } else { + editPart.installEditPolicy(ExternalReferenceEditPolicy.EDIT_POLICY_ROLE, + new RTExternalReferenceEditPolicy()); + } + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTSemanticEditPolicy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTSemanticEditPolicy.java new file mode 100644 index 000000000..6cc89c2f7 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/RTSemanticEditPolicy.java @@ -0,0 +1,100 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; + +/** + * A specialized Semantic Edit Policy that understands the inheritance in diagrams + * and resolves elements correctly when completing requests, especially the + * {@link DestroyElementRequest}. + */ +public class RTSemanticEditPolicy extends DefaultSemanticEditPolicy { + + /** + * Initializes me. + */ + public RTSemanticEditPolicy() { + super(); + } + + @Override + protected IEditCommandRequest completeRequest(IEditCommandRequest request) { + IEditCommandRequest result = request; + + if (result instanceof DestroyRequest) { + DestroyRequest destroyRequest = (DestroyRequest) result; + + if (getHostElement() != null) { + // Destroy element request + + if (destroyRequest instanceof DestroyElementRequest) { + ((DestroyElementRequest) destroyRequest) + .setElementToDestroy(getHostElement()); + ((DestroyElementRequest) destroyRequest).getParameters().clear(); + } else { + result = new DestroyElementRequest(request + .getEditingDomain(), getHostElement(), destroyRequest + .isConfirmationRequired()); + result.addParameters(request.getParameters()); + } + + + } else if (getHost() instanceof ConnectionEditPart) { + // Destroy reference request + ConnectionEditPart connection = (ConnectionEditPart) getHost(); + EObject container = resolveSemanticElement(connection.getSource()); + EObject referenceObject = resolveSemanticElement(connection.getTarget()); + + if (destroyRequest instanceof DestroyReferenceRequest) { + DestroyReferenceRequest destroyReferenceRequest = (DestroyReferenceRequest) result; + + destroyReferenceRequest.setContainer(container); + destroyReferenceRequest.setReferencedObject(referenceObject); + + } else { + result = new DestroyReferenceRequest(((IGraphicalEditPart) getHost()).getEditingDomain(), + container, null, referenceObject, + destroyRequest.isConfirmationRequired()); + + result.addParameters(request.getParameters()); + } + } + } else { + result = super.completeRequest(request); + } + + return result; + } + + protected static EObject resolveSemanticElement(EditPart editPart) { + return (editPart instanceof IGraphicalEditPart) + ? ((IGraphicalEditPart) editPart).resolveSemanticElement() + : ViewUtil.resolveSemanticElement((View) editPart.getModel()); + } + + protected EObject getHostElement() { + return resolveSemanticElement(getHost()); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/stereotype/RTAppliedStereotypeCommentEditPolicy.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/stereotype/RTAppliedStereotypeCommentEditPolicy.java new file mode 100644 index 000000000..1fa1597be --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/stereotype/RTAppliedStereotypeCommentEditPolicy.java @@ -0,0 +1,117 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.stereotype; + +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.Set; + +import org.eclipse.emf.common.util.ECollections; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.papyrus.infra.tools.util.TypeUtils; +import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCommentEditPolicy; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Stereotype; + +/** + * Customization of the applied-stereotype comment edit-policy that accounts for + * inheritance of views from other diagrams by not creating the comment views for + * the transient views of inherited elements. + */ +public class RTAppliedStereotypeCommentEditPolicy extends AppliedStereotypeCommentEditPolicy { + private static final Class<?>[] GET_VALUE_SIGNATURE = { Stereotype.class, String.class }; + private static final Class<?>[] SET_VALUE_SIGNATURE = { Stereotype.class, String.class, Object.class }; + + private Element realHostElement; + private Element stereotypelessHostElement; + + public RTAppliedStereotypeCommentEditPolicy() { + super(); + } + + @Override + protected Element getUMLElement() { + IGraphicalEditPart host = (IGraphicalEditPart) getHost(); + Element result = TypeUtils.as(host.resolveSemanticElement(), Element.class); + + if (result instanceof NamedElement) { + UMLRTNamedElement rtElement = UMLRTFactory.create((NamedElement) result); + if ((rtElement != null) && rtElement.isVirtualRedefinition()) { + // Provide a view of the element that has no stereotypes + if (stereotypelessHostElement != null) { + // Already have one. Is it the correct one? + if (realHostElement != result) { + // Nope, wrong one + stereotypelessHostElement = null; + } + } + if (stereotypelessHostElement == null) { + createStereotypelessHostElement(result); + } + result = stereotypelessHostElement; + } + } + + return result; + } + + private void createStereotypelessHostElement(Element element) { + realHostElement = element; + Class<?>[] interfaces = getAllInterfaces(element.getClass()); + stereotypelessHostElement = (Element) Proxy.newProxyInstance(getClass().getClassLoader(), interfaces, + (proxy, method, args) -> { + Object result; + + switch (method.getName()) { + case "getAppliedStereotypes": + case "getStereotypeApplications": + result = ECollections.EMPTY_ELIST; + break; + case "getValue": + if (Arrays.equals(method.getParameterTypes(), GET_VALUE_SIGNATURE)) { + throw new IllegalArgumentException(String.valueOf(args[0])); + } else { + result = method.invoke(element, args); + } + break; + case "setValue": + if (Arrays.equals(method.getParameterTypes(), SET_VALUE_SIGNATURE)) { + throw new IllegalArgumentException(String.valueOf(args[0])); + } else { + result = method.invoke(element, args); + } + break; + default: + result = method.invoke(element, args); + break; + } + + return result; + }); + } + + static Class<?>[] getAllInterfaces(Class<?> class_) { + Set<Class<?>> result = new LinkedHashSet<>(); + + for (; (class_ != Object.class) && (class_ != null); class_ = class_.getSuperclass()) { + result.addAll(Arrays.asList(class_.getInterfaces())); + } + + return result.toArray(new Class<?>[result.size()]); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/stereotype/RTAppliedStereotypeEditPolicyProvider.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/stereotype/RTAppliedStereotypeEditPolicyProvider.java new file mode 100644 index 000000000..47660dfe4 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/editpolicies/stereotype/RTAppliedStereotypeEditPolicyProvider.java @@ -0,0 +1,80 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.editpolicies.stereotype; + +import static org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCommentEditPolicy.APPLIED_STEREOTYPE_COMMENT; + +import java.util.Map; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; +import org.eclipse.gmf.runtime.common.core.service.IOperation; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation; +import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.Activator; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.UMLRTCapsuleStructureDiagramUtils; +import org.eclipse.uml2.common.util.CacheAdapter; + +import com.google.common.collect.ImmutableMap; + +/** + * An edit-policy provider that serves to replace stereotype-application edit-policies + * by our own that account for inheritance of views from other diagrams. + */ +public class RTAppliedStereotypeEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider { + + private final Map<String, Class<? extends EditPolicy>> editPolicies = ImmutableMap.of( + APPLIED_STEREOTYPE_COMMENT, RTAppliedStereotypeCommentEditPolicy.class); + + @Override + public boolean provides(IOperation operation) { + Diagram diagram = getDiagramView(((CreateEditPoliciesOperation) operation).getEditPart()); + return (diagram != null) && isCapsuleStructureDiagram(diagram); + } + + @Override + public void createEditPolicies(EditPart editPart) { + // Replace edit-policies with our variants + editPolicies.forEach((role, epClass) -> { + EditPolicy existing = editPart.getEditPolicy(role); + if (existing != null) { + try { + editPart.installEditPolicy(role, epClass.newInstance()); + } catch (Exception e) { + Activator.log.error("Failed to override edit policy: " + role, e); //$NON-NLS-1$ + } + } + }); + } + + Diagram getDiagramView(EditPart editPart) { + DiagramEditPart diagramEP = DiagramEditPartsUtil.getDiagramEditPart(editPart); + return (diagramEP == null) ? null : diagramEP.getDiagramView(); + } + + private boolean isCapsuleStructureDiagram(Diagram diagram) { + CacheAdapter cache = CacheAdapter.getCacheAdapter(diagram); + Boolean result = (Boolean) cache.get(diagram, "isCapsuleStructureDiagram"); //$NON-NLS-1$ + if (result == null) { + result = UMLRTCapsuleStructureDiagramUtils.isCapsuleStructureDiagram(diagram); + cache.put(diagram, "isCapsuleStructureDiagram", result); + } + + return result; + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/expressions/EditPartPropertyTester.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/expressions/EditPartPropertyTester.java new file mode 100644 index 000000000..58f3325f3 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/expressions/EditPartPropertyTester.java @@ -0,0 +1,56 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.expressions; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.papyrus.infra.tools.util.TypeUtils; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.IInheritableEditPart; + +/** + * Property tester for UML-RT edit-parts. + */ +public class EditPartPropertyTester extends PropertyTester { + + private static final String PROPERTY_IS_INHERITED = "isInherited"; + + public EditPartPropertyTester() { + super(); + } + + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + boolean result = false; + + switch (property) { + case PROPERTY_IS_INHERITED: + result = isInherited(TypeUtils.as(receiver, IInheritableEditPart.class)) == asBoolean(expectedValue, true); + break; + } + + return result; + } + + boolean asBoolean(Object value, boolean defaultValue) { + return (value instanceof Boolean) + ? (Boolean) value + : (value == null) + ? defaultValue + : Boolean.valueOf(String.valueOf(value)); + } + + protected boolean isInherited(IInheritableEditPart editPart) { + // Dependent children are not "inherited" in their own right + return (editPart != null) && editPart.canInherit() && !editPart.isDependentChild(); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/handlers/ToggleInheritViewHandler.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/handlers/ToggleInheritViewHandler.java new file mode 100644 index 000000000..b33275c54 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/handlers/ToggleInheritViewHandler.java @@ -0,0 +1,144 @@ +/***************************************************************************** + * Copyright (c) 2016, 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.handlers; + +import java.util.Comparator; +import java.util.List; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.UnexecutableCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.papyrus.infra.ui.util.EclipseCommandUtils; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.IInheritableEditPart; +import org.eclipse.ui.ISources; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * Handler for the toggling of view position/routing/etc. inheritance. + */ +public class ToggleInheritViewHandler extends AbstractHandler { + + public ToggleInheritViewHandler() { + super(); + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + IStructuredSelection selection = HandlerUtil.getCurrentStructuredSelection(event); + List<IInheritableEditPart> editParts = getInheritableEditParts(selection); + + if (!editParts.isEmpty()) { + TransactionalEditingDomain domain = editParts.get(0).getEditingDomain(); + List<Boolean> states = getInheritanceStates(editParts); + if ((domain != null) && !states.isEmpty()) { + boolean groundState = states.get(0); + + Function<View, Command> commandFuntion = groundState + ? IInheritableEditPart.StyleUtil::getCreateInheritedStyle + : IInheritableEditPart.StyleUtil::getDeleteInheritedStyle; + + Predicate<IInheritableEditPart> needsChange = iep -> iep.isInherited() == groundState; + + Command command = editParts.stream() + .filter(needsChange) + .map(IGraphicalEditPart::getNotationView) + .map(commandFuntion) + .reduce(Command::chain) + .orElse(UnexecutableCommand.INSTANCE); + + if (command.canExecute()) { + domain.getCommandStack().execute(command); + } + } + } + + return null; + } + + private List<IInheritableEditPart> getInheritableEditParts(IStructuredSelection selection) { + return inheritableEditParts(selection).collect(Collectors.toList()); + } + + private Stream<IInheritableEditPart> inheritableEditParts(IStructuredSelection selection) { + Predicate<IInheritableEditPart> isDependent = IInheritableEditPart::isDependentChild; + return ((List<?>) selection.toList()).stream() + .filter(IInheritableEditPart.class::isInstance) + .map(IInheritableEditPart.class::cast) + .filter(IInheritableEditPart::canInherit) + .filter(isDependent.negate()); + } + + private List<Boolean> getInheritanceStates(IStructuredSelection selection) { + return inheritableEditParts(selection) + .map(IInheritableEditPart::isInherited) + .distinct() + .sorted(followBias()) + .collect(Collectors.toList()); + } + + + private List<Boolean> getInheritanceStates(List<? extends IInheritableEditPart> editParts) { + return editParts.stream() + .map(IInheritableEditPart::isInherited) + .distinct() + .sorted(followBias()) + .collect(Collectors.toList()); + } + + /** + * Obtains a comparator that sorts the inheritance states according to the + * preferred bias for heterogenous selections: to follow or to un-follow. + * + * @return the inheritance state bias comparator + */ + private static Comparator<Boolean> followBias() { + // Bias towards toggling from unfollow to follow + return Comparator.naturalOrder(); + } + + @Override + public void setEnabled(Object context) { + Object sel = HandlerUtil.getVariable(context, ISources.ACTIVE_CURRENT_SELECTION_NAME); + IStructuredSelection selection = (sel instanceof IStructuredSelection) + ? (IStructuredSelection) sel + : StructuredSelection.EMPTY; + List<Boolean> states = getInheritanceStates(selection); + + // I can toggle even an heterogeneous selection because I will just + // set all views to follow their ancestors according to my follow bias + boolean enable = !states.isEmpty(); + + if (enable) { + org.eclipse.core.commands.Command command = EclipseCommandUtils.getCommandService().getCommand("org.eclipse.papyrusrt.umlrt.tooling.diagram.common.toggleInheritView"); + if (command == null) { + enable = false; + } else { + EclipseCommandUtils.updateToggleCommandState(command, states.get(0)); + } + } + + setBaseEnabled(enable); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/layout/PortOnCapsulePartLayoutProvider.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/layout/PortOnCapsulePartLayoutProvider.java index 17f92ad83..d5619cd69 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/layout/PortOnCapsulePartLayoutProvider.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/layout/PortOnCapsulePartLayoutProvider.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2016 Christian W. Damus and others. + * Copyright (c) 2016, 2017 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -110,13 +110,20 @@ public class PortOnCapsulePartLayoutProvider extends AbstractLayoutEditPartProvi * @return the layout command, or {@code null} if none */ private Command getRelativePortLayoutCommand(IGraphicalEditPart capsulePart, List<IGraphicalEditPart> ports) { - Command result = null; - - // These casts are safe because we checked the operation before accepting it - org.eclipse.uml2.uml.Class capsule = (org.eclipse.uml2.uml.Class) ((Property) capsulePart.resolveSemanticElement()).getType(); - Diagram capsuleStructureDiagram = UMLRTCapsuleStructureDiagramUtils.getCapsuleStructureDiagram(capsule); - if (capsuleStructureDiagram != null) { - View frame = ViewUtil.getChildBySemanticHint(capsuleStructureDiagram, ClassCompositeEditPart.VISUAL_ID); + // Don't let the edit part resolve its semantic element because + // that may return a redefinition in the capsule context + Optional<Diagram> capsuleStructureDiagram = Optional.ofNullable(capsulePart.getNotationView()) + .map(View::getElement) + // These casts are safe because we checked the operation before accepting it + .map(Property.class::cast) + .map(Property::getType) + .map(org.eclipse.uml2.uml.Class.class::cast) + .map(UMLRTCapsuleStructureDiagramUtils::getCapsuleStructureDiagram); + + return capsuleStructureDiagram.map(diagram -> { + Command result = null; + + View frame = ViewUtil.getChildBySemanticHint(diagram, ClassCompositeEditPart.VISUAL_ID); if (frame instanceof Node) { Bounds frameBounds = (Bounds) ((Node) frame).getLayoutConstraint(); RelativePortLocationHelper helper = new RelativePortLocationHelper(capsulePart); @@ -125,7 +132,10 @@ public class PortOnCapsulePartLayoutProvider extends AbstractLayoutEditPartProvi List<View> frameChildren = frame.getChildren(); for (IGraphicalEditPart portOnPart : ports) { - Port port = (Port) portOnPart.resolveSemanticElement(); + // Don't let the edit part resolve its semantic element because + // that may return a redefinition in the capsule context + View view = portOnPart.getNotationView(); + Port port = (Port) ((view == null) ? null : view.getElement()); Optional<Node> portOnCapsule = frameChildren.stream() .filter(Node.class::isInstance).map(Node.class::cast) .filter(node -> node.getElement() == port) @@ -136,9 +146,9 @@ public class PortOnCapsulePartLayoutProvider extends AbstractLayoutEditPartProvi result = helper.getPortUpdateCommand(); } - } - return result; + return result; + }).orElse(null); } @Override diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTChildNodesSyncFeature.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTChildNodesSyncFeature.java deleted file mode 100644 index b1345f8ed..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTChildNodesSyncFeature.java +++ /dev/null @@ -1,151 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync; - -import java.util.Map; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.sync.ContainerChildrenSyncFeature; -import org.eclipse.papyrus.infra.sync.SyncBucket; -import org.eclipse.papyrus.infra.sync.SyncItem; - -import com.google.common.collect.MapMaker; - -/** - * Synchronization feature for the edit-parts visualizing the nodes in an UML-RT diagram. - */ -public abstract class UMLRTChildNodesSyncFeature<M extends EObject, N extends EObject> extends ContainerChildrenSyncFeature<M, N, EditPart> { - private final Map<N, N> lastKnownMatch = new MapMaker().weakKeys().weakValues().makeMap(); - - public UMLRTChildNodesSyncFeature(SyncBucket<M, EditPart, Notification> bucket) { - super(bucket); - } - - @Override - protected abstract Class<? extends UMLRTSyncRegistry<N>> getNestedSyncRegistryType(); - - @Override - protected UMLRTSyncRegistry<N> getNestedSyncRegistry() { - // This cast is safe because we narrowed the result type of the getNestedSyncRegistryType() method - return (UMLRTSyncRegistry<N>) super.getNestedSyncRegistry(); - } - - protected abstract SyncBucket<N, EditPart, Notification> createNestedSyncBucket(N model, EditPart editPart); - - protected abstract Iterable<? extends N> getModelContents(M model); - - @Override - protected boolean match(EObject sourceModel, EObject targetModel) { - boolean result = false; - - final UMLRTSyncRegistry<N> nestedRegistry = getNestedSyncRegistry(); - - // One case of a match is when I already have established synchronization between these elements - result = nestedRegistry.getModelType().isInstance(sourceModel) && nestedRegistry.getSemanticSyncRegistry().synchronizes(targetModel, nestedRegistry.getModelType().cast(sourceModel)); - - if (!result) { - // Otherwise, is the source object redefined by the target object? - N matched = nestedRegistry.getRedefinedElement(nestedRegistry.getModelType().cast(targetModel)); - result = (sourceModel.eResource() == null) - ? lastKnownMatch.get(targetModel) == sourceModel - : matched == sourceModel; - } - - return result; - } - - /** - * Finds and returns the model object in the {@code to} side of a synchronization object that corresponds to - * the given source object in the {@code from} side. - * - * @param from - * the source sync-item of a synchronization operation - * @param to - * the target sync-item of a synchronization operation - * @param sourceModel - * an object added to the {@link SyncItem#getModel() model} of the {@code from} item - * @return the corresponding object in the {@code model} of the {@code to} item - */ - @SuppressWarnings("unchecked") - @Override - protected EObject getTargetModel(SyncItem<M, EditPart> from, SyncItem<M, EditPart> to, EObject sourceModel) { - EObject result = sourceModel; - - for (N target : getModelContents((M) getModelOf(to.getBackend()))) { - if (match(sourceModel, target)) { - result = target; - break; - } - } - - return result; - } - - @Override - protected Command onTargetAdded(SyncItem<M, EditPart> from, EObject source, SyncItem<M, EditPart> to, EditPart target) { - final UMLRTSyncRegistry<N> nestedRegistry = getNestedSyncRegistry(); - - N nested = nestedRegistry.getModelOf(target); - N masterNested = (nested == null) ? null : nestedRegistry.getRedefinedElement(nested); - - if (masterNested != null) { - SyncItem<M, EditPart> master = getMaster(); - for (EditPart next : getContents(master.getBackend())) { - N matchNested = nestedRegistry.getModelOf(next); - if (matchNested == masterNested) { - // Remember this pairing in case the underlying model elements are later deleted - lastKnownMatch.put(nested, masterNested); - - // Synchronize our new child with this master edit-part - SyncBucket<N, EditPart, Notification> bucket = nestedRegistry.getBucket(masterNested); - if (bucket == null) { - bucket = createNestedSyncBucket(masterNested, next); - nestedRegistry.register(bucket); - } - bucket.add(target); - break; - } - } - } - - return null; - } - - @Override - protected Command onTargetRemoved(SyncItem<M, EditPart> to, EditPart target) { - final UMLRTSyncRegistry<N> nestedRegistry = getNestedSyncRegistry(); - - N nested = nestedRegistry.getModelOf(target); - N masterNested = (nested == null) ? null : nestedRegistry.getRedefinedElement(nested); - - if (masterNested != null) { - SyncItem<M, EditPart> master = getMaster(); - for (EditPart next : getContents(master.getBackend())) { - N matchNested = nestedRegistry.getModelOf(next); - if (matchNested == masterNested) { - SyncBucket<N, EditPart, Notification> bucket = nestedRegistry.getBucket(masterNested); - if (bucket != null) { - bucket.remove(target); - } - break; - } - } - } - - return null; - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTDiagramEdgesSyncFeature.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTDiagramEdgesSyncFeature.java deleted file mode 100644 index 8b51fbc08..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTDiagramEdgesSyncFeature.java +++ /dev/null @@ -1,142 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync; - -import java.util.Map; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.sync.DiagramEdgesSyncFeature; -import org.eclipse.papyrus.infra.sync.SyncBucket; -import org.eclipse.papyrus.infra.sync.SyncItem; - -import com.google.common.collect.MapMaker; - -/** - * Synchronization feature for the edit-parts visualizing connections in an UML-RT diagram. - */ -public abstract class UMLRTDiagramEdgesSyncFeature<M extends EObject, N extends EObject> extends DiagramEdgesSyncFeature<M, N, EditPart> { - private final Map<N, N> lastKnownMatch = new MapMaker().weakKeys().weakValues().makeMap(); - - public UMLRTDiagramEdgesSyncFeature(SyncBucket<M, EditPart, Notification> bucket) { - super(bucket); - } - - @Override - protected abstract Class<? extends UMLRTSyncRegistry<N>> getNestedSyncRegistryType(); - - @Override - protected UMLRTSyncRegistry<N> getNestedSyncRegistry() { - // This cast is safe because we narrowed the result type of the getNestedSyncRegistryType() method - return (UMLRTSyncRegistry<N>) super.getNestedSyncRegistry(); - } - - protected abstract SyncBucket<N, EditPart, Notification> createNestedSyncBucket(N model, EditPart editPart); - - protected abstract Iterable<? extends N> getModelContents(M model); - - @Override - protected boolean match(EObject sourceModel, EObject targetModel) { - final UMLRTSyncRegistry<N> nestedRegistry = getNestedSyncRegistry(); - - // Is the source object redefined by the target object? Or was it when last the source model was attached? - N matched = nestedRegistry.getRedefinedElement(nestedRegistry.getModelType().cast(targetModel)); - return (sourceModel.eResource() == null) - ? lastKnownMatch.get(targetModel) == sourceModel - : matched == sourceModel; - } - - /** - * Finds and returns the model object in the {@code to} side of a synchronization object that corresponds to - * the given source object in the {@code from} side. - * - * @param from - * the source sync-item of a synchronization operation - * @param to - * the target sync-item of a synchronization operation - * @param sourceModel - * an object added to the {@link SyncItem#getModel() model} of the {@code from} item - * @return the corresponding object in the {@code model} of the {@code to} item - */ - @SuppressWarnings("unchecked") - @Override - protected EObject getTargetModel(SyncItem<M, EditPart> from, SyncItem<M, EditPart> to, EObject sourceModel) { - EObject result = sourceModel; - - for (N target : getModelContents((M) getModelOf(to.getBackend()))) { - if (match(sourceModel, target)) { - result = target; - break; - } - } - - return result; - } - - @Override - protected Command onTargetAdded(SyncItem<M, EditPart> from, EObject source, SyncItem<M, EditPart> to, EditPart target) { - final UMLRTSyncRegistry<N> nestedRegistry = getNestedSyncRegistry(); - - N nested = nestedRegistry.getModelOf(target); - N masterNested = (nested == null) ? null : nestedRegistry.getRedefinedElement(nested); - - if (masterNested != null) { - SyncItem<M, EditPart> master = getMaster(); - for (EditPart next : getContents(master.getBackend())) { - N matchNested = nestedRegistry.getModelOf(next); - if (matchNested == masterNested) { - // Remember this pairing in case the underlying model elements are later deleted - lastKnownMatch.put(nested, masterNested); - - // Synchronize our new child with this master edit-part - SyncBucket<N, EditPart, Notification> bucket = nestedRegistry.getBucket(masterNested); - if (bucket == null) { - bucket = createNestedSyncBucket(masterNested, next); - nestedRegistry.register(bucket); - } - bucket.add(target); - break; - } - } - } - - return null; - } - - @Override - protected Command onTargetRemoved(SyncItem<M, EditPart> to, EditPart target) { - final UMLRTSyncRegistry<N> nestedRegistry = getNestedSyncRegistry(); - - N nested = nestedRegistry.getModelOf(target); - N masterNested = (nested == null) ? null : nestedRegistry.getRedefinedElement(nested); - - if (masterNested != null) { - SyncItem<M, EditPart> master = getMaster(); - for (EditPart next : getContents(master.getBackend())) { - N matchNested = nestedRegistry.getModelOf(next); - if (matchNested == masterNested) { - SyncBucket<N, EditPart, Notification> bucket = nestedRegistry.getBucket(masterNested); - if (bucket != null) { - bucket.remove(target); - } - break; - } - } - } - - return null; - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTMasterSlaveSyncBucket.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTMasterSlaveSyncBucket.java deleted file mode 100644 index df75b53c3..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTMasterSlaveSyncBucket.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.sync.EditPartMasterSlaveSyncBucket; -import org.eclipse.papyrus.infra.gmfdiag.common.sync.EditPartSyncItem; -import org.eclipse.papyrus.infra.sync.SyncItem; - -/** - * A specialized master-slave sync bucket that maps slave diagram edit-parts to the element that is redefined by the - * model element that they visualize. - */ -public abstract class UMLRTMasterSlaveSyncBucket<M extends EObject> extends EditPartMasterSlaveSyncBucket<M, EditPart> { - - private UMLRTSyncRegistry<M> registry; - - public UMLRTMasterSlaveSyncBucket(M model, EditPart master) { - super(model, master); - } - - void setRegistry(UMLRTSyncRegistry<M> registry) { - this.registry = registry; - } - - @Override - protected SyncItem<M, EditPart> encapsulate(EditPart element) { - SyncItem<M, EditPart> result; - - EObject model = ((View) element.getModel()).getElement(); - if (model == getModel()) { - // This is an encapsulation of the master edit-part. Do as usual - result = super.encapsulate(element); - } else { - result = encapsulateRedefinedElement(element); - } - - return result; - } - - protected SyncItem<M, EditPart> encapsulateRedefinedElement(EditPart editPart) { - return new EditPartSyncItem<M, EditPart>(editPart) { - @Override - public M getModel() { - return getRedefinedElement(super.getModel()); - } - }; - } - - protected M getRedefinedElement(M model) { - return registry.getRedefinedElement(model); - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTSyncRegistry.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTSyncRegistry.java deleted file mode 100644 index ade74d220..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/UMLRTSyncRegistry.java +++ /dev/null @@ -1,61 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.sync.EditPartSyncRegistry; -import org.eclipse.papyrus.infra.sync.SyncBucket; -import org.eclipse.papyrusrt.umlrt.core.sync.UMLSyncRegistry; - -/** - * Synchronization registry for UML-RT diagrams. - */ -public abstract class UMLRTSyncRegistry<M extends EObject> extends EditPartSyncRegistry<M, EditPart> { - private final Class<? extends UMLSyncRegistry<M>> semanticSyncRegistryType; - - public UMLRTSyncRegistry(Class<? extends UMLSyncRegistry<M>> semanticSyncRegistryType) { - super(); - - this.semanticSyncRegistryType = semanticSyncRegistryType; - } - - @Override - public void register(SyncBucket<M, EditPart, Notification> bucket) { - if (bucket instanceof UMLRTMasterSlaveSyncBucket<?>) { - ((UMLRTMasterSlaveSyncBucket<M>) bucket).setRegistry(this); - } - - super.register(bucket); - } - - @Override - public void unregister(SyncBucket<M, EditPart, Notification> bucket) { - super.unregister(bucket); - - if (bucket instanceof UMLRTMasterSlaveSyncBucket<?>) { - ((UMLRTMasterSlaveSyncBucket<?>) bucket).setRegistry(null); - } - } - - protected final UMLSyncRegistry<M> getSemanticSyncRegistry() { - return getSyncRegistry(semanticSyncRegistryType); - } - - public final M getRedefinedElement(M model) { - return getSemanticSyncRegistry().getModelOf(model); - } - -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDRegionSyncBucket.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDRegionSyncBucket.java deleted file mode 100644 index 8c30266d3..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDRegionSyncBucket.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.sync.NodePositionSyncFeature; -import org.eclipse.papyrus.infra.gmfdiag.common.sync.NodeSizeSyncFeature; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTMasterSlaveSyncBucket; -import org.eclipse.uml2.uml.Region; - -/** - * Synchronization bucket for regions in a UML-RT Capsule state machine diagram. - */ -public class CSMDRegionSyncBucket extends UMLRTMasterSlaveSyncBucket<Region> { - - public CSMDRegionSyncBucket(Region model, EditPart master) { - super(model, master); - - add(new NodeSizeSyncFeature<>(this)); - add(new NodePositionSyncFeature<>(this)); - add(new CSMDRegionVerticesSyncFeature(this)); - } - -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDRegionSyncRegistry.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDRegionSyncRegistry.java deleted file mode 100644 index 96f3f73b4..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDRegionSyncRegistry.java +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTSyncRegistry; -import org.eclipse.uml2.uml.Region; - -/** - * Synchronization registry for regions in state machine diagrams. - */ -public class CSMDRegionSyncRegistry extends UMLRTSyncRegistry<Region> { - - public CSMDRegionSyncRegistry() { - super(org.eclipse.papyrusrt.umlrt.core.sync.statemachine.RegionSyncRegistry.class); - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDRegionVerticesSyncFeature.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDRegionVerticesSyncFeature.java deleted file mode 100644 index bcc282052..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDRegionVerticesSyncFeature.java +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.sync.SyncBucket; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTChildNodesSyncFeature; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTSyncRegistry; -import org.eclipse.uml2.uml.Region; -import org.eclipse.uml2.uml.Vertex; - -/** - * Synchronization feature for the edit-parts visualizing the regions of a state machine - */ -public class CSMDRegionVerticesSyncFeature extends UMLRTChildNodesSyncFeature<Region, Vertex> { - - public CSMDRegionVerticesSyncFeature(SyncBucket<Region, EditPart, Notification> bucket) { - super(bucket); - } - - @Override - protected Class<? extends UMLRTSyncRegistry<Vertex>> getNestedSyncRegistryType() { - return CSMDVertexSyncRegistry.class; - } - - @Override - protected SyncBucket<Vertex, EditPart, Notification> createNestedSyncBucket(Vertex model, EditPart editPart) { - return new CSMDVertexSyncBucket(model, editPart); - } - - @Override - protected Iterable<? extends Vertex> getModelContents(Region model) { - return model.getSubvertices(); - } - -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineRegionsSyncFeature.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineRegionsSyncFeature.java deleted file mode 100644 index a01f879c7..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineRegionsSyncFeature.java +++ /dev/null @@ -1,60 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ECollections; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; -import org.eclipse.papyrus.infra.sync.SyncBucket; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTChildNodesSyncFeature; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTSyncRegistry; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Region; -import org.eclipse.uml2.uml.State; -import org.eclipse.uml2.uml.StateMachine; - -import com.google.common.collect.Iterables; - -/** - * Synchronization feature for the edit-parts visualizing the regions of a state machine - */ -public class CSMDStateMachineRegionsSyncFeature<M extends Element> extends UMLRTChildNodesSyncFeature<M, Region> { - - public CSMDStateMachineRegionsSyncFeature(SyncBucket<M, EditPart, Notification> bucket) { - super(bucket); - } - - @Override - protected Class<? extends UMLRTSyncRegistry<Region>> getNestedSyncRegistryType() { - return CSMDRegionSyncRegistry.class; - } - - @Override - protected SyncBucket<Region, EditPart, Notification> createNestedSyncBucket(Region model, EditPart editPart) { - return new CSMDRegionSyncBucket(model, editPart); - } - - @Override - protected Iterable<? extends Region> getModelContents(M model) { - return (model instanceof StateMachine) - ? ((StateMachine) model).getRegions() - : (model instanceof State) - ? ((State) model).getRegions() - : ECollections.<Region> emptyEList(); - } - - -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineSyncBucket.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineSyncBucket.java deleted file mode 100644 index 0a18d02e8..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineSyncBucket.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.sync.NodeSizeSyncFeature; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTMasterSlaveSyncBucket; -import org.eclipse.uml2.uml.StateMachine; - -/** - * Synchronization bucket for the state machine frame in a UML-RT Capsule state machine diagram. - */ -public class CSMDStateMachineSyncBucket extends UMLRTMasterSlaveSyncBucket<StateMachine> { - - public CSMDStateMachineSyncBucket(StateMachine model, EditPart master) { - super(model, master); - - add(new NodeSizeSyncFeature<>(this)); - add(new CSMDStateMachineRegionsSyncFeature<>(this)); - add(new CSMDStateMachineTransitionsSyncFeature(this)); - } - -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineSyncRegistry.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineSyncRegistry.java deleted file mode 100644 index af244b74f..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineSyncRegistry.java +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTSyncRegistry; -import org.eclipse.uml2.uml.StateMachine; - -/** - * Synchronization registry for state machine diagrams. - */ -public class CSMDStateMachineSyncRegistry extends UMLRTSyncRegistry<StateMachine> { - - public CSMDStateMachineSyncRegistry() { - super(org.eclipse.papyrusrt.umlrt.core.sync.statemachine.StateMachineSyncRegistry.class); - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineTransitionsSyncFeature.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineTransitionsSyncFeature.java deleted file mode 100644 index 35c0a728d..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDStateMachineTransitionsSyncFeature.java +++ /dev/null @@ -1,138 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import java.util.Iterator; -import java.util.Queue; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; -import org.eclipse.papyrus.infra.sync.SyncBucket; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTDiagramEdgesSyncFeature; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTSyncRegistry; -import org.eclipse.uml2.uml.Region; -import org.eclipse.uml2.uml.State; -import org.eclipse.uml2.uml.StateMachine; -import org.eclipse.uml2.uml.Transition; - -import com.google.common.collect.AbstractIterator; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; - -/** - * Synchronization feature for the edit-parts visualizing the transitions of a state machine - */ -public class CSMDStateMachineTransitionsSyncFeature extends UMLRTDiagramEdgesSyncFeature<StateMachine, Transition> { - - public CSMDStateMachineTransitionsSyncFeature(SyncBucket<StateMachine, EditPart, Notification> bucket) { - super(bucket); - } - - @Override - protected Class<? extends UMLRTSyncRegistry<Transition>> getNestedSyncRegistryType() { - return CSMDTransitionSyncRegistry.class; - } - - @Override - protected SyncBucket<Transition, EditPart, Notification> createNestedSyncBucket(Transition model, EditPart editPart) { - return new CSMDTransitionSyncBucket(model, editPart); - } - - @Override - protected Iterable<? extends Transition> getModelContents(final StateMachine model) { - return new Iterable<Transition>() { - @Override - public Iterator<Transition> iterator() { - return new AbstractIterator<Transition>() { - // Breadth-first walk of the regions in the state machine and its composite states - Queue<Region> regions = Lists.newLinkedList(model.getRegions()); - Iterator<Transition> current; - - @Override - protected Transition computeNext() { - Transition result = null; - - while (result == null) { - if ((current == null) || !current.hasNext()) { - current = null; // In case it was just exhausted - - Region nextRegion = regions.poll(); - if (nextRegion != null) { - // Add regions of composite states - for (State next : Iterables.filter(nextRegion.getSubvertices(), State.class)) { - if (next.isComposite()) { - regions.addAll(next.getRegions()); - } - } - - current = nextRegion.getTransitions().iterator(); - } - } - - if (current == null) { - break; - } else if (current.hasNext()) { - result = current.next(); - } - } - - return (result == null) ? endOfData() : result; - } - }; - } - }; - } - - EditPart findEditPart(EditPart diagram, EObject object) { - EditPart result = null; - - for (TreeIterator<EditPart> iter = DiagramEditPartsUtil.getAllContents(diagram, false); (result == null) && iter.hasNext();) { - EditPart next = iter.next(); - Object view = next.getModel(); - if (!(view instanceof View)) { - iter.prune(); - } else { - EObject model = ((View) view).getElement(); - if ((model == null) || !EcoreUtil.isAncestor(model, object)) { - iter.prune(); - } else if (model == object) { - result = next; - } - } - } - - return result; - } - - @Override - protected EObject getSourceElement(EObject connectionElement) { - if (connectionElement instanceof Transition) { - return ((Transition) connectionElement).getSource(); - } - return null; - } - - @Override - protected EObject getTargetElement(EObject connectionElement) { - if (connectionElement instanceof Transition) { - return ((Transition) connectionElement).getTarget(); - } - return null; - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDTransitionSyncBucket.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDTransitionSyncBucket.java deleted file mode 100644 index a3471044e..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDTransitionSyncBucket.java +++ /dev/null @@ -1,31 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.gef.EditPart; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTMasterSlaveSyncBucket; -import org.eclipse.uml2.uml.Transition; - -/** - * Synchronization bucket for triggers in a UML-RT Capsule state machine diagram. - */ -public class CSMDTransitionSyncBucket extends UMLRTMasterSlaveSyncBucket<Transition> { - - public CSMDTransitionSyncBucket(Transition model, EditPart master) { - super(model, master); - - // Don't attempt to synchronize bendpoints - } - -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDTransitionSyncRegistry.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDTransitionSyncRegistry.java deleted file mode 100644 index afa697619..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDTransitionSyncRegistry.java +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTSyncRegistry; -import org.eclipse.uml2.uml.Transition; - -/** - * Synchronization registry for the transitions in a state machine diagrams. - */ -public class CSMDTransitionSyncRegistry extends UMLRTSyncRegistry<Transition> { - - public CSMDTransitionSyncRegistry() { - super(org.eclipse.papyrusrt.umlrt.core.sync.statemachine.TransitionSyncRegistry.class); - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDVertexSyncBucket.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDVertexSyncBucket.java deleted file mode 100644 index 45706bd1c..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDVertexSyncBucket.java +++ /dev/null @@ -1,41 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.gef.EditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.sync.NodePositionSyncFeature; -import org.eclipse.papyrus.infra.gmfdiag.common.sync.NodeSizeSyncFeature; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTMasterSlaveSyncBucket; -import org.eclipse.uml2.uml.FinalState; -import org.eclipse.uml2.uml.State; -import org.eclipse.uml2.uml.Vertex; - -/** - * Synchronization bucket for vertices in a UML-RT Capsule state machine diagram. - */ -public class CSMDVertexSyncBucket extends UMLRTMasterSlaveSyncBucket<Vertex> { - - public CSMDVertexSyncBucket(Vertex model, EditPart master) { - super(model, master); - - add(new NodeSizeSyncFeature<>(this)); - add(new NodePositionSyncFeature<>(this)); - - // Final states don't contain regions - if ((model instanceof State) && !(model instanceof FinalState)) { - add(new CSMDStateMachineRegionsSyncFeature<>(this)); - } - } - -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDVertexSyncRegistry.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDVertexSyncRegistry.java deleted file mode 100644 index cdd77ffb3..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CSMDVertexSyncRegistry.java +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.UMLRTSyncRegistry; -import org.eclipse.uml2.uml.Vertex; - -/** - * Synchronization registry for the vertices in a state machine diagrams. - */ -public class CSMDVertexSyncRegistry extends UMLRTSyncRegistry<Vertex> { - - public CSMDVertexSyncRegistry() { - super(org.eclipse.papyrusrt.umlrt.core.sync.statemachine.VertexSyncRegistry.class); - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CapsuleStatemachineDiagramSyncTrigger.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CapsuleStatemachineDiagramSyncTrigger.java deleted file mode 100644 index b1062408f..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/sync/statemachine/CapsuleStatemachineDiagramSyncTrigger.java +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.sync.statemachine; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.papyrus.infra.core.utils.AdapterUtils; -import org.eclipse.papyrus.infra.sync.SyncBucket; -import org.eclipse.papyrus.infra.sync.service.AbstractSyncTrigger; -import org.eclipse.papyrus.infra.sync.service.ISyncAction; -import org.eclipse.papyrus.infra.sync.service.ISyncService; -import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.Activator; -import org.eclipse.uml2.uml.StateMachine; - -/** - * Capsule state machine diagram synchronization trigger. - */ -public class CapsuleStatemachineDiagramSyncTrigger extends AbstractSyncTrigger { - - public CapsuleStatemachineDiagramSyncTrigger() { - super(); - } - - @Override - public ISyncAction trigger(ISyncService syncService, Object object) { - ISyncAction result = null; - - if (object instanceof DiagramEditPart) { - // We're interested in the state machine frame edit part - EditPart stateMachine = ((DiagramEditPart) object).getPrimaryChildEditPart(); - if (stateMachine != null) { - result = synchronizeStateMachineAction(); - } - } - - return result; - } - - protected ISyncAction synchronizeStateMachineAction() { - return new ISyncAction() { - - @Override - public IStatus perform(ISyncService syncService, Object object) { - IStatus result = Status.OK_STATUS; - - // We're interested in the state machine frame edit part - EditPart stateMachineFrame = ((DiagramEditPart) object).getPrimaryChildEditPart(); - StateMachine stateMachine = AdapterUtils.adapt(stateMachineFrame, StateMachine.class, null); - if (stateMachine == null) { - result = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Edit-part does not visualize a StateMachine"); - } else { - // Set up the state machine diagram as a sync master for any potential redefining machines - CSMDStateMachineSyncRegistry registry = syncService.getSyncRegistry(CSMDStateMachineSyncRegistry.class); - if (registry != null) { - SyncBucket<StateMachine, EditPart, Notification> bucket = registry.getBucket(stateMachine); - if (bucket == null) { - bucket = new CSMDStateMachineSyncBucket(stateMachine, stateMachineFrame); - registry.register(bucket); - } - - // Look for a master state machine to synchronize with - StateMachine master = registry.getRedefinedElement(stateMachine); - if (master != null) { - SyncBucket<StateMachine, EditPart, Notification> masterBucket = registry.getBucket(master); - if (masterBucket != null) { - masterBucket.add(stateMachineFrame); - } - } - } - } - - return result; - } - }; - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/types/advice/DeleteInheritedViewsAdvice.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/types/advice/DeleteInheritedViewsAdvice.java new file mode 100644 index 000000000..f91f49188 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/types/advice/DeleteInheritedViewsAdvice.java @@ -0,0 +1,90 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.types.advice; + +import java.util.Optional; +import java.util.stream.Stream; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrusrt.umlrt.core.utils.UMLRTCommandUtils; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.uml2.uml.NamedElement; + +/** + * Advice that handles the special case of notation dependents deletion for + * inherited views: these are views that reference the inherited element + * that is not being deleted but that actually need to be deleted because + * a virtual element redefining it that the view actually visualizes was deleted. + */ +public class DeleteInheritedViewsAdvice extends AbstractEditHelperAdvice { + + /** + * Initializes me. + */ + public DeleteInheritedViewsAdvice() { + super(); + } + + @Override + protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request) { + ICommand result = null; + + EObject destructee = request.getElementToDestroy(); + if (destructee instanceof NamedElement) { + result = getBeforeDestroyDependentsCommand(request, (NamedElement) destructee); + } + + return result; + } + + protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request, NamedElement destructee) { + ICommand result; + + Optional<UMLRTNamedElement> virtual = Optional.ofNullable(UMLRTFactory.create(destructee)) + .filter(UMLRTNamedElement::isVirtualRedefinition); + Optional<UMLRTNamedElement> context = virtual.map(UMLRTNamedElement::getRedefinitionContext); + Optional<UMLRTNamedElement> inherited = virtual.map(UMLRTNamedElement::getInheritedElement); + + // Look for views that visualize this element but which in the notation + // model actually reference its inherited element. + Stream<View> candidates = context.flatMap(__ -> inherited.map(this::getViews)) + .orElseGet(Stream::empty); + + NamedElement contextUML = context.map(UMLRTNamedElement::toUML).orElse(null); + + result = candidates.filter(v -> ViewUtil.getContainerView(v).getElement() == contextUML) + .map(request::getDestroyDependentCommand) + .reduce(UMLRTCommandUtils::flatCompose) + .orElse(null); + + return result; + } + + Stream<View> getViews(UMLRTNamedElement element) { + return EMFHelper.getUsages(element.toUML()).stream() + .filter(s -> s.getEStructuralFeature() == NotationPackage.Literals.VIEW__ELEMENT) + .map(EStructuralFeature.Setting::getEObject) + .map(View.class::cast) + .filter(v -> v.eResource() != null); // Only views not already deleted + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/utils/EditPartInheritanceUtils.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/utils/EditPartInheritanceUtils.java new file mode 100644 index 000000000..73032814f --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/utils/EditPartInheritanceUtils.java @@ -0,0 +1,190 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.IInheritableEditPart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTConnector; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTReplicatedElement; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Connector; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Port; +import org.eclipse.uml2.uml.Property; + +/** + * Static utilities for externalization of common behaviour of edit-parts + * that support inheritance of views from other diagrams. + * + * @see IInheritableEditPart + */ +public class EditPartInheritanceUtils { + + /** + * Not instantiable by clients + */ + private EditPartInheritanceUtils() { + super(); + } + + public static EObject resolveSemanticElement(IInheritableEditPart editPart, EObject result) { + if (result instanceof Property) { + Property property = (Property) result; + Class context = editPart.resolveContext(Class.class); + if ((context != null) && (context != property.getClass_())) { + // It's inherited + Property redefiningProperty = resolveRedefiningProperty(property, context); + if (redefiningProperty != null) { + result = redefiningProperty; + } + } + } else if (result instanceof Connector) { + UMLRTConnector connector = UMLRTConnector.getInstance((Connector) result); + if (connector != null) { + Class context = editPart.resolveContext(Class.class); + UMLRTCapsule capsule = (context == null) ? null : UMLRTCapsule.getInstance(context); + if (context != null) { + connector = capsule.getRedefinitionOf(connector); + if (connector != null) { + result = connector.toUML(); + } + } + } + } + + return result; + } + + static Property resolveRedefiningProperty(Property inheritedProperty, Class context) { + return resolveRedefiningProperty(inheritedProperty, UMLRTCapsule.getInstance(context)); + } + + @SuppressWarnings("unchecked") + static <T extends Property> T resolveRedefiningProperty(T inheritedProperty, UMLRTCapsule capsule) { + T result = null; + + UMLRTReplicatedElement redefined = (UMLRTReplicatedElement) UMLRTFactory.create(inheritedProperty); + + if ((capsule != null) && (redefined != null)) { + result = (T) ((redefined instanceof UMLRTPort) ? capsule.getPorts() : capsule.getCapsuleParts()).stream() + .filter(p -> p.redefines(redefined)) + .findFirst() + .map(UMLRTReplicatedElement::toUML) + .orElse(null); + } + + return result; + } + + public static UMLRTCapsule getContextCapsule(View view) { + UMLRTCapsule result = null; + + for (View next = view; (result == null) && (next != null); next = ViewUtil.getContainerView(next)) { + EObject semantic = ViewUtil.resolveSemanticElement(next); + if (semantic instanceof org.eclipse.uml2.uml.Class) { + result = UMLRTCapsule.getInstance((org.eclipse.uml2.uml.Class) semantic); + } + } + + return result; + } + + public static EObject resolveSemanticElement(View view) { + EObject result = ViewUtil.resolveSemanticElement(view); + + UMLRTCapsule capsule = getContextCapsule(view); + if (capsule != null) { + if (result instanceof Port) { + UMLRTPort port = resolvePort((Port) result, capsule, view); + if (port != null) { + result = port.toUML(); + } + } else if (result instanceof Property) { + UMLRTCapsulePart part = resolveCapsulePart((Property) result, capsule, view); + if (part != null) { + result = part.toUML(); + } + } + } + + return result; + } + + public static UMLRTPort resolvePort(Port uml, UMLRTCapsule capsule, View portView) { + UMLRTPort result = null; + + View portParentView = ViewUtil.getContainerView(portView); + EObject portParent = ViewUtil.resolveSemanticElement(portParentView); + if (portParent instanceof Property) { + // It could be inherited + UMLRTCapsulePart part = resolveCapsulePart((Property) portParent, capsule, portParentView); + if (part != null) { + // Resolve the port in the part's capsule type + UMLRTCapsule type = part.getType(); + if (type != null) { + result = UMLRTPort.getInstance(resolveRedefiningProperty(uml, type)); + } + } + } else { + // It's a port on the capsule + result = UMLRTPort.getInstance(resolveRedefiningProperty(uml, capsule)); + } + + return result; + } + + public static UMLRTCapsulePart resolveCapsulePart(Property uml, UMLRTCapsule capsule, View partView) { + Property result = resolveRedefiningProperty(uml, capsule); + + return (result == null) + ? UMLRTCapsulePart.getInstance(uml) + : UMLRTCapsulePart.getInstance(result); + } + + public static Object getAdapter(IInheritableEditPart editPart, @SuppressWarnings("rawtypes") java.lang.Class key, Object result) { + if (result instanceof EObject) { + View view = editPart.getNotationView(); + if (result == view.getElement()) { + result = editPart.resolveSemanticElement(); + } + } + + return result; + } + + public static UMLRTCapsule getContextCapsule(UMLRTNamedElement rtElement) { + UMLRTCapsule result = null; + + NamedElement element = (rtElement == null) ? null : rtElement.toUML(); + if (element != null) { + for (Element owner = element.getOwner(); (result == null) && (owner != null); owner = owner.getOwner()) { + if (owner instanceof Class) { + Class class_ = (Class) owner; + result = UMLRTCapsule.getInstance(class_); + } + } + } + + return result; + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/utils/RTPropertyLabelHelper.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/utils/RTPropertyLabelHelper.java index 8710a7055..4b63c6afb 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/utils/RTPropertyLabelHelper.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/internal/utils/RTPropertyLabelHelper.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.papyrus.uml.diagram.common.helper.PropertyLabelHelper; import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.IRTNameEditPart; @@ -42,6 +43,11 @@ public class RTPropertyLabelHelper extends PropertyLabelHelper { } @Override + public Property getUMLElement(GraphicalEditPart editPart) { + return (Property) ((IGraphicalEditPart) editPart).resolveSemanticElement(); + } + + @Override public Image getImage(GraphicalEditPart editPart) { return (editPart instanceof IRTNameEditPart) ? ((IRTNameEditPart) editPart).getRTLabelIcon() diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/provider/RedefinitionDecoratorProvider.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/provider/RedefinitionDecoratorProvider.java new file mode 100644 index 000000000..d3273de68 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/provider/RedefinitionDecoratorProvider.java @@ -0,0 +1,72 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.provider; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; +import org.eclipse.gmf.runtime.common.core.service.IOperation; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation; +import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider; +import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.decorator.RedefinitionDecorator; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.IInheritableEditPart; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.RTPortOnPartEditPart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.uml2.uml.NamedElement; + +/** + * Provider of redefinition/inheritance decorators in the diagrams. + */ +public class RedefinitionDecoratorProvider extends AbstractProvider implements IDecoratorProvider { + + private static final String DECORATION_KEY = "umlrt.redefinition"; //$NON-NLS-1$ + + @Override + public boolean provides(IOperation operation) { + boolean result = false; + + IDecoratorTarget target = ((CreateDecoratorsOperation) operation).getDecoratorTarget(); + EditPart editPart = target.getAdapter(EditPart.class); + + // Don't show the decorations on ports on parts, which are just too small + if ((editPart instanceof IInheritableEditPart) + && !(editPart instanceof RTPortOnPartEditPart) + && !((IInheritableEditPart) editPart).isDependentChild()) { + + IGraphicalEditPart graphical = (IGraphicalEditPart) editPart; + EObject semantic = graphical.resolveSemanticElement(); + + // Only things that the façade API recognizes can be inherited/redefined + if (semantic instanceof NamedElement) { + UMLRTNamedElement element = UMLRTFactory.create((NamedElement) semantic); + result = element != null; + } + } + + return result; + } + + @Override + public void createDecorators(IDecoratorTarget decoratorTarget) { + final View node = decoratorTarget.getAdapter(View.class); + + if (node != null) { + // Install the decorator + decoratorTarget.installDecorator(DECORATION_KEY, new RedefinitionDecorator(decoratorTarget)); + } + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/utils/DrawFigureUtils.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/utils/DrawFigureUtils.java index 66e50bcc6..050f3a7d8 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/utils/DrawFigureUtils.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/utils/DrawFigureUtils.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2016 CEA LIST and others. + * Copyright (c) 2016 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -9,6 +9,7 @@ * Contributors: * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation * Ansgar Radermacher (CEA) ansgar.radermacher@cea.fr - improvements of stacking figure rendering + * Christian W. Damus - bug 467545 * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils; @@ -16,6 +17,8 @@ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils; import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IRoundedRectangleFigure; @@ -212,9 +215,13 @@ public class DrawFigureUtils { * @param figure * the figure on which the pattern is applied * @param graphics - * The current graphics being draw + * The current graphics being drawn + * @param alpha + * the transparency to apply to the pattern + * @param patternPath + * the path in the UI bundle of the pattern to draw */ - public static void paintPattern(final IRoundedRectangleFigure figure, final Graphics graphics, final String patternPath) { + public static void paintPattern(final IRoundedRectangleFigure figure, final Graphics graphics, final int alpha, final String patternPath) { // Create the Image of the pattern Image hashImage = Activator.getPluginIconImage(org.eclipse.papyrusrt.umlrt.tooling.ui.Activator.PLUGIN_ID, patternPath); @@ -245,6 +252,7 @@ public class DrawFigureUtils { clipRectangle.translate(getTranslation(0, o)); graphics.setClip(clipRectangle); + graphics.setAlpha(alpha); graphics.drawImage(hashImage, origin); graphics.popState(); // translate the original point accordingly @@ -336,4 +344,75 @@ public class DrawFigureUtils { Point translation = new Point(index * o.xOffSet, (o.nl - index) * o.yOffSet); return translation; } + + /** + * Obtains a lighter hue of the given {@code color}. Foreground colors + * are lightened to a lesser degree than backgrounds, for visual clarity. + * + * @param color + * a color + * @param foreground + * whether it is use for a foreground kind of drawing + * + * @return the lighter hue + */ + public static Color getLighterColor(Color color, boolean foreground) { + return DiagramColorRegistry.getInstance().getColor( + getLighterColor(color.getRGB(), foreground)); + } + + /** + * Obtains a lighter hue of the given {@code rgb} color. Foreground colors + * are lightened to a lesser degree than backgrounds, for visual clarity. + * + * @param rgb + * an RGB color specification + * @param foreground + * whether it is use for a foreground kind of drawing + * + * @return the lighter hue + */ + public static RGB getLighterColor(RGB rgb, boolean foreground) { + if (foreground) { + return new RGB( + (rgb.red + (255 - rgb.red) * 3 / 5) & 0xFF, + (rgb.green + (255 - rgb.green) * 3 / 5) & 0xFF, + (rgb.blue + (255 - rgb.blue) * 3 / 5) & 0xFF); + } else { + return new RGB( + (rgb.red + (255 - rgb.red) * 3 / 4) & 0xFF, + (rgb.green + (255 - rgb.green) * 3 / 4) & 0xFF, + (rgb.blue + (255 - rgb.blue) * 3 / 4) & 0xFF); + } + } + + /** + * Obtains a lighter hue of the given color. Foreground colors + * are lightened to a lesser degree than backgrounds, for visual clarity. + * + * @param colorID + * the numeric value of a color + * @param foreground + * whether it is use for a foreground kind of drawing + * + * @return the lighter hue + */ + public static int getLighterColor(int colorID, boolean foreground) { + return FigureUtilities.RGBToInteger( + getLighterColor(FigureUtilities.integerToRGB(colorID), foreground)); + } + + /** + * Obtains a modified alpha-channel (opacity) value for lighter-impact + * rendering of background images or patterns in situations where a + * figure uses the {@linkplain #getLighterColor(Color, boolean) lighter background} + * colour. + * + * @param alpha + * the figure's configured alpha value + * @return a suitably lighter alpha value + */ + public static int getLighterAlpha(int alpha) { + return Math.max(2, alpha / 4); + } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/utils/UMLRTEditPartUtils.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/utils/UMLRTEditPartUtils.java index 1df4aa923..7d435425c 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/utils/UMLRTEditPartUtils.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/utils/UMLRTEditPartUtils.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2016 Christian W. Damus and others. + * Copyright (c) 2016, 2017 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -13,13 +13,18 @@ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils; +import static org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.DrawFigureUtils.getLighterColor; + import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; +import org.eclipse.draw2d.Figure; import org.eclipse.draw2d.geometry.Point; +import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EObject; import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPartViewer; @@ -27,9 +32,13 @@ import org.eclipse.gef.GraphicalViewer; import org.eclipse.gef.Request; import org.eclipse.gef.RequestConstants; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; +import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper; import org.eclipse.papyrus.infra.tools.util.TypeUtils; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.IInheritableEditPart; +import org.eclipse.swt.graphics.Color; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchWindow; @@ -190,4 +199,58 @@ public class UMLRTEditPartUtils { .filter(IGraphicalEditPart.class::isInstance) .map(IGraphicalEditPart.class::cast); } + + public static void updateBackgroundColor(IInheritableEditPart editPart, NodeFigure figure) { + if (editPart.isSemanticInherited()) { + // We present inherited elements in a lighter colour + if (figure.isUsingGradient()) { + figure.setGradientData(getLighterColor(figure.getGradientColor1(), false), + getLighterColor(figure.getGradientColor2(), false), + figure.getGradientStyle()); + } else { + Color bg = figure.getBackgroundColor(); + if (bg != null) { + bg = getLighterColor(bg, false); + figure.setBackgroundColor(bg); + figure.setIsUsingGradient(false); + figure.setGradientData(-1, -1, 0); + } + } + } + } + + public static void updateForegroundColor(IInheritableEditPart editPart, Figure figure) { + Color fg = figure.getForegroundColor(); + if ((fg != null) && editPart.isSemanticInherited()) { + // We present inherited elements in a lighter colour + fg = getLighterColor(fg, true); + figure.setForegroundColor(fg); + } + } + + + public static View findView(View root, String type, EObject semantic) { + View result = null; + + if (Objects.equals(root.getType(), type) && (root.getElement() == semantic)) { + result = root; + } else { + for (TreeIterator<EObject> iter = root.eAllContents(); (result == null) && iter.hasNext();) { + EObject next = iter.next(); + if (!(next instanceof View)) { + iter.prune(); + } else { + View view = (View) next; + if (Objects.equals(view.getType(), type) && (view.getElement() == semantic)) { + result = view; + break; + } + } + } + } + + return result; + } + + } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/META-INF/MANIFEST.MF b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/META-INF/MANIFEST.MF index f8e5a2ea0..9ee2263ad 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/META-INF/MANIFEST.MF +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/META-INF/MANIFEST.MF @@ -1,48 +1,50 @@ Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrusrt.umlrt.tooling.modelexplorer + ;singleton:=true +Export-Package: org.eclipse.papyrusrt.umlrt.tooling.modelexplorer,org. + eclipse.papyrusrt.umlrt.tooling.modelexplorer.copy,org.eclipse.papyru + srt.umlrt.tooling.modelexplorer.handlers,org.eclipse.papyrusrt.umlrt. + tooling.modelexplorer.provider,org.eclipse.papyrusrt.umlrt.tooling.mo + delexplorer.queries,org.eclipse.papyrusrt.umlrt.tooling.modelexplorer + .queries.collaboration,org.eclipse.papyrusrt.umlrt.tooling.modelexplo + rer.utils Bundle-Name: Modelexplorer customization for Papyrus-RT (Incubation) -Bundle-SymbolicName: org.eclipse.papyrusrt.umlrt.tooling.modelexplorer;singleton:=true Bundle-Version: 0.8.0.qualifier -Bundle-Activator: org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.Activator -Bundle-Vendor: Eclipse Modeling Project -Require-Bundle: org.eclipse.ui;bundle-version="[3.108.0,4.0.0)", - org.eclipse.core.runtime;bundle-version="[3.12.0,4.0.0)", - org.eclipse.papyrus.uml.diagram.common;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.newchild;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.infra.types;bundle-version="[2.0.0,3.0.0)", - org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)", - org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)", - org.eclipse.papyrus.emf.facet.efacet.core;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.emf.facet.query.java.core;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.uml.tools;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.emf.facet.custom.metamodel;bundle-version="[1.2.0,2.0.0)", - org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.9.0,2.0.0)", - org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.services.labelprovider;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.emf.facet.custom.core;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.widgets;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.uml.modelexplorer;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.views.modelexplorer;bundle-version="[2.0.0,3.0.0)", - org.eclipse.core.expressions;bundle-version="[3.4.600,4.0.0)", - org.eclipse.papyrus.infra.sync;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[2.0.0,3.0.0)", - org.eclipse.papyrus.infra.core;bundle-version="[2.0.0,3.0.0)", - com.google.guava;bundle-version="[11.0.0,16.0.0)", - org.eclipse.papyrusrt.umlrt.core;bundle-version="[0.8.0,1.0.0)", - org.eclipse.papyrusrt.umlrt.profile;bundle-version="[0.8.0,1.0.0)", - org.eclipse.papyrus.uml.filters;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrusrt.umlrt.tooling.filter;bundle-version="[0.8.0,1.0.0)", - org.eclipse.papyrus.infra.ui.emf;bundle-version="[1.2.0,2.0.0)", - org.eclipse.papyrusrt.umlrt.tooling.ui;bundle-version="[0.8.0,1.0.0)", - org.eclipse.papyrus.views.modelexplorer.newchild;bundle-version="[1.2.0,2.0.0)" +Require-Bundle: org.eclipse.ui;bundle-version="[3.108.0,4.0.0)",org.ec + lipse.core.runtime;bundle-version="[3.12.0,4.0.0)",org.eclipse.papyru + s.uml.diagram.common;bundle-version="[2.0.0,3.0.0)",org.eclipse.papyr + us.infra.newchild;bundle-version="[1.2.0,2.0.0)",org.eclipse.papyrus. + infra.types;bundle-version="[2.0.0,3.0.0)",org.eclipse.emf.ecore;bund + le-version="[2.12.0,3.0.0)",org.eclipse.uml2.uml;bundle-version="[5.2 + .0,6.0.0)",org.eclipse.papyrus.emf.facet.efacet.core;bundle-version=" + [2.0.0,3.0.0)",org.eclipse.papyrus.emf.facet.query.java.core;bundle-v + ersion="[2.0.0,3.0.0)",org.eclipse.papyrus.uml.tools;bundle-version=" + [2.0.0,3.0.0)",org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3 + .0.0)",org.eclipse.papyrus.emf.facet.custom.metamodel;bundle-version= + "[1.2.0,2.0.0)",org.eclipse.gmf.runtime.emf.type.core;bundle-version= + "[1.9.0,2.0.0)",org.eclipse.papyrus.infra.core.log;bundle-version="[1 + .2.0,2.0.0)",org.eclipse.papyrus.emf.facet.custom.ui;bundle-version=" + [2.0.0,3.0.0)",org.eclipse.papyrus.infra.services.labelprovider;bundl + e-version="[1.2.0,2.0.0)",org.eclipse.papyrus.emf.facet.custom.core;b + undle-version="[2.0.0,3.0.0)",org.eclipse.papyrus.infra.widgets;bundl + e-version="[2.0.0,3.0.0)",org.eclipse.papyrus.uml.modelexplorer;bundl + e-version="[1.2.0,2.0.0)",org.eclipse.papyrus.views.modelexplorer;bun + dle-version="[2.0.0,3.0.0)",org.eclipse.core.expressions;bundle-versi + on="[3.4.600,4.0.0)",org.eclipse.papyrus.infra.gmfdiag.common;bundle- + version="[2.0.0,3.0.0)",org.eclipse.papyrus.infra.core;bundle-version + ="[2.0.0,3.0.0)",com.google.guava;bundle-version="[11.0.0,16.0.0)",or + g.eclipse.papyrusrt.umlrt.core;bundle-version="[0.8.0,1.0.0)",org.ecl + ipse.papyrusrt.umlrt.profile;bundle-version="[0.8.0,1.0.0)",org.eclip + se.papyrus.uml.filters;bundle-version="[1.2.0,2.0.0)",org.eclipse.pap + yrusrt.umlrt.tooling.filter;bundle-version="[0.8.0,1.0.0)",org.eclips + e.papyrus.infra.ui.emf;bundle-version="[1.2.0,2.0.0)",org.eclipse.pap + yrusrt.umlrt.tooling.ui;bundle-version="[0.8.0,1.0.0)",org.eclipse.pa + pyrus.views.modelexplorer.newchild;bundle-version="[1.2.0,2.0.0)",org + .eclipse.papyrusrt.umlrt.uml;bundle-version="0.8.0" +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.Ac + tivator Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.papyrusrt.umlrt.tooling.modelexplorer, - org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.copy, - org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.handlers, - org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.provider, - org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries, - org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.collaboration, - org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.utils +Bundle-Vendor: Eclipse Modeling Project + diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Protocol.custom b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Protocol.custom index bbcb37bd8..964306cda 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Protocol.custom +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Protocol.custom @@ -1,246 +1,131 @@ <?xml version="1.0" encoding="UTF-8"?> -<custom:Customization - xmi:version="2.0" - xmlns:xmi="http://www.omg.org/XMI" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:custom="http://www.eclipse.org/papyrus/emf/facet/custom/0.2.incubation/custom" - xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" - xmlns:efacet="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet" - xmlns:javaQuery="http://www.eclipse.org/papyrus/emf/facet/query/java/0.2.incubation/javaquery" - xmlns:query="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet/query" - name="UML-RT Protocols" - documentation="Simplification of the display of UML-RT protocols" - mustBeLoadedByDefault="true" - rank="-100"> - <eClassifiers - xsi:type="efacet:Facet" - name="ProtocolContainerFacet" - documentation="This element represents the Package stereotyped PackageContainer as protocol definition" - conformanceTypedElement="//ProtocolContainerFacet/isProtocolContainer"> - <extendedMetaclass - href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> - <facetOperations - name="isProtocolContainer" - documentation="Test if the current Package is stereotyped ProtocolContainer"> - <eType - xsi:type="ecore:EDataType" - href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolContainerQuery"/> +<custom:Customization xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:custom="http://www.eclipse.org/papyrus/emf/facet/custom/0.2.incubation/custom" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:efacet="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet" xmlns:javaQuery="http://www.eclipse.org/papyrus/emf/facet/query/java/0.2.incubation/javaquery" xmlns:query="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet/query" name="UML-RT Protocols" documentation="Simplification of the display of UML-RT protocols" mustBeLoadedByDefault="true" rank="-100"> + <eClassifiers xsi:type="efacet:Facet" name="ProtocolContainerFacet" documentation="This element represents the Package stereotyped PackageContainer as protocol definition" conformanceTypedElement="//ProtocolContainerFacet/isProtocolContainer"> + <extendedMetaclass href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + <facetOperations name="isProtocolContainer" documentation="Test if the current Package is stereotyped ProtocolContainer"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolContainerQuery"/> </facetOperations> </eClassifiers> - <eClassifiers - xsi:type="efacet:Facet" - name="ProtocolContainerContainersFacet" - documentation="This element represents the Packages that contain ProtocolContainers" - conformanceTypedElement="//ProtocolContainerContainersFacet/isProtocolContainersContainer"> - <extendedMetaclass - href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> - <facetOperations - name="isProtocolContainersContainer"> - <eType - xsi:type="ecore:EDataType" - href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolContainersContainerQuery"/> + <eClassifiers xsi:type="efacet:Facet" name="ProtocolContainerContainersFacet" documentation="This element represents the Packages that contain ProtocolContainers" conformanceTypedElement="//ProtocolContainerContainersFacet/isProtocolContainersContainer"> + <extendedMetaclass href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + <facetOperations name="isProtocolContainersContainer"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolContainersContainerQuery"/> </facetOperations> - <facetOperations - name="DisplayOnlyContainmentReferencesExceptPackagedElement" - upperBound="-1"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetVisiblePackageUMLRTReferencesQuery"/> - <override - xsi:type="efacet:FacetOperation" - href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/> + <facetOperations name="DisplayOnlyContainmentReferencesExceptPackagedElement" upperBound="-1"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetVisiblePackageUMLRTReferencesQuery"/> + <override xsi:type="efacet:FacetOperation" href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/> </facetOperations> </eClassifiers> - <eClassifiers - xsi:type="custom:FacetCustomization" - name="ProtocolContainerHidden" - documentation="hide the protocol containers from their parent package" - extendedFacets="//ProtocolContainerContainersFacet"> - <facetElements - xsi:type="efacet:FacetReference" - name="filteredPackagedElements" - upperBound="-1" - derived="true" - documentation="Representation of the packaged Elements, replacing protocolcontainers by protocols"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/uml2/5.0.0/UML#//PackageableElement"/> - <query - xsi:type="query:OperationCallQuery" - operation="//ProtocolContainerHidden/GetFilteredProtocolsPackageElements"/> + <eClassifiers xsi:type="custom:FacetCustomization" name="ProtocolContainerHidden" documentation="hide the protocol containers from their parent package" extendedFacets="//ProtocolContainerContainersFacet"> + <facetElements xsi:type="efacet:FacetReference" name="filteredPackagedElements" upperBound="-1" derived="true" documentation="Representation of the packaged Elements, replacing protocolcontainers by protocols"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//PackageableElement"/> + <query xsi:type="query:OperationCallQuery" operation="//ProtocolContainerHidden/GetFilteredProtocolsPackageElements"/> </facetElements> - <facetOperations - name="GetFilteredProtocolsPackageElements" - upperBound="-1"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/uml2/5.0.0/UML#//PackageableElement"/> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetFilteredProtocolsPackageElementsQuery"/> + <facetOperations name="GetFilteredProtocolsPackageElements" upperBound="-1"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//PackageableElement"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetFilteredProtocolsPackageElementsQuery"/> </facetOperations> </eClassifiers> - <eClassifiers - xsi:type="efacet:Facet" - name="ProtocolFacet" - documentation="Facet that represents Protocol Collaboration as the main holder for RT protocols" - conformanceTypedElement="//ProtocolFacet/isProtocol"> - <extendedMetaclass - href="http://www.eclipse.org/uml2/5.0.0/UML#//Collaboration"/> - <facetOperations - name="isProtocol"> - <eType - xsi:type="ecore:EDataType" - href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolQuery"/> + <eClassifiers xsi:type="efacet:Facet" name="ProtocolFacet" documentation="Facet that represents Protocol Collaboration as the main holder for RT protocols" conformanceTypedElement="//ProtocolFacet/isProtocol"> + <extendedMetaclass href="http://www.eclipse.org/uml2/5.0.0/UML#//Collaboration"/> + <facetOperations name="isProtocol"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolQuery"/> </facetOperations> - <facetOperations - name="DisplayNoReferences" - upperBound="-1"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.EmptyReferencesListQuery"/> - <override - xsi:type="efacet:FacetOperation" - href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/> + <facetOperations name="DisplayNoReferences" upperBound="-1"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.EmptyReferencesListQuery"/> + <override xsi:type="efacet:FacetOperation" href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/> </facetOperations> </eClassifiers> - <eClassifiers - xsi:type="custom:FacetCustomization" - name="ProtocolContainment_OnlyRTMessages" - documentation="Display RTMessages under the protocol and nothing else" - extendedFacets="//ProtocolFacet"> - <facetElements - xsi:type="efacet:FacetReference" - name="out" - upperBound="-1" - volatile="true" - transient="true" - derived="true"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> - <query - xsi:type="query:OperationCallQuery" - operation="//ProtocolContainment_OnlyRTMessages/GetRTMessagesOut"/> + <eClassifiers xsi:type="custom:FacetCustomization" name="ProtocolContainment_OnlyRTMessages" documentation="Display RTMessages under the protocol and nothing else" extendedFacets="//ProtocolFacet"> + <facetElements xsi:type="efacet:FacetReference" name="generalization" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Generalization"/> + <query xsi:type="query:OperationCallQuery" operation="//ProtocolContainment_OnlyRTMessages/GetGeneralization"/> </facetElements> - <facetElements - xsi:type="efacet:FacetReference" - name="in" - upperBound="-1" - volatile="true" - transient="true" - derived="true"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> - <query - xsi:type="query:OperationCallQuery" - operation="//ProtocolContainment_OnlyRTMessages/GetRTMessagesIn"/> + <facetElements xsi:type="efacet:FacetReference" name="inheritedOut" upperBound="-1" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> + <query xsi:type="query:OperationCallQuery" operation="//ProtocolContainment_OnlyRTMessages/GetRTMessages"> + <arguments xsi:type="query:StringLiteralQuery" value="out"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> </facetElements> - <facetElements - xsi:type="efacet:FacetReference" - name="inout" - upperBound="-1" - volatile="true" - transient="true" - derived="true"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> - <query - xsi:type="query:OperationCallQuery" - operation="//ProtocolContainment_OnlyRTMessages/GetRTMessagesInOut"/> + <facetElements xsi:type="efacet:FacetReference" name="inheritedIn" upperBound="-1" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> + <query xsi:type="query:OperationCallQuery" operation="//ProtocolContainment_OnlyRTMessages/GetRTMessages"> + <arguments xsi:type="query:StringLiteralQuery" value="in"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> </facetElements> - <facetElements - xsi:type="efacet:FacetReference" - name="comments" - upperBound="-1" - volatile="true" - transient="true" - derived="true"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/uml2/5.0.0/UML#//Comment"/> - <query - xsi:type="query:OperationCallQuery" - operation="//ProtocolContainment_OnlyRTMessages/GetOwnedComments"/> + <facetElements xsi:type="efacet:FacetReference" name="inheritedInOut" upperBound="-1" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> + <query xsi:type="query:OperationCallQuery" operation="//ProtocolContainment_OnlyRTMessages/GetRTMessages"> + <arguments xsi:type="query:StringLiteralQuery" value="inOut"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> </facetElements> - <facetOperations - name="GetRTMessagesIn" - upperBound="-1" - documentation="Returns all Messages from the IN MessageSets"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTMessagesInQuery"/> - </facetOperations> - <facetOperations - name="GetRTMessagesOut" - upperBound="-1" - documentation="Returns all Messages from the Out MessageSets"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTMessagesOutQuery"/> - </facetOperations> - <facetOperations - name="GetRTMessagesInOut" - upperBound="-1" - documentation="Returns all Messages from the Inout MessageSets"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTMessagesInOutQuery"/> + <facetElements xsi:type="efacet:FacetReference" name="out" upperBound="-1" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> + <query xsi:type="query:OperationCallQuery" operation="//ProtocolContainment_OnlyRTMessages/GetRTMessages"> + <arguments xsi:type="query:StringLiteralQuery" value="out"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="in" upperBound="-1" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> + <query xsi:type="query:OperationCallQuery" operation="//ProtocolContainment_OnlyRTMessages/GetRTMessages"> + <arguments xsi:type="query:StringLiteralQuery" value="in"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="inOut" upperBound="-1" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> + <query xsi:type="query:OperationCallQuery" operation="//ProtocolContainment_OnlyRTMessages/GetRTMessages"> + <arguments xsi:type="query:StringLiteralQuery" value="inOut"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="comments" upperBound="-1" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Comment"/> + <query xsi:type="query:OperationCallQuery" operation="//ProtocolContainment_OnlyRTMessages/GetOwnedComments"/> + </facetElements> + <facetOperations name="GetRTMessages" upperBound="-1" documentation="Returns inherited or locally defined messages from the specified message set."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> + <eParameters name="directionKind" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eParameters> + <eParameters name="inherited" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <eParameters name="includeAsIs" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTMessagesQuery"/> </facetOperations> - <facetOperations - name="GetOwnedComments" - upperBound="-1" - documentation="Returns all comments owned by the protocol"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/uml2/5.0.0/UML#//Comment"/> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetOwnedComments"/> + <facetOperations name="GetOwnedComments" upperBound="-1" documentation="Returns all comments owned by the protocol"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Comment"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetOwnedComments"/> </facetOperations> - <facetOperations - name="HideCollapseLinks"> - <eType - xsi:type="ecore:EDataType" - href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> - <eParameters - name="eStructuralFeature"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/emf/2002/Ecore#//EStructuralFeature"/> + <facetOperations name="HideCollapseLinks"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + <eParameters name="eStructuralFeature"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EStructuralFeature"/> </eParameters> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.collaboration.HideCollapseLinksExceptDirectionQuery"/> - <override - xsi:type="efacet:FacetOperation" - href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/collapseLink"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.collaboration.HideCollapseLinksExceptDirectionQuery"/> + <override xsi:type="efacet:FacetOperation" href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/collapseLink"/> + </facetOperations> + <facetOperations name="GetGeneralization"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Generalization"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetGeneralizationQuery"/> </facetOperations> </eClassifiers> </custom:Customization> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Structure.custom b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Structure.custom new file mode 100644 index 000000000..7479aef53 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Structure.custom @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="UTF-8"?> +<custom:Customization xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:custom="http://www.eclipse.org/papyrus/emf/facet/custom/0.2.incubation/custom" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:efacet="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet" xmlns:javaQuery="http://www.eclipse.org/papyrus/emf/facet/query/java/0.2.incubation/javaquery" xmlns:query="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet/query" name="UML-RT Structure" nsPrefix="" documentation="Presentation of UML-RT specific structure." mustBeLoadedByDefault="true" rank="-100"> + <eClassifiers xsi:type="efacet:Facet" name="CapsuleFacet" conformanceTypedElement="//CapsuleFacet/isCapsule"> + <extendedMetaclass href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/> + <facetOperations name="isCapsule" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsCapsuleQuery"/> + </facetOperations> + <facetOperations name="noStructuralFeatureReferences" upperBound="-1"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.AllButStructuralFeaturesQuery"/> + <override xsi:type="efacet:FacetOperation" href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/> + </facetOperations> + </eClassifiers> + <eClassifiers xsi:type="efacet:Facet" name="InheritedConnector" documentation="Presentation of an inherited or redefined connector." conformanceTypedElement="//InheritedConnector/isInheritedOrRedefined"> + <extendedMetaclass href="http://www.eclipse.org/uml2/5.0.0/UML#//Connector"/> + <facetOperations name="isInheritedOrRedefined" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsInheritedOrRedefinedQuery"/> + </facetOperations> + <facetOperations name="noContents" upperBound="-1"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.EmptyReferencesListQuery"/> + <override xsi:type="efacet:FacetOperation" href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/> + </facetOperations> + </eClassifiers> + <eClassifiers xsi:type="custom:FacetCustomization" name="CapsuleFeatures" extendedFacets="//CapsuleFacet"> + <facetElements xsi:type="efacet:FacetReference" name="inheritedPort" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Inherited, re-defined, and excluded ports."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Port"/> + <query xsi:type="query:OperationCallQuery" operation="//CapsuleFeatures/getPorts"> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="inheritedAttribute" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Inherited, re-defined, and excluded capsule-parts."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Property"/> + <query xsi:type="query:OperationCallQuery" operation="//CapsuleFeatures/getAttributes"> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="inheritedConnector" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Inherited, re-defined, and excluded connectors."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Connector"/> + <query xsi:type="query:OperationCallQuery" operation="//CapsuleFeatures/getConnectors"> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="port" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Locally-defined ports."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Port"/> + <query xsi:type="query:OperationCallQuery" operation="//CapsuleFeatures/getPorts"> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="attribute" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Locally-defined capsule-parts."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Property"/> + <query xsi:type="query:OperationCallQuery" operation="//CapsuleFeatures/getAttributes"> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="connector" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Locally-defined connectors."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Connector"/> + <query xsi:type="query:OperationCallQuery" operation="//CapsuleFeatures/getConnectors"> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="otherPort" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Non-RT ports. Primarily to make the accessible to apply the stereotype."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Port"/> + <query xsi:type="query:OperationCallQuery" operation="//CapsuleFeatures/getPorts"> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="otherAttribute" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Non-RT attributes."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Property"/> + <query xsi:type="query:OperationCallQuery" operation="//CapsuleFeatures/getAttributes"> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="otherConnector" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Non-RT connectors. Primarily to make the accessible to apply the stereotype."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Connector"/> + <query xsi:type="query:OperationCallQuery" operation="//CapsuleFeatures/getConnectors"> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + <arguments xsi:type="query:FalseLiteralQuery"/> + </query> + </facetElements> + <facetOperations name="getPorts" upperBound="-1" documentation="Returns inherited or locally defined ports of the capsule."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Port"/> + <eParameters name="rtSpecific" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <eParameters name="inherited" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <eParameters name="includeAsIs" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTPortsQuery"/> + </facetOperations> + <facetOperations name="getAttributes" upperBound="-1" documentation="Returns inherited or locally defined attributes (non-ports) of the capsule."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Property"/> + <eParameters name="rtSpecific" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <eParameters name="inherited" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <eParameters name="includeAsIs" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTAttributesQuery"/> + </facetOperations> + <facetOperations name="getConnectors" upperBound="-1" documentation="Returns inherited or locally defined connectors of the capsule."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Connector"/> + <eParameters name="rtSpecific" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <eParameters name="inherited" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <eParameters name="includeAsIs" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eParameters> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTConnectorsQuery"/> + </facetOperations> + </eClassifiers> + <eClassifiers xsi:type="efacet:Facet" name="ExcludedElement" documentation="Presentation of an excluded element." conformanceTypedElement="//ExcludedElement/isExcluded"> + <extendedMetaclass href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> + <facetOperations name="isExcluded" lowerBound="1"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsExcludedQuery"/> + </facetOperations> + <facetOperations name="noContents" upperBound="-1"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/> + <query xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.EmptyReferencesListQuery"/> + <override xsi:type="efacet:FacetOperation" href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/> + </facetOperations> + </eClassifiers> +</custom:Customization> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/StructureInheritance.custom b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/StructureInheritance.custom new file mode 100644 index 000000000..491a28b31 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/StructureInheritance.custom @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<custom:Customization xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:custom="http://www.eclipse.org/papyrus/emf/facet/custom/0.2.incubation/custom" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:efacet="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet" xmlns:query="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet/query" name="UML-RT Inherited Structure" nsPrefix="" documentation="Presentation of purely inherited elements in UML-RT structure inheritance." rank="-99"> + <eClassifiers xsi:type="custom:FacetCustomization" name="ProtocolWithInheritedMessages" documentation="Presents inherited content in protocols."> + <facetElements xsi:type="efacet:FacetReference" name="inheritedOut" upperBound="-1" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> + <query xsi:type="query:OperationCallQuery"> + <operation href="Protocol.custom#//ProtocolContainment_OnlyRTMessages/GetRTMessages"/> + <arguments xsi:type="query:StringLiteralQuery" value="out"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + </query> + <override xsi:type="efacet:FacetReference" href="Protocol.custom#//ProtocolContainment_OnlyRTMessages/inheritedOut"/> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="inheritedIn" upperBound="-1" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> + <query xsi:type="query:OperationCallQuery"> + <operation href="Protocol.custom#//ProtocolContainment_OnlyRTMessages/GetRTMessages"/> + <arguments xsi:type="query:StringLiteralQuery" value="in"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + </query> + <override xsi:type="efacet:FacetReference" href="Protocol.custom#//ProtocolContainment_OnlyRTMessages/inheritedIn"/> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="inheritedInOut" upperBound="-1" volatile="true" transient="true" derived="true"> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> + <query xsi:type="query:OperationCallQuery"> + <operation href="Protocol.custom#//ProtocolContainment_OnlyRTMessages/GetRTMessages"/> + <arguments xsi:type="query:StringLiteralQuery" value="inOut"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + </query> + <override xsi:type="efacet:FacetReference" href="Protocol.custom#//ProtocolContainment_OnlyRTMessages/inheritedInOut"/> + </facetElements> + <extendedFacets href="Protocol.custom#//ProtocolContainment_OnlyRTMessages"/> + </eClassifiers> + <eClassifiers xsi:type="custom:FacetCustomization"> + <facetElements xsi:type="efacet:FacetReference" name="inheritedPort" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Includes the purely inherited ports."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Port"/> + <query xsi:type="query:OperationCallQuery"> + <operation href="Structure.custom#//CapsuleFeatures/getPorts"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + </query> + <override xsi:type="efacet:FacetReference" href="Structure.custom#//CapsuleFeatures/inheritedPort"/> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="inheritedAttribute" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Includes the purely inherited capsule-parts."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Property"/> + <query xsi:type="query:OperationCallQuery"> + <operation href="Structure.custom#//CapsuleFeatures/getAttributes"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + </query> + <override xsi:type="efacet:FacetReference" href="Structure.custom#//CapsuleFeatures/inheritedAttribute"/> + </facetElements> + <facetElements xsi:type="efacet:FacetReference" name="inheritedConnector" upperBound="-1" volatile="true" transient="true" derived="true" documentation="Includes the purely inherited connectors."> + <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Connector"/> + <query xsi:type="query:OperationCallQuery"> + <operation href="Structure.custom#//CapsuleFeatures/getConnectors"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + <arguments xsi:type="query:TrueLiteralQuery"/> + </query> + <override xsi:type="efacet:FacetReference" href="Structure.custom#//CapsuleFeatures/inheritedConnector"/> + </facetElements> + <extendedFacets href="Structure.custom#//CapsuleFeatures"/> + </eClassifiers> +</custom:Customization> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/plugin.xml b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/plugin.xml index 6f04682c4..3dba937b8 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/plugin.xml +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/plugin.xml @@ -19,6 +19,18 @@ </modeldeclaration> </extension> <extension + point="org.eclipse.papyrus.emf.facet.util.emf.core.modeldeclaration"> + <modeldeclaration + file="facet/Structure.custom"> + </modeldeclaration> + </extension> + <extension + point="org.eclipse.papyrus.emf.facet.util.emf.core.modeldeclaration"> + <modeldeclaration + file="facet/StructureInheritance.custom"> + </modeldeclaration> + </extension> + <extension point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider"> <labelProvider priority="10" diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/provider/UMLRTLabelProvider.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/provider/UMLRTLabelProvider.java index 8188e7c92..faae1c078 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/provider/UMLRTLabelProvider.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/provider/UMLRTLabelProvider.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2015, 2017 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,20 +8,31 @@ * * Contributors: * CEA LIST - Initial API and implementation - * Christian W. Damus - bug 475905 + * Christian W. Damus - bugs 475905, 467545 * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.provider; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; +import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.provider.ComposedImage; +import org.eclipse.emf.edit.provider.IChangeNotifier; import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.INotifyChangedListener; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProviderChangedEvent; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.uml.tools.providers.DelegatingItemLabelProvider; import org.eclipse.papyrus.uml.tools.providers.UMLFilteredLabelProvider; @@ -30,13 +41,24 @@ import org.eclipse.papyrusrt.umlrt.core.types.UMLRTElementTypesEnumerator; import org.eclipse.papyrusrt.umlrt.core.utils.MessageSetUtils; import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind; import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.Activator; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTInheritanceKind; import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.NamedElement; /** * UML-RT specific label provider. */ public class UMLRTLabelProvider extends UMLFilteredLabelProvider { + private static final String UI_PLUGIN_ID = "org.eclipse.papyrusrt.umlrt.tooling.ui"; //$NON-NLS-1$ + private static final String OVERLAY_PATH = "$nl$/icons/full/ovr16/"; //$NON-NLS-1$ + private static ImageDescriptor EXCLUDED_OVERLAY = AbstractUIPlugin.imageDescriptorFromPlugin( + UI_PLUGIN_ID, OVERLAY_PATH + "excluded_ovr.png"); //$NON-NLS-1$ + private static ImageDescriptor INHERITED_OVERLAY = AbstractUIPlugin.imageDescriptorFromPlugin( + UI_PLUGIN_ID, OVERLAY_PATH + "inherited_ovr.png"); //$NON-NLS-1$ + private static ImageDescriptor REDEFINITION_OVERLAY = AbstractUIPlugin.imageDescriptorFromPlugin( + UI_PLUGIN_ID, OVERLAY_PATH + "redefinition_ovr.png"); //$NON-NLS-1$ public final Map<String, String> typeIdtoIconPath; @@ -65,6 +87,9 @@ public class UMLRTLabelProvider extends UMLFilteredLabelProvider { protected static final IItemLabelProvider labelProvider = new DelegatingItemLabelProvider(); + private final CopyOnWriteArrayList<ILabelProviderListener> listeners = new CopyOnWriteArrayList<>(); + private final INotifyChangedListener changeForwarder = this::forwardChange; + /** * Default constructor */ @@ -100,6 +125,19 @@ public class UMLRTLabelProvider extends UMLFilteredLabelProvider { typeIdtoIconPath.put(IUMLRTElementTypes.RT_PSEUDO_STATE_SHALLOW_HISTORY_ID, RT_PSEUDO_STATE_SHALLOW_HISTORY_ICON); typeIdtoIconPath.put(IUMLRTElementTypes.RT_PSEUDO_STATE_TERMINATE_ID, RT_PSEUDO_STATE_TERMINATE_ICON); typeIdtoIconPath.put(IUMLRTElementTypes.TRANSITION_INTERNAL_ID, RT_TRANSITION_INTERNAL_ICON); + + if (labelProvider instanceof IChangeNotifier) { + ((IChangeNotifier) labelProvider).addListener(changeForwarder); + } + } + + @Override + public void dispose() { + if (labelProvider instanceof IChangeNotifier) { + ((IChangeNotifier) labelProvider).removeListener(changeForwarder); + } + + super.dispose(); } @Override @@ -191,9 +229,38 @@ public class UMLRTLabelProvider extends UMLFilteredLabelProvider { break; } + // Decorate an excluded element + if (element instanceof NamedElement) { + Image overlay = getInheritanceOverlay((NamedElement) element); + if (overlay != null) { + ComposedImage composed = new ComposedImage(Arrays.asList(image, overlay)); + image = ExtendedImageRegistry.getInstance().getImage(composed); + } + } + return image; } + protected Image getInheritanceOverlay(NamedElement element) { + Image result; + + switch (UMLRTInheritanceKind.of(element)) { + case INHERITED: + result = ExtendedImageRegistry.getInstance().getImage(INHERITED_OVERLAY); + break; + case REDEFINED: + result = ExtendedImageRegistry.getInstance().getImage(REDEFINITION_OVERLAY); + break; + case EXCLUDED: + result = ExtendedImageRegistry.getInstance().getImage(EXCLUDED_OVERLAY); + break; + default: + result = null; + break; + } + + return result; + } @Override public String getText(Object element) { @@ -251,4 +318,31 @@ public class UMLRTLabelProvider extends UMLFilteredLabelProvider { } + @Override + public void addListener(ILabelProviderListener listener) { + // The superclass's handling of listeners is useless to us + listeners.addIfAbsent(listener); + } + + @Override + public void removeListener(ILabelProviderListener listener) { + // The superclass's handling of listeners is useless to us + listeners.remove(listener); + } + + private void forwardChange(Notification notification) { + if (notification instanceof ViewerNotification) { + ViewerNotification vnot = (ViewerNotification) notification; + if (vnot.isLabelUpdate() && !listeners.isEmpty()) { + LabelProviderChangedEvent event = new LabelProviderChangedEvent(this, vnot.getElement()); + listeners.forEach(l -> { + try { + l.labelProviderChanged(event); + } catch (Exception e) { + Activator.log.error("Uncaught exception in label provider listener", e); //$NON-NLS-1$ + } + }); + } + } + } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/AllButStructuralFeaturesQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/AllButStructuralFeaturesQuery.java new file mode 100644 index 000000000..a21294568 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/AllButStructuralFeaturesQuery.java @@ -0,0 +1,48 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; +import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; +import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Query that returns all references of an object apart from its structural features + * (attributes including ports, connectors). + */ +public class AllButStructuralFeaturesQuery implements IJavaQuery2<EObject, List<EReference>> { + + /** + * Constructor. + */ + public AllButStructuralFeaturesQuery() { + super(); + } + + @Override + public List<EReference> evaluate(final EObject source, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException { + List<EReference> result = new ArrayList<>(source.eClass().getEAllContainments()); + result.remove(UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE); + result.remove(UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_CONNECTOR); + result.remove(UMLPackage.Literals.ENCAPSULATED_CLASSIFIER__OWNED_PORT); + return result; + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/DisplayMessageSetsOnlyQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/DisplayMessageSetsOnlyQuery.java deleted file mode 100644 index 0b451c455..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/DisplayMessageSetsOnlyQuery.java +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. - * - * 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: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; -import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.utils.FacetUtils; -import org.eclipse.uml2.uml.Package; - -public class DisplayMessageSetsOnlyQuery implements IJavaQuery2<Package, Boolean> { - public Boolean evaluate(final Package context, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - - // display only in / out and inout features. They should not be collapsed also - ParameterValue parameterValue = parameterValues.getParameterValueByName("eStructuralFeature"); //$NON-NLS-1$ - EStructuralFeature eStructuralFeature = (EStructuralFeature) parameterValue.getValue(); - // the eStructure is a containmentReference or Facet Reference? - if (eStructuralFeature instanceof FacetReference) { - String name = ((FacetReference) eStructuralFeature).getName(); - // check facet name - if(FacetUtils.isMessageOrComment(name)) { - return true; - } - } - return false; - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/DisplayMessagesOnlyQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/DisplayMessagesOnlyQuery.java deleted file mode 100644 index 170373989..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/DisplayMessagesOnlyQuery.java +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. - * - * 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: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; -import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.utils.FacetUtils; -import org.eclipse.uml2.uml.Collaboration; - -public class DisplayMessagesOnlyQuery implements IJavaQuery2<Collaboration, Boolean> { - - public Boolean evaluate(final Collaboration context, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - - // display only in / out and inout features. They should not be collapsed also - ParameterValue parameterValue = parameterValues.getParameterValueByName("eStructuralFeature"); //$NON-NLS-1$ - if (parameterValue == null) { - return false; - } - EStructuralFeature eStructuralFeature = (EStructuralFeature) parameterValue.getValue(); - // the eStructure is a containmentReference or Facet Reference? - if (eStructuralFeature instanceof FacetReference) { - String name = ((FacetReference) eStructuralFeature).getName(); - // check facet name - if(FacetUtils.isMessageOrComment(name)) { - return true; - } - } - return false; - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTMessagesInQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetGeneralizationQuery.java index 641c8df86..74af1b35f 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTMessagesInQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetGeneralizationQuery.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. + * Copyright (c) 2016, 2017 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,31 +7,36 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * CEA LIST - Initial API and implementation + * Christian W. Damus - Initial API and implementation * *****************************************************************************/ -package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; -import java.util.List; +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; -import org.eclipse.emf.ecore.EObject; import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolUtils; -import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind; -import org.eclipse.uml2.uml.Collaboration; -import org.eclipse.uml2.uml.Operation; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.Generalization; -public class GetRTMessagesInQuery implements IJavaQuery2<EObject, List<Operation>> { - public List<Operation> evaluate(final EObject context, +/** + * Facet query for the single generalization permitted by UML-RT on a capsule + * class or protocol collaboration. + */ +public class GetGeneralizationQuery implements IJavaQuery2<Classifier, Generalization> { + @Override + public Generalization evaluate(final Classifier context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - if (context instanceof Collaboration) { - return ProtocolUtils.getRTMessages((Collaboration) context, RTMessageKind.IN, true); + throws DerivedTypedElementException { + + Generalization result = null; + + if (!context.getGeneralizations().isEmpty()) { + result = context.getGeneralizations().get(0); } - return null; + + return result; } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTAttributesQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTAttributesQuery.java new file mode 100644 index 000000000..8e68910a5 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTAttributesQuery.java @@ -0,0 +1,43 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Property; + +/** + * A query that obtains the RT attributes (or non-RT attributes) of a capsule. + */ +public class GetRTAttributesQuery extends GetRTStructuralFeaturesQuery<Property> { + + public GetRTAttributesQuery() { + super(Property.class); + } + + @Override + protected List<Property> getFeatures(Class capsule) { + List<Property> result = new ArrayList<>(capsule.getOwnedAttributes()); + result.removeAll(capsule.getOwnedPorts()); + return result; + } + + @Override + protected List<? extends UMLRTCapsulePart> getFeatures(UMLRTCapsule capsule) { + return capsule.getCapsuleParts(true); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTConnectorsQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTConnectorsQuery.java new file mode 100644 index 000000000..ad01ac837 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTConnectorsQuery.java @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; + +import java.util.List; + +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTConnector; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Connector; + +/** + * A query that obtains the RT connectors (or non-RT connectors) of a capsule. + */ +public class GetRTConnectorsQuery extends GetRTStructuralFeaturesQuery<Connector> { + + public GetRTConnectorsQuery() { + super(Connector.class); + } + + @Override + protected List<Connector> getFeatures(Class capsule) { + return capsule.getOwnedConnectors(); + } + + @Override + protected List<? extends UMLRTConnector> getFeatures(UMLRTCapsule capsule) { + return capsule.getConnectors(true); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTMessagesInOutQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTMessagesInOutQuery.java deleted file mode 100644 index 833d42c71..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTMessagesInOutQuery.java +++ /dev/null @@ -1,37 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. - * - * 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: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; -import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolUtils; -import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind; -import org.eclipse.uml2.uml.Collaboration; -import org.eclipse.uml2.uml.Operation; - -public class GetRTMessagesInOutQuery implements IJavaQuery2<EObject, List<Operation>> { - public List<Operation> evaluate(final EObject context, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - if (context instanceof Collaboration) { - return ProtocolUtils.getRTMessages((Collaboration) context, RTMessageKind.IN_OUT, true); - } - return null; - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTMessagesOutQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTMessagesQuery.java index 016b63378..addfcdfca 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTMessagesOutQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTMessagesQuery.java @@ -12,26 +12,57 @@ *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; +import java.util.Collections; import java.util.List; +import java.util.function.Predicate; import org.eclipse.emf.ecore.EObject; import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolUtils; import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind; +import org.eclipse.papyrusrt.umlrt.uml.util.UMLRTExtensionUtil; import org.eclipse.uml2.uml.Collaboration; +import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Operation; -public class GetRTMessagesOutQuery implements IJavaQuery2<EObject, List<Operation>> { +public class GetRTMessagesQuery implements IJavaQuery2<EObject, List<Operation>> { + @Override public List<Operation> evaluate(final EObject context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { + throws DerivedTypedElementException { + + List<Operation> result = Collections.emptyList(); + + ParameterValue param = parameterValues.get(0); + String directionString = (String) param.getValue(); + RTMessageKind kind = RTMessageKind.get(directionString); + param = parameterValues.get(1); + boolean inherited = (Boolean) param.getValue(); + param = parameterValues.get(2); + boolean includeVirtual = (Boolean) param.getValue(); + if (context instanceof Collaboration) { - return ProtocolUtils.getRTMessages((Collaboration) context, RTMessageKind.OUT, true); + result = ProtocolUtils.getRTMessages((Collaboration) context, kind, inherited); + Predicate<Element> filter = UMLRTExtensionUtil::isInherited; + + if (inherited) { + // We want only the inherited ones + filter = filter.negate(); + + if (!includeVirtual) { + // But not purely inherited (virtual) elements + filter = filter.or(UMLRTExtensionUtil::isVirtualElement); + } + } + + result.removeIf(filter); } - return null; + + return result; } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTPortsQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTPortsQuery.java new file mode 100644 index 000000000..b86a5fed4 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTPortsQuery.java @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; + +import java.util.List; + +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Port; + +/** + * A query that obtains the RT ports (or non-RT ports) of a capsule. + */ +public class GetRTPortsQuery extends GetRTStructuralFeaturesQuery<Port> { + + public GetRTPortsQuery() { + super(Port.class); + } + + @Override + protected List<Port> getFeatures(Class capsule) { + return capsule.getOwnedPorts(); + } + + @Override + protected List<? extends UMLRTPort> getFeatures(UMLRTCapsule capsule) { + return capsule.getPorts(true); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTStructuralFeaturesQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTStructuralFeaturesQuery.java new file mode 100644 index 000000000..178028011 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetRTStructuralFeaturesQuery.java @@ -0,0 +1,98 @@ +/***************************************************************************** + * Copyright (c) 2016, 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; + +import static java.util.stream.Collectors.toList; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Predicate; + +import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; +import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; +import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.util.UMLRTExtensionUtil; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Feature; + +/** + * A query that obtains the structural features (RT-specific or not) of a capsule. + */ +abstract class GetRTStructuralFeaturesQuery<T extends Feature> implements IJavaQuery2<Class, List<T>> { + private final java.lang.Class<T> type; + + protected GetRTStructuralFeaturesQuery(java.lang.Class<T> type) { + super(); + + this.type = type; + } + + @Override + public List<T> evaluate(final Class context, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + + List<T> result = Collections.emptyList(); + + ParameterValue param = parameterValues.get(0); + boolean rtSpecific = (Boolean) param.getValue(); + param = parameterValues.get(1); + boolean inherited = (Boolean) param.getValue(); + param = parameterValues.get(2); + boolean includeVirtual = (Boolean) param.getValue(); + + UMLRTCapsule capsule = UMLRTCapsule.getInstance(context); + if (capsule != null) { + List<? extends UMLRTNamedElement> rtFeatures = getFeatures(capsule); + + if (!rtSpecific) { + // Just the plain ports. They will never be inherited + List<T> features = new ArrayList<>(getFeatures(context)); + rtFeatures.forEach(rt -> features.remove(rt.toUML())); + result = features; + } else { + // The RT ports + result = rtFeatures.stream().map(UMLRTNamedElement::toUML) + .map(type::cast) + .collect(toList()); + + Predicate<Element> filter = UMLRTExtensionUtil::isInherited; + + if (inherited) { + // We want only the inherited ones + filter = filter.negate(); + + if (!includeVirtual) { + // But not purely inherited (virtual) elements + filter = filter.or(UMLRTExtensionUtil::isVirtualElement); + } + } + + result.removeIf(filter); + } + } + + return result; + } + + protected abstract List<? extends UMLRTNamedElement> getFeatures(UMLRTCapsule capsule); + + protected abstract List<T> getFeatures(Class capsule); +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetMessageInFromProtocolContainerQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsCapsuleQuery.java index 994ccc74d..cdc06c9eb 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetMessageInFromProtocolContainerQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsCapsuleQuery.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. + * Copyright (c) 2016 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,26 +7,28 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * CEA LIST - Initial API and implementation + * Christian W. Damus - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; -import java.util.Collection; - import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolContainerUtils; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Package; +import org.eclipse.papyrusrt.umlrt.core.utils.CapsuleUtils; +import org.eclipse.uml2.uml.Class; -public class GetMessageInFromProtocolContainerQuery implements IJavaQuery2<Package, Collection<Operation>> { - public Collection<Operation> evaluate(final Package context, +/** + * Queries whether a class is a capsule. + */ +public class IsCapsuleQuery implements IJavaQuery2<Class, Boolean> { + @Override + public Boolean evaluate(final Class context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException { - return ProtocolContainerUtils.getAllInRTMessages(context); + + return CapsuleUtils.isCapsule(context); } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetMessageOutFromProtocolContainerQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsExcludedQuery.java index ed61c6f9e..9526a035e 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetMessageOutFromProtocolContainerQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsExcludedQuery.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. + * Copyright (c) 2016, 2017 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,26 +7,30 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * CEA LIST - Initial API and implementation + * Christian W. Damus - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; -import java.util.Collection; - import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolContainerUtils; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Package; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTInheritanceKind; +import org.eclipse.uml2.uml.Element; -public class GetMessageOutFromProtocolContainerQuery implements IJavaQuery2<Package, Collection<Operation>> { - public Collection<Operation> evaluate(final Package context, +/** + * Queries whether an element is an excluded (from inheritance) element. + */ +public class IsExcludedQuery implements IJavaQuery2<Element, Boolean> { + @Override + public Boolean evaluate(final Element context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException { - return ProtocolContainerUtils.getAllOutRTMessages(context); + + boolean result = UMLRTInheritanceKind.of(context) == UMLRTInheritanceKind.EXCLUDED; + + return result; } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetMessageInOutFromProtocolContainerQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsInheritedOrRedefinedQuery.java index bc4c21bd1..586116b5e 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetMessageInOutFromProtocolContainerQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsInheritedOrRedefinedQuery.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. + * Copyright (c) 2016, 2017 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,26 +7,30 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * CEA LIST - Initial API and implementation + * Christian W. Damus - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; -import java.util.Collection; - import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolContainerUtils; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Package; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTInheritanceKind; +import org.eclipse.uml2.uml.Element; -public class GetMessageInOutFromProtocolContainerQuery implements IJavaQuery2<Package, Collection<Operation>> { - public Collection<Operation> evaluate(final Package context, +/** + * Queries whether a model element is an UML-RT inherited or redefined element. + */ +public class IsInheritedOrRedefinedQuery implements IJavaQuery2<Element, Boolean> { + @Override + public Boolean evaluate(final Element context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException { - return ProtocolContainerUtils.getAllInOutRTMessages(context); + + boolean result = UMLRTInheritanceKind.of(context) != UMLRTInheritanceKind.NONE; + + return result; } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/collaboration/HideCollapseLinksExceptDirectionQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/collaboration/HideCollapseLinksExceptDirectionQuery.java index 0380bbbc1..97ea9d41b 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/collaboration/HideCollapseLinksExceptDirectionQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/collaboration/HideCollapseLinksExceptDirectionQuery.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. + * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 467545 * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.collaboration; @@ -51,7 +52,7 @@ public class HideCollapseLinksExceptDirectionQuery implements IJavaQuery2<Collab if (eStructuralFeature instanceof FacetReference) { String name = ((FacetReference) eStructuralFeature).getName(); // check facet name - if (FacetUtils.isMessageOrComment(name)) { + if (FacetUtils.isMessageOrComment(name) || FacetUtils.isGeneralization(name)) { result = true; } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/utils/FacetUtils.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/utils/FacetUtils.java index 1880f2870..61dd103be 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/utils/FacetUtils.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/utils/FacetUtils.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. + * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,30 +8,54 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 467545 * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.utils; +import java.util.Set; + +import com.google.common.collect.ImmutableSet; + /** * Names of facets used in the UML/RT customization */ public class FacetUtils { - static final String IN = "in"; //$NON-NLS-1$ - static final String INOUT = "inout"; //$NON-NLS-1$ + static final String INHERITED_IN = "inheritedIn"; //$NON-NLS-1$ + static final String INHERITED_INOUT = "inheritedInOut"; //$NON-NLS-1$ + static final String INHERITED_OUT = "inheritedOut"; //$NON-NLS-1$ + static final String IN = "in"; //$NON-NLS-1$ + static final String INOUT = "inOut"; //$NON-NLS-1$ static final String OUT = "out"; //$NON-NLS-1$ - static final String COMMENTS = "comments"; //$NON-NLS-1$ + static final String COMMENTS = "comments"; //$NON-NLS-1$ + static final String GENERALIZATION = "generalization"; //$NON-NLS-1$ + + static final Set<String> MESSAGES_AND_COMMENTS = ImmutableSet.of( + INHERITED_IN, INHERITED_OUT, INHERITED_INOUT, + IN, OUT, INOUT, + COMMENTS); /** * Check whether the passed facetName is a one of the message set facets (in, out, or inout) * or comment - * + * * @param facetName * @return true, if one of the facet names above */ public static boolean isMessageOrComment(String facetName) { - return FacetUtils.IN.equals(facetName) || FacetUtils.OUT.equals(facetName) || - FacetUtils.INOUT.equals(facetName) || FacetUtils.COMMENTS.equals(facetName); + return MESSAGES_AND_COMMENTS.contains(facetName); + } + + /** + * Check whether a {@code featureName} identifies the generalization reference. + * + * @param featureName + * a facet feature name + * @return whether it is the {@code generalization} reference + */ + public static boolean isGeneralization(String featureName) { + return GENERALIZATION.equals(featureName); } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleCapsule.xwt b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleCapsule.xwt index 0b15fa39d..b256d1e3d 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleCapsule.xwt +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleCapsule.xwt @@ -8,10 +8,19 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <Composite> - <Composite.layout> - <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> - </Composite.layout> - <ppe:StringEditor input="{Binding}" - property="UMLRealTimeExt:Capsule:name"></ppe:StringEditor> - </Composite> + <Composite.layout> + <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> + </Composite.layout> + <ppe:StringEditor input="{Binding}" + property="UMLRTFacade:Capsule:name"></ppe:StringEditor> + </Composite> + <Composite> + <Composite.layout> + <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> + </Composite.layout> + <ppumlrt:InheritableMultiReference input="{Binding}" + property="UMLRTFacade:Capsule:port"></ppumlrt:InheritableMultiReference> + <ppumlrt:InheritableMultiReference input="{Binding}" + property="UMLRTFacade:Capsule:capsulePart"></ppumlrt:InheritableMultiReference> + </Composite> </Composite>
\ No newline at end of file diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleCapsulePart.xwt b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleCapsulePart.xwt index 8360e0461..356900f8e 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleCapsulePart.xwt +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleCapsulePart.xwt @@ -5,6 +5,7 @@ xmlns:j="clr-namespace:java.lang" xmlns="http://www.eclipse.org/xwt/presentation" xmlns:ppe="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets" xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets" + xmlns:utils="clr-namespace:org.eclipse.papyrusrt.umlrt.core.utils" xmlns:x="http://www.eclipse.org/xwt"> <Composite.layout> <ppel:PropertiesLayout></ppel:PropertiesLayout> @@ -13,7 +14,7 @@ <Composite.layout> <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> - <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UMLRealTimeExt:RTNamedElement:name"></ppe:StringEditor> <ppumlrt:CapsulePartTypeEditor customLabel="Capsule" property="UMLRealTimeExt:Property:type" input="{Binding}"></ppumlrt:CapsulePartTypeEditor> </Composite> @@ -21,7 +22,12 @@ <Composite.layout> <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> - <ppe:EnumRadio input="{Binding}" property="UMLRealTime:CapsulePart:kind"></ppe:EnumRadio> + <ppumlrt:RTKindEnumPropertyEditor + property="UMLRealTime:CapsulePart:kind" + utilsClass="utils:CapsulePartUtils" + enumType="utils:CapsulePartKindEnum" + input="{Binding}"> + </ppumlrt:RTKindEnumPropertyEditor> <ppumlrt:PropertyReplicationComboEditor customLabel="Replication" input="{Binding}" property="UMLRealTimeExt:RTMultiplicity:replication"></ppumlrt:PropertyReplicationComboEditor> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleProtocol.xwt b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleProtocol.xwt index e17782ec8..2df340583 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleProtocol.xwt +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleProtocol.xwt @@ -11,17 +11,17 @@ <Composite.layout> <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> - <ppe:StringEditor input="{Binding}" property="UMLRealTimeExt:Protocol:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UMLRTFacade:Protocol:name"></ppe:StringEditor> </Composite> <Composite> <Composite.layout> - <ppel:PropertiesLayout numColumns="3"></ppel:PropertiesLayout> + <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> </Composite.layout> - <ppe:MultiReference input="{Binding}" - property="UMLRealTimeExt:Protocol:Outgoing" customLabel="Out protocol message"></ppe:MultiReference> - <ppe:MultiReference input="{Binding}" - property="UMLRealTimeExt:Protocol:Incoming" customLabel="In protocol message"></ppe:MultiReference> - <ppe:MultiReference input="{Binding}" - property="UMLRealTimeExt:Protocol:InOut" customLabel="InOut protocol message"></ppe:MultiReference> + <umlrt:InheritableMultiReference input="{Binding}" + property="UMLRTFacade:Protocol:Outgoing"></umlrt:InheritableMultiReference> + <umlrt:InheritableMultiReference input="{Binding}" + property="UMLRTFacade:Protocol:Incoming"></umlrt:InheritableMultiReference> + <umlrt:InheritableMultiReference input="{Binding}" + property="UMLRTFacade:Protocol:InOut"></umlrt:InheritableMultiReference> </Composite> </Composite>
\ No newline at end of file diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleRTPort.xwt b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleRTPort.xwt index 2bb5ab997..fb4595131 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleRTPort.xwt +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/ui/SingleRTPort.xwt @@ -4,6 +4,7 @@ xmlns:ppeg="clr-namespace:org.eclipse.papyrus.infra.gmfdiag.properties.widget" xmlns:ppe="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets" xmlns:ppumlrt="clr-namespace:org.eclipse.papyrusrt.umlrt.tooling.ui.widgets" + xmlns:utils="clr-namespace:org.eclipse.papyrusrt.umlrt.core.utils" xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt"> <Composite.layout> <ppel:PropertiesLayout></ppel:PropertiesLayout> @@ -12,7 +13,7 @@ <Composite.layout> <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> - <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor> + <ppe:StringEditor input="{Binding}" property="UMLRealTimeExt:RTNamedElement:name"></ppe:StringEditor> <ppumlrt:RTPortTypeEditor input="{Binding}" customLabel="Protocol" property="UMLRealTimeExt:Port:type"></ppumlrt:RTPortTypeEditor> </Composite> @@ -20,8 +21,12 @@ <Composite.layout> <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> - <ppumlrt:PortRTKindPropertyEditor - property="UMLRealTime:RTPort:kind" input="{Binding}"></ppumlrt:PortRTKindPropertyEditor> + <ppumlrt:RTKindEnumPropertyEditor + property="UMLRealTime:RTPort:kind" + utilsClass="utils:RTPortUtils" + enumType="utils:RTPortKindEnum" + input="{Binding}"> + </ppumlrt:RTKindEnumPropertyEditor> </Composite> <Composite> <Composite.layout> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/uml-rt.ctx b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/uml-rt.ctx index 6f6396e78..a0933282d 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/uml-rt.ctx +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.properties/propertyView/UML-RT/uml-rt.ctx @@ -1,303 +1,907 @@ <?xml version="1.0" encoding="ASCII"?> -<contexts:Context xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" xmi:id="_WdNAMPMfEeSMV8TyMaa7Sg" name="uml-rt"> - <dependencies href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_69QJkKDJEeSZxfCXzZz3-w"/> - <tabs xmi:id="_WdNAMfMfEeSMV8TyMaa7Sg" label="UML-RT" id="umlrealtime" priority="5"> - <sections xmi:id="_WdNAMvMfEeSMV8TyMaa7Sg" name="Single RTConnector" sectionFile="ui/SingleRTConnector.xwt"> - <widget href="ui/SingleRTConnector.xwt#/"/> +<contexts:Context + xmi:version="2.0" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" + xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" + xmi:id="_WdNAMPMfEeSMV8TyMaa7Sg" + name="uml-rt"> + <dependencies + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_69QJkKDJEeSZxfCXzZz3-w"/> + <tabs xmi:id="_WdNAMfMfEeSMV8TyMaa7Sg" + label="UML-RT" + id="umlrealtime" + priority="5"> + <sections + xmi:id="_WdNAMvMfEeSMV8TyMaa7Sg" + name="Single RTConnector" + sectionFile="ui/SingleRTConnector.xwt"> + <widget + href="ui/SingleRTConnector.xwt#/"/> </sections> - <sections xmi:id="_WdNAM_MfEeSMV8TyMaa7Sg" name="Multiple RTConnector" sectionFile="ui/MultipleRTConnector.xwt"> - <widget href="ui/MultipleRTConnector.xwt#/"/> + <sections + xmi:id="_WdNAM_MfEeSMV8TyMaa7Sg" + name="Multiple RTConnector" + sectionFile="ui/MultipleRTConnector.xwt"> + <widget + href="ui/MultipleRTConnector.xwt#/"/> </sections> - <sections xmi:id="_WdNANPMfEeSMV8TyMaa7Sg" name="Single RTPort" sectionFile="ui/SingleRTPort.xwt"> - <widget href="ui/SingleRTPort.xwt#/"/> + <sections + xmi:id="_WdNANPMfEeSMV8TyMaa7Sg" + name="Single RTPort" + sectionFile="ui/SingleRTPort.xwt"> + <widget + href="ui/SingleRTPort.xwt#/"/> </sections> - <sections xmi:id="_WdNANfMfEeSMV8TyMaa7Sg" name="Multiple RTPort" sectionFile="ui/MultipleRTPort.xwt"> - <widget href="ui/MultipleRTPort.xwt#/"/> + <sections + xmi:id="_WdNANfMfEeSMV8TyMaa7Sg" + name="Multiple RTPort" + sectionFile="ui/MultipleRTPort.xwt"> + <widget + href="ui/MultipleRTPort.xwt#/"/> </sections> - <sections xmi:id="_WdNANvMfEeSMV8TyMaa7Sg" name="Single Capsule" sectionFile="ui/SingleCapsule.xwt"> - <widget href="ui/SingleCapsule.xwt#/"/> + <sections + xmi:id="_WdNANvMfEeSMV8TyMaa7Sg" + name="Single Capsule" + sectionFile="ui/SingleCapsule.xwt"> + <widget + href="ui/SingleCapsule.xwt#/"/> </sections> - <sections xmi:id="_WdNAN_MfEeSMV8TyMaa7Sg" name="Multiple Capsule" sectionFile="ui/MultipleCapsule.xwt"> - <widget href="ui/MultipleCapsule.xwt#/"/> + <sections + xmi:id="_WdNAN_MfEeSMV8TyMaa7Sg" + name="Multiple Capsule" + sectionFile="ui/MultipleCapsule.xwt"> + <widget + href="ui/MultipleCapsule.xwt#/"/> </sections> - <sections xmi:id="_WdNAOPMfEeSMV8TyMaa7Sg" name="Single Protocol" sectionFile="ui/SingleProtocol.xwt"> - <widget href="ui/SingleProtocol.xwt#/"/> + <sections + xmi:id="_WdNAOPMfEeSMV8TyMaa7Sg" + name="Single Protocol" + sectionFile="ui/SingleProtocol.xwt"> + <widget + href="ui/SingleProtocol.xwt#/"/> </sections> - <sections xmi:id="_WdNAOfMfEeSMV8TyMaa7Sg" name="Multiple Protocol" sectionFile="ui/MultipleProtocol.xwt"> - <widget href="ui/MultipleProtocol.xwt#/"/> + <sections + xmi:id="_WdNAOfMfEeSMV8TyMaa7Sg" + name="Multiple Protocol" + sectionFile="ui/MultipleProtocol.xwt"> + <widget + href="ui/MultipleProtocol.xwt#/"/> </sections> - <sections xmi:id="_WdNAOvMfEeSMV8TyMaa7Sg" name="Single RTMessageSet" sectionFile="ui/SingleRTMessageSet.xwt"> - <widget href="ui/SingleRTMessageSet.xwt#/"/> + <sections + xmi:id="_WdNAOvMfEeSMV8TyMaa7Sg" + name="Single RTMessageSet" + sectionFile="ui/SingleRTMessageSet.xwt"> + <widget + href="ui/SingleRTMessageSet.xwt#/"/> </sections> - <sections xmi:id="_WdNAO_MfEeSMV8TyMaa7Sg" name="Multiple RTMessageSet" sectionFile="ui/MultipleRTMessageSet.xwt"> - <widget href="ui/MultipleRTMessageSet.xwt#/"/> + <sections + xmi:id="_WdNAO_MfEeSMV8TyMaa7Sg" + name="Multiple RTMessageSet" + sectionFile="ui/MultipleRTMessageSet.xwt"> + <widget + href="ui/MultipleRTMessageSet.xwt#/"/> </sections> - <sections xmi:id="_WdNAPPMfEeSMV8TyMaa7Sg" name="Single ProtocolContainer" sectionFile="ui/SingleProtocolContainer.xwt"> - <widget href="ui/SingleProtocolContainer.xwt#/"/> + <sections + xmi:id="_WdNAPPMfEeSMV8TyMaa7Sg" + name="Single ProtocolContainer" + sectionFile="ui/SingleProtocolContainer.xwt"> + <widget + href="ui/SingleProtocolContainer.xwt#/"/> </sections> - <sections xmi:id="_WdNAPfMfEeSMV8TyMaa7Sg" name="Multiple ProtocolContainer" sectionFile="ui/MultipleProtocolContainer.xwt"> - <widget href="ui/MultipleProtocolContainer.xwt#/"/> + <sections + xmi:id="_WdNAPfMfEeSMV8TyMaa7Sg" + name="Multiple ProtocolContainer" + sectionFile="ui/MultipleProtocolContainer.xwt"> + <widget + href="ui/MultipleProtocolContainer.xwt#/"/> </sections> - <sections xmi:id="_WdNAPvMfEeSMV8TyMaa7Sg" name="Single CapsulePart" sectionFile="ui/SingleCapsulePart.xwt"> - <widget href="ui/SingleCapsulePart.xwt#/"/> + <sections + xmi:id="_WdNAPvMfEeSMV8TyMaa7Sg" + name="Single CapsulePart" + sectionFile="ui/SingleCapsulePart.xwt"> + <widget + href="ui/SingleCapsulePart.xwt#/"/> </sections> - <sections xmi:id="_WdNAP_MfEeSMV8TyMaa7Sg" name="Multiple CapsulePart" sectionFile="ui/MultipleCapsulePart.xwt"> - <widget href="ui/MultipleCapsulePart.xwt#/"/> + <sections + xmi:id="_WdNAP_MfEeSMV8TyMaa7Sg" + name="Multiple CapsulePart" + sectionFile="ui/MultipleCapsulePart.xwt"> + <widget + href="ui/MultipleCapsulePart.xwt#/"/> </sections> - <sections xmi:id="_WdNArvMfEeSMV8TyMaa7Sg" name="Single MessageParameter" sectionFile="ui/SingleMessageParameter.xwt"> - <widget href="ui/SingleMessageParameter.xwt#/"/> + <sections + xmi:id="_WdNArvMfEeSMV8TyMaa7Sg" + name="Single MessageParameter" + sectionFile="ui/SingleMessageParameter.xwt"> + <widget + href="ui/SingleMessageParameter.xwt#/"/> </sections> - <sections xmi:id="_WdNAQPMfEeSMV8TyMaa7Sg" name="Single RTRExcludedElement" sectionFile="ui/SingleRTRExcludedElement.xwt"> - <widget href="ui/SingleRTRExcludedElement.xwt#/"/> + <sections + xmi:id="_WdNAQPMfEeSMV8TyMaa7Sg" + name="Single RTRExcludedElement" + sectionFile="ui/SingleRTRExcludedElement.xwt"> + <widget + href="ui/SingleRTRExcludedElement.xwt#/"/> </sections> - <sections xmi:id="_WdNAQfMfEeSMV8TyMaa7Sg" name="Multiple RTRExcludedElement" sectionFile="ui/MultipleRTRExcludedElement.xwt"> - <widget href="ui/MultipleRTRExcludedElement.xwt#/"/> + <sections + xmi:id="_WdNAQfMfEeSMV8TyMaa7Sg" + name="Multiple RTRExcludedElement" + sectionFile="ui/MultipleRTRExcludedElement.xwt"> + <widget + href="ui/MultipleRTRExcludedElement.xwt#/"/> </sections> - <sections xmi:id="_SectID_SingleRTTrigger" name="Single RTTtrigger" sectionFile="ui/SingleRTTrigger.xwt"> - <widget href="ui/SingleRTTrigger.xwt#/"/> + <sections + xmi:id="_SectID_SingleRTTrigger" + name="Single RTTtrigger" + sectionFile="ui/SingleRTTrigger.xwt"> + <widget + href="ui/SingleRTTrigger.xwt#/"/> </sections> - <sections xmi:id="_SectID_MultRTTrigger" name="Multiple RTTtrigger" sectionFile="ui/MultipleRTTrigger.xwt"> - <widget href="ui/MultipleRTTrigger.xwt#/"/> + <sections + xmi:id="_SectID_MultRTTrigger" + name="Multiple RTTtrigger" + sectionFile="ui/MultipleRTTrigger.xwt"> + <widget + href="ui/MultipleRTTrigger.xwt#/"/> </sections> - <sections xmi:id="_SectID_singleProtocolMessage" name="Single ProtocolMessage" sectionFile="ui/SingleProtocolMessage.xwt"> - <widget href="ui/SingleProtocolMessage.xwt#/"/> + <sections + xmi:id="_SectID_singleProtocolMessage" + name="Single ProtocolMessage" + sectionFile="ui/SingleProtocolMessage.xwt"> + <widget + href="ui/SingleProtocolMessage.xwt#/"/> </sections> - <sections xmi:id="_SectID_singlePackage" name="Single Package" sectionFile="ui/SinglePackage.xwt"> - <widget href="ui/SinglePackage.xwt#/"/> + <sections + xmi:id="_SectID_singlePackage" + name="Single Package" + sectionFile="ui/SinglePackage.xwt"> + <widget + href="ui/SinglePackage.xwt#/"/> </sections> - <sections xmi:id="_BXvsICJZEeaz9Naew8DdYw" name="Single RTPort GridLayout" sectionFile="ui/SingleRTPortGridLayout.xwt"> - <widget href="ui/SingleRTPortGridLayout.xwt#/"/> + <sections + xmi:id="_BXvsICJZEeaz9Naew8DdYw" + name="Single RTPort GridLayout" + sectionFile="ui/SingleRTPortGridLayout.xwt"> + <widget + href="ui/SingleRTPortGridLayout.xwt#/"/> </sections> - <sections xmi:id="_YVrlgCJvEeaz9Naew8DdYw" name="Single RTPort PropertiesLayout" sectionFile="ui/SingleRTPortPropertiesLayout.xwt"> - <widget href="ui/SingleRTPortPropertiesLayout.xwt#/"/> + <sections + xmi:id="_YVrlgCJvEeaz9Naew8DdYw" + name="Single RTPort PropertiesLayout" + sectionFile="ui/SingleRTPortPropertiesLayout.xwt"> + <widget + href="ui/SingleRTPortPropertiesLayout.xwt#/"/> </sections> - <sections xmi:id="_sBPbEJeoEea3dNjw83SHMw" name="Single Transition" sectionFile="ui/SingleTransition.xwt"> - <widget href="ui/SingleTransition.xwt#/"/> + <sections + xmi:id="_sBPbEJeoEea3dNjw83SHMw" + name="Single Transition" + sectionFile="ui/SingleTransition.xwt"> + <widget + href="ui/SingleTransition.xwt#/"/> </sections> </tabs> - <tabs xmi:id="_XgemgCDoEeahxOfXzPUkdQ" label="Language" id="umlrealtime_language" indented="true" priority="10"> - <sections xmi:id="_SectID_singlePackage_Language" name="Single Package Language" sectionFile="ui/SinglePackageLanguage.xwt"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_0U4hkCGOEeaB54IsGU6vwQ" name="isSingleRootPackageSection"> - <constraintType href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.1"/> + <tabs xmi:id="_XgemgCDoEeahxOfXzPUkdQ" + label="Language" + id="umlrealtime_language" + indented="true" + priority="10"> + <sections + xmi:id="_SectID_singlePackage_Language" + name="Single Package Language" + sectionFile="ui/SinglePackageLanguage.xwt"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_0U4hkCGOEeaB54IsGU6vwQ" + name="isSingleRootPackageSection"> + <constraintType + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.1"/> </constraints> - <widget href="ui/SinglePackageLanguage.xwt#/"/> + <widget + href="ui/SinglePackageLanguage.xwt#/"/> </sections> </tabs> - <views xmi:id="_WdNAQvMfEeSMV8TyMaa7Sg" name="Single RTConnector" sections="_WdNAMvMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnafMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNAQ_MfEeSMV8TyMaa7Sg" name="isSingleRTConnector"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNARPMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::RTConnector"/> + <views xmi:id="_WdNAQvMfEeSMV8TyMaa7Sg" + name="Single RTConnector" + sections="_WdNAMvMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnafMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNAQ_MfEeSMV8TyMaa7Sg" + name="isSingleRTConnector"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNARPMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::RTConnector"/> </constraints> </views> - <views xmi:id="_WdNARfMfEeSMV8TyMaa7Sg" elementMultiplicity="-1" name="Multiple RTConnector" sections="_WdNAM_MfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnafMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNARvMfEeSMV8TyMaa7Sg" name="isMultipleRTConnector"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNAR_MfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::RTConnector"/> + <views xmi:id="_WdNARfMfEeSMV8TyMaa7Sg" + elementMultiplicity="-1" + name="Multiple RTConnector" + sections="_WdNAM_MfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnafMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNARvMfEeSMV8TyMaa7Sg" + name="isMultipleRTConnector"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNAR_MfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::RTConnector"/> </constraints> </views> - <views xmi:id="_WdNASPMfEeSMV8TyMaa7Sg" name="Single RTPort" sections="_WdNANPMfEeSMV8TyMaa7Sg _BXvsICJZEeaz9Naew8DdYw _YVrlgCJvEeaz9Naew8DdYw" automaticContext="true" datacontexts="_WdNnY_MfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNASfMfEeSMV8TyMaa7Sg" name="isSingleRTPort"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNASvMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::RTPort"/> + <views xmi:id="_WdNASPMfEeSMV8TyMaa7Sg" + name="Single RTPort" + sections="_WdNANPMfEeSMV8TyMaa7Sg _BXvsICJZEeaz9Naew8DdYw _YVrlgCJvEeaz9Naew8DdYw" + automaticContext="true" + datacontexts="_WdNnY_MfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNASfMfEeSMV8TyMaa7Sg" + name="isSingleRTPort"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNASvMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::RTPort"/> </constraints> </views> - <views xmi:id="_WdNnVvMfEeSMV8TyMaa7Sg" name="Single CapsulePart" sections="_WdNAPvMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnavMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnV_MfEeSMV8TyMaa7Sg" name="isSingleCapsulePart"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnWPMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::CapsulePart"/> + <views xmi:id="_WdNnVvMfEeSMV8TyMaa7Sg" + name="Single CapsulePart" + sections="_WdNAPvMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnavMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnV_MfEeSMV8TyMaa7Sg" + name="isSingleCapsulePart"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnWPMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::CapsulePart"/> </constraints> </views> - <views xmi:id="_WdNAS_MfEeSMV8TyMaa7Sg" elementMultiplicity="-1" name="Multiple RTPort" sections="_WdNANfMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnY_MfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNATPMfEeSMV8TyMaa7Sg" name="isMultipleRTPort"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNATfMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::RTPort"/> + <views xmi:id="_WdNAS_MfEeSMV8TyMaa7Sg" + elementMultiplicity="-1" + name="Multiple RTPort" + sections="_WdNANfMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnY_MfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNATPMfEeSMV8TyMaa7Sg" + name="isMultipleRTPort"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNATfMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::RTPort"/> </constraints> </views> - <views xmi:id="_WdNATvMfEeSMV8TyMaa7Sg" name="Single Capsule" sections="_WdNANvMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnbfMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNAT_MfEeSMV8TyMaa7Sg" name="isSingleCapsule"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnQPMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::Capsule"/> + <views xmi:id="_WdNATvMfEeSMV8TyMaa7Sg" + name="Single Capsule" + sections="_WdNANvMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnbfMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNAT_MfEeSMV8TyMaa7Sg" + name="isSingleCapsule"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnQPMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::Capsule"/> </constraints> </views> - <views xmi:id="_WdNnQfMfEeSMV8TyMaa7Sg" elementMultiplicity="-1" name="Multiple Capsule" sections="_WdNAN_MfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnbfMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnQvMfEeSMV8TyMaa7Sg" name="isMultipleCapsule"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnQ_MfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::Capsule"/> + <views xmi:id="_WdNnQfMfEeSMV8TyMaa7Sg" + elementMultiplicity="-1" + name="Multiple Capsule" + sections="_WdNAN_MfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnbfMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnQvMfEeSMV8TyMaa7Sg" + name="isMultipleCapsule"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnQ_MfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::Capsule"/> </constraints> </views> - <views xmi:id="_WdNnRPMfEeSMV8TyMaa7Sg" name="Single Protocol" sections="_WdNAOPMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNncfMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnRfMfEeSMV8TyMaa7Sg" name="isSingleProtocol"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnRvMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::Protocol"/> + <views xmi:id="_WdNnRPMfEeSMV8TyMaa7Sg" + name="Single Protocol" + sections="_WdNAOPMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNncfMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnRfMfEeSMV8TyMaa7Sg" + name="isSingleProtocol"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnRvMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::Protocol"/> </constraints> </views> - <views xmi:id="_WdNnR_MfEeSMV8TyMaa7Sg" elementMultiplicity="-1" name="Multiple Protocol" sections="_WdNAOfMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNncfMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnSPMfEeSMV8TyMaa7Sg" name="isMultipleProtocol"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnSfMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::Protocol"/> + <views xmi:id="_WdNnR_MfEeSMV8TyMaa7Sg" + elementMultiplicity="-1" + name="Multiple Protocol" + sections="_WdNAOfMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNncfMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnSPMfEeSMV8TyMaa7Sg" + name="isMultipleProtocol"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnSfMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::Protocol"/> </constraints> </views> - <views xmi:id="_WdNnSvMfEeSMV8TyMaa7Sg" name="Single RTMessageSet" sections="_WdNAOvMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnbvMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnS_MfEeSMV8TyMaa7Sg" name="isSingleRTMessageSet"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnTPMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::RTMessageSet"/> + <views xmi:id="_WdNnSvMfEeSMV8TyMaa7Sg" + name="Single RTMessageSet" + sections="_WdNAOvMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnbvMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnS_MfEeSMV8TyMaa7Sg" + name="isSingleRTMessageSet"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnTPMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::RTMessageSet"/> </constraints> </views> - <views xmi:id="_WdNnTfMfEeSMV8TyMaa7Sg" elementMultiplicity="-1" name="Multiple RTMessageSet" sections="_WdNAO_MfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnbvMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnTvMfEeSMV8TyMaa7Sg" name="isMultipleRTMessageSet"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnT_MfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::RTMessageSet"/> + <views xmi:id="_WdNnTfMfEeSMV8TyMaa7Sg" + elementMultiplicity="-1" + name="Multiple RTMessageSet" + sections="_WdNAO_MfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnbvMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnTvMfEeSMV8TyMaa7Sg" + name="isMultipleRTMessageSet"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnT_MfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::RTMessageSet"/> </constraints> </views> - <views xmi:id="_WdNnUPMfEeSMV8TyMaa7Sg" name="Single ProtocolContainer" sections="_WdNAPPMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNna_MfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnUfMfEeSMV8TyMaa7Sg" name="isSingleProtocolContainer"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnUvMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::ProtocolContainer"/> + <views xmi:id="_WdNnUPMfEeSMV8TyMaa7Sg" + name="Single ProtocolContainer" + sections="_WdNAPPMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNna_MfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnUfMfEeSMV8TyMaa7Sg" + name="isSingleProtocolContainer"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnUvMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::ProtocolContainer"/> </constraints> </views> - <views xmi:id="_WdNnU_MfEeSMV8TyMaa7Sg" elementMultiplicity="-1" name="Multiple ProtocolContainer" sections="_WdNAPfMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNna_MfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnVPMfEeSMV8TyMaa7Sg" name="isMultipleProtocolContainer"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnVfMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::ProtocolContainer"/> + <views xmi:id="_WdNnU_MfEeSMV8TyMaa7Sg" + elementMultiplicity="-1" + name="Multiple ProtocolContainer" + sections="_WdNAPfMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNna_MfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnVPMfEeSMV8TyMaa7Sg" + name="isMultipleProtocolContainer"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnVfMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::ProtocolContainer"/> </constraints> </views> - <views xmi:id="_WdNnWfMfEeSMV8TyMaa7Sg" elementMultiplicity="-1" name="Multiple CapsulePart" sections="_WdNAP_MfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnavMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnWvMfEeSMV8TyMaa7Sg" name="isMultipleCapsulePart"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnW_MfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::CapsulePart"/> + <views xmi:id="_WdNnWfMfEeSMV8TyMaa7Sg" + elementMultiplicity="-1" + name="Multiple CapsulePart" + sections="_WdNAP_MfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnavMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnWvMfEeSMV8TyMaa7Sg" + name="isMultipleCapsulePart"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnW_MfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::CapsulePart"/> </constraints> </views> - <views xmi:id="_WdNnXPMfEeSMV8TyMaa7Sg" name="Single RTRExcludedElement" sections="_WdNAQPMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnbPMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnXfMfEeSMV8TyMaa7Sg" name="isSingleRTRExcludedElement"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnXvMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::RTRExcludedElement"/> + <views xmi:id="_WdNnXPMfEeSMV8TyMaa7Sg" + name="Single RTRExcludedElement" + sections="_WdNAQPMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnbPMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnXfMfEeSMV8TyMaa7Sg" + name="isSingleRTRExcludedElement"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnXvMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::RTRExcludedElement"/> </constraints> </views> - <views xmi:id="_WdNnX_MfEeSMV8TyMaa7Sg" elementMultiplicity="-1" name="Multiple RTRExcludedElement" sections="_WdNAQfMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnbPMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_WdNnYPMfEeSMV8TyMaa7Sg" name="isMultipleRTRExcludedElement"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_WdNnYfMfEeSMV8TyMaa7Sg" name="stereotypeName" value="UMLRealTime::RTRExcludedElement"/> + <views xmi:id="_WdNnX_MfEeSMV8TyMaa7Sg" + elementMultiplicity="-1" + name="Multiple RTRExcludedElement" + sections="_WdNAQfMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnbPMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_WdNnYPMfEeSMV8TyMaa7Sg" + name="isMultipleRTRExcludedElement"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_WdNnYfMfEeSMV8TyMaa7Sg" + name="stereotypeName" + value="UMLRealTime::RTRExcludedElement"/> </constraints> </views> - <views xmi:id="_ViewID_SingleRTTrigger" name="Single RTTrigger" sections="_SectID_SingleRTTrigger" automaticContext="true" datacontexts="_DC_ID_Trigger"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_ConID_SingleTrigger" name="isSingleRTTrigger"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_ValID_SingleTrigger" name="umlClassName" value="Trigger"/> + <views xmi:id="_ViewID_SingleRTTrigger" + name="Single RTTrigger" + sections="_SectID_SingleRTTrigger" + automaticContext="true" + datacontexts="_DC_ID_Trigger"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_ConID_SingleTrigger" + name="isSingleRTTrigger"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_ValID_SingleTrigger" + name="umlClassName" + value="Trigger"/> </constraints> </views> - <views xmi:id="_ViewID_MultRTTrigger" elementMultiplicity="-1" name="Multiple RTTrigger" sections="_SectID_MultRTTrigger" automaticContext="true" datacontexts="_DC_ID_Trigger"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_ConID_MultTrigger" name="isMultipleRTTrigger"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_ValID_MultTrigger" name="umlClassName" value="Trigger"/> + <views xmi:id="_ViewID_MultRTTrigger" + elementMultiplicity="-1" + name="Multiple RTTrigger" + sections="_SectID_MultRTTrigger" + automaticContext="true" + datacontexts="_DC_ID_Trigger"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_ConID_MultTrigger" + name="isMultipleRTTrigger"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_ValID_MultTrigger" + name="umlClassName" + value="Trigger"/> </constraints> </views> - <views xmi:id="_ViewID_SingleProtocolMessage" name="Single ProtocolMessage" sections="_SectID_singleProtocolMessage" automaticContext="true" datacontexts="_DC_ID_ProtocolMessage"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_ConID_SingleProtocolMessage" name="isSingleProtocolMessage"> - <constraintType href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_ValID_SingleProtocolMessage" name="elementTypeID" value="org.eclipse.papyrusrt.umlrt.core.ProtocolMessage"/> + <views xmi:id="_ViewID_SingleProtocolMessage" + name="Single ProtocolMessage" + sections="_SectID_singleProtocolMessage" + automaticContext="true" + datacontexts="_DC_ID_ProtocolMessage"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_ConID_SingleProtocolMessage" + name="isSingleProtocolMessage"> + <constraintType + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_ValID_SingleProtocolMessage" + name="elementTypeID" + value="org.eclipse.papyrusrt.umlrt.core.ProtocolMessage"/> </constraints> </views> - <views xmi:id="_viewID_SinglePackage" name="Single Package" sections="_SectID_singlePackage" automaticContext="true"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="__ConID_SinglePackage" name="isSinglePackageView"> - <constraintType href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_ValID_SinglePackage" name="elementTypeID" value="org.eclipse.papyrus.uml.Package"/> + <views xmi:id="_viewID_SinglePackage" + name="Single Package" + sections="_SectID_singlePackage" + automaticContext="true"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="__ConID_SinglePackage" + name="isSinglePackageView"> + <constraintType + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_ValID_SinglePackage" + name="elementTypeID" + value="org.eclipse.papyrus.uml.Package"/> </constraints> </views> - <views xmi:id="_BqRA0CDrEeahxOfXzPUkdQ" name="Single Root Package " sections="_SectID_singlePackage_Language" automaticContext="true"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="__ConID_SingleRootPackage" name="isSingleRootPackage"> - <constraintType href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.1"/> + <views xmi:id="_BqRA0CDrEeahxOfXzPUkdQ" + name="Single Root Package " + sections="_SectID_singlePackage_Language" + automaticContext="true"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="__ConID_SingleRootPackage" + name="isSingleRootPackage"> + <constraintType + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.1"/> </constraints> </views> - <views xmi:id="_W4uXgHXuEeao4KHw1bDb-w" name="Single MessageParameter" sections="_WdNArvMfEeSMV8TyMaa7Sg" automaticContext="true" datacontexts="_WdNnavMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_W4uXgXXuEeao4KHw1bDb-w" name="isSingleMessageParameter"> - <constraintType href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_W4uXgnXuEeao4KHw1bDb-w" name="elementTypeID" value="org.eclipse.papyrusrt.umlrt.core.RTMessageParameter"/> + <views xmi:id="_W4uXgHXuEeao4KHw1bDb-w" + name="Single MessageParameter" + sections="_WdNArvMfEeSMV8TyMaa7Sg" + automaticContext="true" + datacontexts="_WdNnavMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_W4uXgXXuEeao4KHw1bDb-w" + name="isSingleMessageParameter"> + <constraintType + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_W4uXgnXuEeao4KHw1bDb-w" + name="elementTypeID" + value="org.eclipse.papyrusrt.umlrt.core.RTMessageParameter"/> </constraints> </views> - <views xmi:id="_nRw0MJeoEea3dNjw83SHMw" name="Single Transition" sections="_sBPbEJeoEea3dNjw83SHMw"> - <constraints xsi:type="constraints:CompositeConstraint" xmi:id="_RA2ZkKA9EeaJ5NioaCl7yw" name="isRTTransition"> - <constraints xmi:id="_QbubIJepEea3dNjw83SHMw" name="isSingleTransition"> - <constraintType href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_s-ujwJe4Eea3dNjw83SHMw" name="elementTypeID" value="org.eclipse.papyrus.uml.Transition"/> + <views xmi:id="_nRw0MJeoEea3dNjw83SHMw" + name="Single Transition" + sections="_sBPbEJeoEea3dNjw83SHMw"> + <constraints + xsi:type="constraints:CompositeConstraint" + xmi:id="_RA2ZkKA9EeaJ5NioaCl7yw" + name="isRTTransition"> + <constraints + xmi:id="_QbubIJepEea3dNjw83SHMw" + name="isSingleTransition"> + <constraintType + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_s-ujwJe4Eea3dNjw83SHMw" + name="elementTypeID" + value="org.eclipse.papyrus.uml.Transition"/> </constraints> - <constraints xmi:id="_XiunoKA8EeaJ5NioaCl7yw" name="isProfileApplied"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.4"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_dJnXoKA8EeaJ5NioaCl7yw" name="profileURI" value="http://www.eclipse.org/papyrus/umlrt"/> + <constraints + xmi:id="_XiunoKA8EeaJ5NioaCl7yw" + name="isProfileApplied"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.4"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_dJnXoKA8EeaJ5NioaCl7yw" + name="profileURI" + value="http://www.eclipse.org/papyrus/umlrt"/> </constraints> </constraints> </views> - <dataContexts xmi:id="_WdNnYvMfEeSMV8TyMaa7Sg" name="UMLRealTime"> - <elements xmi:id="_WdNnY_MfEeSMV8TyMaa7Sg" name="RTPort"> - <properties xmi:id="_WdNnZPMfEeSMV8TyMaa7Sg" name="isNotification" type="Boolean"/> - <properties xmi:id="_WdNnZfMfEeSMV8TyMaa7Sg" name="isPublish" type="Boolean"/> - <properties xmi:id="_WdNnZvMfEeSMV8TyMaa7Sg" name="isWired" type="Boolean"/> - <properties xmi:id="_WdNnZ_MfEeSMV8TyMaa7Sg" name="registration" type="Enumeration" description=""/> - <properties xmi:id="_WdNnaPMfEeSMV8TyMaa7Sg" name="registrationOverride" description=""/> - <properties xmi:id="_QhkXQC6_EeWWx70qeJ-t-Q" name="kind" label="" type="Enumeration" description=""/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ylaDJEeSZxfCXzZz3-w"/> + <dataContexts + xmi:id="_WdNnYvMfEeSMV8TyMaa7Sg" + name="UMLRealTime"> + <elements + xmi:id="_WdNnY_MfEeSMV8TyMaa7Sg" + name="RTPort"> + <properties + xmi:id="_WdNnZPMfEeSMV8TyMaa7Sg" + name="isNotification" + type="Boolean"/> + <properties + xmi:id="_WdNnZfMfEeSMV8TyMaa7Sg" + name="isPublish" + type="Boolean"/> + <properties + xmi:id="_WdNnZvMfEeSMV8TyMaa7Sg" + name="isWired" + type="Boolean"/> + <properties + xmi:id="_WdNnZ_MfEeSMV8TyMaa7Sg" + name="registration" + type="Enumeration" + description=""/> + <properties + xmi:id="_WdNnaPMfEeSMV8TyMaa7Sg" + name="registrationOverride" + description=""/> + <properties + xmi:id="_QhkXQC6_EeWWx70qeJ-t-Q" + name="kind" + label="" + type="Enumeration" + description=""/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ylaDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNnafMfEeSMV8TyMaa7Sg" name="RTConnector"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yvqDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNnafMfEeSMV8TyMaa7Sg" + name="RTConnector"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yvqDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNnavMfEeSMV8TyMaa7Sg" name="CapsulePart"> - <properties xmi:id="_8KJ-8ETHEeWh8r-Cla6cZg" name="kind" label="" type="Enumeration"/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yG6DJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNnavMfEeSMV8TyMaa7Sg" + name="CapsulePart"> + <properties + xmi:id="_8KJ-8ETHEeWh8r-Cla6cZg" + name="kind" + label="" + type="Enumeration"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yG6DJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNna_MfEeSMV8TyMaa7Sg" name="ProtocolContainer"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690xiaDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNna_MfEeSMV8TyMaa7Sg" + name="ProtocolContainer"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690xiaDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNnbPMfEeSMV8TyMaa7Sg" name="RTRExcludedElement"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690x0KDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNnbPMfEeSMV8TyMaa7Sg" + name="RTRExcludedElement"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690x0KDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNnbfMfEeSMV8TyMaa7Sg" name="Capsule"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yXqDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNnbfMfEeSMV8TyMaa7Sg" + name="Capsule"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yXqDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNnbvMfEeSMV8TyMaa7Sg" name="RTMessageSet"> - <properties xmi:id="_WdNnb_MfEeSMV8TyMaa7Sg" name="rtMsgKind" type="Enumeration"/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ybKDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNnbvMfEeSMV8TyMaa7Sg" + name="RTMessageSet"> + <properties + xmi:id="_WdNnb_MfEeSMV8TyMaa7Sg" + name="rtMsgKind" + type="Enumeration"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ybKDJEeSZxfCXzZz3-w"/> </elements> - <modelElementFactory href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@modelElementFactories.1"/> + <modelElementFactory + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@modelElementFactories.1"/> </dataContexts> - <dataContexts xmi:id="_WdNncPMfEeSMV8TyMaa7Sg" name="UMLRealTimeExt"> - <elements xmi:id="_WdNncfMfEeSMV8TyMaa7Sg" name="Protocol"> - <properties xmi:id="_WdNncvMfEeSMV8TyMaa7Sg" name="provides" type="Reference"/> - <properties xmi:id="_WdNnc_MfEeSMV8TyMaa7Sg" name="required" type="Reference"/> - <properties xmi:id="_WdNndPMfEeSMV8TyMaa7Sg" name="provreq" type="Reference"/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690y4KDJEeSZxfCXzZz3-w"/> + <dataContexts + xmi:id="_WdNncPMfEeSMV8TyMaa7Sg" + name="UMLRealTimeExt"> + <elements + xmi:id="_WdNncfMfEeSMV8TyMaa7Sg" + name="Protocol"> + <properties + xmi:id="_WdNncvMfEeSMV8TyMaa7Sg" + name="provides" + type="Reference"/> + <properties + xmi:id="_WdNnc_MfEeSMV8TyMaa7Sg" + name="required" + type="Reference"/> + <properties + xmi:id="_WdNndPMfEeSMV8TyMaa7Sg" + name="provreq" + type="Reference"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690y4KDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_SIdvoDIMEeWNUrU2mjUBfw" name="Port"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ylaDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_SIdvoDIMEeWNUrU2mjUBfw" + name="Port"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ylaDJEeSZxfCXzZz3-w"/> + <supertypes + href="#_8fNAkMCgEeaQF9hkPG_edQ"/> </elements> - <elements xmi:id="UMLRealTimeExtCapsulePartElement" name="Property"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yG6DJEeSZxfCXzZz3-w"/> + <elements + xmi:id="UMLRealTimeExtCapsulePartElement" + name="Property"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yG6DJEeSZxfCXzZz3-w"/> + <supertypes + href="#_8fNAkMCgEeaQF9hkPG_edQ"/> </elements> - <elements xmi:id="_DC_ID_Trigger" name="RTTrigger"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ykaDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_DC_ID_Trigger" + name="RTTrigger"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ykaDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_DC_ID_ProtocolMessage" name="ProtocolMessage"> - <properties xmi:id="_MBclYMOIEeWTxq8p136Dmw" name="ownedParameter" label="Owned Parameters" type="Reference" description=""/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yQKDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_DC_ID_ProtocolMessage" + name="ProtocolMessage"> + <properties + xmi:id="_MBclYMOIEeWTxq8p136Dmw" + name="ownedParameter" + label="Owned Parameters" + type="Reference" + description=""/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yQKDJEeSZxfCXzZz3-w"/> </elements> - <elements xsi:type="contexts:DataContextRoot" xmi:id="_XDD68EZQEeWh8r-Cla6cZg" name="RTMultiplicity"> - <properties xmi:id="_XDD68UZQEeWh8r-Cla6cZg" name="RTmultiplicity" label="Multiplicity" type="Reference" description="Only n or 0..n multiplicity is allowed for Capsule Part"/> - <properties xmi:id="_X5LXEAxzEeaz9rBOqbTptw" name="replication" label="Replication" type="Reference" description=" Update the replication factor"/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_6964oaDJEeSZxfCXzZz3-w"/> - <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.umlrt.properties/propertyView/UML-RT/Environment.xmi#//@modelElementFactories.0"/> + <elements + xsi:type="contexts:DataContextRoot" + xmi:id="_XDD68EZQEeWh8r-Cla6cZg" + name="RTMultiplicity"> + <properties + xmi:id="_XDD68UZQEeWh8r-Cla6cZg" + name="RTmultiplicity" + label="Multiplicity" + type="Reference" + description="Only n or 0..n multiplicity is allowed for Capsule Part"/> + <properties + xmi:id="_X5LXEAxzEeaz9rBOqbTptw" + name="replication" + label="Replication" + type="Reference" + description=" Update the replication factor"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_6964oaDJEeSZxfCXzZz3-w"/> + <modelElementFactory + href="ppe:/environment/org.eclipse.papyrus.umlrt.properties/propertyView/UML-RT/Environment.xmi#//@modelElementFactories.0"/> </elements> - <elements xmi:id="_elementID_RTPackage" name="RTPackage"> - <properties xmi:id="_porpID_rtPackage_language" name="language" type="Enumeration"/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690xiaDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_elementID_RTPackage" + name="RTPackage"> + <properties + xmi:id="_porpID_rtPackage_language" + name="language" + type="Enumeration"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690xiaDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_FdjkUHXyEeao4KHw1bDb-w" name="RTMessageParameter"> - <properties xmi:id="_KfkssHXyEeao4KHw1bDb-w" name="type" label="Type" type="Reference"/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yBaDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_FdjkUHXyEeao4KHw1bDb-w" + name="RTMessageParameter"> + <properties + xmi:id="_KfkssHXyEeao4KHw1bDb-w" + name="type" + label="Type" + type="Reference"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yBaDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNndvMfEeSMV8TyMaa7Sg" name="Capsule"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yXqDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNndvMfEeSMV8TyMaa7Sg" + name="Capsule"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yXqDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_IWfRAJe3Eea3dNjw83SHMw" name="RTTransition"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yiKDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_IWfRAJe3Eea3dNjw83SHMw" + name="RTTransition"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yiKDJEeSZxfCXzZz3-w"/> </elements> - <modelElementFactory href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@modelElementFactories.0"/> + <elements + xmi:id="_8fNAkMCgEeaQF9hkPG_edQ" + name="RTNamedElement"> + <properties + xmi:id="_8fNAkcCgEeaQF9hkPG_edQ" + name="name" + description="The name of the NamedElement."/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690xk6DJEeSZxfCXzZz3-w"/> + </elements> + <modelElementFactory + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@modelElementFactories.0"/> + </dataContexts> + <dataContexts + xmi:id="_jcwwoM9jEeaEDpYjmvVhPA" + name="UMLRTFacade" + label=""> + <elements + xmi:id="_jcwwoc9jEeaEDpYjmvVhPA" + name="Protocol" + supertypes="_jcwws89jEeaEDpYjmvVhPA"> + <properties + xmi:id="_jcwwo89jEeaEDpYjmvVhPA" + name="Incoming" + label="In messages" + type="Reference" + multiplicity="-1" + description="The owned and inherited incoming messages."/> + <properties + xmi:id="_LDbY0M9kEeaEDpYjmvVhPA" + name="Outgoing" + label="Out messages" + type="Reference" + multiplicity="-1" + description="The owned and inherited outgoing messages."/> + <properties + xmi:id="_LLLmoM9kEeaEDpYjmvVhPA" + name="InOut" + label="In-out messages" + type="Reference" + multiplicity="-1" + description="The owned and inherited in-out messages."/> + </elements> + <elements + xmi:id="_jcwwsc9jEeaEDpYjmvVhPA" + name="Capsule" + supertypes="_jcwws89jEeaEDpYjmvVhPA"> + <properties + xmi:id="_ennxMM9kEeaEDpYjmvVhPA" + name="port" + label="Ports" + type="Reference" + multiplicity="-1" + description="The owned and inherited ports."/> + <properties + xmi:id="_ennxMc9kEeaEDpYjmvVhPA" + name="capsulePart" + label="Capsule parts" + type="Reference" + multiplicity="-1" + description="The owned and inherited capsule-parts."/> + <properties + xmi:id="_gXfMUM9kEeaEDpYjmvVhPA" + name="connector" + label="Connectors" + type="Reference" + multiplicity="-1" + description="The owned and inherited connectors."/> + </elements> + <elements + xmi:id="_jcwws89jEeaEDpYjmvVhPA" + name="NamedElement"> + <properties + xmi:id="_jcwwtM9jEeaEDpYjmvVhPA" + name="name" + description="The name of the NamedElement."/> + </elements> + <modelElementFactory + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@modelElementFactories.2"/> </dataContexts> </contexts:Context> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/META-INF/MANIFEST.MF b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/META-INF/MANIFEST.MF index 2ea646067..3e85325d2 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/META-INF/MANIFEST.MF +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/META-INF/MANIFEST.MF @@ -33,15 +33,18 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.108.0,4.0.0)", org.eclipse.papyrus.infra.nattable.model;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.uml.service.types;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrusrt.umlrt.tooling.types;bundle-version="[0.8.0,1.0.0)", - org.eclipse.papyrusrt.umlrt.common.rts.library;bundle-version="[0.8.0,1.0.0)" + org.eclipse.papyrusrt.umlrt.common.rts.library;bundle-version="[0.8.0,1.0.0)", + org.eclipse.papyrusrt.umlrt.uml;bundle-version="[0.8.0,1.0.0)";visibility:=reexport Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.papyrusrt.umlrt.tooling.ui, org.eclipse.papyrusrt.umlrt.tooling.ui.commands, org.eclipse.papyrusrt.umlrt.tooling.ui.constraints, org.eclipse.papyrusrt.umlrt.tooling.ui.databinding, + org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade, org.eclipse.papyrusrt.umlrt.tooling.ui.editors, org.eclipse.papyrusrt.umlrt.tooling.ui.internal.advice;x-internal:=true, + org.eclipse.papyrusrt.umlrt.tooling.ui.internal.handlers;x-internal:=true, org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement;x-internal:=true, org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties;x-internal:=true, org.eclipse.papyrusrt.umlrt.tooling.ui.internal.types;x-friends:="org.eclipse.papyrusrt.umlrt.tooling.properties", diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/build.properties b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/build.properties index 03455e6a2..9e27bbb32 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/build.properties +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/build.properties @@ -8,4 +8,5 @@ bin.includes = META-INF/,\ environment/,\ elementtypes/,\ dialogs/ +bin.excludes = icons/**/*.pxm jre.compilation.profile = JavaSE-1.8 diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/CreationDialogs.ctx b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/CreationDialogs.ctx index 3835ebfea..f3f2c8c2c 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/CreationDialogs.ctx +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/CreationDialogs.ctx @@ -1,105 +1,301 @@ <?xml version="1.0" encoding="ASCII"?> -<contexts:Context xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" xmi:id="_F4P6wDdoEeWK7ZUbpAMB-g" name="CreationDialogs"> - <dependencies href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_69QJkKDJEeSZxfCXzZz3-w"/> - <tabs xmi:id="_HowPEDdoEeWK7ZUbpAMB-g" label="Real Time" id="umlrealtime" priority="100"> - <sections xmi:id="_Ho1uoDdoEeWK7ZUbpAMB-g" name="Single RTPort" sectionFile="ui/SingleRTPort.xwt"> - <widget href="ui/SingleRTPort.xwt#/"/> +<contexts:Context + xmi:version="2.0" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" + xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" + xmi:id="_F4P6wDdoEeWK7ZUbpAMB-g" + name="CreationDialogs"> + <dependencies + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_69QJkKDJEeSZxfCXzZz3-w"/> + <tabs xmi:id="_HowPEDdoEeWK7ZUbpAMB-g" + label="Real Time" + id="umlrealtime" + priority="100"> + <sections + xmi:id="_Ho1uoDdoEeWK7ZUbpAMB-g" + name="Single RTPort" + sectionFile="ui/SingleRTPort.xwt"> + <widget + href="ui/SingleRTPort.xwt#/"/> </sections> - <sections xmi:id="CapsulePartSection" name="Single CapsulePart" sectionFile="ui/SingleCapsulePart.xwt"> - <widget href="ui/SingleCapsulePart.xwt#/"/> + <sections + xmi:id="CapsulePartSection" + name="Single CapsulePart" + sectionFile="ui/SingleCapsulePart.xwt"> + <widget + href="ui/SingleCapsulePart.xwt#/"/> </sections> - <sections xmi:id="_TFZ-cMsqEeWiCc89vePYSg" name="ParameterCreation" sectionFile="ui/ParameterCreation.xwt"> - <widget href="ui/ParameterCreation.xwt#/"/> + <sections + xmi:id="_TFZ-cMsqEeWiCc89vePYSg" + name="ParameterCreation" + sectionFile="ui/ParameterCreation.xwt"> + <widget + href="ui/ParameterCreation.xwt#/"/> </sections> - <sections xmi:id="_6XEyQAcbEeaXA7QItDtrGg" name="Single Capsule" sectionFile="ui/SingleCapsule.xwt"> - <widget href="ui/SingleCapsule.xwt#/"/> + <sections + xmi:id="_6XEyQAcbEeaXA7QItDtrGg" + name="Single Capsule" + sectionFile="ui/SingleCapsule.xwt"> + <widget + href="ui/SingleCapsule.xwt#/"/> </sections> - <sections xmi:id="_Aa1rgAccEeaXA7QItDtrGg" name="Single Protocol" sectionFile="ui/SingleProtocol.xwt"> - <widget href="ui/SingleProtocol.xwt#/"/> + <sections + xmi:id="_Aa1rgAccEeaXA7QItDtrGg" + name="Single Protocol" + sectionFile="ui/SingleProtocol.xwt"> + <widget + href="ui/SingleProtocol.xwt#/"/> </sections> </tabs> - <views xmi:id="_F4P60zdoEeWK7ZUbpAMB-g" name="RTPort Creation Dialog" sections="_Ho1uoDdoEeWK7ZUbpAMB-g" automaticContext="true" datacontexts="_F4P68jdoEeWK7ZUbpAMB-g"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_F4P61DdoEeWK7ZUbpAMB-g" name="isSingleRTPort"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_F4P61TdoEeWK7ZUbpAMB-g" name="stereotypeName" value="UMLRealTime::RTPort"/> + <views xmi:id="_F4P60zdoEeWK7ZUbpAMB-g" + name="RTPort Creation Dialog" + sections="_Ho1uoDdoEeWK7ZUbpAMB-g" + automaticContext="true" + datacontexts="_F4P68jdoEeWK7ZUbpAMB-g"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_F4P61DdoEeWK7ZUbpAMB-g" + name="isSingleRTPort"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_F4P61TdoEeWK7ZUbpAMB-g" + name="stereotypeName" + value="UMLRealTime::RTPort"/> </constraints> </views> - <views xmi:id="ParameterCreationDialogView" name="Protocol Msg Parameter Creation Dialog" sections="_TFZ-cMsqEeWiCc89vePYSg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_ConID_SingleProtocolMessage" name="isSingleProtocolMessage"> - <constraintType href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_ValID_SingleProtocolMessage" name="elementTypeID" value="org.eclipse.papyrusrt.umlrt.core.ProtocolMessage"/> + <views xmi:id="ParameterCreationDialogView" + name="Protocol Msg Parameter Creation Dialog" + sections="_TFZ-cMsqEeWiCc89vePYSg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_ConID_SingleProtocolMessage" + name="isSingleProtocolMessage"> + <constraintType + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_ValID_SingleProtocolMessage" + name="elementTypeID" + value="org.eclipse.papyrusrt.umlrt.core.ProtocolMessage"/> </constraints> </views> - <views xmi:id="_xj0M4AcbEeaXA7QItDtrGg" name="Protocol Creation Dialog" sections="_Aa1rgAccEeaXA7QItDtrGg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_3LFXYAcbEeaXA7QItDtrGg" name="isSingleProtocol"> - <constraintType href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_DoxKoAcdEeaXA7QItDtrGg" name="elementTypeID" value="org.eclipse.papyrusrt.umlrt.core.Protocol"/> + <views xmi:id="_xj0M4AcbEeaXA7QItDtrGg" + name="Protocol Creation Dialog" + sections="_Aa1rgAccEeaXA7QItDtrGg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_3LFXYAcbEeaXA7QItDtrGg" + name="isSingleProtocol"> + <constraintType + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_DoxKoAcdEeaXA7QItDtrGg" + name="elementTypeID" + value="org.eclipse.papyrusrt.umlrt.core.Protocol"/> </constraints> </views> - <views xmi:id="_kHd8gAcbEeaXA7QItDtrGg" name="Capsule Creation Dialog" sections="_6XEyQAcbEeaXA7QItDtrGg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_n4U_AAcbEeaXA7QItDtrGg" name="isSingleCapsule"> - <constraintType href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="_-qwYgAccEeaXA7QItDtrGg" name="elementTypeID" value="org.eclipse.papyrusrt.umlrt.core.Capsule"/> + <views xmi:id="_kHd8gAcbEeaXA7QItDtrGg" + name="Capsule Creation Dialog" + sections="_6XEyQAcbEeaXA7QItDtrGg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="_n4U_AAcbEeaXA7QItDtrGg" + name="isSingleCapsule"> + <constraintType + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@constraintTypes.0"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="_-qwYgAccEeaXA7QItDtrGg" + name="elementTypeID" + value="org.eclipse.papyrusrt.umlrt.core.Capsule"/> </constraints> </views> - <views xmi:id="CapsulePartDialogView" name="CapsulePart Creation Dialog" sections="CapsulePartSection" automaticContext="true" datacontexts="_WdNnavMfEeSMV8TyMaa7Sg"> - <constraints xsi:type="constraints:SimpleConstraint" xmi:id="SimpleCapsulePartConstraint" name="isSingleCapsulePart"> - <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> - <properties xsi:type="constraints:ValueProperty" xmi:id="valueProp" name="stereotypeName" value="UMLRealTime::CapsulePart"/> + <views xmi:id="CapsulePartDialogView" + name="CapsulePart Creation Dialog" + sections="CapsulePartSection" + automaticContext="true" + datacontexts="_WdNnavMfEeSMV8TyMaa7Sg"> + <constraints + xsi:type="constraints:SimpleConstraint" + xmi:id="SimpleCapsulePartConstraint" + name="isSingleCapsulePart"> + <constraintType + href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.1"/> + <properties + xsi:type="constraints:ValueProperty" + xmi:id="valueProp" + name="stereotypeName" + value="UMLRealTime::CapsulePart"/> </constraints> </views> - <dataContexts xmi:id="_WdNnYvMfEeSMV8TyMaa7Sg" name="UMLRealTime"> - <elements xmi:id="_F4P68jdoEeWK7ZUbpAMB-g" name="RTPort"> - <properties xmi:id="_WdNnZPMfEeSMV8TyMaa7Sg" name="isNotification" type="Boolean"/> - <properties xmi:id="_WdNnZfMfEeSMV8TyMaa7Sg" name="isPublish" type="Boolean"/> - <properties xmi:id="_WdNnZvMfEeSMV8TyMaa7Sg" name="isWired" type="Boolean"/> - <properties xmi:id="_WdNnZ_MfEeSMV8TyMaa7Sg" name="registration" type="Enumeration" description=""/> - <properties xmi:id="_WdNnaPMfEeSMV8TyMaa7Sg" name="registrationOverride" description=""/> - <properties xmi:id="_QhkXQC6_EeWWx70qeJ-t-Q" name="kind" label="" type="Enumeration" description=""/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ylaDJEeSZxfCXzZz3-w"/> + <dataContexts + xmi:id="_WdNnYvMfEeSMV8TyMaa7Sg" + name="UMLRealTime"> + <elements + xmi:id="_F4P68jdoEeWK7ZUbpAMB-g" + name="RTPort"> + <properties + xmi:id="_WdNnZPMfEeSMV8TyMaa7Sg" + name="isNotification" + type="Boolean"/> + <properties + xmi:id="_WdNnZfMfEeSMV8TyMaa7Sg" + name="isPublish" + type="Boolean"/> + <properties + xmi:id="_WdNnZvMfEeSMV8TyMaa7Sg" + name="isWired" + type="Boolean"/> + <properties + xmi:id="_WdNnZ_MfEeSMV8TyMaa7Sg" + name="registration" + type="Enumeration" + description=""/> + <properties + xmi:id="_WdNnaPMfEeSMV8TyMaa7Sg" + name="registrationOverride" + description=""/> + <properties + xmi:id="_QhkXQC6_EeWWx70qeJ-t-Q" + name="kind" + label="" + type="Enumeration" + description=""/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ylaDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNnafMfEeSMV8TyMaa7Sg" name="RTConnector"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yvqDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNnafMfEeSMV8TyMaa7Sg" + name="RTConnector"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yvqDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNnavMfEeSMV8TyMaa7Sg" name="CapsulePart"> - <properties xmi:id="_lozRECyNEeWRyc_Z_MwFYQ" name="type" label="" type="Enumeration" description=""/> - <properties xmi:id="_Wr_eECyOEeWRyc_Z_MwFYQ" name="multiplicity" type="Integer"/> - <properties xmi:id="_XE4fMCyOEeWRyc_Z_MwFYQ" name="aggregation" type="Enumeration"/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yG6DJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNnavMfEeSMV8TyMaa7Sg" + name="CapsulePart"> + <properties + xmi:id="_lozRECyNEeWRyc_Z_MwFYQ" + name="type" + label="" + type="Enumeration" + description=""/> + <properties + xmi:id="_Wr_eECyOEeWRyc_Z_MwFYQ" + name="multiplicity" + type="Integer"/> + <properties + xmi:id="_XE4fMCyOEeWRyc_Z_MwFYQ" + name="aggregation" + type="Enumeration"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yG6DJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNna_MfEeSMV8TyMaa7Sg" name="ProtocolContainer"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690xiaDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNna_MfEeSMV8TyMaa7Sg" + name="ProtocolContainer"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690xiaDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNnbPMfEeSMV8TyMaa7Sg" name="RTRExcludedElement"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690x0KDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNnbPMfEeSMV8TyMaa7Sg" + name="RTRExcludedElement"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690x0KDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNnbfMfEeSMV8TyMaa7Sg" name="Capsule"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yXqDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNnbfMfEeSMV8TyMaa7Sg" + name="Capsule"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yXqDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_WdNnbvMfEeSMV8TyMaa7Sg" name="RTMessageSet"> - <properties xmi:id="_WdNnb_MfEeSMV8TyMaa7Sg" name="rtMsgKind" type="Enumeration"/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ybKDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_WdNnbvMfEeSMV8TyMaa7Sg" + name="RTMessageSet"> + <properties + xmi:id="_WdNnb_MfEeSMV8TyMaa7Sg" + name="rtMsgKind" + type="Enumeration"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ybKDJEeSZxfCXzZz3-w"/> </elements> - <modelElementFactory href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@modelElementFactories.1"/> + <modelElementFactory + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@modelElementFactories.1"/> </dataContexts> - <dataContexts xmi:id="_WdNncPMfEeSMV8TyMaa7Sg" name="UMLRealTimeExt"> - <elements xmi:id="_WdNncfMfEeSMV8TyMaa7Sg" name="Protocol"> - <properties xmi:id="_WdNncvMfEeSMV8TyMaa7Sg" name="provides" type="Reference"/> - <properties xmi:id="_WdNnc_MfEeSMV8TyMaa7Sg" name="required" type="Reference"/> - <properties xmi:id="_WdNndPMfEeSMV8TyMaa7Sg" name="provreq" type="Reference"/> - <properties xmi:id="_UyA-oAu_EeaDb-qs_6SIIA" name="name"/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690y4KDJEeSZxfCXzZz3-w"/> + <dataContexts + xmi:id="_WdNncPMfEeSMV8TyMaa7Sg" + name="UMLRealTimeExt"> + <elements + xmi:id="_WdNncfMfEeSMV8TyMaa7Sg" + name="Protocol"> + <properties + xmi:id="_WdNncvMfEeSMV8TyMaa7Sg" + name="provides" + type="Reference"/> + <properties + xmi:id="_WdNnc_MfEeSMV8TyMaa7Sg" + name="required" + type="Reference"/> + <properties + xmi:id="_WdNndPMfEeSMV8TyMaa7Sg" + name="provreq" + type="Reference"/> + <properties + xmi:id="_UyA-oAu_EeaDb-qs_6SIIA" + name="name"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690y4KDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_SIdvoDIMEeWNUrU2mjUBfw" name="Port"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ylaDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_SIdvoDIMEeWNUrU2mjUBfw" + name="Port"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690ylaDJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="UMLRealTimeExtCapsulePartElement" name="Property"> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yG6DJEeSZxfCXzZz3-w"/> + <elements + xmi:id="UMLRealTimeExtCapsulePartElement" + name="Property"> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yG6DJEeSZxfCXzZz3-w"/> </elements> - <elements xmi:id="_UQYRMAu_EeaDb-qs_6SIIA" name="Capsule"> - <properties xmi:id="_UQYRMQu_EeaDb-qs_6SIIA" name="name"/> - <supertypes href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yXqDJEeSZxfCXzZz3-w"/> + <elements + xmi:id="_UQYRMAu_EeaDb-qs_6SIIA" + name="Capsule"> + <properties + xmi:id="_UQYRMQu_EeaDb-qs_6SIIA" + name="name"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yXqDJEeSZxfCXzZz3-w"/> </elements> - <modelElementFactory href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@modelElementFactories.0"/> + <modelElementFactory + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@modelElementFactories.0"/> + </dataContexts> + <dataContexts + xmi:id="_Mt9S4M9iEeaeF57775zDjg" + name="UMLRTFacade"> + <elements + xmi:id="_Mt9S4c9iEeaeF57775zDjg" + name="Protocol"> + <properties + xmi:id="_Mt9S5c9iEeaeF57775zDjg" + name="name"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690y4KDJEeSZxfCXzZz3-w"/> + </elements> + <elements + xmi:id="_Mt9S6M9iEeaeF57775zDjg" + name="Capsule"> + <properties + xmi:id="_Mt9S6c9iEeaeF57775zDjg" + name="name"/> + <supertypes + href="ppe:/context/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx#_690yXqDJEeSZxfCXzZz3-w"/> + </elements> + <modelElementFactory + href="ppe:/environment/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi#//@modelElementFactories.2"/> </dataContexts> </contexts:Context> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/ui/SingleCapsule.xwt b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/ui/SingleCapsule.xwt index 4f65ba74d..390891ae8 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/ui/SingleCapsule.xwt +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/ui/SingleCapsule.xwt @@ -11,7 +11,7 @@ <Composite.layout> <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> - <ppumlrt:RTStringEditor input="{Binding}" property="UMLRealTimeExt:Capsule:name" + <ppumlrt:RTStringEditor input="{Binding}" property="UMLRTFacade:Capsule:name" customLabel="Name"></ppumlrt:RTStringEditor> </Composite> </Composite>
\ No newline at end of file diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/ui/SingleProtocol.xwt b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/ui/SingleProtocol.xwt index 0bcb0b06b..c3672e762 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/ui/SingleProtocol.xwt +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/dialogs/ui/SingleProtocol.xwt @@ -12,6 +12,6 @@ <ppel:PropertiesLayout></ppel:PropertiesLayout> </Composite.layout> <ppumlrt:RTStringEditor input="{Binding}" - property="UMLRealTimeExt:Protocol:name" customLabel="Name"></ppumlrt:RTStringEditor> + property="UMLRTFacade:Protocol:name" customLabel="Name"></ppumlrt:RTStringEditor> </Composite> </Composite>
\ No newline at end of file diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi index 835abde24..4a606512a 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/environment/Environment.xmi @@ -16,8 +16,8 @@ name="RT Stereotype Model Element Factory" factoryClass="org.eclipse.papyrusrt.umlrt.tooling.ui.modelelement.RTStereotypeModelElementFactory"/> <modelElementFactories - name="UML RT Model Element Factory" - factoryClass="org.eclipse.papyrusrt.umlrt.tooling.ui.modelelement.UMLRTModelElementFactory"/> + name="UML RT Façade Model Element Factory" + factoryClass="org.eclipse.papyrusrt.umlrt.tooling.ui.modelelement.UMLRTFacadeModelElementFactory"/> <propertyEditorTypes label="RTPort Type Editor" widgetClass="RTPortTypeEditor" @@ -29,8 +29,8 @@ namespace="//@namespaces.0" type="Reference"/> <propertyEditorTypes - label="Port RTKind Property Editor" - widgetClass="PortRTKindPropertyEditor" + label="RT Kind Enum Editor" + widgetClass="RTKindEnumPropertyEditor" namespace="//@namespaces.0" type="Enumeration"/> <propertyEditorTypes @@ -54,6 +54,12 @@ widgetClass="MessageParameterTypeEditor" namespace="//@namespaces.0" type="Reference"/> + <propertyEditorTypes + label="Inheritable Multiple Reference" + widgetClass="InheritableMultiReference" + namespace="//@namespaces.0" + type="Reference" + multiplicity="-1"/> <namespaces name="umlrt" value="org.eclipse.papyrusrt.umlrt.tooling.ui.widgets"/> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/dtool16/reinherit_d.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/dtool16/reinherit_d.png Binary files differnew file mode 100644 index 000000000..ec474c970 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/dtool16/reinherit_d.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/dtool16/reinherit_d@2x.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/dtool16/reinherit_d@2x.png Binary files differnew file mode 100644 index 000000000..a1e462706 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/dtool16/reinherit_d@2x.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/reinherit.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/reinherit.png Binary files differnew file mode 100644 index 000000000..3f86044e3 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/reinherit.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/reinherit.pxm b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/reinherit.pxm Binary files differnew file mode 100644 index 000000000..fd55bf285 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/reinherit.pxm diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/reinherit@2x.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/reinherit@2x.png Binary files differnew file mode 100644 index 000000000..e85329dba --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/reinherit@2x.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_excluded.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_excluded.png Binary files differnew file mode 100644 index 000000000..ec29ec355 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_excluded.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_excluded@2x.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_excluded@2x.png Binary files differnew file mode 100644 index 000000000..23b008da8 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_excluded@2x.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_inherited.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_inherited.png Binary files differnew file mode 100644 index 000000000..75b7c9d8f --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_inherited.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_inherited@2x.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_inherited@2x.png Binary files differnew file mode 100644 index 000000000..d28690cb1 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_inherited@2x.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_xyz.pxm b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_xyz.pxm Binary files differnew file mode 100644 index 000000000..2b28f4d68 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/etool16/show_xyz.pxm diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/excluded_ovr.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/excluded_ovr.png Binary files differnew file mode 100644 index 000000000..3e94c7973 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/excluded_ovr.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/excluded_ovr.pxm b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/excluded_ovr.pxm Binary files differnew file mode 100644 index 000000000..5b1c9257a --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/excluded_ovr.pxm diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/excluded_ovr@2x.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/excluded_ovr@2x.png Binary files differnew file mode 100644 index 000000000..2bd2ba8ba --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/excluded_ovr@2x.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/inherited_ovr.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/inherited_ovr.png Binary files differnew file mode 100644 index 000000000..17483ba03 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/inherited_ovr.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/inherited_ovr.pxm b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/inherited_ovr.pxm Binary files differnew file mode 100644 index 000000000..7234f92dd --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/inherited_ovr.pxm diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/inherited_ovr@2x.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/inherited_ovr@2x.png Binary files differnew file mode 100644 index 000000000..e53216317 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/inherited_ovr@2x.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/redefinition_ovr.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/redefinition_ovr.png Binary files differnew file mode 100644 index 000000000..36263df9b --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/redefinition_ovr.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/redefinition_ovr.pxm b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/redefinition_ovr.pxm Binary files differnew file mode 100644 index 000000000..1c2f0873f --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/redefinition_ovr.pxm diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/redefinition_ovr@2x.png b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/redefinition_ovr@2x.png Binary files differnew file mode 100644 index 000000000..19b650219 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/icons/full/ovr16/redefinition_ovr@2x.png diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/plugin.xml b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/plugin.xml index 5fa406dda..609fe1af0 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/plugin.xml +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/plugin.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <!-- - Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others. + Copyright (c) 2015, 2017 CEA LIST, Christian W. Damus, and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 @@ -10,7 +10,7 @@ Contributors: CEA LIST - Initial API and implementation - Christian W. Damus - bug 491543 + Christian W. Damus - bug 491543, 467545 --> <plugin> @@ -71,4 +71,125 @@ factoryClass="org.eclipse.papyrusrt.umlrt.tooling.ui.internal.advice.UMLRTSetTypeAdviceFactory"> </adviceConfigurationKind> </extension> + + <extension + point="org.eclipse.ui.commands"> + <category + id="org.eclipse.papyrusrt.umlrt.tooling.ui.commands" + name="UML-RT Model Editing Commands" + description="Commands for editing of UML-RT elements in Papyrus-RT models."> + </category> + <command + id="org.eclipse.papyrusrt.umlrt.tooling.ui.excludeElement" + name="Exclude Element" + description="Undefines an inherited element in the inheriting context." + categoryId="org.eclipse.papyrusrt.umlrt.tooling.ui.commands"> + </command> + <command + id="org.eclipse.papyrusrt.umlrt.tooling.ui.reinheritElement" + name="Re-inherit Element" + description="Restores inheritance of an element in the inheriting context." + categoryId="org.eclipse.papyrusrt.umlrt.tooling.ui.commands"> + </command> + </extension> + <extension + point="org.eclipse.ui.handlers"> + <handler + commandId="org.eclipse.papyrusrt.umlrt.tooling.ui.excludeElement" + class="org.eclipse.papyrusrt.umlrt.tooling.ui.internal.handlers.ExclusionHandler"> + <enabledWhen> + <iterate operator="and"> + <!-- Model Explorer elements only understand adaptation to EObject, + not to more specific interfaces such as Element --> + <adapt type="org.eclipse.emf.ecore.EObject"> + <instanceof + value="org.eclipse.uml2.uml.Element"> + </instanceof> + <test property="org.eclipse.papyrusrt.umlrt.core.isExcluded" value="false"/> + <test property="org.eclipse.papyrusrt.umlrt.core.isInherited"/> + </adapt> + </iterate> + </enabledWhen> + </handler> + <handler + commandId="org.eclipse.papyrusrt.umlrt.tooling.ui.reinheritElement" + class="org.eclipse.papyrusrt.umlrt.tooling.ui.internal.handlers.ExclusionHandler"> + <enabledWhen> + <iterate operator="and"> + <!-- Model Explorer elements only understand adaptation to EObject, + not to more specific interfaces such as Element --> + <adapt type="org.eclipse.emf.ecore.EObject"> + <instanceof + value="org.eclipse.uml2.uml.Element"> + </instanceof> + <or> + <test property="org.eclipse.papyrusrt.umlrt.core.isRedefinition"/> + <test property="org.eclipse.papyrusrt.umlrt.core.isExcluded"/> + </or> + </adapt> + </iterate> + </enabledWhen> + </handler> + </extension> + <extension + point="org.eclipse.ui.menus"> + <menuContribution + locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?after=org.eclipse.papyrus.infra.gmfdiag.menu.DeleteFromDiagram"> + <command + commandId="org.eclipse.papyrusrt.umlrt.tooling.ui.reinheritElement" + icon="icons/full/etool16/reinherit.png" + disabledIcon="icons/full/dtool16/reinherit_d.png"> + <visibleWhen + checkEnabled="true"> + </visibleWhen> + </command> + </menuContribution> + <menuContribution + locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup?before=rename"> + <command + commandId="org.eclipse.papyrusrt.umlrt.tooling.ui.reinheritElement" + icon="icons/full/etool16/reinherit.png" + disabledIcon="icons/full/dtool16/reinherit_d.png"> + <visibleWhen + checkEnabled="true"> + </visibleWhen> + </command> + </menuContribution> + </extension> + <extension + point="org.eclipse.ui.commandImages"> + <image + commandId="org.eclipse.papyrusrt.umlrt.tooling.ui.excludeElement" + icon="IMG_TOOL_DELETE"> + </image> + <image + commandId="org.eclipse.papyrusrt.umlrt.tooling.ui.reinheritElement" + icon="icons/full/dtool16/reinherit_d.png"> + </image> + </extension> + + <extension + point="org.eclipse.core.runtime.adapters"> + <factory + adaptableType="org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement" + class="org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties.FacadeAdapterFactory"> + <adapter + type="org.eclipse.papyrus.infra.widgets.creation.IAtomicOperationExecutor"> + </adapter> + <adapter + type="org.eclipse.emf.ecore.EObject"> + </adapter> + </factory> + </extension> + + <extension + point="org.eclipse.ui.services"> + <sourceProvider + provider="org.eclipse.papyrusrt.umlrt.tooling.ui.internal.handlers.OverrideDeleteSourceProvider"> + <variable + name="papyrusrt.override.delete" + priorityLevel="activeSite"> + </variable> + </sourceProvider> + </extension> </plugin> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/Activator.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/Activator.java index 7ed9d7413..427cc5502 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/Activator.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/Activator.java @@ -1,6 +1,21 @@ +/***************************************************************************** + * Copyright (c) 2015, 2017 CEA LIST, Christian W. Damus, and others. + * + * 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: + * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 467545 + * + *****************************************************************************/ + package org.eclipse.papyrusrt.umlrt.tooling.ui; import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.handlers.WorkbenchSourceProviders; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -14,7 +29,7 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - + // log helper public static LogHelper log; @@ -22,22 +37,19 @@ public class Activator extends AbstractUIPlugin { * The constructor */ public Activator() { + super(); } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; log = new LogHelper(this); + + WorkbenchSourceProviders.asyncInstall(); } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ + @Override public void stop(BundleContext context) throws Exception { log = null; plugin = null; diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/FilteredObservableList.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/FilteredObservableList.java new file mode 100644 index 000000000..c92c48d5c --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/FilteredObservableList.java @@ -0,0 +1,324 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.databinding; + +import static java.util.stream.Collectors.joining; + +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.eclipse.core.databinding.observable.Diffs; +import org.eclipse.core.databinding.observable.IObserving; +import org.eclipse.core.databinding.observable.list.DecoratingObservableList; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.ListDiff; + + +/** + * A filtering decorator for observable lists. + */ +public class FilteredObservableList<E> extends DecoratingObservableList<E> implements IFilteredObservableList<E> { + + private final List<Predicate<? super E>> filters = new ArrayList<>(3); + private Predicate<? super E> filter; + + public FilteredObservableList(IObservableList<E> wrappedList) { + super(wrappedList, true); + } + + @Override + public boolean addFilter(Predicate<? super E> filter) { + boolean result = !filters.contains(filter) && filters.add(filter); + + if (result) { + ArrayList<E> oldView = new ArrayList<>(this); + this.filter = filters.stream().reduce(Predicate::and).get(); + ArrayList<E> newView = new ArrayList<>(this); + + ListDiff<E> diff = Diffs.computeListDiff(oldView, newView); + if (!diff.isEmpty()) { + fireListChange(diff); + } + } + + return result; + } + + @Override + public boolean removeFilter(Predicate<? super E> filter) { + boolean result = filters.remove(filter); + + if (result) { + ArrayList<E> oldView = new ArrayList<>(this); + filters.remove(filter); + this.filter = filters.stream().reduce(Predicate::and).orElse(null); + ArrayList<E> newView = new ArrayList<>(this); + fireListChange(Diffs.computeListDiff(oldView, newView)); + } + + return result; + } + + // + // IObservableList API + // + + @SuppressWarnings("unchecked") + Stream<E> filtered() { + getterCalled(); + return ((IObservableList<E>) getDecorated()).stream() + .sequential() + .filter(filter); + } + + @Override + public int size() { + if (filter == null) { + return super.size(); + } + + return (int) filtered().count(); + } + + @Override + public boolean contains(Object o) { + if (filter == null) { + return super.contains(o); + } + + return (o != null) && filtered().anyMatch(o::equals); + } + + @Override + public boolean containsAll(Collection<?> c) { + if (filter == null) { + return super.containsAll(c); + } + + return filtered().filter(c::contains).count() >= c.size(); + } + + @Override + public Iterator<E> iterator() { + if (filter == null) { + return super.iterator(); + } + + Iterator<E> delegate = super.iterator(); + return new Iterator<E>() { + private E preparedNext; + + @Override + public boolean hasNext() { + while ((preparedNext == null) && delegate.hasNext()) { + E next = delegate.next(); + if (filter.test(next)) { + preparedNext = next; + } + } + + return preparedNext != null; + } + + @Override + public E next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + + E result = preparedNext; + preparedNext = null; + return result; + } + + @Override + public void remove() { + delegate.remove(); + } + }; + } + + @Override + public ListIterator<E> listIterator(int index) { + if (filter == null) { + return super.listIterator(index); + } + + ListIterator<E> delegate = super.listIterator(index); + return new ListIterator<E>() { + private E preparedNext; + private E preparedPrev; + private int cursor = index; + + @Override + public boolean hasNext() { + while ((preparedNext == null) && delegate.hasNext()) { + E next = delegate.next(); + if (filter.test(next)) { + preparedNext = next; + } + } + + return preparedNext != null; + } + + @Override + public E next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + + E result = preparedNext; + preparedNext = null; + preparedPrev = null; + cursor = cursor + 1; + return result; + } + + @Override + public boolean hasPrevious() { + while ((preparedPrev == null) && delegate.hasPrevious()) { + E prev = delegate.previous(); + if (filter.test(prev)) { + preparedPrev = prev; + } + } + + return preparedPrev != null; + } + + @Override + public E previous() { + if (!hasPrevious()) { + throw new NoSuchElementException(); + } + + E result = preparedPrev; + preparedPrev = null; + preparedNext = null; + cursor = cursor - 1; + return result; + } + + @Override + public int nextIndex() { + return cursor; + } + + @Override + public int previousIndex() { + return cursor - 1; + } + + @Override + public void remove() { + delegate.remove(); + } + + @Override + public void set(E e) { + delegate.set(e); + } + + @Override + public void add(E e) { + delegate.add(e); + } + }; + } + + @Override + public int hashCode() { + if (filter == null) { + return super.hashCode(); + } + + return filtered().mapToInt(Objects::hashCode) + .reduce(1, (a, b) -> 31 * a + b); + } + + @Override + public boolean equals(Object obj) { + if (filter == null) { + return super.equals(obj); + } + + return (obj == this) ? true : filtered().collect(Collectors.toList()).equals(obj); + } + + @Override + public Object[] toArray() { + if (filter == null) { + return super.toArray(); + } + + return filtered().toArray(Object[]::new); + } + + @SuppressWarnings("unchecked") + @Override + public <T> T[] toArray(T[] a) { + if (filter == null) { + return super.toArray(a); + } + + return filtered().toArray(length -> (T[]) Array.newInstance(a.getClass().getComponentType(), length)); + } + + @Override + public String toString() { + if (filter == null) { + return super.toString(); + } + + return filtered().map(Object::toString) + .collect(joining(", ", "[", "]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + // + // Nested types + // + + /** + * A specialized filtering wrapper for lists that implement the {@link IObserving} + * protocol. + */ + public static class Observing<E> extends FilteredObservableList<E> implements IObserving { + private final IObserving observing; + + public Observing(IObservableList<E> wrappedList) { + super(wrappedList); + + if (!(wrappedList instanceof IObserving)) { + throw new IllegalArgumentException("not an observing list"); //$NON-NLS-1$ + } + + this.observing = (IObserving) wrappedList; + } + + @Override + public Object getObserved() { + return observing.getObserved(); + } + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/IFilteredObservableList.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/IFilteredObservableList.java index b093565bc..f5f796ef9 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/IFilteredObservableList.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/IFilteredObservableList.java @@ -15,6 +15,7 @@ package org.eclipse.papyrusrt.umlrt.tooling.ui.databinding; import java.util.function.Predicate; +import org.eclipse.core.databinding.observable.IObserving; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.papyrus.infra.tools.databinding.IDelegatingObservable; @@ -24,13 +25,14 @@ import org.eclipse.papyrus.infra.tools.databinding.IDelegatingObservable; */ public interface IFilteredObservableList<E> { /** - * Add a filter to match objects that should be included in my filtered view - * of my wrapped list. + * Add a {@code filter} to match objects that should be included in my filtered view + * of my wrapped list, if I do not already have this filter. * * @param filter * a filter matching elements to include + * @return whether my filters were modified */ - void addFilter(Predicate<? super E> filter); + boolean addFilter(Predicate<? super E> filter); /** * Removes a filter that was previously {@linkplain #addFilter(Predicate) added} @@ -38,8 +40,9 @@ public interface IFilteredObservableList<E> { * * @param filter * a filter to remove + * @return whether my filters were modified */ - void removeFilter(Predicate<? super E> filter); + boolean removeFilter(Predicate<? super E> filter); /** * Obtains the filtered list that is or that underlies a given {@code list}. @@ -54,7 +57,6 @@ public interface IFilteredObservableList<E> { IFilteredObservableList<E> result = null; if (list instanceof IFilteredObservableList<?>) { - @SuppressWarnings("unchecked") IFilteredObservableList<E> filtered = (IFilteredObservableList<E>) list; result = filtered; } else if (list instanceof IDelegatingObservable) { @@ -65,4 +67,22 @@ public interface IFilteredObservableList<E> { return result; } + + /** + * Wraps an observable list with filtering support and also observing, if the + * {@link list} supports that. + * + * @param list + * a list to be wrapped for filtering + * + * @return the {@code list}, if it already is a filtering list, otherwise + * a filtering decorator for it + */ + static <E> IObservableList<E> wrap(IObservableList<E> list) { + return (list instanceof IFilteredObservableList<?>) + ? list + : (list instanceof IObserving) + ? new FilteredObservableList.Observing<E>(list) + : new FilteredObservableList<>(list); + } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/PapyrusRTObservableList.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/PapyrusRTObservableList.java index 076421888..4efacb516 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/PapyrusRTObservableList.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/PapyrusRTObservableList.java @@ -31,22 +31,32 @@ import org.eclipse.papyrus.infra.services.edit.ui.databinding.PapyrusObservableL @SuppressWarnings({ "unchecked", "rawtypes" }) public class PapyrusRTObservableList extends PapyrusObservableList implements IFilteredObservableList { - private final List<Predicate> filters = new ArrayList<>(); + private final List<Predicate> filters = new ArrayList<>(3); public PapyrusRTObservableList(List<?> wrappedList, EditingDomain domain, EObject source, EStructuralFeature feature) { super(wrappedList, domain, source, feature, GMFtoEMFCommandWrapper::wrap); } @Override - public void addFilter(Predicate filter) { - filters.add(filter); - refreshCacheList(); + public boolean addFilter(Predicate filter) { + boolean result = !filters.contains(filter) && filters.add(filter); + + if (result) { + refreshCacheList(); + } + + return result; } @Override - public void removeFilter(Predicate filter) { - filters.remove(filter); - refreshCacheList(); + public boolean removeFilter(Predicate filter) { + boolean result = filters.remove(filter); + + if (result) { + refreshCacheList(); + } + + return result; } /** diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/CapsuleProperties.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/CapsuleProperties.java new file mode 100644 index 000000000..980d6d659 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/CapsuleProperties.java @@ -0,0 +1,68 @@ +/***************************************************************************** + * Copyright (c) 2016, 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade; + +import static org.eclipse.papyrusrt.umlrt.uml.util.UMLRTExtensionUtil.getUMLRTSupersetOf; + +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTConnector; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Data-binding properties for {@link UMLRTCapsule}. + */ +public class CapsuleProperties { + + /** + * Not instantiable by clients. + */ + public CapsuleProperties() { + super(); + } + + /** + * Obtains a property for binding the ports of a capsule. + * + * @return the ports property + */ + public static IFilteredListProperty<UMLRTCapsule, UMLRTPort> ports() { + return new FacadeListProperty<>(UMLRTPort.class, + getUMLRTSupersetOf(UMLPackage.Literals.ENCAPSULATED_CLASSIFIER__OWNED_PORT), + capsule -> capsule.getPorts(true).stream()); + } + + /** + * Obtains a property for binding the capsule-parts of a capsule. + * + * @return the capsule-parts property + */ + public static IFilteredListProperty<UMLRTCapsule, UMLRTCapsulePart> capsuleParts() { + return new FacadeListProperty<>(UMLRTCapsulePart.class, + getUMLRTSupersetOf(UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE), + capsule -> capsule.getCapsuleParts(true).stream()); + } + + /** + * Obtains a property for binding the connectors of a capsule. + * + * @return the connectors property + */ + public static IFilteredListProperty<UMLRTCapsule, UMLRTConnector> connectors() { + return new FacadeListProperty<>(UMLRTConnector.class, + getUMLRTSupersetOf(UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_CONNECTOR), + capsule -> capsule.getConnectors(true).stream()); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/FacadeListProperty.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/FacadeListProperty.java new file mode 100644 index 000000000..f42aa7ef7 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/FacadeListProperty.java @@ -0,0 +1,384 @@ +/***************************************************************************** + * Copyright (c) 2016, 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade; + +import static java.util.stream.Collectors.toList; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.databinding.observable.Diffs; +import org.eclipse.core.databinding.observable.Realm; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.observable.list.ListDiff; +import org.eclipse.core.databinding.observable.list.ListDiffVisitor; +import org.eclipse.core.databinding.property.INativePropertyListener; +import org.eclipse.core.databinding.property.ISimplePropertyListener; +import org.eclipse.core.databinding.property.SimplePropertyEvent; +import org.eclipse.core.databinding.property.list.SimpleListProperty; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.util.EContentsEList; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.infra.tools.util.TypeUtils; +import org.eclipse.papyrusrt.umlrt.core.commands.ExclusionCommand; +import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.IFilteredObservableList; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTInheritanceKind; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.edit.UMLEditPlugin; + +/** + * A property for a {@link UMLRTNamedElement}'s inheritable list reference, supporting + * filtering. + */ +class FacadeListProperty<S extends UMLRTNamedElement, T extends UMLRTNamedElement> extends SimpleListProperty<S, T> implements IFilteredListProperty<S, T>, IFacadeProperty { + private final Class<T> elementType; + private final List<? extends EStructuralFeature> features; + private final List<? extends EStructuralFeature> notifyingFeatures; + private final Function<? super S, Stream<? extends T>> accessor; + + private List<T> listView; + + FacadeListProperty(Class<T> elementType, List<? extends EStructuralFeature> features, + Function<? super S, Stream<? extends T>> accessor) { + + super(); + + this.elementType = elementType; + this.features = features; + this.notifyingFeatures = getNotifyingFeatures(features); + this.accessor = accessor; + } + + @Override + public Object getElementType() { + return elementType; + } + + @Override + public String getPropertyName() { + EStructuralFeature feature = features.get(0); + return UMLEditPlugin.INSTANCE.getString(String.format("_UI_%s_%s_feature", + feature.getEContainingClass().getName(), feature.getName())); + } + + @Override + public IObservableList<T> observe(Realm realm, S source) { + return IFilteredObservableList.wrap(super.observe(realm, source)); + } + + @Override + protected List<T> doGetList(S source) { + if (listView == null) { + listView = accessor.apply(source) + .sorted(UMLRTInheritanceKind.facadeComparator()) + .collect(toList()); + } + return listView; + } + + @Override + protected void doSetList(S source, List<T> list, ListDiff<T> diff) { + List<? extends ICommand> commands = getCommands(source, diff); + if (!commands.isEmpty()) { + TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(source.toUML()); + CompositeTransactionalCommand command = new CompositeTransactionalCommand( + domain, "Edit " + getPropertyName(), commands); + if (command.canExecute()) { + domain.getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(command.reduce())); + + // Recalculate the content + listView = null; + doGetList(source); + } + } + } + + protected EObject getListOwner(S source) { + return source.toUML(); + } + + @Override + public INativePropertyListener<S> adaptListener(ISimplePropertyListener<S, ListDiff<T>> listener) { + class NativeListener extends AdapterImpl implements INativePropertyListener<S> { + + private S source; + + @Override + public void addTo(S source) { + EObject listOwner = getListOwner(source); + listOwner.eAdapters().add(this); + this.source = source; + + addToMembers(listOwner); + } + + @Override + public void removeFrom(S source) { + if (source != null) { + EObject listOwner = getListOwner(source); + if (listOwner != null) { + removeFromMembers(listOwner); + listOwner.eAdapters().remove(this); + } + source = null; + } + } + + private void addToMembers(EObject listOwner) { + EContentsEList<? extends Notifier> all = new EContentsEList<>(listOwner, notifyingFeatures); + all.forEach(this::addTo); + } + + private void removeFromMembers(EObject listOwner) { + EContentsEList<? extends Notifier> all = new EContentsEList<>(listOwner, notifyingFeatures); + all.forEach(this::removeFrom); + } + + private void addTo(Notifier notifier) { + List<Adapter> adapters = notifier.eAdapters(); + if (!adapters.contains(this)) { + adapters.add(this); + } + } + + private void removeFrom(Notifier notifier) { + notifier.eAdapters().remove(this); + } + + @Override + public void notifyChanged(Notification msg) { + // Process removals by UML representation because after they have been removed + // from the model, it may not be possible to obtain their façade + List<T> added = Collections.emptyList(); + List<NamedElement> removed = Collections.emptyList(); + + // If our list has never been accessed, then there's no point in any of it + if ((listView != null) && !msg.isTouch()) { + EObject listOwner = getListOwner(source); + + if ((msg.getNotifier() == listOwner) && notifyingFeatures.contains(msg.getFeature())) { + switch (msg.getEventType()) { + case Notification.ADD: { + NamedElement newElement = (NamedElement) msg.getNewValue(); + // We need listen to this new element for membership changes + addTo(newElement); + + added = Optional.ofNullable(UMLRTFactory.create(newElement)) + .filter(elementType::isInstance).map(elementType::cast) + .map(Collections::singletonList) + .orElseGet(Collections::emptyList); + break; + } + case Notification.ADD_MANY: { + @SuppressWarnings("unchecked") + List<? extends NamedElement> newElements = (List<? extends NamedElement>) msg.getNewValue(); + // We need listen to these new elements for membership changes + newElements.forEach(this::addTo); + + added = newElements.stream() + .map(UMLRTFactory::create) + .filter(elementType::isInstance).map(elementType::cast) + .collect(Collectors.toList()); + break; + } + case Notification.REMOVE: { + NamedElement oldElement = (NamedElement) msg.getOldValue(); + // We need stop listening to this old element for membership changes + removeFrom(oldElement); + + removed = Collections.singletonList(oldElement); + break; + } + case Notification.REMOVE_MANY: { + @SuppressWarnings("unchecked") + List<NamedElement> oldElements = (List<NamedElement>) msg.getOldValue(); + // We need stop listening to these old elements for membership changes + oldElements.forEach(this::removeFrom); + + removed = oldElements; + break; + } + case Notification.SET: + case Notification.RESOLVE: { + NamedElement newElement = (NamedElement) msg.getNewValue(); + // We need listen to this new element for membership changes + addTo(newElement); + NamedElement oldElement = (NamedElement) msg.getOldValue(); + // We need stop listening to this old element for membership changes + removeFrom(oldElement); + + removed = Collections.singletonList(oldElement); + added = Optional.ofNullable(UMLRTFactory.create(newElement)) + .filter(elementType::isInstance).map(elementType::cast) + .map(Collections::singletonList) + .orElseGet(Collections::emptyList); + break; + } + } + } else if (msg.getNotifier() != listOwner) { + // It came from an object that may or may not be a member of this list, + // in case its membership status is now changed + NamedElement notifier = (NamedElement) msg.getNotifier(); + T existing = listView.stream() + .filter(e -> e.toUML() == notifier) + .findAny().orElse(null); + T eligible = TypeUtils.as(UMLRTFactory.create(notifier), elementType); + + if (existing != eligible) { + // The object's membership status changed + if (existing != null) { + removed = Collections.singletonList(notifier); + } + if (eligible != null) { + added = Collections.singletonList(eligible); + } + } + } + } + + if (!added.isEmpty() || !removed.isEmpty()) { + List<T> newListView = new ArrayList<>(listView); + removed.forEach(r -> newListView.removeIf(e -> e.toUML() == r)); + added.stream().filter(a -> !newListView.contains(a)).forEach(newListView::add); + newListView.sort(UMLRTInheritanceKind.facadeComparator()); + + ListDiff<T> diff = Diffs.computeListDiff(listView, newListView); + listView = newListView; + + if (!diff.isEmpty()) { + listener.handleEvent(new SimplePropertyEvent<>(SimplePropertyEvent.CHANGE, + source, FacadeListProperty.this, diff)); + } + } + } + } + + return new NativeListener(); + } + + protected List<? extends ICommand> getCommands(S source, ListDiff<T> diff) { + TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(source.toUML()); + List<ICommand> result = new ArrayList<>(); + + // We cannot use GMF edit-helpers for these complex properties + diff.accept(new ListDiffVisitor<T>() { + + @Override + public void handleRemove(int index, T element) { + switch (element.getInheritanceKind()) { + case INHERITED: + case REDEFINED: + // Exclude, don't destroy + result.add(ExclusionCommand.getExclusionCommand(domain, element.toUML(), true)); + break; + case NONE: + // Actually destroy it + IEditCommandRequest request = new DestroyElementRequest(domain, element.toUML(), false); + IElementEditService edit = ElementEditServiceUtils.getCommandProvider(element.toUML()); + ICommand destroy = edit.getEditCommand(request); + result.add(destroy); + break; + default: + // Pass + break; + } + } + + @Override + public void handleAdd(int index, T element) { + // We can't really honour the index. And we can't use an AddCommand because it doesn't + // work with the ownedPort derived list implementation for undo/redo + class AddCommand extends AbstractTransactionalCommand { + private S source; + private T element; + + AddCommand(TransactionalEditingDomain domain, String label, S source, T element) { + super(domain, label, getWorkspaceFiles(source.toUML())); + + this.source = source; + this.element = element; + } + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + @SuppressWarnings("unchecked") + EList<? super NamedElement> list = (EList<? super NamedElement>) getListOwner(source).eGet(features.get(0)); + list.add(element.toUML()); + return CommandResult.newOKCommandResult(element); + } + } + + result.add(new AddCommand(domain, "Add " + getPropertyName(), source, element)); + } + }); + + return result; + } + + static List<EStructuralFeature> getNotifyingFeatures(List<? extends EStructuralFeature> features) { + List<EStructuralFeature> result = new ArrayList<>(features.size()); + + for (EStructuralFeature next : features) { + result.add(getNotifyingFeature(next)); + } + + return result; + } + + static EStructuralFeature getNotifyingFeature(EStructuralFeature feature) { + EStructuralFeature result = feature; + if (feature.isDerived()) { + // Look for a non-derived superset. The annotation points to what features this subsets + EAnnotation subsets = feature.getEAnnotation("subsets"); //$NON-NLS-1$ + if (subsets != null) { + for (EObject next : subsets.getReferences()) { + EStructuralFeature notifying = getNotifyingFeature((EStructuralFeature) next); + if (!notifying.isDerived()) { + result = notifying; + break; + } + } + } + } + + return result; + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/FacadeSingleReferenceProperty.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/FacadeSingleReferenceProperty.java new file mode 100644 index 000000000..48a95f890 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/FacadeSingleReferenceProperty.java @@ -0,0 +1,88 @@ +/***************************************************************************** + * Copyright (c) 2016, 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; + +import org.eclipse.core.databinding.observable.value.ValueDiff; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrusrt.umlrt.core.commands.ExclusionCommand; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.uml2.uml.NamedElement; + +/** + * A property for a {@link UMLRTNamedElement}'s inheritable singular reference feature. + */ +class FacadeSingleReferenceProperty<S extends UMLRTNamedElement, T extends UMLRTNamedElement> extends FacadeValueProperty<S, T> { + + FacadeSingleReferenceProperty(Class<T> elementType, List<? extends EStructuralFeature> features, + Function<? super S, ? extends T> accessor) { + + super(elementType, features, accessor); + } + + @Override + T fromModel(Object o) { + return super.fromModel(UMLRTFactory.create((NamedElement) o)); + } + + @Override + Object toModel(T value) { + return (value == null) ? null : value.toUML(); + } + + @Override + protected List<? extends ICommand> getCommands(S source, ValueDiff<T> diff) { + TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(source.toUML()); + List<ICommand> result = new ArrayList<>(); + + if (diff.getOldValue() != null) { + T element = diff.getOldValue(); + + switch (element.getInheritanceKind()) { + case INHERITED: + case REDEFINED: + // Exclude, don't destroy + result.add(ExclusionCommand.getExclusionCommand(domain, element.toUML(), true)); + break; + case NONE: + // Actually destroy it + IEditCommandRequest request = new DestroyElementRequest(domain, element.toUML(), false); + IElementEditService edit = ElementEditServiceUtils.getCommandProvider(element.toUML()); + ICommand destroy = edit.getEditCommand(request); + result.add(destroy); + break; + default: + // Pass + break; + } + } + + result.add(getSetCommand(domain, source, Optional.ofNullable(diff.getNewValue()))); + + return result; + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/FacadeValueProperty.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/FacadeValueProperty.java new file mode 100644 index 000000000..10bab0a96 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/FacadeValueProperty.java @@ -0,0 +1,171 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; + +import org.eclipse.core.databinding.observable.Diffs; +import org.eclipse.core.databinding.observable.value.ValueDiff; +import org.eclipse.core.databinding.property.INativePropertyListener; +import org.eclipse.core.databinding.property.ISimplePropertyListener; +import org.eclipse.core.databinding.property.SimplePropertyEvent; +import org.eclipse.core.databinding.property.value.SimpleValueProperty; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.requests.UnsetRequest; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; + +/** + * A property for a {@link UMLRTNamedElement}'s inheritable singular value feature. + */ +class FacadeValueProperty<S extends UMLRTNamedElement, T> extends SimpleValueProperty<S, T> implements IFacadeProperty { + private final Class<T> elementType; + private final List<? extends EStructuralFeature> features; + private final Function<? super S, ? extends T> accessor; + + FacadeValueProperty(Class<T> elementType, List<? extends EStructuralFeature> features, + Function<? super S, ? extends T> accessor) { + + super(); + + this.elementType = elementType; + this.features = features; + this.accessor = accessor; + } + + @Override + public Object getValueType() { + return elementType; + } + + @Override + public String getPropertyName() { + return features.get(0).getName(); + } + + @Override + protected T doGetValue(S source) { + return accessor.apply(source); + } + + T fromModel(Object o) { + return elementType.cast(o); + } + + Object toModel(T value) { + return value; + } + + @Override + protected void doSetValue(S source, T value) { + List<? extends ICommand> commands = getCommands(source, Diffs.createValueDiff(getValue(source), value)); + if (!commands.isEmpty()) { + TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(source.toUML()); + CompositeTransactionalCommand command = new CompositeTransactionalCommand( + domain, "Edit " + getPropertyName(), commands); + if (command.canExecute()) { + domain.getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(command.reduce())); + } + } + } + + protected EObject getValueOwner(S source) { + return source.toUML(); + } + + @Override + public INativePropertyListener<S> adaptListener(ISimplePropertyListener<S, ValueDiff<? extends T>> listener) { + class NativeListener extends AdapterImpl implements INativePropertyListener<S> { + + private S source; + + @Override + public void addTo(S source) { + EObject listOwner = getValueOwner(source); + listOwner.eAdapters().add(this); + this.source = source; + } + + @Override + public void removeFrom(S source) { + if (source != null) { + EObject listOwner = getValueOwner(source); + if (listOwner != null) { + listOwner.eAdapters().remove(this); + } + source = null; + } + } + + @Override + public void notifyChanged(Notification msg) { + ValueDiff<T> diff = null; + + if (features.contains(msg.getFeature())) { + switch (msg.getEventType()) { + case Notification.SET: + case Notification.UNSET: + case Notification.RESOLVE: + diff = Diffs.createValueDiff( + fromModel(msg.getOldValue()), + fromModel(msg.getNewValue())); + break; + } + } + + if (diff != null) { + listener.handleEvent(new SimplePropertyEvent<>(SimplePropertyEvent.CHANGE, + source, FacadeValueProperty.this, diff)); + } + } + + } + + return new NativeListener(); + } + + protected List<? extends ICommand> getCommands(S source, ValueDiff<T> diff) { + TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(source.toUML()); + List<ICommand> result = new ArrayList<>(1); + Optional<T> newValue = Optional.ofNullable(diff.getNewValue()); + + result.add(getSetCommand(domain, source, newValue)); + + return result; + } + + protected ICommand getSetCommand(TransactionalEditingDomain domain, S source, Optional<T> newValue) { + EObject valueOwner = getValueOwner(source); + IEditCommandRequest request = newValue + .<IEditCommandRequest> map(elem -> new SetRequest(domain, valueOwner, features.get(0), toModel(elem))) + .orElseGet(() -> new UnsetRequest(domain, valueOwner, features.get(0))); + IElementEditService edit = ElementEditServiceUtils.getCommandProvider(valueOwner); + return edit.getEditCommand(request); + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/IFacadeProperty.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/IFacadeProperty.java new file mode 100644 index 000000000..73af41786 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/IFacadeProperty.java @@ -0,0 +1,30 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade; + +import org.eclipse.core.databinding.property.IProperty; + +/** + * A data-binding property for façade objects. + */ +public interface IFacadeProperty extends IProperty { + + /** + * Obtains the name of the property, used for labelling edit commands. + * + * @return the user-presentable property name + */ + String getPropertyName(); + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/IFilteredListProperty.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/IFilteredListProperty.java new file mode 100644 index 000000000..88af08574 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/IFilteredListProperty.java @@ -0,0 +1,44 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade; + +import org.eclipse.core.databinding.observable.Realm; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.IFilteredObservableList; + +/** + * A list property that supports filtering. The lists that it provides implement + * the {@link IFilteredObservableList} protocol. + */ +public interface IFilteredListProperty<S, E> extends IListProperty<S, E> { + /** + * @return an observable list observing this property on the given {@code source}, + * with support for filtering and observing + * + * @see IFilteredObservableList + */ + @Override + public IObservableList<E> observe(S source); + + /** + * @return an observable list observing this property on the given {@code source}, + * with support for filtering and observing + * + * @see IFilteredObservableList + */ + @Override + public IObservableList<E> observe(Realm realm, S source); + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/NamedElementProperties.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/NamedElementProperties.java new file mode 100644 index 000000000..6f48fa6fa --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/NamedElementProperties.java @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade; + +import static org.eclipse.papyrusrt.umlrt.uml.util.UMLRTExtensionUtil.getUMLRTSupersetOf; + +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Data-binding properties for {@link UMLRTNamedElement}. + */ +public class NamedElementProperties { + + /** + * Not instantiable by clients. + */ + public NamedElementProperties() { + super(); + } + + /** + * Obtains a property for binding the name of an element. + * + * @return the name property + */ + public static IValueProperty<UMLRTNamedElement, String> name() { + return new FacadeValueProperty<>(String.class, + getUMLRTSupersetOf(UMLPackage.Literals.NAMED_ELEMENT__NAME), + UMLRTNamedElement::getName); + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/ProtocolProperties.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/ProtocolProperties.java new file mode 100644 index 000000000..34dd4c954 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/databinding/facade/ProtocolProperties.java @@ -0,0 +1,69 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade; + +import static org.eclipse.papyrusrt.umlrt.uml.util.UMLRTExtensionUtil.getUMLRTSupersetOf; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolUtils; +import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocol; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocolMessage; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Data-binding properties for {@link UMLRTProtocol}. + */ +public class ProtocolProperties { + + /** + * Not instantiable by clients. + */ + public ProtocolProperties() { + super(); + } + + /** + * Obtains a property for binding the messages of a protocol in a particular direction. + * + * @param directionKind + * the direction kind + * + * @return the messages property + */ + public static IFilteredListProperty<UMLRTProtocol, UMLRTProtocolMessage> messages(RTMessageKind directionKind) { + return new MessagesProperty(directionKind); + } + + // + // Nested types + // + + private static final class MessagesProperty extends FacadeListProperty<UMLRTProtocol, UMLRTProtocolMessage> { + private final RTMessageKind directionKind; + + MessagesProperty(RTMessageKind directionKind) { + super(UMLRTProtocolMessage.class, + getUMLRTSupersetOf(UMLPackage.Literals.INTERFACE__OWNED_OPERATION), + protocol -> protocol.getMessages(directionKind, true).stream()); + + this.directionKind = directionKind; + } + + @Override + protected EObject getListOwner(UMLRTProtocol source) { + return ProtocolUtils.getMessageSet(source.toUML(), directionKind); + } + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/editors/InheritableMultipleReferenceEditor.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/editors/InheritableMultipleReferenceEditor.java new file mode 100644 index 000000000..e797f7aee --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/editors/InheritableMultipleReferenceEditor.java @@ -0,0 +1,282 @@ +/***************************************************************************** + * Copyright (c) 2016, 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.editors; + +import static org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper.wrap; +import static org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin; + +import java.util.List; +import java.util.Objects; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import org.eclipse.core.databinding.observable.ChangeEvent; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.jface.dialogs.DialogSettings; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.papyrus.infra.tools.util.PlatformHelper; +import org.eclipse.papyrus.infra.widgets.editors.MultipleReferenceEditor; +import org.eclipse.papyrusrt.umlrt.core.commands.ExclusionCommand; +import org.eclipse.papyrusrt.umlrt.tooling.ui.Activator; +import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.IFilteredObservableList; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.util.UMLRTExtensionUtil; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.NamedElement; + +/** + * Customized multiple-reference editor for references that support inheritance. + */ +public class InheritableMultipleReferenceEditor extends MultipleReferenceEditor { + + private static final String SHOW_EXCLUDED_SETTING = "showExcluded"; //$NON-NLS-1$ + + private String dialogSettingsKey; + + private Button toggleExcluded; + private Button reinherit; + + private Predicate<Object> inheritanceFilter; + + + public InheritableMultipleReferenceEditor(Composite parent, int style) { + this(parent, style, false, false, null); + } + + public InheritableMultipleReferenceEditor(Composite parent, int style, String label) { + this(parent, style, false, false, label); + } + + public InheritableMultipleReferenceEditor(Composite parent, int style, boolean ordered, boolean unique, String label) { + super(parent, style, ordered, unique, label); + + GridLayout layout = new GridLayout(7, false); + layout.horizontalSpacing = 2; + layout.marginHeight = 0; + layout.marginWidth = 0; + controlsSection.setLayout(layout); + updateControls(); + } + + public final void setDialogSettingsKey(String key) { + this.dialogSettingsKey = key; + + loadDialogSettings(); + } + + public final String getDialogSettingsKey() { + return dialogSettingsKey; + } + + protected final String getDialogSettingsKey(String subkey) { + String result = getDialogSettingsKey(); + return (result == null) ? null : String.format("%s.%s", result, subkey); + } + + @Override + protected Object getContextElement() { + Object result = super.getContextElement(); + + if (result instanceof UMLRTNamedElement) { + result = ((UMLRTNamedElement) result).toUML(); + } + + return result; + } + + @Override + protected void createListControls() { + ImageDescriptor toggleInheritedImage = imageDescriptorFromPlugin(Activator.PLUGIN_ID, + "$nl$/icons/full/etool16/show_excluded.png"); //$NON-NLS-1$ + + toggleExcluded = createToggleButton(ExtendedImageRegistry.INSTANCE.getImage(toggleInheritedImage), + false, "Show excluded elements"); + + super.createListControls(); + + remove.setToolTipText("Remove or exclude selected element"); + ImageDescriptor reinheritImage = imageDescriptorFromPlugin(Activator.PLUGIN_ID, + "$nl$/icons/full/etool16/reinherit.png"); //$NON-NLS-1$ + reinherit = createButton(ExtendedImageRegistry.INSTANCE.getImage(reinheritImage), + "Re-inherit selected element"); + + loadDialogSettings(); + } + + protected Button createToggleButton(Image image, boolean selected, String tooltip) { + Button result = new Button(controlsSection, SWT.TOGGLE); + result.setImage(image); + result.setSelection(selected); + result.setToolTipText(tooltip); + result.addSelectionListener(this); + return result; + } + + @Override + public void widgetSelected(SelectionEvent e) { + if (e.widget == toggleExcluded) { + toggleExcludedAction(); + } else if (e.widget == reinherit) { + reinheritAction(); + } else { + super.widgetSelected(e); + } + } + + @Override + protected void updateControls() { + super.updateControls(); + + if (controlsSection.getLayout() instanceof GridLayout) { + setExclusion(up, !ordered); + setExclusion(down, !ordered); + } + + toggleExcluded.setEnabled(!readOnly && (modelProperty instanceof IFilteredObservableList<?>)); + reinherit.setEnabled(!readOnly); + } + + protected Predicate<Object> getInheritanceFilter(boolean demandCreate) { + if ((inheritanceFilter == null) && demandCreate) { + Predicate<Object> isExcluded = o -> { + EObject eObject = PlatformHelper.getAdapter(o, EObject.class); + return (eObject instanceof Element) && UMLRTExtensionUtil.isExcluded((Element) eObject); + }; + + inheritanceFilter = isExcluded.negate(); + } + return inheritanceFilter; + } + + protected void toggleExcludedAction() { + updateShowExcluded(); + + commit(); + + storeDialogSettings(); + } + + private void updateShowExcluded() { + boolean showExcluded = toggleExcluded.getSelection(); + + if (modelProperty instanceof IFilteredObservableList<?>) { + IFilteredObservableList<?> list = (IFilteredObservableList<?>) modelProperty; + Predicate<Object> filter = getInheritanceFilter(!showExcluded); + + boolean filterChanged = false; + if (showExcluded) { + if (filter != null) { + filterChanged = list.removeFilter(filter); + } + } else { + filterChanged = list.addFilter(filter); + } + + if (filterChanged && (treeViewer != null) && !treeViewer.getControl().isDisposed()) { + treeViewer.refresh(); + } + } + } + + protected void reinheritAction() { + IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection(); + List<NamedElement> toReinherit = ((List<?>) selection.toList()).stream() + .map(o -> PlatformHelper.getAdapter(o, EObject.class)) + .filter(NamedElement.class::isInstance) + .map(NamedElement.class::cast) + .map(UMLRTFactory::create) + .filter(Objects::nonNull) + .filter(UMLRTNamedElement::isInherited) + .map(UMLRTNamedElement::toUML) + .collect(Collectors.toList()); + + if (!toReinherit.isEmpty()) { + Element any = toReinherit.get(0); + TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(any); + ICommand command = ExclusionCommand.getExclusionCommand(domain, toReinherit, false); + domain.getCommandStack().execute(wrap(command)); + } + + commit(); + } + + @Override + public void setModelObservable(@SuppressWarnings("rawtypes") IObservableList modelProperty) { + super.setModelObservable(modelProperty); + + loadDialogSettings(); + } + + @Override + public void handleChange(ChangeEvent event) { + if (!isDisposed()) { + if (event.getObservable() == modelProperty) { + updateShowExcluded(); + } + } + + super.handleChange(event); + } + + protected void loadDialogSettings() { + if (modelProperty == null) { + return; + } + + if (toggleExcluded != null) { + boolean showExcluded = false; + String setting = getDialogSettingsKey(SHOW_EXCLUDED_SETTING); + if (setting != null) { + showExcluded = getBoolean(setting, false); + toggleExcluded.setSelection(showExcluded); + updateShowExcluded(); + } + } + } + + protected void storeDialogSettings() { + if (toggleExcluded != null) { + String setting = getDialogSettingsKey(SHOW_EXCLUDED_SETTING); + if (setting != null) { + setBoolean(setting, toggleExcluded.getSelection()); + } + } + } + + protected boolean getBoolean(String key, boolean defaultValue) { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings section = DialogSettings.getOrCreateSection(settings, "InheritableMultipleReferenceEditor"); //$NON-NLS-1$ + return (section.get(key) == null) ? defaultValue : section.getBoolean(key); + } + + protected void setBoolean(String key, boolean value) { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings section = DialogSettings.getOrCreateSection(settings, "InheritableMultipleReferenceEditor"); //$NON-NLS-1$ + section.put(key, value); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/handlers/ExclusionHandler.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/handlers/ExclusionHandler.java new file mode 100644 index 000000000..efed6e970 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/handlers/ExclusionHandler.java @@ -0,0 +1,97 @@ +/***************************************************************************** + * Copyright (c) 2016, 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.internal.handlers; + +import static org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper.wrap; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.papyrus.infra.tools.util.PlatformHelper; +import org.eclipse.papyrusrt.umlrt.core.commands.ExclusionCommand; +import org.eclipse.ui.commands.IElementUpdater; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.menus.UIElement; +import org.eclipse.uml2.uml.Element; + +/** + * Default handler for the exclude and reinherit commands. + */ +public class ExclusionHandler extends AbstractHandler implements IElementUpdater { + + private final boolean doUpdate; + + /** + * Initializes me. + */ + public ExclusionHandler() { + this(false); + } + + /** + * Initializes me with the option of updating the text of the command that I + * handle to indicate exclusion, instead. + * + * @param doUpdate + * whether to update my command to indicate exclusion semantics + */ + public ExclusionHandler(boolean doUpdate) { + super(); + + this.doUpdate = doUpdate; + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + Object result = null; + + IStructuredSelection sel = HandlerUtil.getCurrentStructuredSelection(event); + List<Element> elements = ((List<?>) sel.toList()).stream() + .map(e -> PlatformHelper.getAdapter(e, EObject.class)) + .filter(Element.class::isInstance).map(Element.class::cast) + .collect(Collectors.toList()); + if (!elements.isEmpty()) { + TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(elements.get(0)); + if (domain != null) { + boolean exclude = event.getCommand().getId().contains("exclude") //$NON-NLS-1$ + || event.getCommand().getId().contains("delete"); //$NON-NLS-1$ + + Command command = wrap(ExclusionCommand.getExclusionCommand(domain, elements, exclude)); + domain.getCommandStack().execute(command); + result = command.getResult().isEmpty() + ? null + : command.getResult().iterator().next(); + } + } + + return result; + } + + @Override + public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { + if (doUpdate) { + element.setText("Exclude Element"); + element.setTooltip("Undefine the inherited element in the inheriting namespace"); + } + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/handlers/OverrideDeleteSourceProvider.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/handlers/OverrideDeleteSourceProvider.java new file mode 100644 index 000000000..2367760a8 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/handlers/OverrideDeleteSourceProvider.java @@ -0,0 +1,88 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.internal.handlers; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.AbstractSourceProvider; +import org.eclipse.ui.ISources; + +import com.google.common.collect.ImmutableMap; + +/** + * A source provider for a variable, intended for use in XML enablement expressions, + * that indicates via a boolean value whether the standard GMF delete command handler + * should be overridden to implement UML-RT exclusion instead. + */ +public class OverrideDeleteSourceProvider extends AbstractSourceProvider { + private static final String OVERRIDE_DELETE = "papyrusrt.override.delete"; //$NON-NLS-1$ + + private static final String[] SOURCES = { OVERRIDE_DELETE }; + + // The SourceProviderService shifts the priority declared in the plugin.xml by one + private static final int PRIORITY = ISources.ACTIVE_SITE << 1; + + private static AtomicBoolean overrideEnabled = new AtomicBoolean(); + + private static List<OverrideDeleteSourceProvider> instances = new ArrayList<>(1); + + private ISelection selection; + + public OverrideDeleteSourceProvider() { + super(); + + instances.add(this); + } + + @Override + public String[] getProvidedSourceNames() { + return SOURCES; + } + + @SuppressWarnings("rawtypes") + @Override + public Map getCurrentState() { + return overrideEnabled.get() + ? ImmutableMap.of(OVERRIDE_DELETE, true, + // As explained below, we need this variable to be defined + ISources.ACTIVE_MENU_SELECTION_NAME, selection) + : ImmutableMap.of(OVERRIDE_DELETE, false); + } + + @Override + public void dispose() { + instances.remove(this); + } + + static boolean setEnabled(boolean enableOverride, ISelection selection) { + boolean result = overrideEnabled.compareAndSet(!enableOverride, enableOverride); + + if (result) { + if (enableOverride) { + // Let the active menu selection be defined regardless of whether there + // is a menu showing so that our handler can actually use that variable + // for activation to effect its override when triggered by the key binding + instances.forEach(p -> p.fireSourceChanged(ISources.ACTIVE_MENU, ISources.ACTIVE_MENU_SELECTION_NAME, selection)); + } + + instances.forEach(p -> p.fireSourceChanged(PRIORITY, OVERRIDE_DELETE, enableOverride)); + } + + return result; + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/handlers/WorkbenchSourceProviders.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/handlers/WorkbenchSourceProviders.java new file mode 100644 index 000000000..8f6cc9ab1 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/handlers/WorkbenchSourceProviders.java @@ -0,0 +1,198 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.internal.handlers; + +import java.io.StringReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Predicate; +import java.util.stream.Stream; + +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.expressions.Expression; +import org.eclipse.core.expressions.ExpressionConverter; +import org.eclipse.emf.common.util.WrappedException; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTInheritanceKind; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.ISelectionListener; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.IWindowListener; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.handlers.IHandlerActivation; +import org.eclipse.ui.handlers.IHandlerService; +import org.eclipse.ui.services.IDisposable; +import org.eclipse.uml2.uml.Element; +import org.w3c.dom.Document; +import org.xml.sax.InputSource; + +/** + * Utility for installation of custom source providers in the Eclipse Workbench. + */ +public class WorkbenchSourceProviders { + + /** + * Not instantiable by clients. + */ + private WorkbenchSourceProviders() { + super(); + } + + /** + * Asynchronously install the custom source providers in the workbench on the UI thread. + */ + public static void asyncInstall() { + Display.getDefault().asyncExec(() -> { + IWorkbench workbench = PlatformUI.getWorkbench(); + + // Do our installations for the discrete services in each + // workbench window opened by the user + IWindowListener windowListener = createWindowListener(); + workbench.addWindowListener(windowListener); + + // We already missed the opening of these windows + Stream.of(workbench.getWorkbenchWindows()).forEach(windowListener::windowOpened); + }); + } + + /** + * A listener that reacts to window openings by installing our source providers + * and closings by uninstalling them. + */ + private static IWindowListener createWindowListener() { + return new IWindowListener() { + private Map<IWorkbenchWindow, IDisposable> activations = new HashMap<>(); + + @Override + public void windowOpened(IWorkbenchWindow window) { + if (!activations.containsKey(window)) { + activations.put(window, activateSources(window)); + } + } + + @Override + public void windowClosed(IWorkbenchWindow window) { + IDisposable activation = activations.remove(window); + if (activation != null) { + activation.dispose(); + } + } + + @Override + public void windowDeactivated(IWorkbenchWindow window) { + // Pass + } + + @Override + public void windowActivated(IWorkbenchWindow window) { + // Pass + } + }; + } + + /** + * Activate our custom source providers in the given {@code window}. + * + * @param window + * a workbench window + * + * @return a tokn that can be disposed to deactivate our source providers and anything else + * installed/activated along with them + */ + private static IDisposable activateSources(IWorkbenchWindow window) { + // We will have zero or more things to dispose + List<IDisposable> tokens = new ArrayList<>(3); // Anticipate very few + + // We need to interact with some handler-related services + ISelectionService selections = window.getService((ISelectionService.class)); + ICommandService commands = window.getService(ICommandService.class); + IHandlerService handlers = window.getService(IHandlerService.class); + + Command delete = commands.getCommand(ActionFactory.DELETE.getCommandId()); + if (delete != null) { + // Create our exclusion handler + IHandler exclusionHandler = new ExclusionHandler(true); + + // Give the exclusion handler an activation expression that trumps Model Explorer's + // delete handler and the diagram's, too + Expression activeWhen; + try { + // Include the activeMenuSelection for highest priority + Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource( + new StringReader("<and>" + + "<with variable=\"papyrusrt.override.delete\">" + + " <equals value=\"true\"/>" + + "</with>" + + "<with variable=\"activeMenuSelection\">" + + " <iterate ifEmpty=\"true\" operation=\"or\">" + + " <instanceof value=\"java.lang.Object\"/>" + + " </iterate>" + + "</with>" + + "</and>"))); + activeWhen = ExpressionConverter.getDefault().perform(xml.getDocumentElement()); + } catch (Exception e) { + throw new WrappedException(e); + } + + // Register the exlusion handler against the delete action with our activation criteria + IHandlerActivation excludeActivation = handlers.activateHandler(delete.getId(), exclusionHandler, activeWhen); + + selections.addSelectionListener(new ISelectionListener() { + @Override + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + Predicate<UMLRTInheritanceKind> excludeable = UMLRTInheritanceKind.INHERITED::equals; + excludeable = excludeable.or(UMLRTInheritanceKind.REDEFINED::equals); + + IStructuredSelection ssel = (selection instanceof IStructuredSelection) + ? (IStructuredSelection) selection + : StructuredSelection.EMPTY; + + // is all of the selection comprised of excludeable inherited elements? + boolean activate = !ssel.isEmpty() + && (((List<?>) ssel.toList()).stream() + .map(EMFHelper::getEObject) + .filter(Objects::nonNull) + .filter(Element.class::isInstance).map(Element.class::cast) + .map(UMLRTInheritanceKind::of) + .filter(excludeable) + .count() == ssel.size()); + + if (OverrideDeleteSourceProvider.setEnabled(activate, selection)) { + // Update the menu action + commands.refreshElements(delete.getId(), null); + } + } + }); + + tokens.add(() -> handlers.deactivateHandler(excludeActivation)); + } + + return () -> tokens.forEach(IDisposable::dispose); + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/NullReferenceValueFactory.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/NullReferenceValueFactory.java new file mode 100644 index 000000000..280d1f2a1 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/NullReferenceValueFactory.java @@ -0,0 +1,57 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement; + +import java.util.Collection; + +import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory; +import org.eclipse.swt.widgets.Control; + +/** + * A reference value factory that doesn't create or edit anything. + */ +public final class NullReferenceValueFactory implements ReferenceValueFactory { + + public static final NullReferenceValueFactory INSTANCE = new NullReferenceValueFactory(); + + private NullReferenceValueFactory() { + super(); + } + + @Override + public boolean canCreateObject() { + return false; + } + + @Override + public Object createObject(Control widget, Object context) { + throw new UnsupportedOperationException("createObject"); //$NON-NLS-1$ + } + + @Override + public Collection<Object> validateObjects(Collection<Object> objectsToValidate) { + return objectsToValidate; + } + + @Override + public boolean canEdit() { + return false; + } + + @Override + public Object edit(Control widget, Object object) { + throw new UnsupportedOperationException("edit"); //$NON-NLS-1$ + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/FacadeAdapterFactory.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/FacadeAdapterFactory.java new file mode 100644 index 000000000..55ea306be --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/FacadeAdapterFactory.java @@ -0,0 +1,52 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties; + +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.tools.util.PlatformHelper; +import org.eclipse.papyrus.infra.widgets.creation.IAtomicOperationExecutor; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.uml2.uml.Element; + +/** + * Eclipse Platform adapter factory for façade elements. + */ +public class FacadeAdapterFactory implements IAdapterFactory { + + private static final Class<?>[] ADAPTERS = { IAtomicOperationExecutor.class, EObject.class }; + + public FacadeAdapterFactory() { + super(); + } + + @Override + public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { + T result = null; + + if (adaptableObject instanceof UMLRTNamedElement) { + // Re-adapt on the UML element + Element uml = ((UMLRTNamedElement) adaptableObject).toUML(); + result = PlatformHelper.getAdapter(uml, adapterType); + } + + return result; + } + + @Override + public Class<?>[] getAdapterList() { + return ADAPTERS.clone(); + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/FacadePropertyEditorFactory.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/FacadePropertyEditorFactory.java new file mode 100644 index 000000000..9555b3f3e --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/FacadePropertyEditorFactory.java @@ -0,0 +1,146 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties; + +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.papyrus.infra.properties.contexts.Context; +import org.eclipse.papyrus.infra.properties.contexts.View; +import org.eclipse.papyrus.infra.properties.ui.creation.CreationContext; +import org.eclipse.papyrusrt.umlrt.tooling.ui.Activator; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.swt.widgets.Control; +import org.eclipse.uml2.uml.NamedElement; + +/** + * A property-editor factory for façade elements. + */ +public abstract class FacadePropertyEditorFactory extends RTPropertyEditorFactory { + + private static final URI CREATION_DIALOGS_CONTEXT_URI = URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/dialogs/CreationDialogs.ctx", true); + private static final ResourceSet viewModelResourceSet = new ResourceSetImpl(); + + public FacadePropertyEditorFactory(EReference referenceIn) { + this(referenceIn, null); + } + + public FacadePropertyEditorFactory(EReference referenceIn, IObservableList<?> modelProperty) { + super(referenceIn, modelProperty); + } + + protected abstract Set<View> getDialogViews(); + + protected static Set<View> loadDialogViews(URI contextURI, Predicate<? super View> viewSelector) { + Set<View> result = Collections.emptySet(); + + Resource contextResource = viewModelResourceSet.getResource(contextURI, true); + if (contextResource != null) { + result = contextResource.getContents().stream().sequential() + .filter(Context.class::isInstance).map(Context.class::cast) + .flatMap(ctx -> ctx.getViews().stream().sequential()) + .filter(viewSelector) + .collect(Collectors.toCollection(LinkedHashSet::new)); + } + + return result; + } + + protected static Set<View> loadDialogViews(Predicate<? super View> viewSelector) { + return loadDialogViews(CREATION_DIALOGS_CONTEXT_URI, viewSelector); + } + + protected static Set<View> loadDialogViews(String viewName) { + return loadDialogViews(CREATION_DIALOGS_CONTEXT_URI, v -> viewName.equals(v.getName())); + } + + @Override + public Object edit(Control widget, Object source) { + Set<View> views = getDialogViews(); + if (!views.isEmpty()) { + return doEdit(widget, source, views, getEditionDialogTitle(source)); + } + + return asUMLRT(source); + } + + @Override + protected Function<EObject, Predicate<Object>> filterFunction() { + return v -> (o -> asUML(o) != v); + } + + protected Object asUMLRT(Object object) { + Object result = object; + + if (object instanceof NamedElement) { + UMLRTNamedElement facade = UMLRTFactory.create((NamedElement) object); + if (facade != null) { + result = facade; + } + } + + return result; + } + + protected Object asUML(Object object) { + Object result = object; + + if (object instanceof UMLRTNamedElement) { + result = ((UMLRTNamedElement) object).toUML(); + } + + return result; + } + + @Override + protected Object createObject(Control widget, Object context, Object source) { + if (source == null) { + return null; + } + + Set<View> views = getDialogViews(); + if (!views.isEmpty()) { + CreationContext creationContext = getCreationContext(context); + creationContext.pushCreatedElement(source); + try { + return asUMLRT(doEdit(widget, source, views, getCreationDialogTitle())); + } finally { + creationContext.popCreatedElement(source); + } + } + + return asUMLRT(source); + } + + @Override + protected CreationContext basicGetCreationContext(Object element) { + if (element instanceof UMLRTNamedElement) { + element = ((UMLRTNamedElement) element).toUML(); + } + + return super.basicGetCreationContext(element); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/RTPropertyEditorFactory.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/RTPropertyEditorFactory.java index aaabab250..74b9ef783 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/RTPropertyEditorFactory.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/RTPropertyEditorFactory.java @@ -15,16 +15,26 @@ package org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties; import java.util.HashMap; import java.util.Map; +import java.util.function.Function; import java.util.function.Predicate; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EFactory; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.papyrus.infra.properties.ui.creation.CreationContext; +import org.eclipse.papyrus.infra.ui.emf.dialog.NestedEditingDialogContext; import org.eclipse.papyrus.uml.properties.creation.UMLPropertyEditorFactory; import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.IFilteredObservableList; +import org.eclipse.swt.widgets.Control; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; /** * <p> @@ -77,14 +87,18 @@ public class RTPropertyEditorFactory extends UMLPropertyEditorFactory { * attaches created model elements to the model for the duration of the dialog. */ @Override - protected CreationContext getCreationContext(Object element) { - CreationContext result = super.getCreationContext(element); + protected final CreationContext getCreationContext(Object element) { + CreationContext result = basicGetCreationContext(element); return (result == null) ? result : wrapCreationContext(result); } + protected CreationContext basicGetCreationContext(Object element) { + return super.getCreationContext(element); + } + private CreationContext wrapCreationContext(CreationContext context) { return new AttachedCreationContext(context); } @@ -92,7 +106,7 @@ public class RTPropertyEditorFactory extends UMLPropertyEditorFactory { CreateIn getCreateIn(CreationContext context, EObject newElement) { CreateIn result = null; - if (referenceIn.isContainment()) { + if (isContainment(referenceIn)) { // Implicit create-in case result = new CreateIn() { // Pass @@ -106,6 +120,28 @@ public class RTPropertyEditorFactory extends UMLPropertyEditorFactory { return result; } + protected boolean isContainment(EReference reference) { + boolean result = reference.isContainment(); + + if (!result) { + // It is effectively a containment if it subsets a containment + EAnnotation annotation = reference.getEAnnotation("subsets"); //$NON-NLS-1$ + if (annotation != null) { + for (EObject next : annotation.getReferences()) { + if (next instanceof EReference) { + EReference superset = (EReference) next; + if (isContainment(superset)) { + result = true; + break; + } + } + } + } + } + + return result; + } + void filter(EObject createdObject) { IFilteredObservableList<?> list = IFilteredObservableList.getFilteredList(modelProperty); if (list != null) { @@ -114,8 +150,11 @@ public class RTPropertyEditorFactory extends UMLPropertyEditorFactory { } private Predicate<Object> getFilter(EObject createdObject) { - return modelPropertyFilters.computeIfAbsent(createdObject, - v -> (o -> o != v)); + return modelPropertyFilters.computeIfAbsent(createdObject, filterFunction()); + } + + protected Function<EObject, Predicate<Object>> filterFunction() { + return v -> (o -> o != v); } void unfilter(EObject createdObject) { @@ -125,6 +164,36 @@ public class RTPropertyEditorFactory extends UMLPropertyEditorFactory { } } + @Override + protected EObject simpleCreateObject(Control widget) { + EClass toCreate = getEClass(); + if (toCreate == null) { + toCreate = this.type; + } + return create(toCreate); + } + + protected EObject create(EClass eClass) { + ResourceSet rset = NestedEditingDialogContext.getInstance().getResourceSet(); + EFactory factory = rset.getPackageRegistry().getEFactory(UMLPackage.eNS_URI); + if (factory == null) { + factory = UMLFactory.eINSTANCE; + } + return factory.create(eClass); + } + + /** + * Applies stereotypes to the newly created (temporarily in place) element + * after its temporary attachment to the model is established, so that it + * may be properly edited in the dialog. + * + * @param newElement + * the new element to which to apply any needed stereotypes + */ + protected void applyStereotypes(Element newElement) { + // Pass + } + // // Nested types // @@ -169,6 +238,10 @@ public class RTPropertyEditorFactory extends UMLPropertyEditorFactory { } else { owner.eSet(feature, value); } + + if (value instanceof Element) { + applyStereotypes((Element) value); + } } /** diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/UMLRTCapsulePartEditorFactory.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/UMLRTCapsulePartEditorFactory.java new file mode 100644 index 000000000..558a4f76a --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/UMLRTCapsulePartEditorFactory.java @@ -0,0 +1,77 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * Christian W. Damus - bug 467545 + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties; + +import java.util.Set; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.papyrus.infra.properties.contexts.View; +import org.eclipse.papyrus.infra.properties.ui.creation.CreationContext; +import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.UMLRealTimePackage; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper; + +/** + * Property-editor factory for the capsule-parts of a capsule. + */ +public class UMLRTCapsulePartEditorFactory extends FacadePropertyEditorFactory { + + private static final String CAPSULE_PART_DIALOG = "CapsulePart Creation Dialog"; //$NON-NLS-1$ + + public UMLRTCapsulePartEditorFactory(EReference referenceIn) { + this(referenceIn, null); + } + + public UMLRTCapsulePartEditorFactory(EReference referenceIn, IObservableList<?> modelProperty) { + super(referenceIn, modelProperty); + } + + @Override + protected CreationContext basicGetCreationContext(Object element) { + if (element instanceof UMLRTCapsule) { + element = ((UMLRTCapsule) element).toUML(); + } + + return super.basicGetCreationContext(element); + } + + @Override + protected void applyStereotypes(Element newElement) { + super.applyStereotypes(newElement); + + if (newElement instanceof Property) { + StereotypeApplicationHelper.getInstance(newElement).applyStereotype(newElement, + UMLRealTimePackage.Literals.CAPSULE_PART); + } + } + + @Override + public String getCreationDialogTitle() { + return "Create New Capsule Part"; + } + + @Override + public String getEditionDialogTitle(Object objectToEdit) { + return "Edit Capsule Part"; + } + + @Override + protected Set<View> getDialogViews() { + return loadDialogViews(CAPSULE_PART_DIALOG); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/UMLRTPortEditorFactory.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/UMLRTPortEditorFactory.java new file mode 100644 index 000000000..51c057297 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/UMLRTPortEditorFactory.java @@ -0,0 +1,88 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * Christian W. Damus - bug 467545 + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties; + +import java.util.Set; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.papyrus.infra.properties.contexts.View; +import org.eclipse.papyrus.infra.properties.ui.creation.CreationContext; +import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.UMLRealTimePackage; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.swt.widgets.Control; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Port; +import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper; + +/** + * Property-editor factory for the ports of a capsule. + */ +public class UMLRTPortEditorFactory extends FacadePropertyEditorFactory { + + private static final String PORT_DIALOG = "RTPort Creation Dialog"; //$NON-NLS-1$ + + public UMLRTPortEditorFactory(EReference referenceIn) { + this(referenceIn, null); + } + + public UMLRTPortEditorFactory(EReference referenceIn, IObservableList<?> modelProperty) { + super(referenceIn, modelProperty); + } + + @Override + protected CreationContext basicGetCreationContext(Object element) { + if (element instanceof UMLRTCapsule) { + element = ((UMLRTCapsule) element).toUML(); + } + + return super.basicGetCreationContext(element); + } + + @Override + protected Object doCreateObject(Control widget, Object context) { + // The reference isn't a containment, but it subsets one, so + // just do the simple path + + Object instance = simpleCreateObject(widget); + + return createObject(widget, context, instance); + } + + @Override + protected void applyStereotypes(Element newElement) { + super.applyStereotypes(newElement); + + if (newElement instanceof Port) { + StereotypeApplicationHelper.getInstance(newElement).applyStereotype(newElement, + UMLRealTimePackage.Literals.RT_PORT); + } + } + + @Override + public String getCreationDialogTitle() { + return "Create New Port"; + } + + @Override + public String getEditionDialogTitle(Object objectToEdit) { + return "Edit Port"; + } + + @Override + protected Set<View> getDialogViews() { + return loadDialogViews(PORT_DIALOG); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/MessageSetOwnedProtocolMessageValueFactory.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/UMLRTProtocolMessageEditorFactory.java index ae48e1732..a63305b64 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/MessageSetOwnedProtocolMessageValueFactory.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/UMLRTProtocolMessageEditorFactory.java @@ -1,102 +1,69 @@ /***************************************************************************** - * Copyright (c) 2014, 2016 CEA LIST, Christian W. Damus, and others. - * + * Copyright (c) 2016 CEA LIST, Christian W. Damus, and others. + * * 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: - * CEA LIST - Initial API and implementation - * Christian W. Damus - bugs 495140, 495908 + * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 467545 + * *****************************************************************************/ -package org.eclipse.papyrusrt.umlrt.tooling.ui.widgets; + +package org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties; import java.util.Collections; import java.util.Set; import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.papyrus.infra.properties.contexts.Context; import org.eclipse.papyrus.infra.properties.contexts.View; import org.eclipse.papyrus.infra.properties.ui.creation.CreationContext; import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager; +import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolUtils; import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind; import org.eclipse.papyrusrt.umlrt.tooling.ui.Messages; -import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties.RTPropertyEditorFactory; -import org.eclipse.swt.widgets.Control; -import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocol; +import org.eclipse.uml2.uml.Collaboration; /** - * ValueFactory for the MessageSet ownedOperation (protocol message for message sets) + * Property-editor factory for one of the message kinds of a protocol. */ -public class MessageSetOwnedProtocolMessageValueFactory extends RTPropertyEditorFactory { +public class UMLRTProtocolMessageEditorFactory extends FacadePropertyEditorFactory { public static final String SINGLE_PROTOCOL_MESSAGE = "Single ProtocolMessage"; //$NON-NLS-1$ public static final String UML_RT = "uml-rt"; //$NON-NLS-1$ - private RTMessageKind direction = null; + private final RTMessageKind kind; - public MessageSetOwnedProtocolMessageValueFactory(EReference eReference, IObservableList<?> modelProperty) { - super(eReference, modelProperty); + public UMLRTProtocolMessageEditorFactory(EReference referenceIn, RTMessageKind kind) { + this(referenceIn, kind, null); } - /** - * Set the direction of the protocol messages handled by this factory, e.g. to make - * it clear in create and edit dialogues which direction the protocol message has - * - * @param direction - * The direction of the protocol messages handled by this factory - * @return The factory itself - */ - public MessageSetOwnedProtocolMessageValueFactory setDirection(RTMessageKind direction) { - this.direction = direction; - return this; - } + public UMLRTProtocolMessageEditorFactory(EReference referenceIn, RTMessageKind kind, IObservableList<?> modelProperty) { + super(referenceIn, modelProperty); - @Override - protected EObject simpleCreateObject(Control widget) { - return UMLFactory.eINSTANCE.createOperation(); + this.kind = kind; } @Override - public Object edit(Control widget, Object source) { - Set<View> views = getProtocolMessageViews(); - if (!views.isEmpty()) { - return doEdit(widget, source, views, getEditionDialogTitle(source)); + protected CreationContext basicGetCreationContext(Object element) { + if (element instanceof UMLRTProtocol) { + element = basicGetCreationContext(((UMLRTProtocol) element).toUML()); + } else if (element instanceof Collaboration) { + element = ProtocolUtils.getMessageSet((Collaboration) element, kind); } - return source; + return super.basicGetCreationContext(element); } @Override - protected Object createObject(Control widget, Object context, Object source) { - if (source == null) { - return null; - } - - Set<View> views = getProtocolMessageViews(); - if (!views.isEmpty()) { - CreationContext creationContext = getCreationContext(context); - creationContext.pushCreatedElement(source); - try { - return doEdit(widget, source, views, getCreationDialogTitle()); - } finally { - creationContext.popCreatedElement(source); - } - } - - return source; - } - - /** - * {@inheritDoc} - */ - @Override public String getCreationDialogTitle() { - switch (direction) { + switch (kind) { case OUT: return Messages.MessageSetOwnedProtocolMessageValueFactory_CreateOutProtocolMessageDialogTitle; @@ -111,12 +78,9 @@ public class MessageSetOwnedProtocolMessageValueFactory extends RTPropertyEditor } } - /** - * {@inheritDoc} - */ @Override public String getEditionDialogTitle(Object objectToEdit) { - switch (direction) { + switch (kind) { case OUT: return Messages.MessageSetOwnedProtocolMessageValueFactory_EditOutProtocolMessageDialogTitle; @@ -131,7 +95,8 @@ public class MessageSetOwnedProtocolMessageValueFactory extends RTPropertyEditor } } - protected Set<View> getProtocolMessageViews() { + @Override + protected Set<View> getDialogViews() { String contextName = UML_RT; String viewName = SINGLE_PROTOCOL_MESSAGE; Context context = ConfigurationManager.getInstance().getContext(contextName); diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/RTStereotypeModelElement.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/RTStereotypeModelElement.java index b85b74609..c18d57b25 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/RTStereotypeModelElement.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/RTStereotypeModelElement.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2010, 2017 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,7 +8,7 @@ * * Contributors: * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation - * Christian W. Damus - bug 492408 + * Christian W. Damus - bugs 492408, 467545 * Young-Soo Roh - bug 483636 * *****************************************************************************/ @@ -45,10 +45,9 @@ import org.eclipse.papyrusrt.umlrt.tooling.ui.Activator; import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.ChangeListenerUtils; import org.eclipse.papyrusrt.umlrt.tooling.ui.widgets.CapsulePartKindObservableValue; import org.eclipse.papyrusrt.umlrt.tooling.ui.widgets.PortRTKindObservableValue; -import org.eclipse.uml2.uml.Collaboration; -import org.eclipse.uml2.uml.Port; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocol; import org.eclipse.uml2.uml.Stereotype; -import org.eclipse.uml2.uml.Type; /** * Model Element for Real Time Stereotype properties. @@ -74,25 +73,27 @@ public class RTStereotypeModelElement extends StereotypeModelElement { EObject source = getSource(); if (source instanceof RTPort) { - Port port = ((RTPort) source).getBase_Port(); RTPort rtPort = (RTPort) source; + UMLRTPort port = UMLRTPort.getInstance(rtPort.getBase_Port()); if (null != port) { - Type type = port.getType(); - if (type instanceof Collaboration && SystemElementsUtils.isSystemProtocol((Collaboration) type)) { + UMLRTProtocol protocol = port.getType(); + if ((protocol != null) && SystemElementsUtils.isSystemProtocol(protocol.toUML())) { // disable all RT properties if typed with system protocol Bug#483636 editable = false; } else if (IRealTimeConstants.KIND.equals(propertyPath)) { editable = true; - } else if (UMLRealTimePackage.eINSTANCE.getRTPort_IsNotification().equals(feature)) { + } else if (feature == UMLRealTimePackage.Literals.RT_PORT__IS_NOTIFICATION) { editable = port.isBehavior(); // isNotification disabled if !isBehavior - } else if (UMLRealTimePackage.eINSTANCE.getRTPort_IsWired().equals(feature)) { - editable = port.isBehavior() && !RTPortUtils.isConnected(port) && !RTPortUtils.isLegacySpp(port) && !RTPortUtils.isLegacySap(port); // isWired disabled if connected || !isBehavior || isLegacySpp || isLegacySap - } else if (UMLRealTimePackage.eINSTANCE.getRTPort_IsPublish().equals(feature)) { + } else if (feature == UMLRealTimePackage.Literals.RT_PORT__IS_WIRED) { + editable = !port.isInherited(); // Cannot re-define isWired + editable = editable && port.isBehavior() && !port.isConnected() // isWired disabled if connected || !isBehavior || isLegacySpp || isLegacySap + && !RTPortUtils.isLegacySpp(port.toUML()) && !RTPortUtils.isLegacySap(port.toUML()); + } else if (feature == UMLRealTimePackage.Literals.RT_PORT__IS_PUBLISH) { editable = false; // isPublish always disabled - } else if (UMLRealTimePackage.eINSTANCE.getRTPort_Registration().equals(feature)) { - editable = !rtPort.isWired(); // registration kind disabled if isWired - } else if (UMLRealTimePackage.eINSTANCE.getRTPort_RegistrationOverride().equals(feature)) { - editable = !rtPort.isWired(); // registration override disabled if isWired + } else if (feature == UMLRealTimePackage.Literals.RT_PORT__REGISTRATION) { + editable = !rtPort.isWired() && !port.isInherited(); // registration kind disabled if isWired or redefinition + } else if (feature == UMLRealTimePackage.Literals.RT_PORT__REGISTRATION_OVERRIDE) { + editable = !rtPort.isWired() && !port.isInherited(); // registration override disabled if isWired or redefinition } else { editable = super.isFeatureEditable(propertyPath); } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/UMLRTExtModelElement.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/UMLRTExtModelElement.java index 2189d8ceb..ae46754c0 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/UMLRTExtModelElement.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/UMLRTExtModelElement.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2010, 2017 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,7 +8,7 @@ * * Contributors: * Onder GURCAN (CEA LIST) onder.gurcan@cea.fr - Initial API and implementation - * Christian W. Damus - bugs 491543, 495908, 479628, 497801 + * Christian W. Damus - bugs 491543, 495908, 479628, 497801, 467545 * Young-Soo Roh - bug 483636 * * @@ -24,19 +24,14 @@ import static org.eclipse.papyrusrt.umlrt.tooling.ui.Messages.NoTypeForTypedElem import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collections; -import java.util.Hashtable; -import java.util.Iterator; import java.util.List; import org.eclipse.core.databinding.observable.ChangeEvent; import org.eclipse.core.databinding.observable.IChangeListener; import org.eclipse.core.databinding.observable.IObservable; -import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.validation.IValidator; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; @@ -62,7 +57,6 @@ import org.eclipse.papyrus.infra.widgets.util.IPapyrusConverter; import org.eclipse.papyrus.uml.properties.creation.UMLPropertyEditorFactory; import org.eclipse.papyrus.uml.properties.modelelement.UMLModelElement; import org.eclipse.papyrus.uml.tools.databinding.ExtendedMultiplicityObservableValue; -import org.eclipse.papyrus.uml.tools.databinding.NamedElementValidator; import org.eclipse.papyrus.uml.tools.providers.UMLContainerContentProvider; import org.eclipse.papyrus.uml.tools.providers.UMLFilteredLabelProvider; import org.eclipse.papyrusrt.umlrt.core.defaultlanguage.IDefaultLanguage; @@ -70,52 +64,34 @@ import org.eclipse.papyrusrt.umlrt.core.internal.defaultlanguage.DefaultLanguage import org.eclipse.papyrusrt.umlrt.core.internal.defaultlanguage.NoDefautLanguage; import org.eclipse.papyrusrt.umlrt.core.utils.CapsulePartUtils; import org.eclipse.papyrusrt.umlrt.core.utils.IRealTimeConstants; -import org.eclipse.papyrusrt.umlrt.core.utils.MessageSetUtils; -import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolUtils; import org.eclipse.papyrusrt.umlrt.core.utils.RTPortUtils; import org.eclipse.papyrusrt.umlrt.core.utils.SystemElementsUtils; -import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.CapsulePart; -import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind; -import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageSet; import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTPort; import org.eclipse.papyrusrt.umlrt.tooling.ui.Activator; import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.CompositeValidator; -import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.PapyrusRTObservableList; import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.ChangeListenerUtils; import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.MessageParameterTypeReferenceConverter; +import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.NullReferenceValueFactory; import org.eclipse.papyrusrt.umlrt.tooling.ui.widgets.CapsulePartTypeValueFactory; -import org.eclipse.papyrusrt.umlrt.tooling.ui.widgets.MessageSetOwnedProtocolMessageValueFactory; import org.eclipse.papyrusrt.umlrt.tooling.ui.widgets.PropertyReplicationObservableValue; import org.eclipse.papyrusrt.umlrt.tooling.ui.widgets.RTPortTypeValueFactory; -import org.eclipse.uml2.uml.Collaboration; -import org.eclipse.uml2.uml.Dependency; -import org.eclipse.uml2.uml.DirectedRelationship; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interface; -import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocol; import org.eclipse.uml2.uml.Package; import org.eclipse.uml2.uml.Parameter; import org.eclipse.uml2.uml.Port; import org.eclipse.uml2.uml.Property; import org.eclipse.uml2.uml.Transition; -import org.eclipse.uml2.uml.Type; import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.util.UMLUtil; /** - * A UMLRTModelElement provider. In particular, it will take care of UMLRT protocols which reference provided, required and prov/required interfaces. + * A ModelElement provider for UML-RT. In particular, it will take care of UMLRT protocols which reference provided, required and prov/required interfaces. * These can not be specified by means of a property path, since they depend on implemented or used interfaces which are not directly provided. * The idea of this class is to delegate to UMLModelElement belonging to these interfaces */ public class UMLRTExtModelElement extends UMLModelElement { - private Hashtable<Element, UMLModelElement> delegationModelElements; - - protected static final String OWNED_OPERATION = "ownedOperation"; //$NON-NLS-1$ - - /** My owner, if I am a delegate. */ - private final UMLRTExtModelElement owner; - /** * Constructor. */ @@ -127,16 +103,7 @@ public class UMLRTExtModelElement extends UMLModelElement { * Constructor. */ public UMLRTExtModelElement(EObject source, EditingDomain domain) { - this(source, domain, null); - } - - /** - * Constructor. - */ - UMLRTExtModelElement(EObject source, EditingDomain domain, UMLRTExtModelElement owner) { super(source, domain); - delegationModelElements = new Hashtable<>(); - this.owner = owner; } public class UMLRTExtModelElementChangeListener implements IChangeListener { @@ -154,30 +121,8 @@ public class UMLRTExtModelElement extends UMLModelElement { } } - /** - * Get the delegating model element - * - * @param element - * @return - */ - public UMLModelElement getDelegationModelElement(Element element) { - UMLModelElement delegationModelElement = delegationModelElements.get(element); - if (delegationModelElement == null) { - delegationModelElement = new UMLRTExtModelElement(element, this.getDomain(), this); - delegationModelElements.put(element, delegationModelElement); - } - return delegationModelElement; - } - - /** - * {@inheritDoc} - */ @Override public IStaticContentProvider getContentProvider(String propertyPath) { - Interface intf = getInOrInoutOrOutMessageSet(propertyPath); - if (intf != null) { - return getDelegationModelElement(intf).getContentProvider(OWNED_OPERATION); - } if (propertyPath.contains(IRealTimeConstants.CAPSULE_PART_MULTIPLICITY)) { return new StaticContentProvider(new String[] { ONE, OPTIONAL }); } @@ -196,33 +141,14 @@ public class UMLRTExtModelElement extends UMLModelElement { return super.getContentProvider(propertyPath); } - /** - * {@inheritDoc} - */ - @Override - public boolean isOrdered(String propertyPath) { - Interface intf = getInOrInoutOrOutMessageSet(propertyPath); - if (intf != null) { - return getDelegationModelElement(intf).isOrdered(OWNED_OPERATION); - } - return super.isOrdered(propertyPath); - } - - /** - * {@inheritDoc} - */ @Override public boolean isMandatory(String propertyPath) { - Interface intf = getInOrInoutOrOutMessageSet(propertyPath); - if (intf != null) { - return getDelegationModelElement(intf).isMandatory(OWNED_OPERATION); - } if (propertyPath.contains(IRealTimeConstants.PACKAGE_LANGUAGE)) { return true; } // to not display the unset button for the type widget for CapsulePart, RTPort, // and message parameter - if (UMLPackage.eINSTANCE.getTypedElement_Type().equals(getFeature(propertyPath))) { + if (getFeature(propertyPath) == UMLPackage.Literals.TYPED_ELEMENT__TYPE) { if (((source instanceof Property) && CapsulePartUtils.isCapsulePart((Property) source)) || RTPortUtils.isRTPort(source) || isRTMessageParameter(source)) { @@ -232,15 +158,8 @@ public class UMLRTExtModelElement extends UMLModelElement { return super.isMandatory(propertyPath); } - /** - * {@inheritDoc} - */ @Override public ILabelProvider getLabelProvider(String propertyPath) { - Interface intf = getInOrInoutOrOutMessageSet(propertyPath); - if (intf != null) { - return getDelegationModelElement(intf).getLabelProvider(OWNED_OPERATION); - } if (propertyPath.endsWith(IRealTimeConstants.PACKAGE_LANGUAGE)) { return new LabelProvider() { /** @@ -273,46 +192,11 @@ public class UMLRTExtModelElement extends UMLModelElement { return super.getLabelProvider(propertyPath); } - /** - * {@inheritDoc} - */ - @Override - public EStructuralFeature getFeature(String propertyPath) { - Interface intf = getInOrInoutOrOutMessageSet(propertyPath); - if (intf != null) { - return getDelegationModelElement(intf).getFeature(OWNED_OPERATION); - } - return super.getFeature(propertyPath); - } - - /** - * {@inheritDoc} - */ - @Override - public FeaturePath getFeaturePath(String propertyPath) { - Interface intf = getInOrInoutOrOutMessageSet(propertyPath); - if (intf != null) { - return getDelegationModelElement(intf).getFeaturePath(OWNED_OPERATION); - } - return super.getFeaturePath(propertyPath); - } - - /** - * {@inheritDoc} - */ @Override public IObservable doGetObservable(String propertyPath) { IObservable observable = null; - Interface intf = getInOrInoutOrOutMessageSet(propertyPath); - - if (intf != null) { - observable = getDelegationModelElement(intf).doGetObservable(OWNED_OPERATION); - } else if (OWNED_OPERATION.equals(propertyPath)) { - FeaturePath featurePath = getFeaturePath(propertyPath); - EStructuralFeature feature = getFeature(propertyPath); - observable = new PapyrusRTObservableList(EMFProperties.list(featurePath).observe(source), domain, getSource(featurePath), feature); - } else if (IRealTimeConstants.CAPSULE_PART_MULTIPLICITY.equals(propertyPath)) { + if (IRealTimeConstants.CAPSULE_PART_MULTIPLICITY.equals(propertyPath)) { observable = new ExtendedMultiplicityObservableValue(source, domain); } else if (IRealTimeConstants.PACKAGE_LANGUAGE.equals(propertyPath) && domain instanceof TransactionalEditingDomain) { observable = new RTPackageObservableValue((Package) source, (TransactionalEditingDomain) domain); @@ -329,33 +213,28 @@ public class UMLRTExtModelElement extends UMLModelElement { return observable; } - /** - * {@inheritDoc} - */ @Override public ReferenceValueFactory getValueFactory(String propertyPath) { + ReferenceValueFactory result = null; + EReference reference = null; + EClass type = null; - Interface intf = getInOrInoutOrOutMessageSet(propertyPath); - if (intf != null) { - return getDelegationModelElement(intf).getValueFactory(propertyPath); - } - - if (propertyPath.endsWith("type")) { - UMLPropertyEditorFactory factory = null; - EReference reference = UMLPackage.eINSTANCE.getTypedElement_Type(); - EClass type = reference.getEReferenceType(); + if (propertyPath.equals("type")) { + reference = UMLPackage.Literals.TYPED_ELEMENT__TYPE; if (source instanceof Port) { - factory = new RTPortTypeValueFactory(reference); + result = new RTPortTypeValueFactory(reference); } else if (source instanceof Property) { - factory = new CapsulePartTypeValueFactory(reference); + result = new CapsulePartTypeValueFactory(reference); } else if (isRTMessageParameter(source)) { // Don't support the plus and pencil buttons because // the ellipsis does all the work - return null; - } else { - return super.getValueFactory(propertyPath); + result = NullReferenceValueFactory.INSTANCE; } + } + if (result instanceof UMLPropertyEditorFactory) { + UMLPropertyEditorFactory factory = (UMLPropertyEditorFactory) result; + type = reference.getEReferenceType(); factory.setContainerLabelProvider(new UMLFilteredLabelProvider()); factory.setReferenceLabelProvider(new EMFLabelProvider()); ITreeContentProvider contentProvider = new UMLContainerContentProvider(source, reference); @@ -365,50 +244,9 @@ public class UMLRTExtModelElement extends UMLModelElement { factory.setContainerContentProvider(provider); factory.setReferenceContentProvider(new FeatureContentProvider(type)); - return factory; - } else if (propertyPath.endsWith("Incoming") || propertyPath.endsWith("Outgoing") || propertyPath.endsWith("InOut")) { - UMLPropertyEditorFactory factory = null; - EReference reference = UMLPackage.eINSTANCE.getInterface_OwnedOperation(); - EClass type = reference.getEReferenceType(); - if (source instanceof Interface && MessageSetUtils.isRTMessageSet((Interface) source)) { - factory = new MessageSetOwnedProtocolMessageValueFactory(reference, (IObservableList<?>) owner.getObservable(propertyPath)) - .setDirection(MessageSetUtils.getMessageKind(source)); - } else { - return super.getValueFactory(propertyPath); - } - factory.setContainerLabelProvider(new UMLFilteredLabelProvider()); - factory.setReferenceLabelProvider(new EMFLabelProvider()); - ITreeContentProvider contentProvider = new UMLContainerContentProvider(source, reference); - - ResourceSet rs = source == null ? null : source.eResource() == null ? null : source.eResource().getResourceSet(); - EMFGraphicalContentProvider provider = ProviderHelper.encapsulateProvider(contentProvider, rs, HistoryUtil.getHistoryID(source, reference, "container")); - - factory.setContainerContentProvider(provider); - factory.setReferenceContentProvider(new FeatureContentProvider(type)); - return factory; } - return super.getValueFactory(propertyPath); - } - - /** - * return the message set (interface) that is providing the IN, the out or the inout list of protocol messages (operation), depending on propertyPath - * - * @param propertyPath - * @return the message set with the right direction - */ - protected Interface getInOrInoutOrOutMessageSet(String propertyPath) { - Interface result = null; - if (source instanceof Collaboration) { - if (propertyPath.endsWith("Incoming")) { //$NON-NLS-1$ - result = getInterface(RTMessageKind.IN); - } else if (propertyPath.endsWith("Outgoing")) { //$NON-NLS-1$ - result = getInterface(RTMessageKind.OUT); - } else if (propertyPath.endsWith("InOut")) { //$NON-NLS-1$ - result = getInterface(RTMessageKind.IN_OUT); - } - } - return result; + return (result != null) ? result : super.getValueFactory(propertyPath); } @Override @@ -424,42 +262,48 @@ public class UMLRTExtModelElement extends UMLModelElement { if (source instanceof Transition) { return true; } else if (source instanceof Port) { - Port port = (Port) source; - boolean isSystemProtocol = false; - Type type = port.getType(); - if (type instanceof Collaboration && SystemElementsUtils.isSystemProtocol((Collaboration) type)) { - isSystemProtocol = true; + UMLRTPort port = UMLRTPort.getInstance((Port) source); + if (port == null) { + // Cannot edit a non-RT port with this model element + return false; } + + UMLRTProtocol protocol = port.getType(); + boolean isSystemProtocol = (protocol != null) + && SystemElementsUtils.isSystemProtocol(protocol.toUML()); + if (IRealTimeConstants.PROPERTY_REPLICATION.equals(propertyPath)) { editable = true; - } else if (UMLPackage.eINSTANCE.getPort_IsConjugated().equals(feature)) { - if (isSystemProtocol) { - // disable if typed with system protocol Bug#483636 + } else if (feature == UMLPackage.Literals.NAMED_ELEMENT__NAME) { + // Cannot redefine the name + editable = !port.isInherited(); + } else if (feature == UMLPackage.Literals.PORT__IS_CONJUGATED) { + if (isSystemProtocol || port.isInherited()) { + // disable if typed with system protocol Bug#483636. + // Cannot redefine conjugation editable = false; } else { editable = super.isFeatureEditable(propertyPath); } } else if (IRealTimeConstants.PROTOCOL_TYPE.equals(propertyPath)) { editable = super.isFeatureEditable(propertyPath); - } else if (RTPortUtils.isRTPort(source)) { - RTPort rtPort = RTPortUtils.getStereotypeApplication(port); - if (UMLPackage.eINSTANCE.getPort_IsService().equals(feature)) { - if (isSystemProtocol) { - // disable if typed with system protocol Bug#483636 - editable = false; - } else { - editable = !RTPortUtils.isConnected(port) && port.isBehavior(); - } - } else if (UMLPackage.eINSTANCE.getPort_IsBehavior().equals(feature)) { - if (isSystemProtocol) { - // disable if typed with system protocol Bug#483636 - editable = false; - } else { - editable = !(!(rtPort.isWired()) - || (rtPort.isWired() && !port.isService()) - || (rtPort.isWired() && port.isService() && !port.isBehavior() && RTPortUtils.isConnectedInside(port))); - // isBehavior disabled if !iswired || (isWired && !isService) || (isWired && isService && !isBehavior && isConnectedInside) - } + } else if (feature == UMLPackage.Literals.PORT__IS_SERVICE) { + if (isSystemProtocol || port.isInherited()) { + // disable if typed with system protocol Bug#483636. + // Cannot redefine isService + editable = false; + } else { + editable = !port.isConnected() && port.isBehavior(); + } + } else if (feature == UMLPackage.Literals.PORT__IS_BEHAVIOR) { + if (isSystemProtocol) { + // disable if typed with system protocol Bug#483636 + editable = false; + } else { + // isBehavior disabled if !iswired || (isWired && !isService) || (isWired && isService && !isBehavior && isConnectedInside) + editable = !(!port.isWired() + || (port.isWired() && !port.isService()) + || (port.isWired() && port.isService() && !port.isBehavior() && port.isConnectedInside())); } } else { editable = super.isFeatureEditable(propertyPath); @@ -468,13 +312,18 @@ public class UMLRTExtModelElement extends UMLModelElement { // Rules defined by the Client else if (source instanceof Property) { - if (null != UMLUtil.getStereotypeApplication((Element) source, CapsulePart.class)) { - editable = true; + UMLRTCapsulePart capsulePart = UMLRTCapsulePart.getInstance((Property) source); + + if (capsulePart != null) { + if (feature == UMLPackage.Literals.NAMED_ELEMENT__NAME) { + // Cannot redefine the name + editable = !capsulePart.isInherited(); + } else { + editable = true; + } } else { editable = super.isFeatureEditable(propertyPath); } - } else if (isCollaborationOrClass(source)) { - editable = super.isFeatureEditable(propertyPath); } else if (source instanceof Parameter) { editable = super.isFeatureEditable(propertyPath); } else if (source instanceof Package) { @@ -489,93 +338,10 @@ public class UMLRTExtModelElement extends UMLModelElement { } @Override - public boolean getDirectCreation(String propertyPath) { - boolean result; - - EStructuralFeature feature = getFeature(propertyPath); - if (feature == UMLPackage.Literals.TYPED_ELEMENT__TYPE) { - // Don't support the plus and pencil buttons because - // the ellipsis does all the work - result = !isRTMessageParameter(source); - } else { - result = super.getDirectCreation(propertyPath); - } - - return result; - } - - /** - * Get the incoming interfaces. Don't use getImplementedInterfaces, since it only captures - * the interface realization and not the realization relationship. - * - * @return list of required interfaces - */ - protected Interface getInterface(RTMessageKind rtMessageKind) { - Interface result = null; - - Collaboration protocol = (Collaboration) source; - Iterator<DirectedRelationship> relationshipIterator = protocol.getSourceDirectedRelationships().iterator(); - while (relationshipIterator.hasNext() && (result == null)) { - DirectedRelationship directedRelation = relationshipIterator.next(); - if (directedRelation instanceof Dependency) { // Realization or Usage - result = getInterfaceFromDepencies(rtMessageKind, directedRelation); - } - } - - return result; - } - - - /** - * Get the Interface from the dependencies and Kind of Message. - * - * - * @return list of required interfaces - */ - protected Interface getInterfaceFromDepencies(RTMessageKind rtMessageKind, DirectedRelationship directedRelation) { - Interface matchingInterface = null; - Dependency dependency = (Dependency) directedRelation; - Iterator<NamedElement> dependencyIterator = dependency.getSuppliers().iterator(); - - while (dependencyIterator.hasNext() && (null == matchingInterface)) { - NamedElement supplier = dependencyIterator.next(); - if (supplier instanceof Interface) { - Interface interfaceImpl = (Interface) supplier; - RTMessageSet rtMessageSet = UMLUtil.getStereotypeApplication(interfaceImpl, RTMessageSet.class); - if ((null != rtMessageSet) && (rtMessageSet.getRtMsgKind() == rtMessageKind)) { - matchingInterface = (Interface) supplier; - - } - } - } - return matchingInterface; - } - - @Override public IValidator getValidator(String propertyPath) { // Include inherited validator(s), also IValidator result = super.getValidator(propertyPath); - if (propertyPath.matches("\\bname$") && isCollaborationOrClass(source)) { - // Protocols and Capsules must be named. We're only checking the - // base UML metaclass, but we wouldn't be here if it weren't an - // RT element, so don't overspecify by checking element-types - result = CompositeValidator.of(result, value -> { - boolean valid = (value instanceof String) - && !((String) value).trim().isEmpty(); - - return valid ? Status.OK_STATUS : new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Name is required"); - }); - - if (ProtocolUtils.isProtocol(source)) { - // Custom distinguishability rule for protocols: their names imply their container - // package names, so check the container package - result = CompositeValidator.of(result, value -> { - IValidator packageValidator = new NamedElementValidator(ProtocolUtils.getProtocolContainer((Collaboration) source)); - return packageValidator.validate(value); - }); - } - } if (IRealTimeConstants.PROPERTY_REPLICATION.equals(propertyPath)) { // the type is String, but we like to prohibit : // 1) strings with ".." to not specify a multiplicity in the replication text @@ -602,19 +368,6 @@ public class UMLRTExtModelElement extends UMLModelElement { return result; } - /** - * Queries whether an object is a collaboration or a class. RT-specific types - * that require names and may have other constraints besides. - * - * @param object - * an object - * @return whether it is a protocol or a capsule - */ - private boolean isCollaborationOrClass(EObject object) { - return (object instanceof Collaboration) - || (object instanceof org.eclipse.uml2.uml.Class); - } - @Override public IPapyrusConverter getPapyrusConverter(String propertyPath) { IPapyrusConverter result; diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/UMLRTFacadeModelElement.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/UMLRTFacadeModelElement.java new file mode 100644 index 000000000..87a2a8c7f --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/UMLRTFacadeModelElement.java @@ -0,0 +1,314 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.modelelement; + +import org.eclipse.core.databinding.observable.IObservable; +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.validation.IValidator; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.papyrus.infra.emf.utils.HistoryUtil; +import org.eclipse.papyrus.infra.properties.ui.providers.FeatureContentProvider; +import org.eclipse.papyrus.infra.ui.emf.providers.EMFGraphicalContentProvider; +import org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider; +import org.eclipse.papyrus.infra.ui.emf.utils.ProviderHelper; +import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory; +import org.eclipse.papyrus.uml.properties.modelelement.UMLModelElement; +import org.eclipse.papyrus.uml.tools.databinding.NamedElementValidator; +import org.eclipse.papyrus.uml.tools.providers.UMLContainerContentProvider; +import org.eclipse.papyrus.uml.tools.providers.UMLFilteredLabelProvider; +import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolUtils; +import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind; +import org.eclipse.papyrusrt.umlrt.tooling.ui.Activator; +import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.CompositeValidator; +import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade.CapsuleProperties; +import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade.NamedElementProperties; +import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade.ProtocolProperties; +import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties.FacadePropertyEditorFactory; +import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties.UMLRTCapsulePartEditorFactory; +import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties.UMLRTPortEditorFactory; +import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties.UMLRTProtocolMessageEditorFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTClassifier; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocol; +import org.eclipse.papyrusrt.umlrt.uml.util.UMLRTSwitch; +import org.eclipse.uml2.uml.Collaboration; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * A model-element that uses the UML-RT Façade API to access and present properties. + */ +public class UMLRTFacadeModelElement extends UMLModelElement { + + private static final String NAME = "name"; //$NON-NLS-1$ + + private static final String PORT = "port"; //$NON-NLS-1$ + + private static final String CAPSULE_PART = "capsulePart"; //$NON-NLS-1$ + + private static final String INCOMING = "Incoming"; //$NON-NLS-1$ + + private static final String OUTGOING = "Outgoing"; //$NON-NLS-1$ + + private static final String IN_OUT = "InOut"; //$NON-NLS-1$ + + private UMLRTNamedElement element; + + /** + * Initializes me with my {@code source} element. + * + * @param source + * the source façade element + */ + public UMLRTFacadeModelElement(UMLRTNamedElement source) { + super(source.toUML(), TransactionUtil.getEditingDomain(source.toUML())); + + this.element = source; + } + + @Override + public void dispose() { + super.dispose(); + + element = null; + } + + @Override + public boolean isOrdered(String propertyPath) { + RTMessageKind msgKind = getMessageKind(propertyPath); + if (msgKind != null) { + // These are not ordered because we sort by inheritance state + return false; + } + + switch (propertyPath) { + case PORT: + case CAPSULE_PART: + // These are not ordered because we sort by inheritance state + return false; + } + + return super.isOrdered(propertyPath); + } + + @Override + public EStructuralFeature getFeature(String propertyPath) { + + return new UMLRTSwitch<EStructuralFeature>() { + + @Override + public EStructuralFeature caseCapsule(UMLRTCapsule object) { + switch (propertyPath) { + case PORT: + return UMLPackage.Literals.ENCAPSULATED_CLASSIFIER__OWNED_PORT; + case CAPSULE_PART: + return UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE; + default: + return null; + } + } + + @Override + public EStructuralFeature caseProtocol(UMLRTProtocol object) { + RTMessageKind msgKind = getMessageKind(propertyPath); + return (msgKind != null) ? UMLPackage.Literals.INTERFACE__OWNED_OPERATION : null; + } + + @Override + public EStructuralFeature defaultCase(Object object) { + return UMLRTFacadeModelElement.super.getFeature(propertyPath); + } + + }.doSwitch(element); + } + + @Override + public IObservable doGetObservable(String propertyPath) { + return new UMLRTSwitch<IObservable>() { + + @Override + public IObservable caseCapsule(UMLRTCapsule object) { + switch (propertyPath) { + case PORT: + return CapsuleProperties.ports().observe(object); + case CAPSULE_PART: + return CapsuleProperties.capsuleParts().observe(object); + default: + return null; + } + } + + @Override + public IObservable caseProtocol(UMLRTProtocol object) { + RTMessageKind msgKind = getMessageKind(propertyPath); + return (msgKind != null) ? ProtocolProperties.messages(msgKind).observe(object) : null; + } + + @Override + public IObservable caseNamedElement(UMLRTNamedElement object) { + switch (propertyPath) { + case NAME: + return NamedElementProperties.name().observe(object); + default: + return null; + } + } + + }.doSwitch(element); + } + + @Override + public ReferenceValueFactory getValueFactory(String propertyPath) { + return new UMLRTSwitch<ReferenceValueFactory>() { + + @Override + public ReferenceValueFactory caseCapsule(UMLRTCapsule object) { + ReferenceValueFactory result = null; + EReference reference; + + switch (propertyPath) { + case PORT: + reference = UMLPackage.Literals.ENCAPSULATED_CLASSIFIER__OWNED_PORT; + result = complete(new UMLRTPortEditorFactory(reference, (IObservableList<?>) getObservable(propertyPath)), + reference); + break; + case CAPSULE_PART: + reference = UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE; + result = complete(new UMLRTCapsulePartEditorFactory(reference, (IObservableList<?>) getObservable(propertyPath)), + reference); + break; + } + + return result; + } + + @Override + public ReferenceValueFactory caseProtocol(UMLRTProtocol object) { + ReferenceValueFactory result = null; + + RTMessageKind msgKind = getMessageKind(propertyPath); + if (msgKind != null) { + EReference reference = UMLPackage.Literals.INTERFACE__OWNED_OPERATION; + result = complete(new UMLRTProtocolMessageEditorFactory(reference, msgKind, (IObservableList<?>) getObservable(propertyPath)), + reference); + } + + return result; + } + + private FacadePropertyEditorFactory complete(FacadePropertyEditorFactory factory, EReference reference) { + EClass type = reference.getEReferenceType(); + factory.setContainerLabelProvider(new UMLFilteredLabelProvider()); + factory.setReferenceLabelProvider(new EMFLabelProvider()); + ITreeContentProvider contentProvider = new UMLContainerContentProvider(source, reference); + + ResourceSet rs = source == null ? null : source.eResource() == null ? null : source.eResource().getResourceSet(); + EMFGraphicalContentProvider provider = ProviderHelper.encapsulateProvider(contentProvider, rs, HistoryUtil.getHistoryID(source, reference, "container")); + + factory.setContainerContentProvider(provider); + factory.setReferenceContentProvider(new FeatureContentProvider(type)); + + return factory; + } + + }.doSwitch(element); + } + + private RTMessageKind getMessageKind(String propertyPath) { + RTMessageKind result = null; + if (source instanceof Collaboration) { + if (propertyPath.endsWith(INCOMING)) { // $NON-NLS-1$ + result = RTMessageKind.IN; + } else if (propertyPath.endsWith(OUTGOING)) { // $NON-NLS-1$ + result = RTMessageKind.OUT; + } else if (propertyPath.endsWith(IN_OUT)) { // $NON-NLS-1$ + result = RTMessageKind.IN_OUT; + } + } + return result; + } + + // @Override + // public boolean forceRefresh(String propertyPath) { + // return true; + // } + + @Override + protected boolean isFeatureEditable(String propertyPath) { + // So far, I only provide editable properties + return true; + } + + @Override + public boolean getDirectCreation(String propertyPath) { + boolean result; + + EStructuralFeature feature = getFeature(propertyPath); + if (feature == UMLPackage.Literals.ENCAPSULATED_CLASSIFIER__OWNED_PORT) { + // It isn't EMF-ishly a containment, but it subsets a containment + result = true; + } else { + result = super.getDirectCreation(propertyPath); + } + + return result; + } + + @Override + public IValidator getValidator(String propertyPath) { + // Include inherited validator(s), also + IValidator result = super.getValidator(propertyPath); + + if (propertyPath.equals(NAME)) { + IValidator specific = new UMLRTSwitch<IValidator>() { + + @Override + public IValidator caseClassifier(UMLRTClassifier object) { + // Capsules and protocols must be named + return value -> { + boolean valid = (value instanceof String) + && !((String) value).trim().isEmpty(); + + return valid + ? Status.OK_STATUS + : new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Name is required"); + }; + } + + + @Override + public IValidator caseProtocol(UMLRTProtocol object) { + // Custom distinguishability rule for protocols: their names imply their container + // package names, so check the container package + IValidator packageValidator = new NamedElementValidator(ProtocolUtils.getProtocolContainer(object.toUML())); + return CompositeValidator.of(caseClassifier(object), value -> { + return packageValidator.validate(value); + }); + } + + }.doSwitch(element); + + result = CompositeValidator.of(result, specific); + } + + return result; + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/UMLRTFacadeModelElementFactory.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/UMLRTFacadeModelElementFactory.java new file mode 100644 index 000000000..beaecdb62 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/modelelement/UMLRTFacadeModelElementFactory.java @@ -0,0 +1,49 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.modelelement; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.properties.contexts.DataContextElement; +import org.eclipse.papyrus.uml.properties.modelelement.UMLModelElement; +import org.eclipse.papyrus.uml.properties.modelelement.UMLModelElementFactory; +import org.eclipse.papyrusrt.umlrt.tooling.ui.Activator; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.uml2.uml.NamedElement; + +/** + * A factory creating model-elements that use the UML-RT Façade API + * to access and present properties. + */ +public class UMLRTFacadeModelElementFactory extends UMLModelElementFactory { + + @Override + protected UMLModelElement doCreateFromSource(Object sourceElement, DataContextElement context) { + EObject source = EMFHelper.getEObject(sourceElement); + UMLRTFacadeModelElement result = null; + if (source instanceof NamedElement) { + UMLRTNamedElement element = UMLRTFactory.create((NamedElement) source); + + if (element != null) { + result = new UMLRTFacadeModelElement(element); + } + } else { + Activator.log.warn("Unable to resolve the selected element to an UMLRTNamedElement"); //$NON-NLS-1$ + } + + return result; + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/InheritableMultiReference.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/InheritableMultiReference.java new file mode 100644 index 000000000..f371bb000 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/InheritableMultiReference.java @@ -0,0 +1,48 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.widgets; + +import org.eclipse.papyrus.infra.properties.ui.widgets.MultiReference; +import org.eclipse.papyrusrt.umlrt.tooling.ui.editors.InheritableMultipleReferenceEditor; +import org.eclipse.swt.widgets.Composite; + +/** + * Customized multi-reference property for references that support inheritance. + */ +public class InheritableMultiReference extends MultiReference { + + public InheritableMultiReference(Composite parent, int style) { + super(parent, style); + } + + @Override + protected InheritableMultipleReferenceEditor createMultipleReferenceEditor(Composite parent, int style) { + InheritableMultipleReferenceEditor result = new InheritableMultipleReferenceEditor(parent, style); + + if (getProperty() != null) { + result.setDialogSettingsKey(getProperty()); + } + + return result; + } + + @Override + public void setProperty(String path) { + super.setProperty(path); + + if (editor instanceof InheritableMultipleReferenceEditor) { + ((InheritableMultipleReferenceEditor) editor).setDialogSettingsKey(path); + } + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/PortRTKindPropertyEditor.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/PortRTKindPropertyEditor.java deleted file mode 100644 index 6ed34f45b..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/PortRTKindPropertyEditor.java +++ /dev/null @@ -1,93 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 CEA LIST. - * - * 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: - * CEA LIST - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrusrt.umlrt.tooling.ui.widgets; - -import org.eclipse.papyrus.infra.properties.ui.modelelement.ModelElement; -import org.eclipse.papyrus.infra.properties.ui.widgets.AbstractPropertyEditor; -import org.eclipse.papyrusrt.umlrt.core.utils.RTPortKindEnum; -import org.eclipse.papyrusrt.umlrt.core.utils.RTPortUtils; -import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTPort; -import org.eclipse.papyrusrt.umlrt.tooling.ui.modelelement.RTStereotypeModelElement; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.uml2.uml.Port; - -/** - * Specific EnumRadio that can have read only status only on some of the radio buttons - */ -public class PortRTKindPropertyEditor extends AbstractPropertyEditor { - - protected RTEnumRadioValueEditor kindValueEditor; - - protected int numColumns = -1; - - /** - * Constructor. - * - * @param parent - * The composite in which the widget will be displayed - * @param style - * The style for the widget - */ - public PortRTKindPropertyEditor(Composite parent, int style) { - super(new RTEnumRadioValueEditor(parent, style)); - kindValueEditor = (RTEnumRadioValueEditor) valueEditor; - } - - /** - * Applies the readOnly state to the editor - * - * @param readOnly - * Indicates if this widget should be read-only - */ - @Override - protected void applyReadOnly(boolean readOnly) { - super.applyReadOnly(readOnly); - if (!readOnly) { - // should be writable, but check for specific non executable commands - ModelElement element = input.getModelElement(propertyPath); - if (element instanceof RTStereotypeModelElement && ((RTStereotypeModelElement) element).getSource() instanceof RTPort) { - for (RTPortKindEnum enumValue : RTPortKindEnum.values()) { - Port port = ((RTPort) ((RTStereotypeModelElement) element).getSource()).getBase_Port(); - kindValueEditor.setReadOnly(enumValue, RTPortUtils.isKindEditable(port, enumValue)); - } - } - } - } - - /** - * Sets the maximum number of columns for this editor. The radio values - * will be distributed according to this number - * - * @param numColumns - */ - public void setNumColumns(int numColumns) { - this.numColumns = numColumns; - kindValueEditor.setNumColumns(numColumns); - } - - /** - * Return the maximum number of columns for this editor - * - * @return - * The number of columns for this editor - */ - public int getNumColumns() { - return numColumns; - } - - @Override - protected void doBinding() { - kindValueEditor.setProviders(input.getContentProvider(propertyPath), input.getLabelProvider(propertyPath)); - super.doBinding(); - } - -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/PropertyReplicationObservableValue.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/PropertyReplicationObservableValue.java index b81019fd2..18642652f 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/PropertyReplicationObservableValue.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/PropertyReplicationObservableValue.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2016 CEA LIST and others. + * Copyright (c) 2016 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,10 +8,15 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 467545 * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.ui.widgets; +import java.util.Collections; +import java.util.Map; +import java.util.Objects; + import org.eclipse.core.databinding.observable.Diffs; import org.eclipse.core.databinding.observable.IObserving; import org.eclipse.core.databinding.observable.value.ValueDiff; @@ -20,16 +25,24 @@ import org.eclipse.emf.common.command.UnexecutableCommand; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.requests.UnsetRequest; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; +import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureListCommandFactory; +import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; import org.eclipse.papyrus.uml.tools.Activator; import org.eclipse.papyrus.uml.tools.databinding.PapyrusObservableValue; import org.eclipse.papyrusrt.umlrt.core.defaultlanguage.IDefaultLanguage; @@ -37,14 +50,15 @@ import org.eclipse.papyrusrt.umlrt.core.defaultlanguage.IDefaultLanguageService; import org.eclipse.papyrusrt.umlrt.core.utils.CapsulePartUtils; import org.eclipse.papyrusrt.umlrt.core.utils.MultipleAdapter; import org.eclipse.papyrusrt.umlrt.core.utils.RTPortUtils; -import org.eclipse.uml2.uml.LiteralInteger; import org.eclipse.uml2.uml.LiteralUnlimitedNatural; +import org.eclipse.uml2.uml.MultiplicityElement; import org.eclipse.uml2.uml.OpaqueExpression; import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.UMLFactory; import org.eclipse.uml2.uml.UMLPackage; import org.eclipse.uml2.uml.ValueSpecification; +import com.google.common.collect.ImmutableMap; + /** * @author as247872 @@ -111,18 +125,17 @@ public class PropertyReplicationObservableValue extends PapyrusObservableValue i @Override public Command getCommand(final Object value) { + Command result; - // Set the new value based on the Replication Value - ValueSpecification newUpperValue = null; - ValueSpecification newLowerValue = null; - int upperValue; - int lowerValue; - if (value instanceof String && value != null) { - - // if it is an Integer, create a LiteralUnlimittedNatural for Upper and LiteralInteger for Lower + if (!(value instanceof String)) { + result = UnexecutableCommand.INSTANCE; + } else { + // if it is an Integer, create a LiteralUnlimitedNatural for Upper and LiteralInteger for Lower if (((String) value).matches("[0-9]*|\\*")) { + int upperValue; + int lowerValue; if (value.equals(STAR)) { - upperValue = -1; + upperValue = LiteralUnlimitedNatural.UNLIMITED; } else { upperValue = Integer.decode((String) value); } @@ -137,41 +150,32 @@ public class PropertyReplicationObservableValue extends PapyrusObservableValue i lowerValue = upperValue; } } - newUpperValue = UMLFactory.eINSTANCE.createLiteralUnlimitedNatural(); - ((LiteralUnlimitedNatural) newUpperValue).setValue(upperValue); - newLowerValue = UMLFactory.eINSTANCE.createLiteralInteger(); - ((LiteralInteger) newLowerValue).setValue(lowerValue); - // if the value ="None (1)" unset upper and lower values: + result = getSetMultiplicityCommand(propertyElement, lowerValue, upperValue); } else if (((String) value).equals("None (1)")) { - newLowerValue = null; - newUpperValue = null; - } - - // create an opaque expression with body = value and language = default Language - else { - newUpperValue = UMLFactory.eINSTANCE.createOpaqueExpression(); - setOpaqueExpressionProperties((OpaqueExpression) newUpperValue, (String) value); + // if the value ="None (1)" unset upper and lower values: + result = getUnsetMultiplicityCommand(propertyElement); + } else { + // create an opaque expression with body = value and language = default Language + String upperValue = (String) value; + Object lowerValue = null; - // case of Capsule Part if (CapsulePartUtils.isCapsulePart(propertyElement)) { + // case of Capsule Part if (propertyElement.getLower() != 0) { - newLowerValue = UMLFactory.eINSTANCE.createOpaqueExpression(); - setOpaqueExpressionProperties((OpaqueExpression) newLowerValue, (String) value); + lowerValue = value; } else { - newLowerValue = UMLFactory.eINSTANCE.createLiteralInteger(); - ((LiteralInteger) newLowerValue).setValue(0); + lowerValue = 0; } - // cade of RTPort } else if (RTPortUtils.isRTPort(propertyElement)) { - newLowerValue = UMLFactory.eINSTANCE.createOpaqueExpression(); - setOpaqueExpressionProperties((OpaqueExpression) newLowerValue, (String) value); - + // case of RTPort + lowerValue = value; } + + result = getSetMultiplicityCommand(propertyElement, lowerValue, upperValue); } } - Command command = getCommandForCapsulePart(newLowerValue, newUpperValue); - return command; + return result; } private String getDefaultLanguage() { @@ -192,36 +196,107 @@ public class PropertyReplicationObservableValue extends PapyrusObservableValue i return defaultLanguage; } - private void setOpaqueExpressionProperties(OpaqueExpression oe, String value) { - oe.getBodies().add(value); - // regex to enhance, only take into account simple arithmetic expression do not manage "()"... - // if (value.matches("[0-9A-Za-a]*( ){0,}([+-/*]( ){0,}[0-9A-Za-a]*( ){0,})*")) {} - // the oe language is set to the defaultLanguage Name (here C++). - oe.getLanguages().add(getDefaultLanguage()); - } - - protected Command getCommandForCapsulePart(final ValueSpecification newLowerValue, final ValueSpecification newUpperValue) { + protected Command getSetMultiplicityCommand(MultiplicityElement element, int lower, int upper) { + ICommand result = null; try { - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved()); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(element); if (provider != null) { - CompositeCommand cc = new CompositeCommand("Edit value"); - IEditCommandRequest createUpperSetRequest = createSetRequest((TransactionalEditingDomain) domain, eObject, UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue(), newUpperValue); - IEditCommandRequest createLowerSetRequest = createSetRequest((TransactionalEditingDomain) domain, eObject, UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue(), newLowerValue); - if (createLowerSetRequest == null || createUpperSetRequest == null) { - return UnexecutableCommand.INSTANCE; + TransactionalEditingDomain ted = (TransactionalEditingDomain) domain; + CompositeTransactionalCommand cc = new CompositeTransactionalCommand(ted, "Set Replication"); + IEditCommandRequest setLowerRequest = createSetRequest(ted, eObject, UMLPackage.Literals.MULTIPLICITY_ELEMENT__LOWER, lower); + IEditCommandRequest setUpperRequest = createSetRequest(ted, eObject, UMLPackage.Literals.MULTIPLICITY_ELEMENT__UPPER, upper); + cc.add(provider.getEditCommand(setLowerRequest)); + cc.add(provider.getEditCommand(setUpperRequest)); + + result = cc.canExecute() ? cc.reduce() : null; + } + } catch (Exception ex) { + Activator.log.error(ex); + } + + return (result == null) ? UnexecutableCommand.INSTANCE : GMFtoEMFCommandWrapper.wrap(result); + } + + protected Command getSetMultiplicityCommand(MultiplicityElement element, Object lower, String upper) { + ICommand result = null; + + if (lower != null) { + try { + String lang = getDefaultLanguage(); + + TransactionalEditingDomain ted = (TransactionalEditingDomain) domain; + CompositeTransactionalCommand cc = new CompositeTransactionalCommand(ted, "Set Replication"); + + if (element.getUpperValue() instanceof OpaqueExpression) { + appendSetCommands(cc, (OpaqueExpression) element.getUpperValue(), upper, lang); + } else { + appendCreateExpressionCommand(cc, element, upper, lang, UMLPackage.Literals.MULTIPLICITY_ELEMENT__UPPER_VALUE); + } + + if (lower instanceof Integer) { + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(element); + cc.add(provider.getEditCommand(createSetRequest(ted, element, UMLPackage.Literals.MULTIPLICITY_ELEMENT__LOWER, lower))); + } else if (element.getLowerValue() instanceof OpaqueExpression) { + appendSetCommands(cc, (OpaqueExpression) element.getLowerValue(), (String) lower, lang); + } else { + appendCreateExpressionCommand(cc, element, (String) lower, lang, UMLPackage.Literals.MULTIPLICITY_ELEMENT__LOWER_VALUE); } - cc.add(provider.getEditCommand(createUpperSetRequest)); - cc.add(provider.getEditCommand(createLowerSetRequest)); - return new GMFtoEMFCommandWrapper(cc); + result = cc.canExecute() ? cc.reduce() : null; + } catch (Exception ex) { + Activator.log.error(ex); + } + } + + return (result == null) ? UnexecutableCommand.INSTANCE : GMFtoEMFCommandWrapper.wrap(result); + } + + private void appendSetCommands(ICompositeCommand cc, OpaqueExpression expr, String body, String language) { + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(expr); + TransactionalEditingDomain ted = (TransactionalEditingDomain) domain; + if (expr.getBodies().isEmpty() || !body.equals(expr.getBodies().get(0))) { + cc.add(provider.getEditCommand(createSetRequest(ted, expr, UMLPackage.Literals.OPAQUE_EXPRESSION__BODY, Collections.singletonList(body)))); + } + if (expr.getLanguages().isEmpty() || !Objects.equals(expr.getLanguages().get(0), language)) { + cc.add(provider.getEditCommand(createSetRequest(ted, expr, UMLPackage.Literals.OPAQUE_EXPRESSION__LANGUAGE, Collections.singletonList(language)))); + } + } + + private void appendCreateExpressionCommand(ICompositeCommand cc, MultiplicityElement element, String body, String language, EReference bound) { + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(element); + TransactionalEditingDomain ted = (TransactionalEditingDomain) domain; + + CreateElementRequest create = new CreateElementRequest(ted, element, UMLElementTypes.OPAQUE_EXPRESSION, bound); + Map<EStructuralFeature, Object> configuration = ImmutableMap.of( + UMLPackage.Literals.OPAQUE_EXPRESSION__BODY, Collections.singletonList(body), + UMLPackage.Literals.OPAQUE_EXPRESSION__LANGUAGE, Collections.singletonList(language)); + create.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureListCommandFactory(configuration)); + + cc.add(provider.getEditCommand(create)); + } + + protected Command getUnsetMultiplicityCommand(MultiplicityElement element) { + ICommand result = null; + + try { + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(element); + if (provider != null) { + TransactionalEditingDomain ted = (TransactionalEditingDomain) domain; + CompositeTransactionalCommand cc = new CompositeTransactionalCommand(ted, "Set Replication"); + IEditCommandRequest setLowerRequest = new UnsetRequest(ted, eObject, UMLPackage.Literals.MULTIPLICITY_ELEMENT__LOWER_VALUE); + IEditCommandRequest setUpperRequest = new UnsetRequest(ted, eObject, UMLPackage.Literals.MULTIPLICITY_ELEMENT__UPPER_VALUE); + cc.add(provider.getEditCommand(setLowerRequest)); + cc.add(provider.getEditCommand(setUpperRequest)); + + result = cc.canExecute() ? cc.reduce() : null; } } catch (Exception ex) { Activator.log.error(ex); } - return UnexecutableCommand.INSTANCE; - } + return (result == null) ? UnexecutableCommand.INSTANCE : GMFtoEMFCommandWrapper.wrap(result); + } @Override protected IEditCommandRequest createSetRequest(TransactionalEditingDomain domain, EObject owner, EStructuralFeature feature, Object value) { @@ -300,4 +375,4 @@ public class PropertyReplicationObservableValue extends PapyrusObservableValue i } } -}
\ No newline at end of file +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/RTKindEnumPropertyEditor.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/RTKindEnumPropertyEditor.java new file mode 100644 index 000000000..8c69f0cce --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui/src/org/eclipse/papyrusrt/umlrt/tooling/ui/widgets/RTKindEnumPropertyEditor.java @@ -0,0 +1,164 @@ +/***************************************************************************** + * Copyright (c) 2014, 2016 CEA LIST, Christian W. Damus, and others. + * + * 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: + * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 467545 + * + *****************************************************************************/ +package org.eclipse.papyrusrt.umlrt.tooling.ui.widgets; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import org.eclipse.papyrus.infra.properties.ui.modelelement.ModelElement; +import org.eclipse.papyrus.infra.properties.ui.widgets.AbstractPropertyEditor; +import org.eclipse.papyrus.uml.properties.modelelement.UMLModelElement; +import org.eclipse.papyrusrt.umlrt.tooling.ui.Activator; +import org.eclipse.papyrusrt.umlrt.tooling.ui.modelelement.RTStereotypeModelElement; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.util.UMLUtil; + +/** + * Radio group editor for an enumeration of RT element kinds, supporting selective + * enablement of one or more options under certain circumstances. + */ +public class RTKindEnumPropertyEditor extends AbstractPropertyEditor { + + protected RTEnumRadioValueEditor kindValueEditor; + + protected int numColumns = -1; + + protected Method isEditableMethod; + + protected Class<? extends Enum<?>> enumType; + + /** + * Constructor. + * + * @param parent + * The composite in which the widget will be displayed + * @param style + * The style for the widget + */ + public RTKindEnumPropertyEditor(Composite parent, int style) { + super(new RTEnumRadioValueEditor(parent, style)); + kindValueEditor = (RTEnumRadioValueEditor) valueEditor; + } + + public void setEnumType(Class<? extends Enum<?>> enumType) { + this.enumType = enumType; + + if ((input != null) && (propertyPath != null)) { + // Read-only states may have changed + applyReadOnly(readOnly); + } + } + + public Class<? extends Enum<?>> getEnumType() { + return (enumType == null) ? null : enumType; + } + + public void setUtilsClass(Class<?> utilsClass) { + for (Method next : utilsClass.getDeclaredMethods()) { + if (next.getName().equals("isKindEditable") + && Modifier.isStatic(next.getModifiers()) + && (next.getParameterTypes().length == 2) + && next.getParameterTypes()[1].isEnum()) { + + isEditableMethod = next; + + if ((input != null) && (propertyPath != null)) { + // Read-only states may have changed + applyReadOnly(readOnly); + } + break; + } + } + } + + public Class<?> getUtilsClass() { + return (isEditableMethod == null) ? null : isEditableMethod.getDeclaringClass(); + } + + /** + * Applies the readOnly state to the editor + * + * @param readOnly + * Indicates if this widget should be read-only + */ + @Override + protected void applyReadOnly(boolean readOnly) { + super.applyReadOnly(readOnly); + if (!readOnly && (enumType != null)) { + // should be writable, but check for specific non executable commands + ModelElement element = input.getModelElement(propertyPath); + Element uml = getSourceUMLElement(element); + if (uml != null) { + for (Enum<?> enumValue : enumType.getEnumConstants()) { + kindValueEditor.setReadOnly(enumValue, isKindEditable(uml, enumValue)); + } + } + } + } + + protected Element getSourceUMLElement(ModelElement element) { + Element result = null; + + if (element instanceof UMLModelElement) { + result = (Element) ((UMLModelElement) element).getSource(); + } else if (element instanceof RTStereotypeModelElement) { + result = UMLUtil.getBaseElement(((RTStereotypeModelElement) element).getSource()); + } + + return result; + } + + protected boolean isKindEditable(Element element, Enum<?> enumValue) { + boolean result = true; + + if (isEditableMethod != null) { + try { + result = (Boolean) isEditableMethod.invoke(null, element, enumValue); + } catch (Exception e) { + Activator.log.error("Failed to determine validity of enum value; probable properties view configuration fault", e); //$NON-NLS-1$ + } + } + + return result; + } + + /** + * Sets the maximum number of columns for this editor. The radio values + * will be distributed according to this number + * + * @param numColumns + */ + public void setNumColumns(int numColumns) { + this.numColumns = numColumns; + kindValueEditor.setNumColumns(numColumns); + } + + /** + * Return the maximum number of columns for this editor + * + * @return + * The number of columns for this editor + */ + public int getNumColumns() { + return numColumns; + } + + @Override + protected void doBinding() { + kindValueEditor.setProviders(input.getContentProvider(propertyPath), input.getLabelProvider(propertyPath)); + super.doBinding(); + } + +} diff --git a/tests/junit/framework/org.eclipse.papyrusrt.junit/src/org/eclipse/papyrusrt/junit/rules/DataBindingsRule.java b/tests/junit/framework/org.eclipse.papyrusrt.junit/src/org/eclipse/papyrusrt/junit/rules/DataBindingsRule.java new file mode 100644 index 000000000..0f4a158a8 --- /dev/null +++ b/tests/junit/framework/org.eclipse.papyrusrt.junit/src/org/eclipse/papyrusrt/junit/rules/DataBindingsRule.java @@ -0,0 +1,85 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.junit.rules; + +import org.eclipse.core.databinding.observable.Realm; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +/** + * A rule that sets a default realm for the duration of a test for the convenience of + * testing data-bindings APIs such as observables without requiring the UI thread. + */ +public class DataBindingsRule implements TestRule { + + public DataBindingsRule() { + super(); + } + + @Override + public Statement apply(Statement base, Description description) { + return new Statement() { + + @Override + public void evaluate() throws Throwable { + Throwable[] thrown = { null }; + + new TestRealm().installWhile(() -> { + try { + base.evaluate(); + } catch (Throwable t) { + thrown[0] = t; + } + }); + + if (thrown[0] != null) { + throw thrown[0]; + } + } + }; + } + + // + // Nested types + // + + /** + * A realm useful for testing data-bindings without requiring the UI thread. + */ + public static class TestRealm extends Realm { + + private final Thread owner = Thread.currentThread(); + + public TestRealm() { + super(); + } + + @Override + public boolean isCurrent() { + return Thread.currentThread() == owner; + } + + public void installWhile(Runnable action) { + Realm restore = setDefault(this); + + try { + action.run(); + } finally { + setDefault(restore); + } + } + } + +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.tests/org.eclipse.papyrusrt.tooling.compare.tests.launch b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.tests/org.eclipse.papyrusrt.tooling.compare.tests.launch new file mode 100644 index 000000000..83fe4e81c --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.tests/org.eclipse.papyrusrt.tooling.compare.tests.launch @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig"> +<booleanAttribute key="append.args" value="true"/> +<booleanAttribute key="askclear" value="false"/> +<booleanAttribute key="automaticAdd" value="true"/> +<booleanAttribute key="automaticValidate" value="false"/> +<stringAttribute key="bootstrap" value=""/> +<stringAttribute key="checked" value="[NONE]"/> +<booleanAttribute key="clearConfig" value="true"/> +<booleanAttribute key="clearws" value="true"/> +<booleanAttribute key="clearwslog" value="false"/> +<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/> +<booleanAttribute key="default" value="true"/> +<booleanAttribute key="includeOptional" value="true"/> +<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.papyrusrt.umlrt.tooling.compare.tests"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="4"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.papyrusrt.umlrt.tooling.compare.tests"/> +<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> +<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> +<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> +<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> +<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> +<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrusrt.umlrt.tooling.compare.tests"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> +<stringAttribute key="pde.version" value="3.3"/> +<stringAttribute key="product" value="org.eclipse.sdk.ide"/> +<booleanAttribute key="run_in_ui_thread" value="false"/> +<booleanAttribute key="show_selected_only" value="false"/> +<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/> +<booleanAttribute key="tracing" value="false"/> +<booleanAttribute key="useCustomFeatures" value="false"/> +<booleanAttribute key="useDefaultConfig" value="true"/> +<booleanAttribute key="useDefaultConfigArea" value="false"/> +<booleanAttribute key="useProduct" value="true"/> +</launchConfiguration> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/META-INF/MANIFEST.MF b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/META-INF/MANIFEST.MF index 02a1502d9..bef4d4249 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/META-INF/MANIFEST.MF +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/META-INF/MANIFEST.MF @@ -33,4 +33,12 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.108.0,4.0.0)", org.eclipse.papyrusrt.umlrt.cpp;bundle-version="[0.8.0,1.0.0)" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.papyrusrt.umlrt.tooling.diagram.common.canonical.tests;x-friends:="org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine.tests" +Export-Package: org.eclipse.papyrusrt.umlrt.tooling.diagram.common.canonical.tests, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.copypaste.tests, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.drop.tests, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editpolicies.tests, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.inheritance.tests, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils.tests, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.locator.tests, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.service.tests, + org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/connectors.di b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/connectors.di new file mode 100644 index 000000000..1dce30bd2 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/connectors.di @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi"> + <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> + <windows> + <children xsi:type="di:TabFolder"> + <children> + <emfPageIdentifier href="papyrus.welcome:dynamic#/"/> + </children> + <children> + <emfPageIdentifier href="connectors.notation#_hiGAQNG_Eeak5ZdHZR9A7Q"/> + </children> + <children> + <emfPageIdentifier href="connectors.notation#_ihu4UNG_Eeak5ZdHZR9A7Q"/> + </children> + </children> + </windows> + </sashModel> +</di:SashWindowsMngr> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/connectors.notation b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/connectors.notation new file mode 100644 index 000000000..092a7eb53 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/connectors.notation @@ -0,0 +1,488 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <notation:Diagram xmi:id="_hiGAQNG_Eeak5ZdHZR9A7Q" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_hiIcgNG_Eeak5ZdHZR9A7Q" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_hiK4wNG_Eeak5ZdHZR9A7Q" type="Class_NameLabel"> + <element xmi:type="uml:Class" href="connectors.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_hiK4wdG_Eeak5ZdHZR9A7Q" type="Class_FloatingNameLabel"> + <element xmi:type="uml:Class" href="connectors.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_hiK4wtG_Eeak5ZdHZR9A7Q" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_hiK4w9G_Eeak5ZdHZR9A7Q" type="Class_StructureCompartment"> + <children xmi:type="notation:Shape" xmi:id="_2L82ANIIEeagWPsFxRCPvQ" type="Property_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_31ZgENIIEeagWPsFxRCPvQ" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_31ZgEdIIEeagWPsFxRCPvQ" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_2L82AtIIEeagWPsFxRCPvQ" type="Property_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_2L82A9IIEeagWPsFxRCPvQ" type="Property_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_2L82BNIIEeagWPsFxRCPvQ" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_2L82BdIIEeagWPsFxRCPvQ" type="Property_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_2L82BtIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2L82B9IIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_2MCVkNIIEeagWPsFxRCPvQ" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_2MCVkdIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2MCVktIIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_2MCVk9IIEeagWPsFxRCPvQ" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_2MCVlNIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_2MCVldIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2MCVltIIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_2MC8oNIIEeagWPsFxRCPvQ" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_2MC8odIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2MC8otIIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_2MDjsNIIEeagWPsFxRCPvQ" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_2MDjsdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_2MDjstIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2MDjs9IIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_3y_sUNIIEeagWPsFxRCPvQ" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_31ZgEtIIEeagWPsFxRCPvQ" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_31ZgE9IIEeagWPsFxRCPvQ" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_3y_sUtIIEeagWPsFxRCPvQ" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_3y_sU9IIEeagWPsFxRCPvQ" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_3y_sVNIIEeagWPsFxRCPvQ" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_3y_sVdIIEeagWPsFxRCPvQ" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_3B8C0NIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3y_sUdIIEeagWPsFxRCPvQ" x="-5" y="23" width="11" height="11"/> + </children> + <element xmi:type="uml:Property" href="connectors.uml#_1aWZ8NIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2L82AdIIEeagWPsFxRCPvQ" x="153" y="130"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_2MC8o9IIEeagWPsFxRCPvQ" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_2MC8pNIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_2MC8ptIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Property" href="connectors.uml#_1aWZ8NIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2MC8pdIIEeagWPsFxRCPvQ" x="200"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_3zD9yNIIEeagWPsFxRCPvQ" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_3zD9ydIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_3zD9y9IIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_3B8C0NIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3zD9ytIIEeagWPsFxRCPvQ" x="194" y="-6"/> + </children> + <styles xmi:type="notation:TitleStyle" xmi:id="_hiK4xNG_Eeak5ZdHZR9A7Q"/> + <element xmi:type="uml:Class" href="connectors.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hiK4xdG_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_cU3jQNIIEeagWPsFxRCPvQ" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cU3jQdIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cU3jQtIIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cU4xYNIIEeagWPsFxRCPvQ" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cU4xYdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cU4xYtIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cU4xY9IIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cU5_gNIIEeagWPsFxRCPvQ" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cU5_gdIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cU5_gtIIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cU_fENIIEeagWPsFxRCPvQ" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cU_fEdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cU_fEtIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cU_fE9IIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_fCltwNIIEeagWPsFxRCPvQ" type="Port_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_fCmU0NIIEeagWPsFxRCPvQ" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_fCmU0dIIEeagWPsFxRCPvQ" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_fCmU0tIIEeagWPsFxRCPvQ" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_fCmU09IIEeagWPsFxRCPvQ" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_eXoFMNIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fCltwdIIEeagWPsFxRCPvQ" x="-8" y="62" width="16" height="16"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_kms2kNIIEeagWPsFxRCPvQ" type="Port_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_kms2ktIIEeagWPsFxRCPvQ" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_kms2k9IIEeagWPsFxRCPvQ" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_kms2lNIIEeagWPsFxRCPvQ" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_kms2ldIIEeagWPsFxRCPvQ" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_f8bf0NIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kms2kdIIEeagWPsFxRCPvQ" x="117" y="77" width="16" height="16"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_5ZqvMNIIEeagWPsFxRCPvQ" type="Port_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_5ZqvMtIIEeagWPsFxRCPvQ" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_5ZqvM9IIEeagWPsFxRCPvQ" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_5ZqvNNIIEeagWPsFxRCPvQ" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_5ZqvNdIIEeagWPsFxRCPvQ" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_4ikvINIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_5ZqvMdIIEeagWPsFxRCPvQ" x="41" y="190" width="16" height="16"/> + </children> + <element xmi:type="uml:Class" href="connectors.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hiIcgdG_Eeak5ZdHZR9A7Q" x="40" y="40" width="500" height="250"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_cU8bwNIIEeagWPsFxRCPvQ" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cU8bwdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_cU9C0NIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="connectors.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cU8bwtIIEeagWPsFxRCPvQ" x="240" y="40"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_fCr0YNIIEeagWPsFxRCPvQ" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_fCr0YdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_fCr0Y9IIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_eXoFMNIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fCr0YtIIEeagWPsFxRCPvQ" x="192" y="62"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_kmyWINIIEeagWPsFxRCPvQ" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_kmyWIdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_kmyWI9IIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_f8bf0NIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kmyWItIIEeagWPsFxRCPvQ" x="317" y="77"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_mbLr89IIEeagWPsFxRCPvQ" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_mbLr9NIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_mbMTANIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Connector" href="connectors.uml#_maH8ANIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_mbLr9dIIEeagWPsFxRCPvQ" x="192" y="-38"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_5ZvAoNIIEeagWPsFxRCPvQ" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_5ZvAodIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_5ZvAo9IIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_4ikvINIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_5ZvAotIIEeagWPsFxRCPvQ" x="241" y="190"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_hiGAQdG_Eeak5ZdHZR9A7Q" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_hiGAQtG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_hiGAQ9G_Eeak5ZdHZR9A7Q"> + <owner xmi:type="uml:Class" href="connectors.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="connectors.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <edges xmi:type="notation:Connector" xmi:id="_cU9p4NIIEeagWPsFxRCPvQ" type="StereotypeCommentLink" source="_hiIcgNG_Eeak5ZdHZR9A7Q" target="_cU8bwNIIEeagWPsFxRCPvQ"> + <styles xmi:type="notation:FontStyle" xmi:id="_cU9p4dIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_cU-Q8NIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="connectors.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_cU9p4tIIEeagWPsFxRCPvQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_cU9p49IIEeagWPsFxRCPvQ"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_cU9p5NIIEeagWPsFxRCPvQ"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_fCr0ZNIIEeagWPsFxRCPvQ" type="StereotypeCommentLink" source="_fCltwNIIEeagWPsFxRCPvQ" target="_fCr0YNIIEeagWPsFxRCPvQ"> + <styles xmi:type="notation:FontStyle" xmi:id="_fCr0ZdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_fCr0adIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_eXoFMNIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_fCr0ZtIIEeagWPsFxRCPvQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_fCr0Z9IIEeagWPsFxRCPvQ"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_fCr0aNIIEeagWPsFxRCPvQ"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_kmyWJNIIEeagWPsFxRCPvQ" type="StereotypeCommentLink" source="_kms2kNIIEeagWPsFxRCPvQ" target="_kmyWINIIEeagWPsFxRCPvQ"> + <styles xmi:type="notation:FontStyle" xmi:id="_kmyWJdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_kmyWKdIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_f8bf0NIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_kmyWJtIIEeagWPsFxRCPvQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_kmyWJ9IIEeagWPsFxRCPvQ"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_kmyWKNIIEeagWPsFxRCPvQ"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_malPANIIEeagWPsFxRCPvQ" type="Connector_Edge" source="_fCltwNIIEeagWPsFxRCPvQ" target="_kms2kNIIEeagWPsFxRCPvQ"> + <children xmi:type="notation:DecorationNode" xmi:id="_mal2ENIIEeagWPsFxRCPvQ" type="Connector_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_mamdINIIEeagWPsFxRCPvQ" y="60"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_mamdIdIIEeagWPsFxRCPvQ" type="Connector_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_mamdItIIEeagWPsFxRCPvQ" y="-20"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_malPAdIIEeagWPsFxRCPvQ"/> + <element xmi:type="uml:Connector" href="connectors.uml#_maH8ANIIEeagWPsFxRCPvQ"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_malPAtIIEeagWPsFxRCPvQ" points="[48, 111, -643984, -643984]$[165, 133, -643984, -643984]"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_mbMTAdIIEeagWPsFxRCPvQ" type="StereotypeCommentLink" source="_malPANIIEeagWPsFxRCPvQ" target="_mbLr89IIEeagWPsFxRCPvQ"> + <styles xmi:type="notation:FontStyle" xmi:id="_mbMTAtIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_mbMTBtIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Connector" href="connectors.uml#_maH8ANIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_mbMTA9IIEeagWPsFxRCPvQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_mbMTBNIIEeagWPsFxRCPvQ"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_mbMTBdIIEeagWPsFxRCPvQ"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_2MC8p9IIEeagWPsFxRCPvQ" type="StereotypeCommentLink" source="_2L82ANIIEeagWPsFxRCPvQ" target="_2MC8o9IIEeagWPsFxRCPvQ"> + <styles xmi:type="notation:FontStyle" xmi:id="_2MC8qNIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_2MC8rNIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Property" href="connectors.uml#_1aWZ8NIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_2MC8qdIIEeagWPsFxRCPvQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_2MC8qtIIEeagWPsFxRCPvQ"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_2MC8q9IIEeagWPsFxRCPvQ"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_3zD9zNIIEeagWPsFxRCPvQ" type="StereotypeCommentLink" source="_3y_sUNIIEeagWPsFxRCPvQ" target="_3zD9yNIIEeagWPsFxRCPvQ"> + <styles xmi:type="notation:FontStyle" xmi:id="_3zD9zdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_3zD90dIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_3B8C0NIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_3zD9ztIIEeagWPsFxRCPvQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3zD9z9IIEeagWPsFxRCPvQ"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3zD90NIIEeagWPsFxRCPvQ"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_5ZvApNIIEeagWPsFxRCPvQ" type="StereotypeCommentLink" source="_5ZqvMNIIEeagWPsFxRCPvQ" target="_5ZvAoNIIEeagWPsFxRCPvQ"> + <styles xmi:type="notation:FontStyle" xmi:id="_5ZvApdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_5ZvAqdIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_4ikvINIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_5ZvAptIIEeagWPsFxRCPvQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5ZvAp9IIEeagWPsFxRCPvQ"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5ZvAqNIIEeagWPsFxRCPvQ"/> + </edges> + </notation:Diagram> + <notation:Diagram xmi:id="_ihu4UNG_Eeak5ZdHZR9A7Q" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_ihu4VNG_Eeak5ZdHZR9A7Q" type="Class_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fFLHsNIIEeagWPsFxRCPvQ" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_fFLHsdIIEeagWPsFxRCPvQ" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_ihu4VtG_Eeak5ZdHZR9A7Q" type="Class_NameLabel"> + <element xmi:type="uml:Class" href="connectors.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_ihu4V9G_Eeak5ZdHZR9A7Q" type="Class_FloatingNameLabel"> + <element xmi:type="uml:Class" href="connectors.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_ihvfYNG_Eeak5ZdHZR9A7Q" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_ihvfYdG_Eeak5ZdHZR9A7Q" type="Class_StructureCompartment"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_qmWr4NIIEeagWPsFxRCPvQ" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_qmWr4dIIEeagWPsFxRCPvQ" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:Shape" xmi:id="_2LsXUNIIEeagWPsFxRCPvQ" type="Property_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_2OHZMNIIEeagWPsFxRCPvQ" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_2OHZMdIIEeagWPsFxRCPvQ" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_2LsXUtIIEeagWPsFxRCPvQ" type="Property_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_2LsXU9IIEeagWPsFxRCPvQ" type="Property_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_2LsXVNIIEeagWPsFxRCPvQ" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_2LsXVdIIEeagWPsFxRCPvQ" type="Property_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_2LsXVtIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2LsXV9IIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_2LwowNIIEeagWPsFxRCPvQ" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_2LwowdIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2LwowtIIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_2LxP0NIIEeagWPsFxRCPvQ" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_2LxP0dIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_2LxP0tIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2LxP09IIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_2LxP1NIIEeagWPsFxRCPvQ" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_2LxP1dIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2LxP1tIIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_2Lx24NIIEeagWPsFxRCPvQ" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_2Lx24dIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_2Lx24tIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2Lx249IIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_3y-eMNIIEeagWPsFxRCPvQ" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_31e_oNIIEeagWPsFxRCPvQ" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_31e_odIIEeagWPsFxRCPvQ" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_3y-eMtIIEeagWPsFxRCPvQ" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_3y-eM9IIEeagWPsFxRCPvQ" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_3y-eNNIIEeagWPsFxRCPvQ" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_3y-eNdIIEeagWPsFxRCPvQ" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_3B8C0NIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3y-eMdIIEeagWPsFxRCPvQ" x="-5" y="23" width="11" height="11"/> + </children> + <element xmi:type="uml:Property" href="connectors.uml#_1aWZ8NIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_2LsXUdIIEeagWPsFxRCPvQ" x="153" y="130"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_3zLSgNIIEeagWPsFxRCPvQ" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_3zLSgdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_3zLSg9IIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_3B8C0NIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3zLSgtIIEeagWPsFxRCPvQ" x="194" y="-6"/> + </children> + <styles xmi:type="notation:TitleStyle" xmi:id="_ihvfYtG_Eeak5ZdHZR9A7Q"/> + <element xmi:type="uml:Class" href="connectors.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ihvfY9G_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_dAmn4NIIEeagWPsFxRCPvQ" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_dAmn4dIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dAmn4tIIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_dAn2ANIIEeagWPsFxRCPvQ" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_dAn2AdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_dAn2AtIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dAn2A9IIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_dAodENIIEeagWPsFxRCPvQ" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_dAodEdIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dAodEtIIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_dAprNNIIEeagWPsFxRCPvQ" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_dAprNdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_dAprNtIIEeagWPsFxRCPvQ" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dAprN9IIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_fCOhYNIIEeagWPsFxRCPvQ" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fFLHstIIEeagWPsFxRCPvQ" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_fFLHs9IIEeagWPsFxRCPvQ" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_fCPIcNIIEeagWPsFxRCPvQ" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_fCPIcdIIEeagWPsFxRCPvQ" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_fCPIctIIEeagWPsFxRCPvQ" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_fCPIc9IIEeagWPsFxRCPvQ" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_eXoFMNIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fCOhYdIIEeagWPsFxRCPvQ" x="-8" y="62" width="16" height="16"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_kmbw0NIIEeagWPsFxRCPvQ" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_kpC_8NIIEeagWPsFxRCPvQ" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_kpC_8dIIEeagWPsFxRCPvQ" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_kmbw0tIIEeagWPsFxRCPvQ" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_kmbw09IIEeagWPsFxRCPvQ" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_kmbw1NIIEeagWPsFxRCPvQ" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_kmbw1dIIEeagWPsFxRCPvQ" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_f8bf0NIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kmbw0dIIEeagWPsFxRCPvQ" x="117" y="77" width="16" height="16"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_5ZdT0NIIEeagWPsFxRCPvQ" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_5b8AENIIEeagWPsFxRCPvQ" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_5b8AEdIIEeagWPsFxRCPvQ" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_5ZdT0tIIEeagWPsFxRCPvQ" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_5ZdT09IIEeagWPsFxRCPvQ" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_5ZdT1NIIEeagWPsFxRCPvQ" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_5ZdT1dIIEeagWPsFxRCPvQ" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_4ikvINIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_5ZdT0dIIEeagWPsFxRCPvQ" x="41" y="190" width="16" height="16"/> + </children> + <element xmi:type="uml:Class" href="connectors.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ihu4VdG_Eeak5ZdHZR9A7Q" x="40" y="40" width="500" height="250"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_dApEINIIEeagWPsFxRCPvQ" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_dApEIdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_dApEI9IIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="connectors.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dApEItIIEeagWPsFxRCPvQ" x="240" y="40"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_ihu4UdG_Eeak5ZdHZR9A7Q" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_ihu4UtG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_ihu4U9G_Eeak5ZdHZR9A7Q"> + <owner xmi:type="uml:Class" href="connectors.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="connectors.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <edges xmi:type="notation:Connector" xmi:id="_dApEJNIIEeagWPsFxRCPvQ" type="StereotypeCommentLink" source="_ihu4VNG_Eeak5ZdHZR9A7Q" target="_dApEINIIEeagWPsFxRCPvQ"> + <styles xmi:type="notation:FontStyle" xmi:id="_dApEJdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_dApEKdIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="connectors.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_dApEJtIIEeagWPsFxRCPvQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_dApEJ9IIEeagWPsFxRCPvQ"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_dApEKNIIEeagWPsFxRCPvQ"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_mbvsoNIIEeagWPsFxRCPvQ" type="Connector_Edge" source="_fCOhYNIIEeagWPsFxRCPvQ" target="_kmbw0NIIEeagWPsFxRCPvQ"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_meISQNIIEeagWPsFxRCPvQ" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_meISQdIIEeagWPsFxRCPvQ" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_mbvso9IIEeagWPsFxRCPvQ" type="Connector_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_mbvspNIIEeagWPsFxRCPvQ" y="60"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_mbvspdIIEeagWPsFxRCPvQ" type="Connector_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_mbvsptIIEeagWPsFxRCPvQ" y="-20"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_mbvsodIIEeagWPsFxRCPvQ"/> + <element xmi:type="uml:Connector" href="connectors.uml#_maH8ANIIEeagWPsFxRCPvQ"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_mbvsotIIEeagWPsFxRCPvQ" points="[48, 111, -643984, -643984]$[165, 133, -643984, -643984]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_mbwTsNIIEeagWPsFxRCPvQ" id="(0.0,0.0)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_mbwTsdIIEeagWPsFxRCPvQ" id="(0.0,0.0)"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_3zLShNIIEeagWPsFxRCPvQ" type="StereotypeCommentLink" source="_3y-eMNIIEeagWPsFxRCPvQ" target="_3zLSgNIIEeagWPsFxRCPvQ"> + <styles xmi:type="notation:FontStyle" xmi:id="_3zLShdIIEeagWPsFxRCPvQ"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_3zLSidIIEeagWPsFxRCPvQ" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_3B8C0NIIEeagWPsFxRCPvQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_3zLShtIIEeagWPsFxRCPvQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3zLSh9IIEeagWPsFxRCPvQ"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3zLSiNIIEeagWPsFxRCPvQ"/> + </edges> + </notation:Diagram> + <notation:Diagram xmi:id="_12nfMNIIEeagWPsFxRCPvQ" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_12otUNIIEeagWPsFxRCPvQ" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_12otUtIIEeagWPsFxRCPvQ" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_12otU9IIEeagWPsFxRCPvQ" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_12otVNIIEeagWPsFxRCPvQ" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_12otVdIIEeagWPsFxRCPvQ" type="Class_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_12otVtIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_12otV9IIEeagWPsFxRCPvQ"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_3y6z0NIIEeagWPsFxRCPvQ" type="Port_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_3y6z0tIIEeagWPsFxRCPvQ" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_3y6z09IIEeagWPsFxRCPvQ" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_3y6z1NIIEeagWPsFxRCPvQ" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_3y6z1dIIEeagWPsFxRCPvQ" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_3B8C0NIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3y6z0dIIEeagWPsFxRCPvQ" y="140" width="16" height="16"/> + </children> + <element xmi:type="uml:Class" href="connectors.uml#_116UkNIIEeagWPsFxRCPvQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_12otUdIIEeagWPsFxRCPvQ" x="40" y="40" width="500" height="250"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_12nfMdIIEeagWPsFxRCPvQ" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_12nfMtIIEeagWPsFxRCPvQ"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_12nfM9IIEeagWPsFxRCPvQ"> + <owner xmi:type="uml:Class" href="connectors.uml#_116UkNIIEeagWPsFxRCPvQ"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="connectors.uml#_116UkNIIEeagWPsFxRCPvQ"/> + </notation:Diagram> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/connectors.uml b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/connectors.uml new file mode 100644 index 000000000..2bb6f7350 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/connectors.uml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:UMLRealTime="http://www.eclipse.org/papyrus/umlrt" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <uml:Model xmi:id="_dlF_MNG_Eeak5ZdHZR9A7Q" name="ports"> + <packagedElement xmi:type="uml:Class" xmi:id="_hfVnMNG_Eeak5ZdHZR9A7Q" name="Capsule1" isActive="true"> + <ownedAttribute xmi:type="uml:Port" xmi:id="_eXoFMNIIEeagWPsFxRCPvQ" name="protocol1" visibility="public" type="_ewQnoNIIEeagWPsFxRCPvQ" isOrdered="true" aggregation="composite" isBehavior="false" isService="true"/> + <ownedAttribute xmi:type="uml:Port" xmi:id="_f8bf0NIIEeagWPsFxRCPvQ" name="protocol12" visibility="protected" type="_ewQnoNIIEeagWPsFxRCPvQ" isOrdered="true" aggregation="composite" isBehavior="true" isService="false"/> + <ownedAttribute xmi:type="uml:Property" xmi:id="_1aWZ8NIIEeagWPsFxRCPvQ" name="capsule3" visibility="protected" type="_116UkNIIEeagWPsFxRCPvQ" isOrdered="true" aggregation="composite"/> + <ownedAttribute xmi:type="uml:Port" xmi:id="_4ikvINIIEeagWPsFxRCPvQ" name="protocol2" visibility="protected" type="_3auWQNIIEeagWPsFxRCPvQ" isOrdered="true" aggregation="composite" isBehavior="true" isService="false"/> + <ownedConnector xmi:type="uml:Connector" xmi:id="_maH8ANIIEeagWPsFxRCPvQ" name="RTConnector1"> + <end xmi:type="uml:ConnectorEnd" xmi:id="_maOCoNIIEeagWPsFxRCPvQ" role="_eXoFMNIIEeagWPsFxRCPvQ"/> + <end xmi:type="uml:ConnectorEnd" xmi:id="_maOCodIIEeagWPsFxRCPvQ" role="_f8bf0NIIEeagWPsFxRCPvQ"/> + </ownedConnector> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_ihirENG_Eeak5ZdHZR9A7Q" name="Capsule2" isActive="true"> + <generalization xmi:type="uml:Generalization" xmi:id="_kSDmcNG_Eeak5ZdHZR9A7Q" general="_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_ewX8YNIIEeagWPsFxRCPvQ" name="Protocol1"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_ewQnoNIIEeagWPsFxRCPvQ" name="Protocol1"> + <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_ewc04NIIEeagWPsFxRCPvQ" client="_ewQnoNIIEeagWPsFxRCPvQ" supplier="_ewa_sNIIEeagWPsFxRCPvQ" contract="_ewa_sNIIEeagWPsFxRCPvQ"/> + <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_ewi7gNIIEeagWPsFxRCPvQ" client="_ewQnoNIIEeagWPsFxRCPvQ" supplier="_ewhGUNIIEeagWPsFxRCPvQ" contract="_ewhGUNIIEeagWPsFxRCPvQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_ewa_sNIIEeagWPsFxRCPvQ" name="Protocol1"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_eweDANIIEeagWPsFxRCPvQ" name="Protocol1~"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_ewf4MNIIEeagWPsFxRCPvQ" client="_ewQnoNIIEeagWPsFxRCPvQ" supplier="_eweDANIIEeagWPsFxRCPvQ"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_ewgfQNIIEeagWPsFxRCPvQ" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_ewhGUNIIEeagWPsFxRCPvQ" name="Protocol1IO"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_ewjikNIIEeagWPsFxRCPvQ" client="_ewQnoNIIEeagWPsFxRCPvQ" supplier="_ewhGUNIIEeagWPsFxRCPvQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_116UkNIIEeagWPsFxRCPvQ" name="Capsule3" isActive="true"> + <ownedAttribute xmi:type="uml:Port" xmi:id="_3B8C0NIIEeagWPsFxRCPvQ" name="protocol2" visibility="public" type="_3auWQNIIEeagWPsFxRCPvQ" isOrdered="true" aggregation="composite" isBehavior="true" isConjugated="true" isService="true"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_3avkYNIIEeagWPsFxRCPvQ" name="Protocol2"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_3auWQNIIEeagWPsFxRCPvQ" name="Protocol2"> + <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_3aynsNIIEeagWPsFxRCPvQ" client="_3auWQNIIEeagWPsFxRCPvQ" supplier="_3awygNIIEeagWPsFxRCPvQ" contract="_3awygNIIEeagWPsFxRCPvQ"/> + <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_3a1rANIIEeagWPsFxRCPvQ" client="_3auWQNIIEeagWPsFxRCPvQ" supplier="_3a0c4tIIEeagWPsFxRCPvQ" contract="_3a0c4tIIEeagWPsFxRCPvQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_3awygNIIEeagWPsFxRCPvQ" name="Protocol2"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_3azOwNIIEeagWPsFxRCPvQ" name="Protocol2~"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_3a0c4NIIEeagWPsFxRCPvQ" client="_3auWQNIIEeagWPsFxRCPvQ" supplier="_3azOwNIIEeagWPsFxRCPvQ"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_3a0c4dIIEeagWPsFxRCPvQ" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_3a0c4tIIEeagWPsFxRCPvQ" name="Protocol2IO"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_3a2SENIIEeagWPsFxRCPvQ" client="_3auWQNIIEeagWPsFxRCPvQ" supplier="_3a0c4tIIEeagWPsFxRCPvQ"/> + </packagedElement> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_dlhdANG_Eeak5ZdHZR9A7Q"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_dljSMNG_Eeak5ZdHZR9A7Q" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt#/"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/> + </profileApplication> + </uml:Model> + <UMLRealTime:Capsule xmi:id="_hiN8ENG_Eeak5ZdHZR9A7Q" base_Class="_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <UMLRealTime:Capsule xmi:id="_ihwGcNG_Eeak5ZdHZR9A7Q" base_Class="_ihirENG_Eeak5ZdHZR9A7Q"/> + <UMLRealTime:RTPort xmi:id="_eZ-1oNIIEeagWPsFxRCPvQ" isPublish="false" isWired="true" base_Port="_eXoFMNIIEeagWPsFxRCPvQ"/> + <UMLRealTime:ProtocolContainer xmi:id="_ewZKgNIIEeagWPsFxRCPvQ" base_Package="_ewX8YNIIEeagWPsFxRCPvQ"/> + <UMLRealTime:RTMessageSet xmi:id="_ewcN0NIIEeagWPsFxRCPvQ" base_Interface="_ewa_sNIIEeagWPsFxRCPvQ"/> + <UMLRealTime:RTMessageSet xmi:id="_ewfRINIIEeagWPsFxRCPvQ" base_Interface="_eweDANIIEeagWPsFxRCPvQ" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_ewiUcNIIEeagWPsFxRCPvQ" base_Interface="_ewhGUNIIEeagWPsFxRCPvQ" rtMsgKind="inOut"/> + <UMLRealTime:Protocol xmi:id="_ewkJoNIIEeagWPsFxRCPvQ" base_Collaboration="_ewQnoNIIEeagWPsFxRCPvQ"/> + <UMLRealTime:RTPort xmi:id="_f8iNgNIIEeagWPsFxRCPvQ" isPublish="false" isWired="true" base_Port="_f8bf0NIIEeagWPsFxRCPvQ"/> + <UMLRealTime:RTConnector xmi:id="_maOpsNIIEeagWPsFxRCPvQ" base_Connector="_maH8ANIIEeagWPsFxRCPvQ"/> + <UMLRealTime:CapsulePart xmi:id="_1aY2MNIIEeagWPsFxRCPvQ" base_Property="_1aWZ8NIIEeagWPsFxRCPvQ"/> + <UMLRealTime:Capsule xmi:id="_12rJkNIIEeagWPsFxRCPvQ" base_Class="_116UkNIIEeagWPsFxRCPvQ"/> + <UMLRealTime:RTPort xmi:id="_3B_GINIIEeagWPsFxRCPvQ" isPublish="false" isWired="true" base_Port="_3B8C0NIIEeagWPsFxRCPvQ"/> + <UMLRealTime:ProtocolContainer xmi:id="_3awLcNIIEeagWPsFxRCPvQ" base_Package="_3avkYNIIEeagWPsFxRCPvQ"/> + <UMLRealTime:RTMessageSet xmi:id="_3axZkNIIEeagWPsFxRCPvQ" base_Interface="_3awygNIIEeagWPsFxRCPvQ"/> + <UMLRealTime:RTMessageSet xmi:id="_3az10NIIEeagWPsFxRCPvQ" base_Interface="_3azOwNIIEeagWPsFxRCPvQ" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_3a1D8NIIEeagWPsFxRCPvQ" base_Interface="_3a0c4tIIEeagWPsFxRCPvQ" rtMsgKind="inOut"/> + <UMLRealTime:Protocol xmi:id="_3a25INIIEeagWPsFxRCPvQ" base_Collaboration="_3auWQNIIEeagWPsFxRCPvQ"/> + <UMLRealTime:RTPort xmi:id="_4inLYNIIEeagWPsFxRCPvQ" isPublish="false" isWired="true" base_Port="_4ikvINIIEeagWPsFxRCPvQ"/> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/parts.di b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/parts.di new file mode 100644 index 000000000..21fbfb8cc --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/parts.di @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi"> + <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> + <windows> + <children xsi:type="di:TabFolder"> + <children> + <emfPageIdentifier href="papyrus.welcome:dynamic#/"/> + </children> + <children> + <emfPageIdentifier href="parts.notation#_hiGAQNG_Eeak5ZdHZR9A7Q"/> + </children> + <children> + <emfPageIdentifier href="parts.notation#_ihu4UNG_Eeak5ZdHZR9A7Q"/> + </children> + </children> + </windows> + </sashModel> +</di:SashWindowsMngr> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/parts.notation b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/parts.notation new file mode 100644 index 000000000..1e03d063e --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/parts.notation @@ -0,0 +1,275 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <notation:Diagram xmi:id="_hiGAQNG_Eeak5ZdHZR9A7Q" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_hiIcgNG_Eeak5ZdHZR9A7Q" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_hiK4wNG_Eeak5ZdHZR9A7Q" type="Class_NameLabel"> + <element xmi:type="uml:Class" href="parts.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_hiK4wdG_Eeak5ZdHZR9A7Q" type="Class_FloatingNameLabel"> + <element xmi:type="uml:Class" href="parts.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_hiK4wtG_Eeak5ZdHZR9A7Q" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_hiK4w9G_Eeak5ZdHZR9A7Q" type="Class_StructureCompartment"> + <children xmi:type="notation:Shape" xmi:id="_siGB0NHyEeak5ZdHZR9A7Q" type="Property_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_vRFXoNHyEeak5ZdHZR9A7Q" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_vRFXodHyEeak5ZdHZR9A7Q" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_siGo4NHyEeak5ZdHZR9A7Q" type="Property_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_siGo4dHyEeak5ZdHZR9A7Q" type="Property_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_siGo4tHyEeak5ZdHZR9A7Q" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_siGo49HyEeak5ZdHZR9A7Q" type="Property_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_siGo5NHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_siGo5dHyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_siLhYNHyEeak5ZdHZR9A7Q" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_siLhYdHyEeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_siLhYtHyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_siMIcNHyEeak5ZdHZR9A7Q" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_siMIcdHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_siMIctHyEeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_siMIc9HyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_siMIdNHyEeak5ZdHZR9A7Q" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_siMIddHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_siMIdtHyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_siMvitHyEeak5ZdHZR9A7Q" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_siMvi9HyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_siMvjNHyEeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_siMvjdHyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_vOogkNHyEeak5ZdHZR9A7Q" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_vRFXotHyEeak5ZdHZR9A7Q" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_vRFXo9HyEeak5ZdHZR9A7Q" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_vOpHoNHyEeak5ZdHZR9A7Q" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_vOpHodHyEeak5ZdHZR9A7Q" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_vOpHotHyEeak5ZdHZR9A7Q" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_vOpHo9HyEeak5ZdHZR9A7Q" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="parts.uml#_t3w0QNHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_vOogkdHyEeak5ZdHZR9A7Q" x="110" y="55" width="11" height="11"/> + </children> + <element xmi:type="uml:Property" href="parts.uml#_rvjxoNHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_siGB0dHyEeak5ZdHZR9A7Q" x="51" y="66" height="104"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_siMId9HyEeak5ZdHZR9A7Q" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_siMIeNHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_siMIetHyEeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Property" href="parts.uml#_rvjxoNHyEeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_siMIedHyEeak5ZdHZR9A7Q" x="200"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_vOuAKNHyEeak5ZdHZR9A7Q" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_vOuAKdHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_vOuAK9HyEeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="parts.uml#_t3w0QNHyEeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_vOuAKtHyEeak5ZdHZR9A7Q" x="194" y="-6"/> + </children> + <styles xmi:type="notation:TitleStyle" xmi:id="_hiK4xNG_Eeak5ZdHZR9A7Q"/> + <element xmi:type="uml:Class" href="parts.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hiK4xdG_Eeak5ZdHZR9A7Q"/> + </children> + <element xmi:type="uml:Class" href="parts.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hiIcgdG_Eeak5ZdHZR9A7Q" x="40" y="40" width="500" height="250"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_oO0OwNHyEeak5ZdHZR9A7Q" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_oO0OwdHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_oO0Ow9HyEeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="parts.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_oO0OwtHyEeak5ZdHZR9A7Q" x="240" y="40"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_hiGAQdG_Eeak5ZdHZR9A7Q" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_hiGAQtG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_hiGAQ9G_Eeak5ZdHZR9A7Q"> + <owner xmi:type="uml:Class" href="parts.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="parts.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <edges xmi:type="notation:Connector" xmi:id="_oO0OxNHyEeak5ZdHZR9A7Q" type="StereotypeCommentLink" source="_hiIcgNG_Eeak5ZdHZR9A7Q" target="_oO0OwNHyEeak5ZdHZR9A7Q"> + <styles xmi:type="notation:FontStyle" xmi:id="_oO0OxdHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_oO0OydHyEeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="parts.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_oO0OxtHyEeak5ZdHZR9A7Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_oO0Ox9HyEeak5ZdHZR9A7Q"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_oO0OyNHyEeak5ZdHZR9A7Q"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_siMvgNHyEeak5ZdHZR9A7Q" type="StereotypeCommentLink" source="_siGB0NHyEeak5ZdHZR9A7Q" target="_siMId9HyEeak5ZdHZR9A7Q"> + <styles xmi:type="notation:FontStyle" xmi:id="_siMvgdHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_siMvhdHyEeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Property" href="parts.uml#_rvjxoNHyEeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_siMvgtHyEeak5ZdHZR9A7Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_siMvg9HyEeak5ZdHZR9A7Q"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_siMvhNHyEeak5ZdHZR9A7Q"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_vOuALNHyEeak5ZdHZR9A7Q" type="StereotypeCommentLink" source="_vOogkNHyEeak5ZdHZR9A7Q" target="_vOuAKNHyEeak5ZdHZR9A7Q"> + <styles xmi:type="notation:FontStyle" xmi:id="_vOuALdHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_vOuAMdHyEeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="parts.uml#_t3w0QNHyEeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_vOuALtHyEeak5ZdHZR9A7Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_vOuAL9HyEeak5ZdHZR9A7Q"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_vOuAMNHyEeak5ZdHZR9A7Q"/> + </edges> + </notation:Diagram> + <notation:Diagram xmi:id="_ihu4UNG_Eeak5ZdHZR9A7Q" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_ihu4VNG_Eeak5ZdHZR9A7Q" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_ihu4VtG_Eeak5ZdHZR9A7Q" type="Class_NameLabel"> + <element xmi:type="uml:Class" href="parts.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_ihu4V9G_Eeak5ZdHZR9A7Q" type="Class_FloatingNameLabel"> + <element xmi:type="uml:Class" href="parts.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_ihvfYNG_Eeak5ZdHZR9A7Q" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_ihvfYdG_Eeak5ZdHZR9A7Q" type="Class_StructureCompartment"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_skl8MNHyEeak5ZdHZR9A7Q" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_skl8MdHyEeak5ZdHZR9A7Q" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:Shape" xmi:id="_shyf0NHyEeak5ZdHZR9A7Q" type="Property_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_skl8MtHyEeak5ZdHZR9A7Q" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_skmjQNHyEeak5ZdHZR9A7Q" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_shzG4NHyEeak5ZdHZR9A7Q" type="Property_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_shzG4dHyEeak5ZdHZR9A7Q" type="Property_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_shzG4tHyEeak5ZdHZR9A7Q" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_shzG49HyEeak5ZdHZR9A7Q" type="Property_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_shzG5NHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_shzG5dHyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_sh50kNHyEeak5ZdHZR9A7Q" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_sh50kdHyEeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_sh50ktHyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_sh50k9HyEeak5ZdHZR9A7Q" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_sh50lNHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_sh50ldHyEeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_sh50ltHyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_sh50l9HyEeak5ZdHZR9A7Q" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_sh50mNHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_sh50mdHyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_sh6boNHyEeak5ZdHZR9A7Q" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_sh6bodHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_sh6botHyEeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_sh6bo9HyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_vOn5gNHyEeak5ZdHZR9A7Q" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_vRKQINHyEeak5ZdHZR9A7Q" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_vRKQIdHyEeak5ZdHZR9A7Q" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_vOn5gtHyEeak5ZdHZR9A7Q" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_vOn5g9HyEeak5ZdHZR9A7Q" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_vOn5hNHyEeak5ZdHZR9A7Q" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_vOn5hdHyEeak5ZdHZR9A7Q" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="parts.uml#_t3w0QNHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_vOn5gdHyEeak5ZdHZR9A7Q" x="110" y="55" width="11" height="11"/> + </children> + <element xmi:type="uml:Property" href="parts.uml#_rvjxoNHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_shyf0dHyEeak5ZdHZR9A7Q" x="51" y="66" height="104"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_vO0t2tHyEeak5ZdHZR9A7Q" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_vO0t29HyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_vO0t3dHyEeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="parts.uml#_t3w0QNHyEeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_vO0t3NHyEeak5ZdHZR9A7Q" x="194" y="-6"/> + </children> + <styles xmi:type="notation:TitleStyle" xmi:id="_ihvfYtG_Eeak5ZdHZR9A7Q"/> + <element xmi:type="uml:Class" href="parts.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ihvfY9G_Eeak5ZdHZR9A7Q"/> + </children> + <element xmi:type="uml:Class" href="parts.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ihu4VdG_Eeak5ZdHZR9A7Q" x="40" y="40" width="500" height="250"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_p4KLINHyEeak5ZdHZR9A7Q" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_p4KLIdHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_p4KLI9HyEeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="parts.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_p4KLItHyEeak5ZdHZR9A7Q" x="240" y="40"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_ihu4UdG_Eeak5ZdHZR9A7Q" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_ihu4UtG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_ihu4U9G_Eeak5ZdHZR9A7Q"> + <owner xmi:type="uml:Class" href="parts.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="parts.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <edges xmi:type="notation:Connector" xmi:id="_p4KLJNHyEeak5ZdHZR9A7Q" type="StereotypeCommentLink" source="_ihu4VNG_Eeak5ZdHZR9A7Q" target="_p4KLINHyEeak5ZdHZR9A7Q"> + <styles xmi:type="notation:FontStyle" xmi:id="_p4KLJdHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_p4KLKdHyEeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="parts.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_p4KLJtHyEeak5ZdHZR9A7Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_p4KLJ9HyEeak5ZdHZR9A7Q"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_p4KLKNHyEeak5ZdHZR9A7Q"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_vO0t3tHyEeak5ZdHZR9A7Q" type="StereotypeCommentLink" source="_vOn5gNHyEeak5ZdHZR9A7Q" target="_vO0t2tHyEeak5ZdHZR9A7Q"> + <styles xmi:type="notation:FontStyle" xmi:id="_vO0t39HyEeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_vO0t49HyEeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="parts.uml#_t3w0QNHyEeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_vO0t4NHyEeak5ZdHZR9A7Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_vO0t4dHyEeak5ZdHZR9A7Q"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_vO0t4tHyEeak5ZdHZR9A7Q"/> + </edges> + </notation:Diagram> + <notation:Diagram xmi:id="_sPX6INHyEeak5ZdHZR9A7Q" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_sPYhMNHyEeak5ZdHZR9A7Q" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_sPYhMtHyEeak5ZdHZR9A7Q" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_sPYhM9HyEeak5ZdHZR9A7Q" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_sPYhNNHyEeak5ZdHZR9A7Q" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_sPYhNdHyEeak5ZdHZR9A7Q" type="Class_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_sPYhNtHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_sPYhN9HyEeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_vOjoENHyEeak5ZdHZR9A7Q" type="Port_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_vOkPINHyEeak5ZdHZR9A7Q" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_vOkPIdHyEeak5ZdHZR9A7Q" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_vOkPItHyEeak5ZdHZR9A7Q" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_vOkPI9HyEeak5ZdHZR9A7Q" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="parts.uml#_t3w0QNHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_vOjoEdHyEeak5ZdHZR9A7Q" x="385" width="16" height="16"/> + </children> + <element xmi:type="uml:Class" href="parts.uml#_sPMT8NHyEeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_sPYhMdHyEeak5ZdHZR9A7Q" x="40" y="40" width="500" height="250"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_sPX6IdHyEeak5ZdHZR9A7Q" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_sPX6ItHyEeak5ZdHZR9A7Q"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_sPX6I9HyEeak5ZdHZR9A7Q"> + <owner xmi:type="uml:Class" href="parts.uml#_sPMT8NHyEeak5ZdHZR9A7Q"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="parts.uml#_sPMT8NHyEeak5ZdHZR9A7Q"/> + </notation:Diagram> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/parts.uml b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/parts.uml new file mode 100644 index 000000000..750a91078 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/parts.uml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:UMLRealTime="http://www.eclipse.org/papyrus/umlrt" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <uml:Model xmi:id="_dlF_MNG_Eeak5ZdHZR9A7Q" name="parts"> + <packagedElement xmi:type="uml:Class" xmi:id="_hfVnMNG_Eeak5ZdHZR9A7Q" name="Capsule1" isActive="true"> + <ownedAttribute xmi:type="uml:Property" xmi:id="_rvjxoNHyEeak5ZdHZR9A7Q" name="capsule3" visibility="protected" type="_sPMT8NHyEeak5ZdHZR9A7Q" isOrdered="true" aggregation="composite"/> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_ihirENG_Eeak5ZdHZR9A7Q" name="Capsule2" isActive="true"> + <generalization xmi:type="uml:Generalization" xmi:id="_kSDmcNG_Eeak5ZdHZR9A7Q" general="_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_sPMT8NHyEeak5ZdHZR9A7Q" name="Capsule3" isActive="true"> + <ownedAttribute xmi:type="uml:Port" xmi:id="_t3w0QNHyEeak5ZdHZR9A7Q" name="protocol1" visibility="public" type="_uUSYMNHyEeak5ZdHZR9A7Q" isOrdered="true" aggregation="composite" isBehavior="true" isService="true"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_uUTmUNHyEeak5ZdHZR9A7Q" name="Protocol1"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_uUSYMNHyEeak5ZdHZR9A7Q" name="Protocol1"> + <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_uUWpoNHyEeak5ZdHZR9A7Q" client="_uUSYMNHyEeak5ZdHZR9A7Q" supplier="_uUVbgNHyEeak5ZdHZR9A7Q" contract="_uUVbgNHyEeak5ZdHZR9A7Q"/> + <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_uUaUANHyEeak5ZdHZR9A7Q" client="_uUSYMNHyEeak5ZdHZR9A7Q" supplier="_uUZF4dHyEeak5ZdHZR9A7Q" contract="_uUZF4dHyEeak5ZdHZR9A7Q"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_uUVbgNHyEeak5ZdHZR9A7Q" name="Protocol1"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_uUXQsNHyEeak5ZdHZR9A7Q" name="Protocol1~"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_uUYe0NHyEeak5ZdHZR9A7Q" client="_uUSYMNHyEeak5ZdHZR9A7Q" supplier="_uUXQsNHyEeak5ZdHZR9A7Q"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_uUZF4NHyEeak5ZdHZR9A7Q" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_uUZF4dHyEeak5ZdHZR9A7Q" name="Protocol1IO"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_uUa7ENHyEeak5ZdHZR9A7Q" client="_uUSYMNHyEeak5ZdHZR9A7Q" supplier="_uUZF4dHyEeak5ZdHZR9A7Q"/> + </packagedElement> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_dlhdANG_Eeak5ZdHZR9A7Q"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_dljSMNG_Eeak5ZdHZR9A7Q" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt#/"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/> + </profileApplication> + </uml:Model> + <UMLRealTime:Capsule xmi:id="_hiN8ENG_Eeak5ZdHZR9A7Q" base_Class="_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <UMLRealTime:Capsule xmi:id="_ihwGcNG_Eeak5ZdHZR9A7Q" base_Class="_ihirENG_Eeak5ZdHZR9A7Q"/> + <UMLRealTime:CapsulePart xmi:id="_rxd2INHyEeak5ZdHZR9A7Q" base_Property="_rvjxoNHyEeak5ZdHZR9A7Q"/> + <UMLRealTime:Capsule xmi:id="_sPZIQNHyEeak5ZdHZR9A7Q" base_Class="_sPMT8NHyEeak5ZdHZR9A7Q"/> + <UMLRealTime:RTPort xmi:id="_t3ypcNHyEeak5ZdHZR9A7Q" isPublish="false" isWired="true" base_Port="_t3w0QNHyEeak5ZdHZR9A7Q"/> + <UMLRealTime:ProtocolContainer xmi:id="_uUUNYNHyEeak5ZdHZR9A7Q" base_Package="_uUTmUNHyEeak5ZdHZR9A7Q"/> + <UMLRealTime:RTMessageSet xmi:id="_uUWCkNHyEeak5ZdHZR9A7Q" base_Interface="_uUVbgNHyEeak5ZdHZR9A7Q"/> + <UMLRealTime:RTMessageSet xmi:id="_uUX3wNHyEeak5ZdHZR9A7Q" base_Interface="_uUXQsNHyEeak5ZdHZR9A7Q" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_uUZs8NHyEeak5ZdHZR9A7Q" base_Interface="_uUZF4dHyEeak5ZdHZR9A7Q" rtMsgKind="inOut"/> + <UMLRealTime:Protocol xmi:id="_uUbiINHyEeak5ZdHZR9A7Q" base_Collaboration="_uUSYMNHyEeak5ZdHZR9A7Q"/> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/ports.di b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/ports.di new file mode 100644 index 000000000..9efad2478 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/ports.di @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi"> + <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> + <windows> + <children xsi:type="di:TabFolder"> + <children> + <emfPageIdentifier href="papyrus.welcome:dynamic#/"/> + </children> + <children> + <emfPageIdentifier href="ports.notation#_hiGAQNG_Eeak5ZdHZR9A7Q"/> + </children> + <children> + <emfPageIdentifier href="ports.notation#_ihu4UNG_Eeak5ZdHZR9A7Q"/> + </children> + </children> + </windows> + </sashModel> +</di:SashWindowsMngr> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/ports.notation b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/ports.notation new file mode 100644 index 000000000..84eff702c --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/ports.notation @@ -0,0 +1,167 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <notation:Diagram xmi:id="_hiGAQNG_Eeak5ZdHZR9A7Q" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_hiIcgNG_Eeak5ZdHZR9A7Q" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_hiK4wNG_Eeak5ZdHZR9A7Q" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_hiK4wdG_Eeak5ZdHZR9A7Q" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_hiK4wtG_Eeak5ZdHZR9A7Q" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_hiK4w9G_Eeak5ZdHZR9A7Q" type="Class_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_hiK4xNG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hiK4xdG_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_xGpTQNG_Eeak5ZdHZR9A7Q" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_xGpTQdG_Eeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xGpTQtG_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_xGp6UNG_Eeak5ZdHZR9A7Q" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_xGp6UdG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_xGp6UtG_Eeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xGp6U9G_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_xGrvgNG_Eeak5ZdHZR9A7Q" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_xGrvgdG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xGrvgtG_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_xGwA9NG_Eeak5ZdHZR9A7Q" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_xGwA9dG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_xGwA9tG_Eeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xGwA99G_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_1pcwENG_Eeak5ZdHZR9A7Q" type="Port_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_1pcwEtG_Eeak5ZdHZR9A7Q" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_1pcwE9G_Eeak5ZdHZR9A7Q" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_1pcwFNG_Eeak5ZdHZR9A7Q" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_1pcwFdG_Eeak5ZdHZR9A7Q" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="ports.uml#_1DSvANG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1pcwEdG_Eeak5ZdHZR9A7Q" x="-8" y="142" width="16" height="16"/> + </children> + <element xmi:type="uml:Class" href="ports.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hiIcgdG_Eeak5ZdHZR9A7Q" x="40" y="40" width="500" height="250"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_xGtksNG_Eeak5ZdHZR9A7Q" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_xGtksdG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_xGuLwNG_Eeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="ports.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xGtkstG_Eeak5ZdHZR9A7Q" x="240" y="40"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_1piPoNG_Eeak5ZdHZR9A7Q" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_1piPodG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_1piPo9G_Eeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="ports.uml#_1DSvANG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1piPotG_Eeak5ZdHZR9A7Q" x="192" y="94"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_hiGAQdG_Eeak5ZdHZR9A7Q" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_hiGAQtG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_hiGAQ9G_Eeak5ZdHZR9A7Q"> + <owner xmi:type="uml:Class" href="ports.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="ports.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <edges xmi:type="notation:Connector" xmi:id="_xGuy0NG_Eeak5ZdHZR9A7Q" type="StereotypeCommentLink" source="_hiIcgNG_Eeak5ZdHZR9A7Q" target="_xGtksNG_Eeak5ZdHZR9A7Q"> + <styles xmi:type="notation:FontStyle" xmi:id="_xGuy0dG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_xGvZ4NG_Eeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="ports.uml#_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_xGuy0tG_Eeak5ZdHZR9A7Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_xGuy09G_Eeak5ZdHZR9A7Q"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_xGuy1NG_Eeak5ZdHZR9A7Q"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_1piPpNG_Eeak5ZdHZR9A7Q" type="StereotypeCommentLink" source="_1pcwENG_Eeak5ZdHZR9A7Q" target="_1piPoNG_Eeak5ZdHZR9A7Q"> + <styles xmi:type="notation:FontStyle" xmi:id="_1piPpdG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_1pi2stG_Eeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="ports.uml#_1DSvANG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_1piPptG_Eeak5ZdHZR9A7Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_1pi2sNG_Eeak5ZdHZR9A7Q"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_1pi2sdG_Eeak5ZdHZR9A7Q"/> + </edges> + </notation:Diagram> + <notation:Diagram xmi:id="_ihu4UNG_Eeak5ZdHZR9A7Q" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_ihu4VNG_Eeak5ZdHZR9A7Q" type="Class_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1rpIcNG_Eeak5ZdHZR9A7Q" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_1rpIcdG_Eeak5ZdHZR9A7Q" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_ihu4VtG_Eeak5ZdHZR9A7Q" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_ihu4V9G_Eeak5ZdHZR9A7Q" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_ihvfYNG_Eeak5ZdHZR9A7Q" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_ihvfYdG_Eeak5ZdHZR9A7Q" type="Class_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_ihvfYtG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ihvfY9G_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_x2e0wNG_Eeak5ZdHZR9A7Q" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_x2e0wdG_Eeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_x2e0wtG_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_x2fb0NG_Eeak5ZdHZR9A7Q" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_x2fb0dG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_x2fb0tG_Eeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_x2fb09G_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_x2gC4NG_Eeak5ZdHZR9A7Q" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_x2gC4dG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_x2gC4tG_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_x2hRANG_Eeak5ZdHZR9A7Q" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_x2hRAdG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_x2hRAtG_Eeak5ZdHZR9A7Q" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_x2hRA9G_Eeak5ZdHZR9A7Q"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_HRuOUNHAEeak5ZdHZR9A7Q" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_HWuDENHAEeak5ZdHZR9A7Q" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_HWuDEdHAEeak5ZdHZR9A7Q" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_HRuOUtHAEeak5ZdHZR9A7Q" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_HRuOU9HAEeak5ZdHZR9A7Q" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_HRuOVNHAEeak5ZdHZR9A7Q" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_HRuOVdHAEeak5ZdHZR9A7Q" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="ports.uml#_1DSvANG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_HRuOUdHAEeak5ZdHZR9A7Q" x="-8" y="142" width="16" height="16"/> + </children> + <element xmi:type="uml:Class" href="ports.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ihu4VdG_Eeak5ZdHZR9A7Q" x="40" y="40" width="500" height="250"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_x2gC49G_Eeak5ZdHZR9A7Q" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_x2gC5NG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_x2gp8NG_Eeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="ports.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_x2gC5dG_Eeak5ZdHZR9A7Q" x="240" y="40"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_ihu4UdG_Eeak5ZdHZR9A7Q" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_ihu4UtG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_ihu4U9G_Eeak5ZdHZR9A7Q"> + <owner xmi:type="uml:Class" href="ports.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="ports.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + <edges xmi:type="notation:Connector" xmi:id="_x2gp8dG_Eeak5ZdHZR9A7Q" type="StereotypeCommentLink" source="_ihu4VNG_Eeak5ZdHZR9A7Q" target="_x2gC49G_Eeak5ZdHZR9A7Q"> + <styles xmi:type="notation:FontStyle" xmi:id="_x2gp8tG_Eeak5ZdHZR9A7Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_x2gp9tG_Eeak5ZdHZR9A7Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="ports.uml#_ihirENG_Eeak5ZdHZR9A7Q"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_x2gp89G_Eeak5ZdHZR9A7Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_x2gp9NG_Eeak5ZdHZR9A7Q"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_x2gp9dG_Eeak5ZdHZR9A7Q"/> + </edges> + </notation:Diagram> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/ports.uml b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/ports.uml new file mode 100644 index 000000000..360bac29d --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/resource/inheritance/ports.uml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:UMLRealTime="http://www.eclipse.org/papyrus/umlrt" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <uml:Model xmi:id="_dlF_MNG_Eeak5ZdHZR9A7Q" name="ports"> + <packagedElement xmi:type="uml:Class" xmi:id="_hfVnMNG_Eeak5ZdHZR9A7Q" name="Capsule1" isActive="true"> + <ownedAttribute xmi:type="uml:Port" xmi:id="_1DSvANG_Eeak5ZdHZR9A7Q" name="protocol1" visibility="public" type="_1VpqUNG_Eeak5ZdHZR9A7Q" isOrdered="true" aggregation="composite" isBehavior="true" isService="true"/> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_ihirENG_Eeak5ZdHZR9A7Q" name="Capsule2" isActive="true"> + <generalization xmi:type="uml:Generalization" xmi:id="_kSDmcNG_Eeak5ZdHZR9A7Q" general="_hfVnMNG_Eeak5ZdHZR9A7Q"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_1Vw_ENG_Eeak5ZdHZR9A7Q" name="Protocol1"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_1VpqUNG_Eeak5ZdHZR9A7Q" name="Protocol1"> + <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_1V1QgNG_Eeak5ZdHZR9A7Q" client="_1VpqUNG_Eeak5ZdHZR9A7Q" supplier="_1V0CYNG_Eeak5ZdHZR9A7Q" contract="_1V0CYNG_Eeak5ZdHZR9A7Q"/> + <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_1V6wENG_Eeak5ZdHZR9A7Q" client="_1VpqUNG_Eeak5ZdHZR9A7Q" supplier="_1V5h8NG_Eeak5ZdHZR9A7Q" contract="_1V5h8NG_Eeak5ZdHZR9A7Q"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_1V0CYNG_Eeak5ZdHZR9A7Q" name="Protocol1"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_1V2eoNG_Eeak5ZdHZR9A7Q" name="Protocol1~"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_1V4T0NG_Eeak5ZdHZR9A7Q" client="_1VpqUNG_Eeak5ZdHZR9A7Q" supplier="_1V2eoNG_Eeak5ZdHZR9A7Q"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_1V464NG_Eeak5ZdHZR9A7Q" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_1V5h8NG_Eeak5ZdHZR9A7Q" name="Protocol1IO"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_1V7XING_Eeak5ZdHZR9A7Q" client="_1VpqUNG_Eeak5ZdHZR9A7Q" supplier="_1V5h8NG_Eeak5ZdHZR9A7Q"/> + </packagedElement> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_dlhdANG_Eeak5ZdHZR9A7Q"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_dljSMNG_Eeak5ZdHZR9A7Q" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt#/"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/> + </profileApplication> + </uml:Model> + <UMLRealTime:Capsule xmi:id="_hiN8ENG_Eeak5ZdHZR9A7Q" base_Class="_hfVnMNG_Eeak5ZdHZR9A7Q"/> + <UMLRealTime:Capsule xmi:id="_ihwGcNG_Eeak5ZdHZR9A7Q" base_Class="_ihirENG_Eeak5ZdHZR9A7Q"/> + <UMLRealTime:RTPort xmi:id="_1DimoNG_Eeak5ZdHZR9A7Q" isPublish="false" isWired="true" base_Port="_1DSvANG_Eeak5ZdHZR9A7Q"/> + <UMLRealTime:ProtocolContainer xmi:id="_1VyNMNG_Eeak5ZdHZR9A7Q" base_Package="_1Vw_ENG_Eeak5ZdHZR9A7Q"/> + <UMLRealTime:RTMessageSet xmi:id="_1V0pcNG_Eeak5ZdHZR9A7Q" base_Interface="_1V0CYNG_Eeak5ZdHZR9A7Q"/> + <UMLRealTime:RTMessageSet xmi:id="_1V3FsNG_Eeak5ZdHZR9A7Q" base_Interface="_1V2eoNG_Eeak5ZdHZR9A7Q" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_1V6JANG_Eeak5ZdHZR9A7Q" base_Interface="_1V5h8NG_Eeak5ZdHZR9A7Q" rtMsgKind="inOut"/> + <UMLRealTime:Protocol xmi:id="_1V7-MNG_Eeak5ZdHZR9A7Q" base_Collaboration="_1VpqUNG_Eeak5ZdHZR9A7Q"/> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/canonical/tests/AbstractCanonicalTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/canonical/tests/AbstractCanonicalTest.java index 17ddb3e4c..ba75be656 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/canonical/tests/AbstractCanonicalTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/canonical/tests/AbstractCanonicalTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015, 2016 Christian W. Damus and others. + * Copyright (c) 2015, 2017 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -21,35 +21,19 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.fail; import static org.junit.Assume.assumeThat; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.FutureTask; -import org.eclipse.core.commands.operations.IOperationHistory; -import org.eclipse.core.commands.operations.IUndoContext; -import org.eclipse.core.commands.operations.IUndoableOperation; import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.util.AbstractTreeIterator; -import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.ENamedElement; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.transaction.RecordingCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.workspace.IWorkspaceCommandStack; import org.eclipse.gef.EditPart; import org.eclipse.gef.RequestConstants; import org.eclipse.gef.commands.Command; @@ -60,7 +44,6 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter; import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; @@ -70,39 +53,22 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.IHintedType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.notation.Edge; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.emf.utils.TreeIterators; import org.eclipse.papyrus.infra.gmfdiag.common.commands.SetCanonicalCommand; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; import org.eclipse.papyrus.infra.services.edit.utils.ElementTypeUtils; import org.eclipse.papyrus.infra.tools.util.PlatformHelper; -import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; -import org.eclipse.papyrus.junit.utils.JUnitUtils; -import org.eclipse.papyrus.junit.utils.rules.AbstractHouseKeeperRule.CleanUp; -import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; -import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; -import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.umlrt.core.types.UMLRTElementTypesEnumerator; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests.AbstractPapyrusRTDiagramTest; import org.eclipse.uml2.uml.AggregationKind; import org.eclipse.uml2.uml.Association; import org.eclipse.uml2.uml.Dependency; -import org.eclipse.uml2.uml.DirectedRelationship; import org.eclipse.uml2.uml.LiteralUnlimitedNatural; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.Type; import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.util.UMLUtil; -import org.junit.Before; -import org.junit.Rule; -import org.junit.rules.TestRule; -import org.junit.rules.TestWatcher; -import org.junit.runner.Description; import com.google.common.base.Function; import com.google.common.base.Predicates; @@ -110,123 +76,16 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.google.common.util.concurrent.Futures; /** * Common implementation of canonical test cases. */ -public abstract class AbstractCanonicalTest extends AbstractPapyrusTest { - /** - * The canonical diagram tests need to run in the UI thread. - */ - @Rule - public final TestRule uiThread = new UIThreadRule(); - - @Rule - public final HouseKeeper houseKeeper = new HouseKeeper(); - - @Rule - public final TestRule annotationRule = new AnnotationRule(); - - @Rule - public final PapyrusEditorFixture editor = new PapyrusEditorFixture(); - - @CleanUp - private ComposedAdapterFactory adapterFactory; - - private boolean needUIEvents; - - @CleanUp - private IUndoableOperation undoMark; +public abstract class AbstractCanonicalTest extends AbstractPapyrusRTDiagramTest { public AbstractCanonicalTest() { super(); } - @Before - public void createAdapterFactory() { - adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - } - - protected DiagramEditPart getDiagramEditPart() { - return editor.getActiveDiagramEditor().getDiagramEditPart(); - } - - protected TreeIterator<IGraphicalEditPart> allContents(EditPart root, boolean includeRoot) { - return TreeIterators.filter(DiagramEditPartsUtil.getAllContents(root, includeRoot), IGraphicalEditPart.class); - } - - protected IGraphicalEditPart getEditPart(EObject element) { - return getEditPart(element, getDiagramEditPart()); - } - - protected IGraphicalEditPart getEditPart(EObject element, IGraphicalEditPart scope) { - IGraphicalEditPart result = null; - - for (Iterator<IGraphicalEditPart> iter = allContents(scope, true); iter.hasNext();) { - IGraphicalEditPart next = iter.next(); - View view = next.getNotationView(); - if ((view != null) && (view.getElement() == element)) { - result = next; - break; - } - } - - return result; - } - - protected IGraphicalEditPart requireEditPart(EObject element) { - IGraphicalEditPart result = getEditPart(element, getDiagramEditPart()); - assertThat("No edit part for " + label(element), result, notNullValue()); - return result; - } - - protected IGraphicalEditPart getConnectionEditPart(EObject element) { - IGraphicalEditPart result = null; - - for (Iterator<IGraphicalEditPart> iter = Iterators.filter(getDiagramEditPart().getConnections().iterator(), IGraphicalEditPart.class); iter.hasNext();) { - IGraphicalEditPart next = iter.next(); - View view = next.getNotationView(); - if ((view != null) && (view.getElement() == element)) { - result = next; - break; - } - } - - return result; - } - - protected IGraphicalEditPart requireConnectionEditPart(EObject element) { - IGraphicalEditPart result = getConnectionEditPart(element); - assertThat("No connection edit part for " + label(element), result, notNullValue()); - return result; - } - - protected View getView(EObject element, View scope) { - View result = null; - - for (Iterator<View> iter = Iterators.filter(scope.eAllContents(), View.class); (result == null) && iter.hasNext();) { - View next = iter.next(); - if (next.getElement() == element) { - result = next; - } - } - - return result; - } - - protected View requireView(EObject element, View scope) { - View result = getView(element, scope); - assertThat("View not found: " + label(element), result, notNullValue()); - return result; - } - - protected View assumeView(EObject element, View scope) { - View result = getView(element, scope); - assumeThat("View not found: " + label(element), result, notNullValue()); - return result; - } - protected void assertNoView(EObject element, View scope) { View view = getView(element, scope); assertThat("View exists: " + label(element), view, nullValue()); @@ -237,117 +96,6 @@ public abstract class AbstractCanonicalTest extends AbstractPapyrusTest { assumeThat("View exists: " + label(element), view, nullValue()); } - protected <T extends DirectedRelationship> T getRelationship(NamedElement from, NamedElement to, Class<T> type) { - T result = null; - - for (T next : Iterables.filter(from.getSourceDirectedRelationships(), type)) { - if (next.getTargets().contains(to)) { - result = next; - break; - } - } - - return result; - } - - protected void execute(ICommand command) { - execute(GMFtoEMFCommandWrapper.wrap(command)); - } - - protected void execute(Command command) { - execute(GEFtoEMFCommandWrapper.wrap(command)); - } - - protected void execute(org.eclipse.emf.common.command.Command command) { - assertThat("Cannot execute command", command.canExecute(), is(true)); - editor.getEditingDomain().getCommandStack().execute(command); - waitForUIEvents(); - } - - protected final void waitForUIEvents() { - // If we're running the tests in the IDE, we should see what's happening. Or, it could be that a - // particular test actually needs UI events to be processed before proceeding - if (!JUnitUtils.isAutomatedBuildExecution() || isNeedUIEvents()) { - editor.flushDisplayEvents(); - } - } - - protected final boolean isNeedUIEvents() { - return needUIEvents; - } - - protected void execute(final Runnable writeOperation) { - execute(new RecordingCommand(editor.getEditingDomain()) { - - @Override - protected void doExecute() { - writeOperation.run(); - } - }); - } - - protected <V> V execute(final Callable<V> writeOperation) { - final FutureTask<V> result = new FutureTask<>(writeOperation); - execute(result); - return Futures.getUnchecked(result); - } - - protected void undo() { - CommandStack stack = editor.getEditingDomain().getCommandStack(); - assertThat("Cannot undo", stack.canUndo(), is(true)); - stack.undo(); - waitForUIEvents(); - } - - /** - * Marks the current place in the undo history for a subsequent {@link #undoToMark()} - * to unwind the history back to that same state. This simplifies test cases that - * need to execute a sequence of commands and then undo them all or, as happens - * sometimes with canonical view creation, have asynchronous layout commands executed - * on their behalf without their knowledge, depending on the configuration of - * installed plug-ins. - * - * @see #undoToMark() - */ - protected void markForUndo() { - IWorkspaceCommandStack stack = (IWorkspaceCommandStack) editor.getEditingDomain().getCommandStack(); - IOperationHistory history = stack.getOperationHistory(); - undoMark = history.getUndoOperation(stack.getDefaultUndoContext()); - } - - /** - * Undoes the top command in the undo history until the previously established - * {@linkplain #markForUndo() mark} is reached. - * - * @see #markForUndo() - */ - protected void undoToMark() { - IWorkspaceCommandStack stack = (IWorkspaceCommandStack) editor.getEditingDomain().getCommandStack(); - IOperationHistory history = stack.getOperationHistory(); - IUndoContext ctx = stack.getDefaultUndoContext(); - - try { - IUndoableOperation lastOperation; - - do { - assertThat("Cannot undo", stack.canUndo(), is(true)); - stack.undo(); - lastOperation = history.getUndoOperation(ctx); - } while ((lastOperation != null) && (lastOperation != undoMark)); - - waitForUIEvents(); - } finally { - undoMark = null; - } - } - - protected void redo() { - CommandStack stack = editor.getEditingDomain().getCommandStack(); - assertThat("Cannot redo", stack.canRedo(), is(true)); - stack.redo(); - waitForUIEvents(); - } - protected void setEditPartsCanonical(boolean canonical, Iterable<? extends EditPart> editParts) { final TransactionalEditingDomain domain = editor.getEditingDomain(); @@ -512,13 +260,7 @@ public abstract class AbstractCanonicalTest extends AbstractPapyrusTest { * Relies on canonical edit policy to create the notation view. */ protected Dependency addDependency(final NamedElement client, final NamedElement supplier) { - return execute(new Callable<Dependency>() { - - @Override - public Dependency call() throws Exception { - return client.createDependency(supplier); - } - }); + return execute(() -> client.createDependency(supplier)); } /** @@ -526,15 +268,11 @@ public abstract class AbstractCanonicalTest extends AbstractPapyrusTest { * Relies on canonical edit policy to create the notation view. */ protected Association addAssociation(final Type end1, final Type end2) { - return execute(new Callable<Association>() { - - @Override - public Association call() throws Exception { - String end1Name = end2.getName().substring(0, 1).toLowerCase() + end2.getName().substring(1); - String end2Name = end1.getName().substring(0, 1).toLowerCase() + end1.getName().substring(1); - return end1.createAssociation(true, AggregationKind.NONE_LITERAL, end1Name, 0, 1, end2, - false, AggregationKind.NONE_LITERAL, end2Name, 0, LiteralUnlimitedNatural.UNLIMITED); - } + return execute(() -> { + String end1Name = end2.getName().substring(0, 1).toLowerCase() + end2.getName().substring(1); + String end2Name = end1.getName().substring(0, 1).toLowerCase() + end1.getName().substring(1); + return end1.createAssociation(true, AggregationKind.NONE_LITERAL, end1Name, 0, 1, end2, + false, AggregationKind.NONE_LITERAL, end2Name, 0, LiteralUnlimitedNatural.UNLIMITED); }); } @@ -619,69 +357,6 @@ public abstract class AbstractCanonicalTest extends AbstractPapyrusTest { execute(command); } - protected String label(EObject object) { - String result; - - if (object instanceof ENamedElement) { - result = ((UMLUtil.getQualifiedName((ENamedElement) object, NamedElement.SEPARATOR))); - } else { - IItemLabelProvider labels = (IItemLabelProvider) adapterFactory.adapt(object, IItemLabelProvider.class); - result = (labels == null) ? String.valueOf(object) : labels.getText(object); - } - - return result; - } - - protected View getView(EObject object) { - IGraphicalEditPart editPart = getEditPart(object); - if (editPart == null) { - // Maybe it's an edge - editPart = getConnectionEditPart(object); - } - return (editPart == null) ? null : editPart.getNotationView(); - } - - protected View requireView(EObject object) { - View result = getView(object); - assertThat("No view for " + label(object), result, notNullValue()); - return result; - } - - protected View assumeView(EObject object) { - View result = getView(object); - assumeThat("No view for " + label(object), result, notNullValue()); - return result; - } - - protected Edge requireEdge(View oneEnd, View otherEnd) { - Edge result = getEdge(oneEnd, otherEnd); - assertThat("No edge between " + label(oneEnd) + " and " + label(otherEnd), result, notNullValue()); - return result; - } - - protected Edge getEdge(View oneEnd, View otherEnd) { - Edge result = null; - - for (Edge next : Iterables.filter(oneEnd.getSourceEdges(), Edge.class)) { - if (next.getTarget() == otherEnd) { - result = next; - break; - } - } - - if (result == null) { - // Try the other way around - for (Edge next : Iterables.filter(oneEnd.getTargetEdges(), Edge.class)) { - if (next.getSource() == otherEnd) { - result = next; - break; - } - } - } - - return result; - } - protected void assertNoView(EObject object) { View view = getView(object); assertThat("View exists for " + label(object), view, nullValue()); @@ -761,21 +436,4 @@ public abstract class AbstractCanonicalTest extends AbstractPapyrusTest { protected void assertDetached(EObject first, EObject second, EObject... rest) { assertDetached(Lists.asList(first, second, rest)); } - - // - // Nested types - // - - @Retention(RetentionPolicy.RUNTIME) - @Target({ ElementType.TYPE, ElementType.METHOD }) - protected @interface NeedsUIEvents { - // Empty - } - - private class AnnotationRule extends TestWatcher { - @Override - protected void starting(Description description) { - needUIEvents = JUnitUtils.getAnnotation(description, NeedsUIEvents.class) != null; - } - } } diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/canonical/tests/CapsuleStructureDiagramTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/canonical/tests/CapsuleStructureDiagramTest.java index b392aec16..76838a631 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/canonical/tests/CapsuleStructureDiagramTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/canonical/tests/CapsuleStructureDiagramTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2016 Christian W. Damus, CEA LIST, and others. + * Copyright (c) 2016, 2017 Christian W. Damus, CEA LIST, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -9,14 +9,12 @@ * Contributors: * Christian W. Damus - Initial API and implementation * CEA LIST - bug 489624 - * Christian W. Damus - bug 496464 + * Christian W. Damus - bugs 496464, 467545 * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.canonical.tests; -import java.util.concurrent.Callable; - import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; @@ -104,13 +102,9 @@ public class CapsuleStructureDiagramTest extends AbstractCanonicalTest { // Find the structure compartment View structure = (View) assumeView(capsule2_capsule1Part).eContainer(); - Property attribute = execute(new Callable<Property>() { - @Override - public Property call() throws Exception { - // It's not a proper capsule-part - return capsule2.createOwnedAttribute("attr1", capsule1); - } - }); + Property attribute = execute(() -> + // It's not a proper capsule-part + capsule2.createOwnedAttribute("attr1", capsule1)); assertNoView(attribute, structure); // It isn't shown } @@ -124,21 +118,18 @@ public class CapsuleStructureDiagramTest extends AbstractCanonicalTest { // Find the structure compartment View structure = (View) assumeView(capsule2_capsule1Part).eContainer(); - Property newPart = execute(new Callable<Property>() { - @Override - public Property call() throws Exception { - // Do this the hard way because we mustn't pop up a capsule - // selection dialog - Property result = capsule2.createOwnedAttribute("part2", capsule1); - result.applyStereotype(result.getApplicableStereotype("UMLRealTime::CapsulePart")); - result.setAggregation(AggregationKind.COMPOSITE_LITERAL); - result.setVisibility(VisibilityKind.PROTECTED_LITERAL); - ((LiteralInteger) result.createLowerValue(null, null, UMLPackage.Literals.LITERAL_INTEGER)).setValue(1); - ((LiteralUnlimitedNatural) result.createUpperValue(null, null, - UMLPackage.Literals.LITERAL_UNLIMITED_NATURAL)).setValue(1); - - return result; - } + Property newPart = execute(() -> { + // Do this the hard way because we mustn't pop up a capsule + // selection dialog + Property result = capsule2.createOwnedAttribute("part2", capsule1); + result.applyStereotype(result.getApplicableStereotype("UMLRealTime::CapsulePart")); + result.setAggregation(AggregationKind.COMPOSITE_LITERAL); + result.setVisibility(VisibilityKind.PROTECTED_LITERAL); + ((LiteralInteger) result.createLowerValue(null, null, UMLPackage.Literals.LITERAL_INTEGER)).setValue(1); + ((LiteralUnlimitedNatural) result.createUpperValue(null, null, + UMLPackage.Literals.LITERAL_UNLIMITED_NATURAL)).setValue(1); + + return result; }); requireView(newPart, structure); // The new capsule-part is shown diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/CapsuleToCapsulePartOnCapsuleDropStrategyTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/CapsuleToCapsulePartOnCapsuleDropStrategyTest.java index 484909440..74a3bc06c 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/CapsuleToCapsulePartOnCapsuleDropStrategyTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/CapsuleToCapsulePartOnCapsuleDropStrategyTest.java @@ -30,6 +30,7 @@ import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartEditPartCN; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.papyrusrt.umlrt.core.utils.CapsulePartUtils; @@ -56,7 +57,7 @@ public class CapsuleToCapsulePartOnCapsuleDropStrategyTest { public static final TestRule viewpoint = new UMLRTViewpointRule(); @Rule - public final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); private final CapsulePartEditingFixture capsuleParts = new CapsulePartEditingFixture(editor, "Capsule1", "capsule2"); diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/ClassifierToPartOnCapsuleDropTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/ClassifierToPartOnCapsuleDropTest.java index df06ada0f..3679881c4 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/ClassifierToPartOnCapsuleDropTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/ClassifierToPartOnCapsuleDropTest.java @@ -33,6 +33,7 @@ import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.uml2.uml.Classifier; @@ -58,7 +59,7 @@ public class ClassifierToPartOnCapsuleDropTest { public static final TestRule viewpoint = new UMLRTViewpointRule(); @Rule - public final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); private Point insideTheStructureCompartment = new Point(100, 100); diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/DropSystemProtocolTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/DropSystemProtocolTest.java index 2a10bf5f1..65259e9e8 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/DropSystemProtocolTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/DropSystemProtocolTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2016 CEA LIST and others. + * Copyright (c) 2016 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 467545 * *****************************************************************************/ @@ -28,6 +29,7 @@ import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart; import org.eclipse.papyrusrt.junit.rules.ElementTypesResource; import org.eclipse.papyrusrt.junit.rules.ElementTypesRule; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.papyrusrt.umlrt.core.defaultlanguage.IDefaultLanguage; @@ -63,7 +65,7 @@ public class DropSystemProtocolTest extends AbstractPapyrusTest { public static final TestRule elementTypesRule = new ElementTypesRule(); @ClassRule - public static final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public static final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); private final PortEditingFixture ports = new PortEditingFixture(editor, "Capsule1"); /** diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/ProtocolToPortOnPartDropStrategyTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/ProtocolToPortOnPartDropStrategyTest.java index 5f9493f83..6d6ec1d66 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/ProtocolToPortOnPartDropStrategyTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/drop/tests/ProtocolToPortOnPartDropStrategyTest.java @@ -35,6 +35,7 @@ import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartEditPartCN; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.papyrusrt.umlrt.core.utils.RTPortKindEnum; @@ -63,7 +64,7 @@ public class ProtocolToPortOnPartDropStrategyTest { public static final TestRule viewpoint = new UMLRTViewpointRule(); @Rule - public final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); private final PortEditingFixture ports = new PortEditingFixture(editor, "Capsule1", "capsule2"); diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/DropExistingElementsOnCapsuleTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/DropExistingElementsOnCapsuleTest.java index 73c41406a..d28582f72 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/DropExistingElementsOnCapsuleTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/DropExistingElementsOnCapsuleTest.java @@ -33,6 +33,7 @@ import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart; import org.eclipse.papyrusrt.junit.rules.FixtureElementRule; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.UMLRTEditPartUtils; @@ -59,7 +60,7 @@ public class DropExistingElementsOnCapsuleTest { public static final TestRule viewpoint = new UMLRTViewpointRule(); @ClassRule - public static final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public static final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); @Rule public final FixtureElementRule elements = new FixtureElementRule(); diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/PortCreationTests.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/PortCreationTests.java index 118b1f96e..71d1d6440 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/PortCreationTests.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/PortCreationTests.java @@ -24,6 +24,7 @@ import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrusrt.junit.rules.ElementTypesResource; import org.eclipse.papyrusrt.junit.rules.ElementTypesRule; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.uml2.uml.Port; @@ -51,7 +52,7 @@ public class PortCreationTests { public static final TestRule elementTypesRule = new ElementTypesRule(); @ClassRule - public static final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public static final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); private final PortEditingFixture ports = new PortEditingFixture(editor, "Capsule2"); diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/PortOnPartCreationTests.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/PortOnPartCreationTests.java index 2887bde53..b4bde19c5 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/PortOnPartCreationTests.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/PortOnPartCreationTests.java @@ -28,6 +28,7 @@ import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrusrt.junit.rules.ElementTypesResource; import org.eclipse.papyrusrt.junit.rules.ElementTypesRule; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils.RelativePortLocation; @@ -60,7 +61,7 @@ public class PortOnPartCreationTests { public static final TestRule elementTypesRule = new ElementTypesRule(); @ClassRule - public static final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public static final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); private final PortEditingFixture ports = new PortEditingFixture(editor, "Capsule1", "capsule2"); diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTPortResizableEditPolicyTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTPortResizableEditPolicyTest.java index 6b811395e..eddc3560f 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTPortResizableEditPolicyTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTPortResizableEditPolicyTest.java @@ -28,6 +28,7 @@ import org.eclipse.gef.handles.AbstractHandle; import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.uml2.uml.Class; @@ -50,7 +51,7 @@ public class RTPortResizableEditPolicyTest { public final TestRule uiThread = new UIThreadRule(); @Rule - public final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); /** * Verify that a port on a part is not resizable (it has only selection diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTResizableShapeEditPolicyTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTResizableShapeEditPolicyTest.java index 3480a5e22..d7459d1f5 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTResizableShapeEditPolicyTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTResizableShapeEditPolicyTest.java @@ -31,6 +31,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.internal.utils.RelativePortLocation; @@ -55,7 +56,7 @@ public class RTResizableShapeEditPolicyTest { public final TestRule uiThread = new UIThreadRule(); @Rule - public final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); /** * Verify that the new view for a newly created capsule-part initially diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTSideAffixedNodesCreationEditPolicyTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTSideAffixedNodesCreationEditPolicyTest.java index 59663897a..6cc4c017e 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTSideAffixedNodesCreationEditPolicyTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/editpolicies/tests/RTSideAffixedNodesCreationEditPolicyTest.java @@ -29,6 +29,7 @@ import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.papyrusrt.umlrt.core.types.UMLRTElementTypesEnumerator; @@ -55,7 +56,7 @@ public class RTSideAffixedNodesCreationEditPolicyTest { public final TestRule uiThread = new UIThreadRule(); @Rule - public final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); /** * Verify that the new view for a newly created capsule-part initially diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/AbstractInheritanceTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/AbstractInheritanceTest.java new file mode 100644 index 000000000..f9ff59502 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/AbstractInheritanceTest.java @@ -0,0 +1,482 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.inheritance.tests; + +import static org.eclipse.papyrus.junit.matchers.MoreMatchers.greaterThan; +import static org.eclipse.papyrusrt.junit.matchers.FunctionalMatchers.compose; +import static org.hamcrest.CoreMatchers.both; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.sameInstance; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.List; +import java.util.Optional; +import java.util.function.BiConsumer; + +import org.eclipse.draw2d.Connection; +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.gef.ConnectionEditPart; +import org.eclipse.gef.RequestConstants; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.requests.BendpointRequest; +import org.eclipse.gef.requests.ChangeBoundsRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; +import org.eclipse.gmf.runtime.notation.BooleanValueStyle; +import org.eclipse.gmf.runtime.notation.Bounds; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.Location; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.RelativeBendpoints; +import org.eclipse.gmf.runtime.notation.Size; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.junit.utils.rules.JavaResource; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartEditPartCN; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.editparts.IInheritableEditPart; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests.AbstractPapyrusRTDiagramTest; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTConnector; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPackage; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTReplicatedElement; +import org.eclipse.papyrusrt.umlrt.uml.util.UMLRTSwitch; +import org.eclipse.uml2.uml.NamedElement; +import org.junit.runners.Parameterized; + +/** + * Abstract superclass of diagram inheritance tests, providing various test framework + * services to help the authoring of test cases. + */ +public abstract class AbstractInheritanceTest extends AbstractPapyrusRTDiagramTest { + + public AbstractInheritanceTest() { + super(); + } + + /** + * Initializes me with a test resource path to inject not via an annotation. + * This is useful especially for {@link Parameterized parameterized} test suites. + * + * @param modelPath + * the model path to load instead of any that might be supplied by an annotaiton + * + * @see Parameterized + * @see PluginResource + * @see JavaResource + */ + public AbstractInheritanceTest(String modelPath) { + super(modelPath); + } + + protected void activateDiagram(String capsuleName) { + activateDiagram(getCapsule(capsuleName)); + } + + /** + * Activates the diagram that visualizes the capsule contet of the given {@code element}. + * + * @param element + * an element in a capsule (or, itself, a capsule) + */ + protected void activateDiagram(UMLRTNamedElement element) { + UMLRTCapsule capsule = new UMLRTSwitch<UMLRTCapsule>() { + @Override + public UMLRTCapsule caseReplicatedElement(UMLRTReplicatedElement object) { + return object.getCapsule(); + } + + @Override + public UMLRTCapsule caseConnector(UMLRTConnector object) { + return object.getCapsule(); + } + + @Override + public UMLRTCapsule caseCapsule(UMLRTCapsule object) { + return object; + } + }.doSwitch(element); + + assertThat("No capsule context inferred from " + element, capsule, notNullValue()); + + editor.activateDiagram(capsule.getName()); + } + + protected UMLRTPackage getRoot() { + return UMLRTPackage.getInstance(editor.getModel()); + } + + protected UMLRTCapsule getCapsule(String name) { + return getRoot().getCapsule(name); + } + + /** + * Obtains the {@code name}d port of <b>Capsule1</b>, for the common use case + * of accessing the inherited element (root definition). For ports of any + * other capsule, {@linkplain #getCapsule(String) get} that capsule, first, + * and {@linkplain UMLRTCapsule#getPort(String) get} the port from it. + * + * @param name + * the port name to get from Capsule1 + * + * @return the port + */ + protected UMLRTPort getPort(String name) { + return getCapsule("Capsule1").getPort(name); + } + + /** + * Obtains the {@code name}d capsule-part of <b>Capsule1</b>, for the common use case + * of accessing the inherited element (root definition). For capsule-parts of any + * other capsule, {@linkplain #getCapsule(String) get} that capsule, first, + * and {@linkplain UMLRTCapsule#getCapsulePart(String) get} the capsule-part from it. + * + * @param name + * the capsule-part name to get from Capsule1 + * + * @return the capsule-part + */ + protected UMLRTCapsulePart getCapsulePart(String name) { + return getCapsule("Capsule1").getCapsulePart(name); + } + + protected UMLRTPort getPortOnPart(String capsulePartName, String portName) { + return getCapsulePart(capsulePartName).getType().getPort(portName); + } + + /** + * Obtains the {@code name}d connector in <b>Capsule1</b>, for the common use case + * of accessing the inherited element (root definition). For connectors in any + * other capsule, {@linkplain #getCapsule(String) get} that capsule, first, + * and {@linkplain UMLRTCapsule#getConnector(String) get} the connector from it. + * + * @param name + * the connector name to get from Capsule1 + * + * @return the connector + */ + protected UMLRTConnector getConnector(String name) { + return getCapsule("Capsule1").getConnector(name); + } + + /** + * Obtains the redefinition of an {@code element} in the current diagram context. + * + * @param element + * an element in the superclass diagram + * + * @return the redefinition of it in the context of the currently active diagram + */ + protected <T extends UMLRTNamedElement> T getRedefinition(T element) { + T result = null; + + EObject context = editor.getActiveDiagram().resolveSemanticElement(); + if (context instanceof NamedElement) { + UMLRTNamedElement rtContext = UMLRTFactory.create((NamedElement) context); + if (rtContext instanceof UMLRTCapsule) { + result = ((UMLRTCapsule) rtContext).getRedefinitionOf(element); + } + } + + if (result == null) { + // Perhaps it's a port on a part? In which case, it had better be unique, + // otherwise the test probably won't work + result = element; + } + + return result; + } + + protected View requireView(UMLRTNamedElement element) { + return requireView(element.toUML()); + } + + protected IGraphicalEditPart requireEditPart(UMLRTNamedElement element) { + return requireEditPart(element.toUML()); + } + + protected IFigure getCoreFigure(IGraphicalEditPart editPart) { + IFigure result; + if (editPart instanceof PortEditPart) { + result = ((PortEditPart) editPart).getPrimaryShape(); + } else if (editPart instanceof PropertyPartEditPartCN) { + result = ((PropertyPartEditPartCN) editPart).getPrimaryShape(); + } else { + result = editPart.getFigure(); + } + return result; + } + + protected IGraphicalEditPart requireLabel(UMLRTNamedElement element) { + IGraphicalEditPart mainEP = requireEditPart(element); + Optional<? extends IGraphicalEditPart> result = ((List<?>) mainEP.getChildren()).stream() + .filter(LabelEditPart.class::isInstance) + .map(LabelEditPart.class::cast) + .findFirst(); + + return result.orElseThrow(() -> new AssertionError("No label found for edit-part of " + element)); + } + + protected void move(IGraphicalEditPart editPart, int deltaX, int deltaY) { + ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_MOVE); + request.setMoveDelta(new Point(deltaX, deltaY)); + request.setEditParts(editPart); + + Command move = editPart.getCommand(request); + assertThat(move, notNullValue()); + assertThat(move.canExecute(), is(true)); + + // If we're moving it, it must be a node with a location + Node node = (Node) editPart.getNotationView(); + Location location = (Location) node.getLayoutConstraint(); + Point oldLocation = new Point(location.getX(), location.getY()); + + execute(move); + + location = (Location) node.getLayoutConstraint(); // In case it was created anew + Point newLocation = new Point(location.getX(), location.getY()); + + assertThat("Edit-part was not moved", newLocation, not(oldLocation)); + } + + protected void resize(IGraphicalEditPart editPart, int deltaWidth, int deltaHeight) { + ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE); + request.setSizeDelta(new Dimension(deltaWidth, deltaHeight)); + request.setCenteredResize(true); + request.setEditParts(editPart); + + Command resize = editPart.getCommand(request); + assertThat(resize, notNullValue()); + assertThat(resize.canExecute(), is(true)); + + // If we're resizing and moving it, it must be a node with a bounds + Node node = (Node) editPart.getNotationView(); + Bounds bounds = (Bounds) node.getLayoutConstraint(); + Rectangle oldBounds = new Rectangle(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight()); + + execute(resize); + + bounds = (Bounds) node.getLayoutConstraint(); // In case it was created anew + Rectangle newBounds = new Rectangle(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight()); + + assertThat("Edit-part was not resized", newBounds, not(oldBounds)); + } + + protected void bend(IGraphicalEditPart editPart, int x, int y) { + BendpointRequest request = new BendpointRequest(); + request.setType(RequestConstants.REQ_CREATE_BENDPOINT); + request.setSource((ConnectionEditPart) editPart); + request.setLocation(new Point(x, y)); + + Connection connection = (Connection) editPart.getFigure(); + connection.getPoints().insertPoint(new Point(x, y), 1); + + Command bend = editPart.getCommand(request); + assertThat(bend, notNullValue()); + assertThat(bend.canExecute(), is(true)); + + // If we're adding a bendpoint, it must be an edge + Edge edge = (Edge) editPart.getNotationView(); + RelativeBendpoints bendpoints = (RelativeBendpoints) edge.getBendpoints(); + List<?> oldPoints = bendpoints.getPoints(); + + execute(bend); + + bendpoints = (RelativeBendpoints) edge.getBendpoints(); // In case it was created anew + List<?> newPoints = bendpoints.getPoints(); + + assertThat("No bend-point was added", newPoints.size(), greaterThan(oldPoints.size())); + } + + protected void unfollow(IGraphicalEditPart editPart) { + View view = editPart.getNotationView(); + Optional<BooleanValueStyle> style = IInheritableEditPart.StyleUtil.getInheritedStyle(view); + if (!style.isPresent()) { + execute(IInheritableEditPart.StyleUtil.getCreateInheritedStyle(view)); + } else if (style.get().isBooleanValue()) { + execute(SetCommand.create(editor.getEditingDomain(), style.get(), + NotationPackage.Literals.BOOLEAN_VALUE_STYLE__BOOLEAN_VALUE, false)); + } + } + + /** + * Verifies that an edit-part in the {@link local} diagram context followed the corresponding + * edit-part {@link inherited} from the supertype context in the specified detail. + * + * @param inherited + * an edit-part in the inherited diagram context + * @param local + * the corresponding edit-part in the inheriting/redefining diagram context + * @param detailType + * the kind of detail of the notation view to verify + * + * @throws IllegalArgumentException + * if the {@code detailType} is not a class of the Notation package + */ + protected void assertFollowed(IGraphicalEditPart inherited, IGraphicalEditPart local, EClass detailType) { + if (detailType.getEPackage() != NotationPackage.eINSTANCE) { + throw new IllegalArgumentException("not a Notation class: " + detailType.getName()); + } + + switch (detailType.getClassifierID()) { + case NotationPackage.LOCATION: + assertDetail(inherited, local, detailType, Location.class, this::assertEquals); + break; + case NotationPackage.SIZE: + assertDetail(inherited, local, detailType, Size.class, this::assertEquals); + break; + case NotationPackage.BOUNDS: + assertDetail(inherited, local, detailType, Bounds.class, this::assertEquals); + break; + case NotationPackage.RELATIVE_BENDPOINTS: + assertDetail(inherited, local, detailType, RelativeBendpoints.class, this::assertEquals); + break; + } + } + + private void assertEquals(Location expected, Location actual) { + assertThat("wrong x coördinate", actual.getX(), is(expected.getX())); + assertThat("wrong y coördinate", actual.getY(), is(expected.getY())); + } + + private void assertEquals(Size expected, Size actual) { + assertThat("wrong width", actual.getWidth(), is(expected.getWidth())); + assertThat("wrong height", actual.getHeight(), is(expected.getHeight())); + } + + private void assertEquals(Bounds expected, Bounds actual) { + assertEquals((Location) expected, (Location) actual); + assertEquals((Size) expected, (Size) actual); + } + + private void assertEquals(RelativeBendpoints expected, RelativeBendpoints actual) { + assertThat("wrong bendpoints", actual.getPoints(), is(expected.getPoints())); + } + + /** + * Verifies that an edit-part in the {@link local} diagram context followed the corresponding + * edit-part {@link inherited} from the supertype context in the specified detail. + * + * @param inherited + * an edit-part in the inherited diagram context + * @param local + * the corresponding edit-part in the inheriting/redefining diagram context + * @param detailEClass + * the metaclass of the detail of the notation view to verify + * @param detailType + * the kind of detail of the notation view to verify + * + * @throws IllegalArgumentException + * if the {@code detailType} is not a class of the Notation package + */ + private <T extends EObject> void assertDetail(IGraphicalEditPart inherited, IGraphicalEditPart local, + EClass detailEClass, Class<T> detailType, BiConsumer<? super T, ? super T> assertion) { + + View inheritedView = inherited.getNotationView(); + View localView = local.getNotationView(); + + // First, make sure that we aren't comparing an object to itself + assertThat(localView, not(sameInstance(inheritedView))); + + EStructuralFeature detail; + + switch (detailEClass.getClassifierID()) { + case NotationPackage.LOCATION: + case NotationPackage.SIZE: + case NotationPackage.BOUNDS: + detail = NotationPackage.Literals.NODE__LAYOUT_CONSTRAINT; + break; + case NotationPackage.RELATIVE_BENDPOINTS: + detail = NotationPackage.Literals.EDGE__BENDPOINTS; + break; + default: + throw new IllegalArgumentException("Unsupported assertion detail: " + detailEClass); + } + + Object inheritedDetail = inheritedView.eGet(detail); + Object localDetail = localView.eGet(detail); + + assertion.accept(detailType.cast(localDetail), detailType.cast(inheritedDetail)); + } + + /** + * Verifies that an edit-part in the {@link local} diagram context did not follow the corresponding + * edit-part {@link inherited} from the supertype context in the specified detail. + * + * @param inherited + * an edit-part in the inherited diagram context + * @param local + * the corresponding edit-part in the inheriting/redefining diagram context + * @param detailType + * the kind of detail of the notation view to verify + * + * @throws IllegalArgumentException + * if the {@code detailType} is not a class of the Notation package + */ + protected void assertNotFollowed(IGraphicalEditPart inherited, IGraphicalEditPart local, EClass detailType) { + if (detailType.getEPackage() != NotationPackage.eINSTANCE) { + throw new IllegalArgumentException("not a Notation class: " + detailType.getName()); + } + + switch (detailType.getClassifierID()) { + case NotationPackage.LOCATION: + assertDetail(inherited, local, detailType, Location.class, this::assertNotEquals); + break; + case NotationPackage.SIZE: + assertDetail(inherited, local, detailType, Size.class, this::assertNotEquals); + break; + case NotationPackage.BOUNDS: + assertDetail(inherited, local, detailType, Bounds.class, this::assertNotEquals); + break; + case NotationPackage.RELATIVE_BENDPOINTS: + assertDetail(inherited, local, detailType, RelativeBendpoints.class, this::assertNotEquals); + break; + } + } + + private void assertNotEquals(Location expected, Location actual) { + assertThat("same location", actual, not(both(compose(Location::getX, is(expected.getX()))).and( + compose(Location::getY, is(expected.getY()))))); + } + + private void assertNotEquals(Size expected, Size actual) { + assertThat("same size", actual, not(both(compose(Size::getWidth, is(expected.getWidth()))).and( + compose(Size::getHeight, is(expected.getHeight()))))); + } + + private void assertNotEquals(Bounds expected, Bounds actual) { + assertThat("same bounds", actual, not(both(compose(Bounds::getWidth, is(expected.getWidth()))).and( + compose(Bounds::getHeight, is(expected.getHeight()))).and( + compose(Location::getX, is(expected.getX()))) + .and(compose(Location::getY, is(expected.getY()))))); + } + + private void assertNotEquals(RelativeBendpoints expected, RelativeBendpoints actual) { + assertThat("same bendpoints", actual.getPoints(), not(expected.getPoints())); + } +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/CapsuleStructureDiagramCapsulePartInheritanceTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/CapsuleStructureDiagramCapsulePartInheritanceTest.java new file mode 100644 index 000000000..cc689d359 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/CapsuleStructureDiagramCapsulePartInheritanceTest.java @@ -0,0 +1,159 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.inheritance.tests; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.RGB; +import org.junit.Test; + +/** + * Capsule-part inheritance test cases for the Capsule Structure Diagram. + */ +@PluginResource("resource/inheritance/parts.di") +@ActiveDiagram("Capsule1") // We usually start the test with some action in the superclass diagram +public class CapsuleStructureDiagramCapsulePartInheritanceTest extends AbstractInheritanceTest { + + public CapsuleStructureDiagramCapsulePartInheritanceTest() { + super(); + } + + @Test + public void followCapsulePart() { + // Expand the part around its centre + UMLRTCapsulePart part = getCapsulePart("capsule3"); + IGraphicalEditPart partEP = requireEditPart(part); + resize(partEP, 20, 20); + + // Check that the part in the other diagram followed it + activateDiagram("Capsule2"); + IGraphicalEditPart redefEP = requireEditPart(getRedefinition(part)); + assertFollowed(redefEP, partEP, NotationPackage.Literals.BOUNDS); + + undo(); + + assertFollowed(redefEP, partEP, NotationPackage.Literals.BOUNDS); + + redo(); + + assertFollowed(redefEP, partEP, NotationPackage.Literals.BOUNDS); + } + + @Test + public void unfollowPart() { + UMLRTCapsulePart part = getCapsulePart("capsule3"); + IGraphicalEditPart partEP = requireEditPart(part); + + activateDiagram("Capsule2"); + UMLRTCapsulePart redef = getRedefinition(part); + IGraphicalEditPart redefEP = requireEditPart(redef); + unfollow(redefEP); + + activateDiagram(part); + resize(partEP, 20, 20); + + // Check that the part in the other diagram did not follow it + activateDiagram(redef); + assertNotFollowed(partEP, redefEP, NotationPackage.Literals.BOUNDS); + } + + @Test + public void autoUnfollowPart() { + UMLRTCapsulePart part = getCapsulePart("capsule3"); + IGraphicalEditPart partEP = requireEditPart(part); + + activateDiagram("Capsule2"); + UMLRTCapsulePart redef = getRedefinition(part); + IGraphicalEditPart redefEP = requireEditPart(redef); + + // Resize the redefining part so that it will unfollow + resize(redefEP, -10, -10); + + activateDiagram(part); + resize(partEP, 20, 20); + + // Check that the part in the other diagram did not follow it + activateDiagram(redef); + assertNotFollowed(partEP, redefEP, NotationPackage.Literals.BOUNDS); + } + + @Test + public void addNewPartToSuperclass() { + UMLRTCapsulePart initialPart = getCapsulePart("capsule3"); + UMLRTCapsule owner = initialPart.getCapsule(); + + UMLRTCapsulePart newPart = execute(() -> owner.createCapsulePart(owner.getPackage().createCapsule("NewCapsule"))); + + // Place the new part + IGraphicalEditPart partEP = requireEditPart(newPart); + resize(partEP, 10, 10); + + // Check that the part in the subclass followed it + activateDiagram("Capsule2"); + IGraphicalEditPart redefEP = requireEditPart(getRedefinition(newPart)); + assertFollowed(partEP, redefEP, NotationPackage.Literals.BOUNDS); + } + + @Test + @ActiveDiagram("Capsule2") + public void partExclusion() { + UMLRTCapsulePart part = getCapsule("Capsule2").getCapsulePart("capsule3"); + IGraphicalEditPart partEP = requireEditPart(part); + + execute(() -> part.exclude()); + + partEP = getEditPart(part.toUML()); + assertThat(partEP, nullValue()); + } + + @Test + public void partAppearance() { + UMLRTCapsulePart part = getCapsulePart("capsule3"); + IGraphicalEditPart partEP = requireEditPart(part); + + IFigure figure = getCoreFigure(partEP); + RGB fg = figure.getForegroundColor().getRGB(); + + // Check that the part in the subclass is colored appropriately + activateDiagram("Capsule2"); + UMLRTCapsulePart redefPart = getRedefinition(part); + IGraphicalEditPart redefEP = requireEditPart(redefPart); + IFigure redefFig = getCoreFigure(redefEP); + + assertThat("Wrong capsule-part color", redefFig.getForegroundColor().getRGB(), not(fg)); + + // Inherited capsule-part has normal label + IGraphicalEditPart redefLabel = requireLabel(redefPart); + IFigure redefLabelFig = getCoreFigure(redefLabel); + FontData fontData = redefLabelFig.getFont().getFontData()[0]; + assertThat(fontData.getStyle() & SWT.BOLD, is(0)); + + // But a redefined capsule-part that overrides the inherted type has a bold label + execute(() -> redefPart.setType(redefPart.getType().getPackage().createCapsule("NewCapsule"))); + fontData = redefLabelFig.getFont().getFontData()[0]; + assertThat(fontData.getStyle() & SWT.BOLD, is(SWT.BOLD)); + } +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/CapsuleStructureDiagramConnectorInheritanceTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/CapsuleStructureDiagramConnectorInheritanceTest.java new file mode 100644 index 000000000..77f2b36e4 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/CapsuleStructureDiagramConnectorInheritanceTest.java @@ -0,0 +1,148 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.inheritance.tests; + +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTConnector; +import org.eclipse.swt.graphics.RGB; +import org.junit.Test; + +/** + * Connector inheritance test cases for the Capsule Structure Diagram. + */ +@PluginResource("resource/inheritance/connectors.di") +@ActiveDiagram("Capsule1") // We usually start the test with some action in the superclass diagram +public class CapsuleStructureDiagramConnectorInheritanceTest extends AbstractInheritanceTest { + + public CapsuleStructureDiagramConnectorInheritanceTest() { + super(); + } + + @Test + public void followConnector() { + // Add a bend-point to the connector + UMLRTConnector connector = getConnector("RTConnector1"); + IGraphicalEditPart connectorEP = requireEditPart(connector); + bend(connectorEP, 100, 20); + + // Check that the port in the other diagram followed it + activateDiagram("Capsule2"); + IGraphicalEditPart redefEP = requireEditPart(getRedefinition(connector)); + assertFollowed(redefEP, connectorEP, NotationPackage.Literals.RELATIVE_BENDPOINTS); + + undo(); + + assertFollowed(redefEP, connectorEP, NotationPackage.Literals.RELATIVE_BENDPOINTS); + + redo(); + + assertFollowed(redefEP, connectorEP, NotationPackage.Literals.RELATIVE_BENDPOINTS); + } + + @Test + public void unfollowConnector() { + UMLRTConnector connector = getConnector("RTConnector1"); + IGraphicalEditPart connectorEP = requireEditPart(connector); + + activateDiagram("Capsule2"); + UMLRTConnector redef = getRedefinition(connector); + IGraphicalEditPart redefEP = requireEditPart(redef); + unfollow(redefEP); + + activateDiagram(connector); + bend(connectorEP, 100, 20); + + // Check that the part in the other diagram did not follow it + activateDiagram(redef); + assertNotFollowed(connectorEP, redefEP, NotationPackage.Literals.RELATIVE_BENDPOINTS); + } + + @Test + public void autoUnfollowConnector() { + UMLRTConnector connector = getConnector("RTConnector1"); + IGraphicalEditPart connectorEP = requireEditPart(connector); + + activateDiagram("Capsule2"); + UMLRTConnector redef = getRedefinition(connector); + IGraphicalEditPart redefEP = requireEditPart(redef); + + // Add a bendpoint to the redefining connector so that it will unfollow + bend(redefEP, 100, 100); + + activateDiagram(connector); + bend(connectorEP, 100, 20); + + // Check that the connector in the other diagram did not follow it + activateDiagram(redef); + assertNotFollowed(connectorEP, redefEP, NotationPackage.Literals.RELATIVE_BENDPOINTS); + } + + @Test + @NeedsUIEvents + public void addNewConnectorToSuperclass() { + UMLRTConnector initialConnector = getConnector("RTConnector1"); + UMLRTCapsule owner = initialConnector.getCapsule(); + + UMLRTConnector newConnector = execute(() -> owner.createConnector("RTConnector2", + getPort("protocol2"), null, + getPortOnPart("capsule3", "protocol2"), getCapsulePart("capsule3"))); + + // Place the new part + IGraphicalEditPart connectorEP = requireEditPart(newConnector); + bend(connectorEP, 100, 100); + + // Check that the connector in the subclass followed it + activateDiagram("Capsule2"); + IGraphicalEditPart redefEP = requireEditPart(getRedefinition(newConnector)); + assertFollowed(connectorEP, redefEP, NotationPackage.Literals.RELATIVE_BENDPOINTS); + } + + @Test + @ActiveDiagram("Capsule2") + public void connectorExclusion() { + UMLRTConnector part = getCapsule("Capsule2").getConnector("RTConnector1"); + IGraphicalEditPart partEP = requireEditPart(part); + + execute(() -> part.exclude()); + + partEP = getEditPart(part.toUML()); + assertThat(partEP, nullValue()); + } + + @Test + public void connectorAppearance() { + UMLRTConnector connector = getConnector("RTConnector1"); + IGraphicalEditPart connectorEP = requireEditPart(connector); + + IFigure figure = getCoreFigure(connectorEP); + RGB fg = figure.getForegroundColor().getRGB(); + + // Check that the port in the subclass is colored appropriately + activateDiagram("Capsule2"); + UMLRTConnector redefConnector = getRedefinition(connector); + IGraphicalEditPart redefEP = requireEditPart(redefConnector); + IFigure redefFig = getCoreFigure(redefEP); + + assertThat("Wrong connector color", redefFig.getForegroundColor().getRGB(), not(fg)); + } +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/CapsuleStructureDiagramPortInheritanceTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/CapsuleStructureDiagramPortInheritanceTest.java new file mode 100644 index 000000000..c05e738ad --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/inheritance/tests/CapsuleStructureDiagramPortInheritanceTest.java @@ -0,0 +1,284 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.inheritance.tests; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.Arrays; +import java.util.function.BiFunction; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.RGB; +import org.hamcrest.Matcher; +import org.junit.Assume; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +/** + * Port inheritance test cases for the Capsule Structure Diagram. + */ +@ActiveDiagram("Capsule1") // We usually start the test with some action in the superclass diagram +@RunWith(Parameterized.class) +public class CapsuleStructureDiagramPortInheritanceTest extends AbstractInheritanceTest { + + private final BiFunction<AbstractInheritanceTest, String, UMLRTPort> getPort; + private final boolean portSameColor; + + public CapsuleStructureDiagramPortInheritanceTest(String modelPath, PortTestKind testKind) { + super(modelPath); + + this.getPort = testKind.portFunction(); + this.portSameColor = testKind.isPortSameColor(); + } + + @Test + public void followPort() { + // Nudge the port up along the edge + UMLRTPort port = getPort.apply(this, "protocol1"); + IGraphicalEditPart portEP = requireEditPart(port); + move(portEP, 0, -50); + + // Check that the port in the other diagram followed it + activateDiagram("Capsule2"); + IGraphicalEditPart redefEP = requireEditPart(getRedefinition(port)); + assertFollowed(redefEP, portEP, NotationPackage.Literals.LOCATION); + + undo(); + + assertFollowed(redefEP, portEP, NotationPackage.Literals.LOCATION); + + redo(); + + assertFollowed(redefEP, portEP, NotationPackage.Literals.LOCATION); + } + + @Test + public void unfollowPort() { + UMLRTPort port = getPort.apply(this, "protocol1"); + IGraphicalEditPart portEP = requireEditPart(port); + + activateDiagram("Capsule2"); + UMLRTPort redef = getRedefinition(port); + IGraphicalEditPart redefEP = requireEditPart(redef); + unfollow(redefEP); + + activateDiagram(port); + move(portEP, 0, -50); + + // Check that the port in the other diagram did not follow it + activateDiagram(redef); + assertNotFollowed(portEP, redefEP, NotationPackage.Literals.LOCATION); + } + + @Test + public void autoUnfollowPort() { + UMLRTPort port = getPort.apply(this, "protocol1"); + IGraphicalEditPart portEP = requireEditPart(port); + + activateDiagram("Capsule2"); + UMLRTPort redef = getRedefinition(port); + IGraphicalEditPart redefEP = requireEditPart(redef); + + // Move the redefining port so that it will unfollow + move(redefEP, 0, 10); + + activateDiagram(port); + move(portEP, 0, -50); + + // Check that the port in the other diagram did not follow it + activateDiagram(redef); + assertNotFollowed(portEP, redefEP, NotationPackage.Literals.LOCATION); + } + + @Test + public void followPortLabel() { + // Nudge the port label + UMLRTPort port = getPort.apply(this, "protocol1"); + IGraphicalEditPart portLabel = requireLabel(port); + move(portLabel, 10, -10); + + // Check that the port label in the other diagram followed it + activateDiagram("Capsule2"); + IGraphicalEditPart redefLabel = requireLabel(getRedefinition(port)); + assertFollowed(redefLabel, portLabel, NotationPackage.Literals.LOCATION); + + undo(); + + assertFollowed(redefLabel, portLabel, NotationPackage.Literals.LOCATION); + + redo(); + + assertFollowed(redefLabel, portLabel, NotationPackage.Literals.LOCATION); + } + + @Test + public void unfollowPortLabel() { + UMLRTPort port = getPort.apply(this, "protocol1"); + IGraphicalEditPart portLabel = requireLabel(port); + + activateDiagram("Capsule2"); + UMLRTPort redef = getRedefinition(port); + IGraphicalEditPart redefLabel = requireLabel(redef); + + // Following of the label goes as following of the port + unfollow(requireEditPart(redef)); + + activateDiagram(port); + move(portLabel, 10, -10); + + // Check that the port in the other diagram did not follow it + activateDiagram(redef); + assertNotFollowed(portLabel, redefLabel, NotationPackage.Literals.LOCATION); + } + + @Test + public void autoUnfollowPortLabel() { + UMLRTPort port = getPort.apply(this, "protocol1"); + IGraphicalEditPart portLabel = requireLabel(port); + + activateDiagram("Capsule2"); + UMLRTPort redef = getRedefinition(port); + IGraphicalEditPart redefLabel = requireLabel(redef); + + // Move the redefining port label so that it will unfollow + move(redefLabel, 10, 10); + + activateDiagram(port); + move(portLabel, 10, -10); + + // Check that the port label in the other diagram did not follow it + activateDiagram(redef); + assertNotFollowed(portLabel, redefLabel, NotationPackage.Literals.LOCATION); + } + + @Test + @NeedsUIEvents + public void addNewPortToSuperclass() { + UMLRTPort initialPort = getPort.apply(this, "protocol1"); + UMLRTCapsule owner = initialPort.getCapsule(); + + UMLRTPort newPort = execute(() -> owner.createPort(owner.getPackage().createProtocol("NewProtocol"))); + + // Place the new port + IGraphicalEditPart portEP = requireEditPart(newPort); + move(portEP, 0, 50); + + // Check that the port in the subclass followed it + activateDiagram("Capsule2"); + IGraphicalEditPart redefEP = requireEditPart(getRedefinition(newPort)); + assertFollowed(portEP, redefEP, NotationPackage.Literals.LOCATION); + } + + @Test + @ActiveDiagram("Capsule2") + public void portExclusion() { + Assume.assumeThat("Exclusion test case only applicable to port on capsule", portSameColor, is(false)); + + UMLRTPort port = getCapsule("Capsule2").getPort("protocol1"); + IGraphicalEditPart partEP = requireEditPart(port); + + execute(() -> port.exclude()); + + partEP = getEditPart(port.toUML()); + assertThat(partEP, nullValue()); + } + + @Test + public void portAppearance() { + UMLRTPort port = getPort.apply(this, "protocol1"); + IGraphicalEditPart portEP = requireEditPart(port); + + IFigure figure = getCoreFigure(portEP); + RGB fg = figure.getForegroundColor().getRGB(); + + // Check that the port in the subclass is colored appropriately + activateDiagram("Capsule2"); + UMLRTPort redefPort = getRedefinition(port); + IGraphicalEditPart redefEP = requireEditPart(redefPort); + IFigure redefFig = getCoreFigure(redefEP); + + Matcher<RGB> matcher = portSameColor ? is(fg) : not(fg); + assertThat("Wrong port color", redefFig.getForegroundColor().getRGB(), matcher); + + // This only makes sense for ports that actually are redefined. Our port-on-part + // scenario does not have an inherited port, but a port on an inherited part + if (!portSameColor) { + // Inherited port has normal label + IGraphicalEditPart redefLabel = requireLabel(redefPort); + IFigure redefLabelFig = getCoreFigure(redefLabel); + FontData fontData = redefLabelFig.getFont().getFontData()[0]; + assertThat(fontData.getStyle() & SWT.BOLD, is(0)); + + // But a redefined port that overrides the inherted type has a bold label + execute(() -> redefPort.setType(redefPort.getType().getPackage().createProtocol("NewProtocol"))); + fontData = redefLabelFig.getFont().getFontData()[0]; + assertThat(fontData.getStyle() & SWT.BOLD, is(SWT.BOLD)); + } + } + + // + // Test framework + // + + @Parameters(name = "{1}") + public static Iterable<Object[]> parameters() { + + return Arrays.asList(new Object[][] { + { "resource/inheritance/ports.di", PortTestKind.PORT }, + { "resource/inheritance/parts.di", PortTestKind.PORT_ON_PART }, + }); + } + + enum PortTestKind { + PORT("Port"), PORT_ON_PART("Port on Part"); + + private final String label; + + private PortTestKind(String label) { + this.label = label; + } + + BiFunction<AbstractInheritanceTest, String, UMLRTPort> portFunction() { + switch (this) { + case PORT: + return AbstractInheritanceTest::getPort; + case PORT_ON_PART: + return (test, name) -> test.getPortOnPart("capsule3", name); + default: + throw new AssertionError("Invalid port test kind: " + this); + } + } + + boolean isPortSameColor() { + return (this == PortTestKind.PORT_ON_PART); + } + + @Override + public String toString() { + return label; + } + } +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/locator/tests/RTPortPositionLocatorTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/locator/tests/RTPortPositionLocatorTest.java index 92f6aced7..e3be4005c 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/locator/tests/RTPortPositionLocatorTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/locator/tests/RTPortPositionLocatorTest.java @@ -8,7 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation - * Christian W. Damus - bug 496304 + * Christian W. Damus - bugs 496304, 467545 * *****************************************************************************/ @@ -45,6 +45,7 @@ import org.eclipse.papyrus.uml.diagram.composite.custom.figures.PortFigure; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart; import org.eclipse.papyrusrt.junit.rules.ElementTypesResource; import org.eclipse.papyrusrt.junit.rules.ElementTypesRule; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; import org.eclipse.papyrusrt.umlrt.core.utils.RTPortKindEnum; @@ -80,7 +81,7 @@ public class RTPortPositionLocatorTest extends AbstractPapyrusTest { public static final TestRule elementTypesRule = new ElementTypesRule(); @ClassRule - public static final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public static final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); private final PortEditingFixture ports = new PortEditingFixture(editor, "Capsule1"); private Point capsuleLocation = new Point(20, 20); diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/tests/AbstractPapyrusRTDiagramTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/tests/AbstractPapyrusRTDiagramTest.java new file mode 100644 index 000000000..a3f049f29 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/tests/AbstractPapyrusRTDiagramTest.java @@ -0,0 +1,414 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests; + +import static com.google.common.base.Predicates.not; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assume.assumeThat; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.Iterator; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.commands.operations.IUndoableOperation; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.workspace.IWorkspaceCommandStack; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.commands.Command; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.utils.TreeIterators; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.eclipse.papyrus.junit.utils.JUnitUtils; +import org.eclipse.papyrus.junit.utils.rules.AbstractHouseKeeperRule.CleanUp; +import org.eclipse.papyrus.junit.utils.rules.AnnotationRule; +import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; +import org.eclipse.papyrus.junit.utils.rules.JavaResource; +import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture.DiagramNaming; +import org.eclipse.papyrusrt.junit.rules.UIThreadRule; +import org.eclipse.papyrusrt.junit.rules.UMLRTViewpointRule; +import org.eclipse.uml2.uml.DirectedRelationship; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.util.UMLUtil; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.rules.TestRule; +import org.junit.runners.Parameterized; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Iterators; + +/** + * Abstract superclass suitable for most Papyrus-RT diagram tests. + */ +@DiagramNaming(CapsuleStructureDiagramNameStrategy.class) +public abstract class AbstractPapyrusRTDiagramTest extends AbstractPapyrusTest { + + @ClassRule + public static final TestRule VIEWPOINT_RULE = new UMLRTViewpointRule(); + + /** + * Tests using the diagram-editor fixture have to run in the UI thread. + */ + @Rule + public final TestRule uiThread = new UIThreadRule(); + + @Rule + public final HouseKeeper houseKeeper = new HouseKeeper(); + + @Rule + public final AnnotationRule<Boolean> needUIEvents = AnnotationRule.createExists(NeedsUIEvents.class); + + @Rule + public final PapyrusEditorFixture editor; + + @CleanUp + private ComposedAdapterFactory adapterFactory; + + @CleanUp + private IUndoableOperation undoMark; + + public AbstractPapyrusRTDiagramTest() { + super(); + + this.editor = new PapyrusRTEditorFixture(); + } + + /** + * Initializes me with a test resource path to inject not via an annotation. + * This is useful especially for {@link Parameterized parameterized} test suites. + * + * @param modelPath + * the model path to load instead of any that might be supplied by an annotaiton + * + * @see Parameterized + * @see PluginResource + * @see JavaResource + */ + public AbstractPapyrusRTDiagramTest(String modelPath) { + super(); + + this.editor = new PapyrusRTEditorFixture(modelPath); + } + + @Before + public void createAdapterFactory() { + adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + } + + protected DiagramEditPart getDiagramEditPart() { + return editor.getActiveDiagramEditor().getDiagramEditPart(); + } + + protected TreeIterator<IGraphicalEditPart> allContents(EditPart root, boolean includeRoot) { + return TreeIterators.filter(DiagramEditPartsUtil.getAllContents(root, includeRoot), IGraphicalEditPart.class); + } + + protected IGraphicalEditPart getEditPart(EObject element) { + return getEditPart(element, getDiagramEditPart()); + } + + protected IGraphicalEditPart getEditPart(EObject element, IGraphicalEditPart scope) { + IGraphicalEditPart result = null; + + com.google.common.base.Predicate<EditPart> isLabel = LabelEditPart.class::isInstance; + TreeIterator<IGraphicalEditPart> nonLabels = TreeIterators.filter(allContents(scope, true), not(isLabel)); + + for (Iterator<IGraphicalEditPart> iter = nonLabels; iter.hasNext();) { + IGraphicalEditPart next = iter.next(); + + // We don't want to get the label edit-parts by this means (we search for them as + // a specific child of a shape edit-part). We especially don't want applied-stereotype labels + if (!(next instanceof LabelEditPart) && (next.resolveSemanticElement() == element)) { + result = next; + break; + } + } + + return result; + } + + protected IGraphicalEditPart requireEditPart(EObject element) { + IGraphicalEditPart result = getEditPart(element, getDiagramEditPart()); + assertThat("No edit part for " + label(element), result, notNullValue()); + return result; + } + + protected IGraphicalEditPart getConnectionEditPart(EObject element) { + IGraphicalEditPart result = null; + + for (Iterator<IGraphicalEditPart> iter = Iterators.filter(getDiagramEditPart().getConnections().iterator(), IGraphicalEditPart.class); iter.hasNext();) { + IGraphicalEditPart next = iter.next(); + View view = next.getNotationView(); + if ((view != null) && (view.getElement() == element)) { + result = next; + break; + } + } + + return result; + } + + protected IGraphicalEditPart requireConnectionEditPart(EObject element) { + IGraphicalEditPart result = getConnectionEditPart(element); + assertThat("No connection edit part for " + label(element), result, notNullValue()); + return result; + } + + protected View getView(EObject element, View scope) { + View result = null; + + for (Iterator<View> iter = Iterators.filter(scope.eAllContents(), View.class); (result == null) && iter.hasNext();) { + View next = iter.next(); + if (next.getElement() == element) { + result = next; + } + } + + return result; + } + + protected View requireView(EObject element, View scope) { + View result = getView(element, scope); + assertThat("View not found: " + label(element), result, notNullValue()); + return result; + } + + protected View assumeView(EObject element, View scope) { + View result = getView(element, scope); + assumeThat("View not found: " + label(element), result, notNullValue()); + return result; + } + + protected String label(EObject object) { + String result; + + if (object instanceof ENamedElement) { + result = ((UMLUtil.getQualifiedName((ENamedElement) object, NamedElement.SEPARATOR))); + } else { + IItemLabelProvider labels = (IItemLabelProvider) adapterFactory.adapt(object, IItemLabelProvider.class); + result = (labels == null) ? String.valueOf(object) : labels.getText(object); + } + + return result; + } + + protected View getView(EObject object) { + IGraphicalEditPart editPart = getEditPart(object); + if (editPart == null) { + // Maybe it's an edge + editPart = getConnectionEditPart(object); + } + return (editPart == null) ? null : editPart.getNotationView(); + } + + protected View requireView(EObject object) { + View result = getView(object); + assertThat("No view for " + label(object), result, notNullValue()); + return result; + } + + protected View assumeView(EObject object) { + View result = getView(object); + assumeThat("No view for " + label(object), result, notNullValue()); + return result; + } + + protected Edge requireEdge(View oneEnd, View otherEnd) { + Edge result = getEdge(oneEnd, otherEnd); + assertThat("No edge between " + label(oneEnd) + " and " + label(otherEnd), result, notNullValue()); + return result; + } + + protected Edge getEdge(View oneEnd, View otherEnd) { + Edge result = null; + + for (Edge next : Iterables.filter(oneEnd.getSourceEdges(), Edge.class)) { + if (next.getTarget() == otherEnd) { + result = next; + break; + } + } + + if (result == null) { + // Try the other way around + for (Edge next : Iterables.filter(oneEnd.getTargetEdges(), Edge.class)) { + if (next.getSource() == otherEnd) { + result = next; + break; + } + } + } + + return result; + } + + protected <T extends DirectedRelationship> T getRelationship(NamedElement from, NamedElement to, Class<T> type) { + T result = null; + + for (T next : Iterables.filter(from.getSourceDirectedRelationships(), type)) { + if (next.getTargets().contains(to)) { + result = next; + break; + } + } + + return result; + } + + protected void execute(ICommand command) { + execute(GMFtoEMFCommandWrapper.wrap(command)); + } + + protected void execute(Command command) { + execute(GEFtoEMFCommandWrapper.wrap(command)); + } + + protected void execute(org.eclipse.emf.common.command.Command command) { + assertThat("Cannot execute command", command.canExecute(), is(true)); + editor.getEditingDomain().getCommandStack().execute(command); + waitForUIEvents(); + } + + protected final void waitForUIEvents() { + // If we're running the tests in the IDE, we should see what's happening. Or, it could be that a + // particular test actually needs UI events to be processed before proceeding + if (!JUnitUtils.isAutomatedBuildExecution() || isNeedUIEvents()) { + editor.flushDisplayEvents(); + } + } + + protected final boolean isNeedUIEvents() { + return needUIEvents.get(); + } + + protected void execute(final Runnable writeOperation) { + execute(new RecordingCommand(editor.getEditingDomain()) { + + @Override + protected void doExecute() { + writeOperation.run(); + } + }); + } + + protected <T> T execute(Supplier<T> supplier) { + AtomicReference<T> result = new AtomicReference<>(null); + + execute(new RecordingCommand(editor.getEditingDomain()) { + + @Override + protected void doExecute() { + result.set(supplier.get()); + } + }); + + return result.get(); + } + + protected void undo() { + CommandStack stack = editor.getEditingDomain().getCommandStack(); + assertThat("Cannot undo", stack.canUndo(), is(true)); + stack.undo(); + waitForUIEvents(); + } + + /** + * Marks the current place in the undo history for a subsequent {@link #undoToMark()} + * to unwind the history back to that same state. This simplifies test cases that + * need to execute a sequence of commands and then undo them all or, as happens + * sometimes with canonical view creation, have asynchronous layout commands executed + * on their behalf without their knowledge, depending on the configuration of + * installed plug-ins. + * + * @see #undoToMark() + */ + protected void markForUndo() { + IWorkspaceCommandStack stack = (IWorkspaceCommandStack) editor.getEditingDomain().getCommandStack(); + IOperationHistory history = stack.getOperationHistory(); + undoMark = history.getUndoOperation(stack.getDefaultUndoContext()); + } + + /** + * Undoes the top command in the undo history until the previously established + * {@linkplain #markForUndo() mark} is reached. + * + * @see #markForUndo() + */ + protected void undoToMark() { + IWorkspaceCommandStack stack = (IWorkspaceCommandStack) editor.getEditingDomain().getCommandStack(); + IOperationHistory history = stack.getOperationHistory(); + IUndoContext ctx = stack.getDefaultUndoContext(); + + try { + IUndoableOperation lastOperation; + + do { + IUndoableOperation topOperation = history.getUndoOperation(ctx); + assertThat("Cannot undo", stack.canUndo(), is(true)); + stack.undo(); + lastOperation = history.getUndoOperation(ctx); + assertThat("Undo failed; check log for an exception", lastOperation, not(topOperation)); + } while ((lastOperation != null) && (lastOperation != undoMark)); + + waitForUIEvents(); + } finally { + undoMark = null; + } + } + + protected void redo() { + CommandStack stack = editor.getEditingDomain().getCommandStack(); + assertThat("Cannot redo", stack.canRedo(), is(true)); + stack.redo(); + waitForUIEvents(); + } + + // + // Nested types + // + + @Retention(RetentionPolicy.RUNTIME) + @Target({ ElementType.TYPE, ElementType.METHOD }) + protected @interface NeedsUIEvents { + // Empty + } + +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/tests/CapsuleStructureDiagramNameStrategy.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/tests/CapsuleStructureDiagramNameStrategy.java new file mode 100644 index 000000000..4960ffd05 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/common/tests/CapsuleStructureDiagramNameStrategy.java @@ -0,0 +1,38 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.common.tests; + +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture.DiagramNameStrategy; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.common.utils.UMLRTCapsuleStructureDiagramUtils; + +/** + * Diagram naming strategy supporting capsule-structure diagrams. + * + * @see PapyrusRTEditorFixture.DiagramNaming + */ +public final class CapsuleStructureDiagramNameStrategy implements DiagramNameStrategy { + + @Override + public boolean canName(Diagram diagram) { + return UMLRTCapsuleStructureDiagramUtils.isCapsuleStructureDiagram(diagram); + } + + @Override + public String getName(Diagram diagram) { + return UMLRTCapsuleStructureDiagramUtils.getDisplayedCapsuleStructureDiagramName(diagram); + } + +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests.launch b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests.launch index c3d160e71..c058f381c 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests.launch +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests.launch @@ -9,6 +9,9 @@ <booleanAttribute key="clearConfig" value="true"/> <booleanAttribute key="clearws" value="true"/> <booleanAttribute key="clearwslog" value="false"/> +<listAttribute key="com.mountainminds.eclemma.core.SCOPE_IDS"> +<listEntry value="=org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src"/> +</listAttribute> <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/> <booleanAttribute key="default" value="true"/> <booleanAttribute key="includeOptional" value="true"/> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/allelements/various.di b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/allelements/various.di new file mode 100644 index 000000000..bf9abab34 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/allelements/various.di @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/allelements/various.notation b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/allelements/various.notation new file mode 100644 index 000000000..4439bd918 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/allelements/various.notation @@ -0,0 +1,315 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <notation:Diagram xmi:id="_cZ1jkKaqEeaVuqljGw-fqQ" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_caQaUKaqEeaVuqljGw-fqQ" type="Class_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_VG04ELp2EeaV0fVWRP8bJg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_VG04Ebp2EeaV0fVWRP8bJg" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_caTdoKaqEeaVuqljGw-fqQ" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_caTdoaaqEeaVuqljGw-fqQ" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_caTdoqaqEeaVuqljGw-fqQ" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_caUEsKaqEeaVuqljGw-fqQ" type="Class_StructureCompartment"> + <children xmi:type="notation:Shape" xmi:id="_cjYwQLp2EeaV0fVWRP8bJg" type="Property_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_d7dWcLp2EeaV0fVWRP8bJg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_d7dWcbp2EeaV0fVWRP8bJg" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_cjZXULp2EeaV0fVWRP8bJg" type="Property_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_cjZXUbp2EeaV0fVWRP8bJg" type="Property_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_cjZXUrp2EeaV0fVWRP8bJg" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cjZXU7p2EeaV0fVWRP8bJg" type="Property_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cjZXVLp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjZXVbp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_cjh6MLp2EeaV0fVWRP8bJg" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cjh6Mbp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjh6Mrp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cjihQLp2EeaV0fVWRP8bJg" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cjihQbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cjihQrp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjihQ7p2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cjihRLp2EeaV0fVWRP8bJg" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cjihRbp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjihRrp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cjjvYLp2EeaV0fVWRP8bJg" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cjjvYbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cjjvYrp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjjvY7p2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_d5mVQLp2EeaV0fVWRP8bJg" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_d7d9gLp2EeaV0fVWRP8bJg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_d7d9gbp2EeaV0fVWRP8bJg" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_d5mVQrp2EeaV0fVWRP8bJg" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_d5mVQ7p2EeaV0fVWRP8bJg" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_d5mVRLp2EeaV0fVWRP8bJg" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_d5mVRbp2EeaV0fVWRP8bJg" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="various.uml#_dVF6ALp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_d5mVQbp2EeaV0fVWRP8bJg" x="-5" y="16" width="11" height="11"/> + </children> + <element xmi:type="uml:Property" href="various.uml#_cisMsLp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjYwQbp2EeaV0fVWRP8bJg" x="125" y="46"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_cjjIULp2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cjjIUbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_cjjIU7p2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Property" href="various.uml#_cisMsLp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjjIUrp2EeaV0fVWRP8bJg" x="325" y="46"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_d5p_oLp2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_d5p_obp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_d5p_o7p2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="various.uml#_dVF6ALp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_d5p_orp2EeaV0fVWRP8bJg" x="194" y="-6"/> + </children> + <styles xmi:type="notation:TitleStyle" xmi:id="_caUEsaaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_caUEsqaqEeaVuqljGw-fqQ"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_VB7xALp2EeaV0fVWRP8bJg" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_VB7xAbp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB7xArp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_VB8YELp2EeaV0fVWRP8bJg" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VB8YEbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_VB8YErp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB8YE7p2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_VB8_ILp2EeaV0fVWRP8bJg" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VB8_Ibp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB8_Irp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_VB9mOrp2EeaV0fVWRP8bJg" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VB9mO7p2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_VB-NQLp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB-NQbp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_VB-0ULp2EeaV0fVWRP8bJg" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_VG04Erp2EeaV0fVWRP8bJg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_VG04E7p2EeaV0fVWRP8bJg" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_VB-0Urp2EeaV0fVWRP8bJg" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_VB-0U7p2EeaV0fVWRP8bJg" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_VB-0VLp2EeaV0fVWRP8bJg" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_VB-0Vbp2EeaV0fVWRP8bJg" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="various.uml#_uFmasKaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB-0Ubp2EeaV0fVWRP8bJg" x="-8" y="117" width="16" height="16"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_VB_bYLp2EeaV0fVWRP8bJg" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_VG04FLp2EeaV0fVWRP8bJg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_VG04Fbp2EeaV0fVWRP8bJg" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_VB_bYrp2EeaV0fVWRP8bJg" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_VB_bY7p2EeaV0fVWRP8bJg" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_VB_bZLp2EeaV0fVWRP8bJg" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_VB_bZbp2EeaV0fVWRP8bJg" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="various.uml#_0JPYIKaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB_bYbp2EeaV0fVWRP8bJg" x="-8" y="140" width="16" height="16"/> + </children> + <element xmi:type="uml:Class" href="various.uml#_cUZp8KaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_caQaUaaqEeaVuqljGw-fqQ" x="40" y="40" width="500" height="250"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_VB8_I7p2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VB8_JLp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VB8_Jrp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="various.uml#_cUZp8KaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB8_Jbp2EeaV0fVWRP8bJg" x="240" y="40"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_VCCesrp2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VCCes7p2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VCCetbp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="various.uml#_uFmasKaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VCCetLp2EeaV0fVWRP8bJg" x="192" y="-8"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_VCGJIbp2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VCGJIrp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VCGJJLp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="various.uml#_0JPYIKaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VCGJI7p2EeaV0fVWRP8bJg" x="192" y="-8"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_euCC4Lp2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_euCC4bp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_euCC47p2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Connector" href="various.uml#_etrdkLp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_euCC4rp2EeaV0fVWRP8bJg" x="192" y="17"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cZ1jkaaqEeaVuqljGw-fqQ" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_cZ1jkqaqEeaVuqljGw-fqQ"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_cZ1jk6aqEeaVuqljGw-fqQ"> + <owner xmi:type="uml:Class" href="various.uml#_cUZp8KaqEeaVuqljGw-fqQ"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="various.uml#_cUZp8KaqEeaVuqljGw-fqQ"/> + <edges xmi:type="notation:Connector" xmi:id="_VB9mMLp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_caQaUKaqEeaVuqljGw-fqQ" target="_VB8_I7p2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_VB9mMbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VB9mNbp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="various.uml#_cUZp8KaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VB9mMrp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VB9mM7p2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VB9mNLp2EeaV0fVWRP8bJg"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_VCCetrp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_VB-0ULp2EeaV0fVWRP8bJg" target="_VCCesrp2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_VCCet7p2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VCCeu7p2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="various.uml#_uFmasKaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VCCeuLp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VCCeubp2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VCCeurp2EeaV0fVWRP8bJg"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_VCGwILp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_VB_bYLp2EeaV0fVWRP8bJg" target="_VCGJIbp2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_VCGwIbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VCGwJbp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="various.uml#_0JPYIKaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VCGwIrp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VCGwI7p2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VCGwJLp2EeaV0fVWRP8bJg"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_cjjIVLp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_cjYwQLp2EeaV0fVWRP8bJg" target="_cjjIULp2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_cjjIVbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_cjjIWbp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Property" href="various.uml#_cisMsLp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_cjjIVrp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_cjjIV7p2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_cjjIWLp2EeaV0fVWRP8bJg"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_d5p_pLp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_d5mVQLp2EeaV0fVWRP8bJg" target="_d5p_oLp2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_d5p_pbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_d5p_qbp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="various.uml#_dVF6ALp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_d5p_prp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_d5p_p7p2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_d5p_qLp2EeaV0fVWRP8bJg"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_et0AcLp2EeaV0fVWRP8bJg" type="Connector_Edge" source="_VB-0ULp2EeaV0fVWRP8bJg" target="_d5mVQLp2EeaV0fVWRP8bJg"> + <children xmi:type="notation:DecorationNode" xmi:id="_et0ngLp2EeaV0fVWRP8bJg" type="Connector_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_et0ngbp2EeaV0fVWRP8bJg" y="60"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_et0ngrp2EeaV0fVWRP8bJg" type="Connector_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_et0ng7p2EeaV0fVWRP8bJg" y="-20"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_et0Acbp2EeaV0fVWRP8bJg"/> + <element xmi:type="uml:Connector" href="various.uml#_etrdkLp2EeaV0fVWRP8bJg"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_et0Acrp2EeaV0fVWRP8bJg" points="[48, 163, -643984, -643984]$[171, 128, -643984, -643984]"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_euCC5Lp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_et0AcLp2EeaV0fVWRP8bJg" target="_euCC4Lp2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_euCC5bp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_euCC6bp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Connector" href="various.uml#_etrdkLp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_euCC5rp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_euCC57p2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_euCC6Lp2EeaV0fVWRP8bJg"/> + </edges> + </notation:Diagram> + <notation:Diagram xmi:id="_eOk3oKaqEeaVuqljGw-fqQ" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_eOlesKaqEeaVuqljGw-fqQ" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_eOlesqaqEeaVuqljGw-fqQ" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_eOles6aqEeaVuqljGw-fqQ" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_eOletKaqEeaVuqljGw-fqQ" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_eOletaaqEeaVuqljGw-fqQ" type="Class_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_eOletqaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_eOlet6aqEeaVuqljGw-fqQ"/> + </children> + <element xmi:type="uml:Class" href="various.uml#_eOTK0KaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_eOlesaaqEeaVuqljGw-fqQ" x="40" y="40" width="500" height="250"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_eOk3oaaqEeaVuqljGw-fqQ" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_eOk3oqaqEeaVuqljGw-fqQ"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_eOk3o6aqEeaVuqljGw-fqQ"> + <owner xmi:type="uml:Class" href="various.uml#_eOTK0KaqEeaVuqljGw-fqQ"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="various.uml#_eOTK0KaqEeaVuqljGw-fqQ"/> + </notation:Diagram> + <notation:Diagram xmi:id="_go16oKaqEeaVuqljGw-fqQ" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_go2hsKaqEeaVuqljGw-fqQ" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_go2hsqaqEeaVuqljGw-fqQ" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_go2hs6aqEeaVuqljGw-fqQ" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_go2htKaqEeaVuqljGw-fqQ" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_go2htaaqEeaVuqljGw-fqQ" type="Class_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_go2htqaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_go2ht6aqEeaVuqljGw-fqQ"/> + </children> + <element xmi:type="uml:Class" href="various.uml#_golb8KaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_go2hsaaqEeaVuqljGw-fqQ" x="40" y="40" width="500" height="250"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_go16oaaqEeaVuqljGw-fqQ" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_go16oqaqEeaVuqljGw-fqQ"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_go16o6aqEeaVuqljGw-fqQ"> + <owner xmi:type="uml:Class" href="various.uml#_golb8KaqEeaVuqljGw-fqQ"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="various.uml#_golb8KaqEeaVuqljGw-fqQ"/> + </notation:Diagram> + <notation:Diagram xmi:id="_bbqTMLp2EeaV0fVWRP8bJg" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_bbq6QLp2EeaV0fVWRP8bJg" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_bbq6Qrp2EeaV0fVWRP8bJg" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_bbq6Q7p2EeaV0fVWRP8bJg" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_bbq6RLp2EeaV0fVWRP8bJg" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_bbq6Rbp2EeaV0fVWRP8bJg" type="Class_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_bbq6Rrp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bbq6R7p2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_d5j5ALp2EeaV0fVWRP8bJg" type="Port_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_d5j5Arp2EeaV0fVWRP8bJg" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_d5j5A7p2EeaV0fVWRP8bJg" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_d5j5BLp2EeaV0fVWRP8bJg" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_d5j5Bbp2EeaV0fVWRP8bJg" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="various.uml#_dVF6ALp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_d5j5Abp2EeaV0fVWRP8bJg" y="105" width="16" height="16"/> + </children> + <element xmi:type="uml:Class" href="various.uml#_bZqvILp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bbq6Qbp2EeaV0fVWRP8bJg" x="40" y="40" width="500" height="250"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_bbqTMbp2EeaV0fVWRP8bJg" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_bbqTMrp2EeaV0fVWRP8bJg"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_bbqTM7p2EeaV0fVWRP8bJg"> + <owner xmi:type="uml:Class" href="various.uml#_bZqvILp2EeaV0fVWRP8bJg"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="various.uml#_bZqvILp2EeaV0fVWRP8bJg"/> + </notation:Diagram> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/allelements/various.uml b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/allelements/various.uml new file mode 100644 index 000000000..e32afad1c --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/allelements/various.uml @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:UMLRealTime="http://www.eclipse.org/papyrus/umlrt" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <uml:Model xmi:id="_upCUYKapEeaVuqljGw-fqQ" name="various"> + <packageImport xmi:id="_4tIaoK5sEeab8Ykik38t7Q"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Class" xmi:id="_cUZp8KaqEeaVuqljGw-fqQ" name="RootCapsule" isActive="true"> + <ownedAttribute xmi:type="uml:Port" xmi:id="_uFmasKaqEeaVuqljGw-fqQ" name="protocol1" visibility="public" type="_ufaB0KaqEeaVuqljGw-fqQ" isOrdered="true" aggregation="composite"/> + <ownedAttribute xmi:type="uml:Port" xmi:id="_0JPYIKaqEeaVuqljGw-fqQ" name="protocol2" visibility="public" type="_0h-oQKaqEeaVuqljGw-fqQ" isOrdered="true" aggregation="composite" isBehavior="true"> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Lp1UoKarEeaVuqljGw-fqQ" value="4"/> + <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_MY-5oKarEeaVuqljGw-fqQ" value="4"/> + </ownedAttribute> + <ownedAttribute xmi:id="_cisMsLp2EeaV0fVWRP8bJg" name="nestedCapsule" visibility="protected" type="_bZqvILp2EeaV0fVWRP8bJg" isOrdered="true" aggregation="composite"/> + <ownedConnector xmi:id="_etrdkLp2EeaV0fVWRP8bJg" name="connector1"> + <end xmi:id="_etsrsLp2EeaV0fVWRP8bJg" role="_uFmasKaqEeaVuqljGw-fqQ"/> + <end xmi:id="_etsrsbp2EeaV0fVWRP8bJg" partWithPort="_cisMsLp2EeaV0fVWRP8bJg" role="_dVF6ALp2EeaV0fVWRP8bJg"/> + </ownedConnector> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_eOTK0KaqEeaVuqljGw-fqQ" name="Subcapsule" isActive="true"> + <generalization xmi:id="_2gbR8KaqEeaVuqljGw-fqQ" general="_cUZp8KaqEeaVuqljGw-fqQ"/> + <ownedAttribute xmi:type="uml:Port" xmi:id="_fWif4NT6EeafW_l8XPEIlA" name="redefProtocol1" isOrdered="true" redefinedProperty="_uFmasKaqEeaVuqljGw-fqQ" redefinedPort="_uFmasKaqEeaVuqljGw-fqQ"/> + <ownedAttribute xmi:type="uml:Port" xmi:id="_fWif4dT6EeafW_l8XPEIlA" name="excludedProtocol2" isOrdered="true" redefinedProperty="_0JPYIKaqEeaVuqljGw-fqQ" isBehavior="true" redefinedPort="_0JPYIKaqEeaVuqljGw-fqQ"/> + <ownedAttribute xmi:id="_fWif5NT6EeafW_l8XPEIlA" name="redefNestedCapsule" isOrdered="true" redefinedProperty="_cisMsLp2EeaV0fVWRP8bJg"/> + <ownedConnector xmi:id="_fWjG8NT6EeafW_l8XPEIlA" name="redefConnector1" redefinedConnector="_etrdkLp2EeaV0fVWRP8bJg"/> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_golb8KaqEeaVuqljGw-fqQ" name="Subsubcapsule" isActive="true"> + <generalization xmi:id="_4D3aoKaqEeaVuqljGw-fqQ" general="_eOTK0KaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_ufb3AKaqEeaVuqljGw-fqQ" name="Protocol1"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_ufaB0KaqEeaVuqljGw-fqQ" name="Protocol1"> + <interfaceRealization xmi:id="_ufgIcKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufeTQKaqEeaVuqljGw-fqQ" contract="_ufeTQKaqEeaVuqljGw-fqQ"/> + <interfaceRealization xmi:id="_ufmPEKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufkZ4KaqEeaVuqljGw-fqQ" contract="_ufkZ4KaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_ufeTQKaqEeaVuqljGw-fqQ" name="Protocol1"> + <ownedOperation xmi:id="_l58soK5lEeab8Ykik38t7Q" name="greet"> + <ownedParameter xmi:id="_0QqTgK5lEeab8Ykik38t7Q" name="data"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> + </ownedParameter> + </ownedOperation> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_ufhWkKaqEeaVuqljGw-fqQ" name="Protocol1~"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_ufjLwKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufhWkKaqEeaVuqljGw-fqQ"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_ufjy0KaqEeaVuqljGw-fqQ" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_ufkZ4KaqEeaVuqljGw-fqQ" name="Protocol1IO"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_ufm2IKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufkZ4KaqEeaVuqljGw-fqQ"/> + <packagedElement xmi:type="uml:CallEvent" xmi:id="_l6EocK5lEeab8Ykik38t7Q" operation="_l58soK5lEeab8Ykik38t7Q"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_0iAdcKaqEeaVuqljGw-fqQ" name="Protocol2"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_0h-oQKaqEeaVuqljGw-fqQ" name="Protocol2"> + <interfaceRealization xmi:id="_0iEH0KaqEeaVuqljGw-fqQ" client="_0h-oQKaqEeaVuqljGw-fqQ" supplier="_0iCSoKaqEeaVuqljGw-fqQ" contract="_0iCSoKaqEeaVuqljGw-fqQ"/> + <interfaceRealization xmi:id="_0i0VwKaqEeaVuqljGw-fqQ" client="_0h-oQKaqEeaVuqljGw-fqQ" supplier="_0iHyMKaqEeaVuqljGw-fqQ" contract="_0iHyMKaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_0iCSoKaqEeaVuqljGw-fqQ" name="Protocol2"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_0iEu4KaqEeaVuqljGw-fqQ" name="Protocol2~"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_0iGkEKaqEeaVuqljGw-fqQ" client="_0h-oQKaqEeaVuqljGw-fqQ" supplier="_0iEu4KaqEeaVuqljGw-fqQ"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_0iHLIKaqEeaVuqljGw-fqQ" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_0iHyMKaqEeaVuqljGw-fqQ" name="Protocol2IO"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_0i080KaqEeaVuqljGw-fqQ" client="_0h-oQKaqEeaVuqljGw-fqQ" supplier="_0iHyMKaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_YbdjIK31Eeab8Ykik38t7Q" name="nested"/> + <packagedElement xmi:type="uml:Class" xmi:id="_bZqvILp2EeaV0fVWRP8bJg" name="NestedCapsule" isActive="true"> + <ownedAttribute xmi:type="uml:Port" xmi:id="_dVF6ALp2EeaV0fVWRP8bJg" name="protocol1" visibility="public" type="_ufaB0KaqEeaVuqljGw-fqQ" isOrdered="true" aggregation="composite" isBehavior="true"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_lUf5INOnEeaFeYmSU0wjMA" name="Subprotocol"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_lUf5IdOnEeaFeYmSU0wjMA" name="Subprotocol"> + <generalization xmi:id="_G-7zcNOoEeaFeYmSU0wjMA" general="_ufaB0KaqEeaVuqljGw-fqQ"/> + <interfaceRealization xmi:id="_lUf5ItOnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5JNOnEeaFeYmSU0wjMA" contract="_lUf5JNOnEeaFeYmSU0wjMA"/> + <interfaceRealization xmi:id="_lUf5I9OnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5KNOnEeaFeYmSU0wjMA" contract="_lUf5KNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_lUf5JNOnEeaFeYmSU0wjMA" name="Subprotocol"> + <generalization xmi:id="_KJGCUNOoEeaFeYmSU0wjMA" general="_ufeTQKaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_lUf5JdOnEeaFeYmSU0wjMA" name="Subprotocol~"> + <generalization xmi:id="_RL2TYNOoEeaFeYmSU0wjMA" general="_ufhWkKaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_lUf5JtOnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5JdOnEeaFeYmSU0wjMA"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_lUf5J9OnEeaFeYmSU0wjMA" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_lUf5KNOnEeaFeYmSU0wjMA" name="SubprotocolIO"> + <generalization xmi:id="_TEKf4NOoEeaFeYmSU0wjMA" general="_ufkZ4KaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_lUf5KdOnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5KNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_u-RPwNOnEeaFeYmSU0wjMA" name="Subsubprotocol"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_u-RPwdOnEeaFeYmSU0wjMA" name="Subsubprotocol"> + <generalization xmi:id="_5pFMoNOnEeaFeYmSU0wjMA" general="_lUf5IdOnEeaFeYmSU0wjMA"/> + <interfaceRealization xmi:id="_u-RPwtOnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPxNOnEeaFeYmSU0wjMA" contract="_u-RPxNOnEeaFeYmSU0wjMA"/> + <interfaceRealization xmi:id="_u-RPw9OnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPyNOnEeaFeYmSU0wjMA" contract="_u-RPyNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_u-RPxNOnEeaFeYmSU0wjMA" name="Subsubprotocol"> + <generalization xmi:id="_9TS0kNOnEeaFeYmSU0wjMA" general="_lUf5JNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_u-RPxdOnEeaFeYmSU0wjMA" name="Subsubprotocol~"> + <generalization xmi:id="__nY-INOnEeaFeYmSU0wjMA" general="_lUf5JdOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_u-RPxtOnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPxdOnEeaFeYmSU0wjMA"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_u-RPx9OnEeaFeYmSU0wjMA" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_u-RPyNOnEeaFeYmSU0wjMA" name="SubsubprotocolIO"> + <generalization xmi:id="_ElZwQNOoEeaFeYmSU0wjMA" general="_lUf5KNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_u-RPydOnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPyNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_gMoP0NT5EeafW_l8XPEIlA" name="BogusCapsule" isActive="true"> + <ownedAttribute xmi:type="uml:Port" xmi:id="_jW5zcNT5EeafW_l8XPEIlA" name="nonRTPort" visibility="public" aggregation="composite"/> + <ownedAttribute xmi:id="_mrM1wNT5EeafW_l8XPEIlA" name="nonRTPart" visibility="protected" type="_bZqvILp2EeaV0fVWRP8bJg" aggregation="composite"/> + <ownedConnector xmi:id="_twWTgNT5EeafW_l8XPEIlA" name="nonRTConnector"> + <end xmi:id="_yLELUNT5EeafW_l8XPEIlA" role="_jW5zcNT5EeafW_l8XPEIlA"/> + <end xmi:id="_0xO8UNT5EeafW_l8XPEIlA" partWithPort="_mrM1wNT5EeafW_l8XPEIlA" role="_dVF6ALp2EeaV0fVWRP8bJg"/> + </ownedConnector> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_w1QwwNXPEeaPwoHF5ZFD8Q" name="PassiveClass"/> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_06VIsNXPEeaPwoHF5ZFD8Q" name="DesignCollaboration"/> + <profileApplication xmi:id="_usQngKapEeaVuqljGw-fqQ"> + <eAnnotations xmi:id="_usWHEKapEeaVuqljGw-fqQ" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt#/"/> + </eAnnotations> + <appliedProfile href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/> + </profileApplication> + </uml:Model> + <UMLRealTime:Capsule xmi:id="_caZkQKaqEeaVuqljGw-fqQ" base_Class="_cUZp8KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:Capsule xmi:id="_eOms0KaqEeaVuqljGw-fqQ" base_Class="_eOTK0KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:Capsule xmi:id="_go3IwKaqEeaVuqljGw-fqQ" base_Class="_golb8KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTPort xmi:id="_uFo28KaqEeaVuqljGw-fqQ" base_Port="_uFmasKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:ProtocolContainer xmi:id="_ufdFIKaqEeaVuqljGw-fqQ" base_Package="_ufb3AKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_uffhYKaqEeaVuqljGw-fqQ" base_Interface="_ufeTQKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_ufh9oKaqEeaVuqljGw-fqQ" base_Interface="_ufhWkKaqEeaVuqljGw-fqQ" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_ufloAKaqEeaVuqljGw-fqQ" base_Interface="_ufkZ4KaqEeaVuqljGw-fqQ" rtMsgKind="inOut"/> + <UMLRealTime:Protocol xmi:id="_ufndMKaqEeaVuqljGw-fqQ" base_Collaboration="_ufaB0KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTPort xmi:id="_0JRNUKaqEeaVuqljGw-fqQ" base_Port="_0JPYIKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:ProtocolContainer xmi:id="_0iBrkKaqEeaVuqljGw-fqQ" base_Package="_0iAdcKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_0iDgwKaqEeaVuqljGw-fqQ" base_Interface="_0iCSoKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_0iF9AKaqEeaVuqljGw-fqQ" base_Interface="_0iEu4KaqEeaVuqljGw-fqQ" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_0iIZQKaqEeaVuqljGw-fqQ" base_Interface="_0iHyMKaqEeaVuqljGw-fqQ" rtMsgKind="inOut"/> + <UMLRealTime:Protocol xmi:id="_0i080aaqEeaVuqljGw-fqQ" base_Collaboration="_0h-oQKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:Capsule xmi:id="_bbrhULp2EeaV0fVWRP8bJg" base_Class="_bZqvILp2EeaV0fVWRP8bJg"/> + <UMLRealTime:CapsulePart xmi:id="_cita0Lp2EeaV0fVWRP8bJg" base_Property="_cisMsLp2EeaV0fVWRP8bJg"/> + <UMLRealTime:RTPort xmi:id="_dVHIILp2EeaV0fVWRP8bJg" base_Port="_dVF6ALp2EeaV0fVWRP8bJg"/> + <UMLRealTime:RTConnector xmi:id="_etsrsrp2EeaV0fVWRP8bJg" base_Connector="_etrdkLp2EeaV0fVWRP8bJg"/> + <UMLRealTime:ProtocolContainer xmi:id="_lUsGYNOnEeaFeYmSU0wjMA" base_Package="_lUf5INOnEeaFeYmSU0wjMA"/> + <UMLRealTime:Protocol xmi:id="_lUtUgNOnEeaFeYmSU0wjMA" base_Collaboration="_lUf5IdOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_lUtUgdOnEeaFeYmSU0wjMA" base_Interface="_lUf5JNOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_lUtUgtOnEeaFeYmSU0wjMA" base_Interface="_lUf5JdOnEeaFeYmSU0wjMA" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_lUt7kNOnEeaFeYmSU0wjMA" base_Interface="_lUf5KNOnEeaFeYmSU0wjMA" rtMsgKind="inOut"/> + <UMLRealTime:ProtocolContainer xmi:id="_u-RPytOnEeaFeYmSU0wjMA" base_Package="_u-RPwNOnEeaFeYmSU0wjMA"/> + <UMLRealTime:Protocol xmi:id="_u-R20NOnEeaFeYmSU0wjMA" base_Collaboration="_u-RPwdOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_u-R20dOnEeaFeYmSU0wjMA" base_Interface="_u-RPxNOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_u-R20tOnEeaFeYmSU0wjMA" base_Interface="_u-RPxdOnEeaFeYmSU0wjMA" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_u-R209OnEeaFeYmSU0wjMA" base_Interface="_u-RPyNOnEeaFeYmSU0wjMA" rtMsgKind="inOut"/> + <UMLRealTime:Capsule xmi:id="_gM3gYNT5EeafW_l8XPEIlA" base_Class="_gMoP0NT5EeafW_l8XPEIlA"/> + <UMLRealTime:RTPort xmi:id="_gM5VkNT5EeafW_l8XPEIlA"/> + <UMLRealTime:RTPort xmi:id="_fWjG89T6EeafW_l8XPEIlA" base_Port="_fWif4NT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTPort xmi:id="_fWjG9NT6EeafW_l8XPEIlA" base_Port="_fWif4dT6EeafW_l8XPEIlA"/> + <UMLRealTime:CapsulePart xmi:id="_fWjG9dT6EeafW_l8XPEIlA" base_Property="_fWif5NT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTConnector xmi:id="_fWjG9tT6EeafW_l8XPEIlA" base_Connector="_fWjG8NT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTRedefinedElement xmi:id="_1lxiMNT6EeafW_l8XPEIlA" base_RedefinableElement="_fWif4NT6EeafW_l8XPEIlA" rootFragment="_uFmasKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTRedefinedElement xmi:id="_3Al6YNT6EeafW_l8XPEIlA" base_RedefinableElement="_fWif4dT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTRedefinedElement xmi:id="_4FnBsNT6EeafW_l8XPEIlA" base_RedefinableElement="_fWif5NT6EeafW_l8XPEIlA" rootFragment="_cisMsLp2EeaV0fVWRP8bJg"/> + <UMLRealTime:RTRedefinedElement xmi:id="_5mV0oNT6EeafW_l8XPEIlA" base_RedefinableElement="_fWjG8NT6EeafW_l8XPEIlA" rootFragment="_etrdkLp2EeaV0fVWRP8bJg"/> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/connectors.di b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/connectors.di new file mode 100644 index 000000000..bf9abab34 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/connectors.di @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/connectors.notation b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/connectors.notation new file mode 100644 index 000000000..708c3577a --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/connectors.notation @@ -0,0 +1,315 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <notation:Diagram xmi:id="_cZ1jkKaqEeaVuqljGw-fqQ" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_caQaUKaqEeaVuqljGw-fqQ" type="Class_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_VG04ELp2EeaV0fVWRP8bJg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_VG04Ebp2EeaV0fVWRP8bJg" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_caTdoKaqEeaVuqljGw-fqQ" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_caTdoaaqEeaVuqljGw-fqQ" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_caTdoqaqEeaVuqljGw-fqQ" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_caUEsKaqEeaVuqljGw-fqQ" type="Class_StructureCompartment"> + <children xmi:type="notation:Shape" xmi:id="_cjYwQLp2EeaV0fVWRP8bJg" type="Property_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_d7dWcLp2EeaV0fVWRP8bJg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_d7dWcbp2EeaV0fVWRP8bJg" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_cjZXULp2EeaV0fVWRP8bJg" type="Property_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_cjZXUbp2EeaV0fVWRP8bJg" type="Property_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_cjZXUrp2EeaV0fVWRP8bJg" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cjZXU7p2EeaV0fVWRP8bJg" type="Property_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cjZXVLp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjZXVbp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_cjh6MLp2EeaV0fVWRP8bJg" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cjh6Mbp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjh6Mrp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cjihQLp2EeaV0fVWRP8bJg" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cjihQbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cjihQrp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjihQ7p2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cjihRLp2EeaV0fVWRP8bJg" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cjihRbp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjihRrp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_cjjvYLp2EeaV0fVWRP8bJg" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cjjvYbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cjjvYrp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::CapsulePart"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_EQwT4EhOEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjjvY7p2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_d5mVQLp2EeaV0fVWRP8bJg" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_d7d9gLp2EeaV0fVWRP8bJg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_d7d9gbp2EeaV0fVWRP8bJg" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_d5mVQrp2EeaV0fVWRP8bJg" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_d5mVQ7p2EeaV0fVWRP8bJg" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_d5mVRLp2EeaV0fVWRP8bJg" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_d5mVRbp2EeaV0fVWRP8bJg" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_dVF6ALp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_d5mVQbp2EeaV0fVWRP8bJg" x="-5" y="16" width="11" height="11"/> + </children> + <element xmi:type="uml:Property" href="connectors.uml#_cisMsLp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjYwQbp2EeaV0fVWRP8bJg" x="125" y="46"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_cjjIULp2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_cjjIUbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_cjjIU7p2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Property" href="connectors.uml#_cisMsLp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cjjIUrp2EeaV0fVWRP8bJg" x="325" y="46"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_d5p_oLp2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_d5p_obp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_d5p_o7p2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_dVF6ALp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_d5p_orp2EeaV0fVWRP8bJg" x="194" y="-6"/> + </children> + <styles xmi:type="notation:TitleStyle" xmi:id="_caUEsaaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_caUEsqaqEeaVuqljGw-fqQ"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_VB7xALp2EeaV0fVWRP8bJg" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_VB7xAbp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB7xArp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_VB8YELp2EeaV0fVWRP8bJg" type="StereotypeBrace"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VB8YEbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_VB8YErp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB8YE7p2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_VB8_ILp2EeaV0fVWRP8bJg" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VB8_Ibp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB8_Irp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_VB9mOrp2EeaV0fVWRP8bJg" type="StereotypeCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VB9mO7p2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:StringValueStyle" xmi:id="_VB-NQLp2EeaV0fVWRP8bJg" name="stereotype" stringValue="UMLRealTime::Capsule"/> + <element xmi:type="uml:Stereotype" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_hcMIwEhNEeO0lv5O1DTHOQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB-NQbp2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_VB-0ULp2EeaV0fVWRP8bJg" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_VG04Erp2EeaV0fVWRP8bJg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_VG04E7p2EeaV0fVWRP8bJg" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_VB-0Urp2EeaV0fVWRP8bJg" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_VB-0U7p2EeaV0fVWRP8bJg" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_VB-0VLp2EeaV0fVWRP8bJg" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_VB-0Vbp2EeaV0fVWRP8bJg" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_uFmasKaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB-0Ubp2EeaV0fVWRP8bJg" x="-8" y="117" width="16" height="16"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_VB_bYLp2EeaV0fVWRP8bJg" type="Port_Shape"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_VG04FLp2EeaV0fVWRP8bJg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_VG04Fbp2EeaV0fVWRP8bJg" key="mutable" value="true"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_VB_bYrp2EeaV0fVWRP8bJg" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_VB_bY7p2EeaV0fVWRP8bJg" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_VB_bZLp2EeaV0fVWRP8bJg" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_VB_bZbp2EeaV0fVWRP8bJg" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_0JPYIKaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB_bYbp2EeaV0fVWRP8bJg" x="-8" y="140" width="16" height="16"/> + </children> + <element xmi:type="uml:Class" href="connectors.uml#_cUZp8KaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_caQaUaaqEeaVuqljGw-fqQ" x="40" y="40" width="500" height="250"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_VB8_I7p2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VB8_JLp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VB8_Jrp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="connectors.uml#_cUZp8KaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VB8_Jbp2EeaV0fVWRP8bJg" x="240" y="40"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_VCCesrp2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VCCes7p2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VCCetbp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_uFmasKaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VCCetLp2EeaV0fVWRP8bJg" x="192" y="-8"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_VCGJIbp2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_VCGJIrp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VCGJJLp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_0JPYIKaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VCGJI7p2EeaV0fVWRP8bJg" x="192" y="-8"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_euCC4Lp2EeaV0fVWRP8bJg" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_euCC4bp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_euCC47p2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Connector" href="connectors.uml#_etrdkLp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_euCC4rp2EeaV0fVWRP8bJg" x="192" y="17"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_cZ1jkaaqEeaVuqljGw-fqQ" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_cZ1jkqaqEeaVuqljGw-fqQ"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_cZ1jk6aqEeaVuqljGw-fqQ"> + <owner xmi:type="uml:Class" href="connectors.uml#_cUZp8KaqEeaVuqljGw-fqQ"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="connectors.uml#_cUZp8KaqEeaVuqljGw-fqQ"/> + <edges xmi:type="notation:Connector" xmi:id="_VB9mMLp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_caQaUKaqEeaVuqljGw-fqQ" target="_VB8_I7p2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_VB9mMbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VB9mNbp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="connectors.uml#_cUZp8KaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VB9mMrp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VB9mM7p2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VB9mNLp2EeaV0fVWRP8bJg"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_VCCetrp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_VB-0ULp2EeaV0fVWRP8bJg" target="_VCCesrp2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_VCCet7p2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VCCeu7p2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_uFmasKaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VCCeuLp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VCCeubp2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VCCeurp2EeaV0fVWRP8bJg"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_VCGwILp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_VB_bYLp2EeaV0fVWRP8bJg" target="_VCGJIbp2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_VCGwIbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_VCGwJbp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_0JPYIKaqEeaVuqljGw-fqQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VCGwIrp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VCGwI7p2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VCGwJLp2EeaV0fVWRP8bJg"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_cjjIVLp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_cjYwQLp2EeaV0fVWRP8bJg" target="_cjjIULp2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_cjjIVbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_cjjIWbp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Property" href="connectors.uml#_cisMsLp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_cjjIVrp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_cjjIV7p2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_cjjIWLp2EeaV0fVWRP8bJg"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_d5p_pLp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_d5mVQLp2EeaV0fVWRP8bJg" target="_d5p_oLp2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_d5p_pbp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_d5p_qbp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Port" href="connectors.uml#_dVF6ALp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_d5p_prp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_d5p_p7p2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_d5p_qLp2EeaV0fVWRP8bJg"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_et0AcLp2EeaV0fVWRP8bJg" type="Connector_Edge" source="_VB-0ULp2EeaV0fVWRP8bJg" target="_d5mVQLp2EeaV0fVWRP8bJg"> + <children xmi:type="notation:DecorationNode" xmi:id="_et0ngLp2EeaV0fVWRP8bJg" type="Connector_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_et0ngbp2EeaV0fVWRP8bJg" y="60"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_et0ngrp2EeaV0fVWRP8bJg" type="Connector_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_et0ng7p2EeaV0fVWRP8bJg" y="-20"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_et0Acbp2EeaV0fVWRP8bJg"/> + <element xmi:type="uml:Connector" href="connectors.uml#_etrdkLp2EeaV0fVWRP8bJg"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_et0Acrp2EeaV0fVWRP8bJg" points="[48, 163, -643984, -643984]$[171, 128, -643984, -643984]"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_euCC5Lp2EeaV0fVWRP8bJg" type="StereotypeCommentLink" source="_et0AcLp2EeaV0fVWRP8bJg" target="_euCC4Lp2EeaV0fVWRP8bJg"> + <styles xmi:type="notation:FontStyle" xmi:id="_euCC5bp2EeaV0fVWRP8bJg"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_euCC6bp2EeaV0fVWRP8bJg" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Connector" href="connectors.uml#_etrdkLp2EeaV0fVWRP8bJg"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_euCC5rp2EeaV0fVWRP8bJg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_euCC57p2EeaV0fVWRP8bJg"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_euCC6Lp2EeaV0fVWRP8bJg"/> + </edges> + </notation:Diagram> + <notation:Diagram xmi:id="_eOk3oKaqEeaVuqljGw-fqQ" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_eOlesKaqEeaVuqljGw-fqQ" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_eOlesqaqEeaVuqljGw-fqQ" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_eOles6aqEeaVuqljGw-fqQ" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_eOletKaqEeaVuqljGw-fqQ" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_eOletaaqEeaVuqljGw-fqQ" type="Class_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_eOletqaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_eOlet6aqEeaVuqljGw-fqQ"/> + </children> + <element xmi:type="uml:Class" href="connectors.uml#_eOTK0KaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_eOlesaaqEeaVuqljGw-fqQ" x="40" y="40" width="500" height="250"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_eOk3oaaqEeaVuqljGw-fqQ" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_eOk3oqaqEeaVuqljGw-fqQ"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_eOk3o6aqEeaVuqljGw-fqQ"> + <owner xmi:type="uml:Class" href="connectors.uml#_eOTK0KaqEeaVuqljGw-fqQ"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="connectors.uml#_eOTK0KaqEeaVuqljGw-fqQ"/> + </notation:Diagram> + <notation:Diagram xmi:id="_go16oKaqEeaVuqljGw-fqQ" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_go2hsKaqEeaVuqljGw-fqQ" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_go2hsqaqEeaVuqljGw-fqQ" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_go2hs6aqEeaVuqljGw-fqQ" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_go2htKaqEeaVuqljGw-fqQ" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_go2htaaqEeaVuqljGw-fqQ" type="Class_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_go2htqaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_go2ht6aqEeaVuqljGw-fqQ"/> + </children> + <element xmi:type="uml:Class" href="connectors.uml#_golb8KaqEeaVuqljGw-fqQ"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_go2hsaaqEeaVuqljGw-fqQ" x="40" y="40" width="500" height="250"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_go16oaaqEeaVuqljGw-fqQ" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_go16oqaqEeaVuqljGw-fqQ"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_go16o6aqEeaVuqljGw-fqQ"> + <owner xmi:type="uml:Class" href="connectors.uml#_golb8KaqEeaVuqljGw-fqQ"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="connectors.uml#_golb8KaqEeaVuqljGw-fqQ"/> + </notation:Diagram> + <notation:Diagram xmi:id="_bbqTMLp2EeaV0fVWRP8bJg" type="CompositeStructure" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_bbq6QLp2EeaV0fVWRP8bJg" type="Class_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_bbq6Qrp2EeaV0fVWRP8bJg" type="Class_NameLabel"/> + <children xmi:type="notation:DecorationNode" xmi:id="_bbq6Q7p2EeaV0fVWRP8bJg" type="Class_FloatingNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_bbq6RLp2EeaV0fVWRP8bJg" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_bbq6Rbp2EeaV0fVWRP8bJg" type="Class_StructureCompartment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_bbq6Rrp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bbq6R7p2EeaV0fVWRP8bJg"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_d5j5ALp2EeaV0fVWRP8bJg" type="Port_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_d5j5Arp2EeaV0fVWRP8bJg" type="Port_NameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_d5j5A7p2EeaV0fVWRP8bJg" x="25" y="3"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_d5j5BLp2EeaV0fVWRP8bJg" type="Port_StereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_d5j5Bbp2EeaV0fVWRP8bJg" x="25" y="-10"/> + </children> + <element xmi:type="uml:Port" href="connectors.uml#_dVF6ALp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_d5j5Abp2EeaV0fVWRP8bJg" y="105" width="16" height="16"/> + </children> + <element xmi:type="uml:Class" href="connectors.uml#_bZqvILp2EeaV0fVWRP8bJg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bbq6Qbp2EeaV0fVWRP8bJg" x="40" y="40" width="500" height="250"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_bbqTMbp2EeaV0fVWRP8bJg" name="diagram_compatibility_version" stringValue="1.2.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_bbqTMrp2EeaV0fVWRP8bJg"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_bbqTM7p2EeaV0fVWRP8bJg"> + <owner xmi:type="uml:Class" href="connectors.uml#_bZqvILp2EeaV0fVWRP8bJg"/> + <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/> + </styles> + <element xmi:type="uml:Class" href="connectors.uml#_bZqvILp2EeaV0fVWRP8bJg"/> + </notation:Diagram> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/connectors.uml b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/connectors.uml new file mode 100644 index 000000000..d219a8fe7 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/connectors.uml @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:UMLRealTime="http://www.eclipse.org/papyrus/umlrt" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <uml:Model xmi:id="_upCUYKapEeaVuqljGw-fqQ" name="connectors"> + <packageImport xmi:id="_4tIaoK5sEeab8Ykik38t7Q"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Class" xmi:id="_cUZp8KaqEeaVuqljGw-fqQ" name="RootCapsule" isActive="true"> + <ownedAttribute xmi:type="uml:Port" xmi:id="_uFmasKaqEeaVuqljGw-fqQ" name="protocol1" visibility="public" type="_ufaB0KaqEeaVuqljGw-fqQ" isOrdered="true" aggregation="composite"/> + <ownedAttribute xmi:type="uml:Port" xmi:id="_0JPYIKaqEeaVuqljGw-fqQ" name="protocol2" visibility="public" type="_0h-oQKaqEeaVuqljGw-fqQ" isOrdered="true" aggregation="composite" isBehavior="true"> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Lp1UoKarEeaVuqljGw-fqQ" value="4"/> + <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_MY-5oKarEeaVuqljGw-fqQ" value="4"/> + </ownedAttribute> + <ownedAttribute xmi:id="_cisMsLp2EeaV0fVWRP8bJg" name="nestedCapsule" visibility="protected" type="_bZqvILp2EeaV0fVWRP8bJg" isOrdered="true" aggregation="composite"/> + <ownedConnector xmi:id="_etrdkLp2EeaV0fVWRP8bJg" name="connector1"> + <end xmi:id="_etsrsLp2EeaV0fVWRP8bJg" role="_uFmasKaqEeaVuqljGw-fqQ"/> + <end xmi:id="_etsrsbp2EeaV0fVWRP8bJg" partWithPort="_cisMsLp2EeaV0fVWRP8bJg" role="_dVF6ALp2EeaV0fVWRP8bJg"/> + </ownedConnector> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_eOTK0KaqEeaVuqljGw-fqQ" name="Subcapsule" isActive="true"> + <generalization xmi:id="_2gbR8KaqEeaVuqljGw-fqQ" general="_cUZp8KaqEeaVuqljGw-fqQ"/> + <ownedAttribute xmi:type="uml:Port" xmi:id="_fWif4NT6EeafW_l8XPEIlA" name="redefProtocol1" isOrdered="true" redefinedProperty="_uFmasKaqEeaVuqljGw-fqQ" redefinedPort="_uFmasKaqEeaVuqljGw-fqQ"/> + <ownedAttribute xmi:type="uml:Port" xmi:id="_fWif4dT6EeafW_l8XPEIlA" name="redefProtocol2" isOrdered="true" redefinedProperty="_0JPYIKaqEeaVuqljGw-fqQ" isBehavior="true" redefinedPort="_0JPYIKaqEeaVuqljGw-fqQ"/> + <ownedAttribute xmi:id="_fWif5NT6EeafW_l8XPEIlA" name="redefNestedCapsule" isOrdered="true" redefinedProperty="_cisMsLp2EeaV0fVWRP8bJg"/> + <ownedConnector xmi:id="_fWjG8NT6EeafW_l8XPEIlA" name="redefConnector1" redefinedConnector="_etrdkLp2EeaV0fVWRP8bJg"/> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_golb8KaqEeaVuqljGw-fqQ" name="Subsubcapsule" isActive="true"> + <generalization xmi:id="_4D3aoKaqEeaVuqljGw-fqQ" general="_eOTK0KaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_ufb3AKaqEeaVuqljGw-fqQ" name="Protocol1"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_ufaB0KaqEeaVuqljGw-fqQ" name="Protocol1"> + <interfaceRealization xmi:id="_ufgIcKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufeTQKaqEeaVuqljGw-fqQ" contract="_ufeTQKaqEeaVuqljGw-fqQ"/> + <interfaceRealization xmi:id="_ufmPEKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufkZ4KaqEeaVuqljGw-fqQ" contract="_ufkZ4KaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_ufeTQKaqEeaVuqljGw-fqQ" name="Protocol1"> + <ownedOperation xmi:id="_l58soK5lEeab8Ykik38t7Q" name="greet"> + <ownedParameter xmi:id="_0QqTgK5lEeab8Ykik38t7Q" name="data"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> + </ownedParameter> + </ownedOperation> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_ufhWkKaqEeaVuqljGw-fqQ" name="Protocol1~"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_ufjLwKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufhWkKaqEeaVuqljGw-fqQ"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_ufjy0KaqEeaVuqljGw-fqQ" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_ufkZ4KaqEeaVuqljGw-fqQ" name="Protocol1IO"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_ufm2IKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufkZ4KaqEeaVuqljGw-fqQ"/> + <packagedElement xmi:type="uml:CallEvent" xmi:id="_l6EocK5lEeab8Ykik38t7Q" operation="_l58soK5lEeab8Ykik38t7Q"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_0iAdcKaqEeaVuqljGw-fqQ" name="Protocol2"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_0h-oQKaqEeaVuqljGw-fqQ" name="Protocol2"> + <interfaceRealization xmi:id="_0iEH0KaqEeaVuqljGw-fqQ" client="_0h-oQKaqEeaVuqljGw-fqQ" supplier="_0iCSoKaqEeaVuqljGw-fqQ" contract="_0iCSoKaqEeaVuqljGw-fqQ"/> + <interfaceRealization xmi:id="_0i0VwKaqEeaVuqljGw-fqQ" client="_0h-oQKaqEeaVuqljGw-fqQ" supplier="_0iHyMKaqEeaVuqljGw-fqQ" contract="_0iHyMKaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_0iCSoKaqEeaVuqljGw-fqQ" name="Protocol2"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_0iEu4KaqEeaVuqljGw-fqQ" name="Protocol2~"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_0iGkEKaqEeaVuqljGw-fqQ" client="_0h-oQKaqEeaVuqljGw-fqQ" supplier="_0iEu4KaqEeaVuqljGw-fqQ"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_0iHLIKaqEeaVuqljGw-fqQ" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_0iHyMKaqEeaVuqljGw-fqQ" name="Protocol2IO"/> + <packagedElement xmi:type="uml:Usage" xmi:id="_0i080KaqEeaVuqljGw-fqQ" client="_0h-oQKaqEeaVuqljGw-fqQ" supplier="_0iHyMKaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_YbdjIK31Eeab8Ykik38t7Q" name="nested"/> + <packagedElement xmi:type="uml:Class" xmi:id="_bZqvILp2EeaV0fVWRP8bJg" name="NestedCapsule" isActive="true"> + <ownedAttribute xmi:type="uml:Port" xmi:id="_dVF6ALp2EeaV0fVWRP8bJg" name="protocol1" visibility="public" type="_ufaB0KaqEeaVuqljGw-fqQ" isOrdered="true" aggregation="composite" isBehavior="true"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_lUf5INOnEeaFeYmSU0wjMA" name="Subprotocol"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_lUf5IdOnEeaFeYmSU0wjMA" name="Subprotocol"> + <generalization xmi:id="_G-7zcNOoEeaFeYmSU0wjMA" general="_ufaB0KaqEeaVuqljGw-fqQ"/> + <interfaceRealization xmi:id="_lUf5ItOnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5JNOnEeaFeYmSU0wjMA" contract="_lUf5JNOnEeaFeYmSU0wjMA"/> + <interfaceRealization xmi:id="_lUf5I9OnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5KNOnEeaFeYmSU0wjMA" contract="_lUf5KNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_lUf5JNOnEeaFeYmSU0wjMA" name="Subprotocol"> + <generalization xmi:id="_KJGCUNOoEeaFeYmSU0wjMA" general="_ufeTQKaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_lUf5JdOnEeaFeYmSU0wjMA" name="Subprotocol~"> + <generalization xmi:id="_RL2TYNOoEeaFeYmSU0wjMA" general="_ufhWkKaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_lUf5JtOnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5JdOnEeaFeYmSU0wjMA"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_lUf5J9OnEeaFeYmSU0wjMA" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_lUf5KNOnEeaFeYmSU0wjMA" name="SubprotocolIO"> + <generalization xmi:id="_TEKf4NOoEeaFeYmSU0wjMA" general="_ufkZ4KaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_lUf5KdOnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5KNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_u-RPwNOnEeaFeYmSU0wjMA" name="Subsubprotocol"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_u-RPwdOnEeaFeYmSU0wjMA" name="Subsubprotocol"> + <generalization xmi:id="_5pFMoNOnEeaFeYmSU0wjMA" general="_lUf5IdOnEeaFeYmSU0wjMA"/> + <interfaceRealization xmi:id="_u-RPwtOnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPxNOnEeaFeYmSU0wjMA" contract="_u-RPxNOnEeaFeYmSU0wjMA"/> + <interfaceRealization xmi:id="_u-RPw9OnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPyNOnEeaFeYmSU0wjMA" contract="_u-RPyNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_u-RPxNOnEeaFeYmSU0wjMA" name="Subsubprotocol"> + <generalization xmi:id="_9TS0kNOnEeaFeYmSU0wjMA" general="_lUf5JNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_u-RPxdOnEeaFeYmSU0wjMA" name="Subsubprotocol~"> + <generalization xmi:id="__nY-INOnEeaFeYmSU0wjMA" general="_lUf5JdOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_u-RPxtOnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPxdOnEeaFeYmSU0wjMA"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_u-RPx9OnEeaFeYmSU0wjMA" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_u-RPyNOnEeaFeYmSU0wjMA" name="SubsubprotocolIO"> + <generalization xmi:id="_ElZwQNOoEeaFeYmSU0wjMA" general="_lUf5KNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_u-RPydOnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPyNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_gMoP0NT5EeafW_l8XPEIlA" name="BogusCapsule" isActive="true"> + <ownedAttribute xmi:type="uml:Port" xmi:id="_jW5zcNT5EeafW_l8XPEIlA" name="nonRTPort" visibility="public" aggregation="composite"/> + <ownedAttribute xmi:id="_mrM1wNT5EeafW_l8XPEIlA" name="nonRTPart" visibility="protected" type="_bZqvILp2EeaV0fVWRP8bJg" aggregation="composite"/> + <ownedConnector xmi:id="_twWTgNT5EeafW_l8XPEIlA" name="nonRTConnector"> + <end xmi:id="_yLELUNT5EeafW_l8XPEIlA" role="_jW5zcNT5EeafW_l8XPEIlA"/> + <end xmi:id="_0xO8UNT5EeafW_l8XPEIlA" partWithPort="_mrM1wNT5EeafW_l8XPEIlA" role="_dVF6ALp2EeaV0fVWRP8bJg"/> + </ownedConnector> + </packagedElement> + <profileApplication xmi:id="_usQngKapEeaVuqljGw-fqQ"> + <eAnnotations xmi:id="_usWHEKapEeaVuqljGw-fqQ" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt#/"/> + </eAnnotations> + <appliedProfile href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/> + </profileApplication> + </uml:Model> + <UMLRealTime:Capsule xmi:id="_caZkQKaqEeaVuqljGw-fqQ" base_Class="_cUZp8KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:Capsule xmi:id="_eOms0KaqEeaVuqljGw-fqQ" base_Class="_eOTK0KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:Capsule xmi:id="_go3IwKaqEeaVuqljGw-fqQ" base_Class="_golb8KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTPort xmi:id="_uFo28KaqEeaVuqljGw-fqQ" base_Port="_uFmasKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:ProtocolContainer xmi:id="_ufdFIKaqEeaVuqljGw-fqQ" base_Package="_ufb3AKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_uffhYKaqEeaVuqljGw-fqQ" base_Interface="_ufeTQKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_ufh9oKaqEeaVuqljGw-fqQ" base_Interface="_ufhWkKaqEeaVuqljGw-fqQ" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_ufloAKaqEeaVuqljGw-fqQ" base_Interface="_ufkZ4KaqEeaVuqljGw-fqQ" rtMsgKind="inOut"/> + <UMLRealTime:Protocol xmi:id="_ufndMKaqEeaVuqljGw-fqQ" base_Collaboration="_ufaB0KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTPort xmi:id="_0JRNUKaqEeaVuqljGw-fqQ" base_Port="_0JPYIKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:ProtocolContainer xmi:id="_0iBrkKaqEeaVuqljGw-fqQ" base_Package="_0iAdcKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_0iDgwKaqEeaVuqljGw-fqQ" base_Interface="_0iCSoKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_0iF9AKaqEeaVuqljGw-fqQ" base_Interface="_0iEu4KaqEeaVuqljGw-fqQ" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_0iIZQKaqEeaVuqljGw-fqQ" base_Interface="_0iHyMKaqEeaVuqljGw-fqQ" rtMsgKind="inOut"/> + <UMLRealTime:Protocol xmi:id="_0i080aaqEeaVuqljGw-fqQ" base_Collaboration="_0h-oQKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:Capsule xmi:id="_bbrhULp2EeaV0fVWRP8bJg" base_Class="_bZqvILp2EeaV0fVWRP8bJg"/> + <UMLRealTime:CapsulePart xmi:id="_cita0Lp2EeaV0fVWRP8bJg" base_Property="_cisMsLp2EeaV0fVWRP8bJg"/> + <UMLRealTime:RTPort xmi:id="_dVHIILp2EeaV0fVWRP8bJg" base_Port="_dVF6ALp2EeaV0fVWRP8bJg"/> + <UMLRealTime:RTConnector xmi:id="_etsrsrp2EeaV0fVWRP8bJg" base_Connector="_etrdkLp2EeaV0fVWRP8bJg"/> + <UMLRealTime:ProtocolContainer xmi:id="_lUsGYNOnEeaFeYmSU0wjMA" base_Package="_lUf5INOnEeaFeYmSU0wjMA"/> + <UMLRealTime:Protocol xmi:id="_lUtUgNOnEeaFeYmSU0wjMA" base_Collaboration="_lUf5IdOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_lUtUgdOnEeaFeYmSU0wjMA" base_Interface="_lUf5JNOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_lUtUgtOnEeaFeYmSU0wjMA" base_Interface="_lUf5JdOnEeaFeYmSU0wjMA" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_lUt7kNOnEeaFeYmSU0wjMA" base_Interface="_lUf5KNOnEeaFeYmSU0wjMA" rtMsgKind="inOut"/> + <UMLRealTime:ProtocolContainer xmi:id="_u-RPytOnEeaFeYmSU0wjMA" base_Package="_u-RPwNOnEeaFeYmSU0wjMA"/> + <UMLRealTime:Protocol xmi:id="_u-R20NOnEeaFeYmSU0wjMA" base_Collaboration="_u-RPwdOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_u-R20dOnEeaFeYmSU0wjMA" base_Interface="_u-RPxNOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_u-R20tOnEeaFeYmSU0wjMA" base_Interface="_u-RPxdOnEeaFeYmSU0wjMA" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_u-R209OnEeaFeYmSU0wjMA" base_Interface="_u-RPyNOnEeaFeYmSU0wjMA" rtMsgKind="inOut"/> + <UMLRealTime:Capsule xmi:id="_gM3gYNT5EeafW_l8XPEIlA" base_Class="_gMoP0NT5EeafW_l8XPEIlA"/> + <UMLRealTime:RTPort xmi:id="_gM5VkNT5EeafW_l8XPEIlA"/> + <UMLRealTime:RTPort xmi:id="_fWjG89T6EeafW_l8XPEIlA" base_Port="_fWif4NT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTPort xmi:id="_fWjG9NT6EeafW_l8XPEIlA" base_Port="_fWif4dT6EeafW_l8XPEIlA"/> + <UMLRealTime:CapsulePart xmi:id="_fWjG9dT6EeafW_l8XPEIlA" base_Property="_fWif5NT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTConnector xmi:id="_fWjG9tT6EeafW_l8XPEIlA" base_Connector="_fWjG8NT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTRedefinedElement xmi:id="_1lxiMNT6EeafW_l8XPEIlA" base_RedefinableElement="_fWif4NT6EeafW_l8XPEIlA" rootFragment="_uFmasKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTRedefinedElement xmi:id="_3Al6YNT6EeafW_l8XPEIlA" base_RedefinableElement="_fWif4dT6EeafW_l8XPEIlA" rootFragment="_0JPYIKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTRedefinedElement xmi:id="_4FnBsNT6EeafW_l8XPEIlA" base_RedefinableElement="_fWif5NT6EeafW_l8XPEIlA" rootFragment="_cisMsLp2EeaV0fVWRP8bJg"/> + <UMLRealTime:RTRedefinedElement xmi:id="_5mV0oNT6EeafW_l8XPEIlA" base_RedefinableElement="_fWjG8NT6EeafW_l8XPEIlA" rootFragment="_etrdkLp2EeaV0fVWRP8bJg"/> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/protocols.di b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/protocols.di new file mode 100644 index 000000000..bf9abab34 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/protocols.di @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/protocols.notation b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/protocols.notation new file mode 100644 index 000000000..bf9abab34 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/protocols.notation @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/protocols.uml b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/protocols.uml new file mode 100644 index 000000000..008c991dc --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/resource/inheritance/protocols.uml @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:UMLRealTime="http://www.eclipse.org/papyrus/umlrt" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <uml:Model xmi:id="_upCUYKapEeaVuqljGw-fqQ" name="protocols"> + <packageImport xmi:id="_4tIaoK5sEeab8Ykik38t7Q"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Package" xmi:id="_ufb3AKaqEeaVuqljGw-fqQ" name="RootProtocol"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_ufaB0KaqEeaVuqljGw-fqQ" name="RootProtocol"> + <interfaceRealization xmi:id="_ufgIcKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufeTQKaqEeaVuqljGw-fqQ" contract="_ufeTQKaqEeaVuqljGw-fqQ"/> + <interfaceRealization xmi:id="_ufmPEKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufkZ4KaqEeaVuqljGw-fqQ" contract="_ufkZ4KaqEeaVuqljGw-fqQ"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_ufeTQKaqEeaVuqljGw-fqQ" name="RootProtocol"> + <ownedOperation xmi:id="_l58soK5lEeab8Ykik38t7Q" name="greet"> + <ownedParameter xmi:id="_0QqTgK5lEeab8Ykik38t7Q" name="data"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> + </ownedParameter> + </ownedOperation> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_ufhWkKaqEeaVuqljGw-fqQ" name="RootProtocol~"> + <ownedOperation xmi:id="_t4x58NT9EeafW_l8XPEIlA" name="ack"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_ufjLwKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufhWkKaqEeaVuqljGw-fqQ"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_ufjy0KaqEeaVuqljGw-fqQ" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_ufkZ4KaqEeaVuqljGw-fqQ" name="RootProtocolIO"> + <ownedOperation xmi:id="_wiV9MNT9EeafW_l8XPEIlA" name="exchange"> + <ownedParameter xmi:id="_yX9bANT9EeafW_l8XPEIlA" name="data"/> + </ownedOperation> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_ufm2IKaqEeaVuqljGw-fqQ" client="_ufaB0KaqEeaVuqljGw-fqQ" supplier="_ufkZ4KaqEeaVuqljGw-fqQ"/> + <packagedElement xmi:type="uml:CallEvent" xmi:id="_l6EocK5lEeab8Ykik38t7Q" operation="_l58soK5lEeab8Ykik38t7Q"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_lUf5INOnEeaFeYmSU0wjMA" name="Subprotocol"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_lUf5IdOnEeaFeYmSU0wjMA" name="Subprotocol"> + <generalization xmi:id="_G-7zcNOoEeaFeYmSU0wjMA" general="_ufaB0KaqEeaVuqljGw-fqQ"/> + <interfaceRealization xmi:id="_lUf5ItOnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5JNOnEeaFeYmSU0wjMA" contract="_lUf5JNOnEeaFeYmSU0wjMA"/> + <interfaceRealization xmi:id="_lUf5I9OnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5KNOnEeaFeYmSU0wjMA" contract="_lUf5KNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_lUf5JNOnEeaFeYmSU0wjMA" name="Subprotocol"> + <generalization xmi:id="_KJGCUNOoEeaFeYmSU0wjMA" general="_ufeTQKaqEeaVuqljGw-fqQ"/> + <ownedOperation xmi:id="_0yY2ENT9EeafW_l8XPEIlA" name="greet" redefinedOperation="_l58soK5lEeab8Ykik38t7Q"> + <ownedParameter xmi:id="_0yY2EdT9EeafW_l8XPEIlA" name="data"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> + </ownedParameter> + </ownedOperation> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_lUf5JdOnEeaFeYmSU0wjMA" name="Subprotocol~"> + <generalization xmi:id="_RL2TYNOoEeaFeYmSU0wjMA" general="_ufhWkKaqEeaVuqljGw-fqQ"/> + <ownedOperation xmi:id="_1YzV0NT9EeafW_l8XPEIlA" name="ack" redefinedOperation="_t4x58NT9EeafW_l8XPEIlA"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_lUf5JtOnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5JdOnEeaFeYmSU0wjMA"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_lUf5J9OnEeaFeYmSU0wjMA" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_lUf5KNOnEeaFeYmSU0wjMA" name="SubprotocolIO"> + <generalization xmi:id="_TEKf4NOoEeaFeYmSU0wjMA" general="_ufkZ4KaqEeaVuqljGw-fqQ"/> + <ownedOperation xmi:id="_2JFjQNT9EeafW_l8XPEIlA" name="exchange" redefinedOperation="_wiV9MNT9EeafW_l8XPEIlA"> + <ownedParameter xmi:id="_2JFjQdT9EeafW_l8XPEIlA" name="data"/> + </ownedOperation> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_lUf5KdOnEeaFeYmSU0wjMA" client="_lUf5IdOnEeaFeYmSU0wjMA" supplier="_lUf5KNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_u-RPwNOnEeaFeYmSU0wjMA" name="Subsubprotocol"> + <packagedElement xmi:type="uml:Collaboration" xmi:id="_u-RPwdOnEeaFeYmSU0wjMA" name="Subsubprotocol"> + <generalization xmi:id="_5pFMoNOnEeaFeYmSU0wjMA" general="_lUf5IdOnEeaFeYmSU0wjMA"/> + <interfaceRealization xmi:id="_u-RPwtOnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPxNOnEeaFeYmSU0wjMA" contract="_u-RPxNOnEeaFeYmSU0wjMA"/> + <interfaceRealization xmi:id="_u-RPw9OnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPyNOnEeaFeYmSU0wjMA" contract="_u-RPyNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_u-RPxNOnEeaFeYmSU0wjMA" name="Subsubprotocol"> + <generalization xmi:id="_9TS0kNOnEeaFeYmSU0wjMA" general="_lUf5JNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_u-RPxdOnEeaFeYmSU0wjMA" name="Subsubprotocol~"> + <generalization xmi:id="__nY-INOnEeaFeYmSU0wjMA" general="_lUf5JdOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_u-RPxtOnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPxdOnEeaFeYmSU0wjMA"/> + <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_u-RPx9OnEeaFeYmSU0wjMA" name="*"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_u-RPyNOnEeaFeYmSU0wjMA" name="SubsubprotocolIO"> + <generalization xmi:id="_ElZwQNOoEeaFeYmSU0wjMA" general="_lUf5KNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <packagedElement xmi:type="uml:Usage" xmi:id="_u-RPydOnEeaFeYmSU0wjMA" client="_u-RPwdOnEeaFeYmSU0wjMA" supplier="_u-RPyNOnEeaFeYmSU0wjMA"/> + </packagedElement> + <profileApplication xmi:id="_usQngKapEeaVuqljGw-fqQ"> + <eAnnotations xmi:id="_usWHEKapEeaVuqljGw-fqQ" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt#/"/> + </eAnnotations> + <appliedProfile href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/> + </profileApplication> + </uml:Model> + <UMLRealTime:Capsule xmi:id="_caZkQKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:Capsule xmi:id="_eOms0KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:Capsule xmi:id="_go3IwKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTPort xmi:id="_uFo28KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:ProtocolContainer xmi:id="_ufdFIKaqEeaVuqljGw-fqQ" base_Package="_ufb3AKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_uffhYKaqEeaVuqljGw-fqQ" base_Interface="_ufeTQKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_ufh9oKaqEeaVuqljGw-fqQ" base_Interface="_ufhWkKaqEeaVuqljGw-fqQ" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_ufloAKaqEeaVuqljGw-fqQ" base_Interface="_ufkZ4KaqEeaVuqljGw-fqQ" rtMsgKind="inOut"/> + <UMLRealTime:Protocol xmi:id="_ufndMKaqEeaVuqljGw-fqQ" base_Collaboration="_ufaB0KaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTPort xmi:id="_0JRNUKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:ProtocolContainer xmi:id="_0iBrkKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_0iDgwKaqEeaVuqljGw-fqQ"/> + <UMLRealTime:RTMessageSet xmi:id="_0iF9AKaqEeaVuqljGw-fqQ" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_0iIZQKaqEeaVuqljGw-fqQ" rtMsgKind="inOut"/> + <UMLRealTime:Protocol xmi:id="_0i080aaqEeaVuqljGw-fqQ"/> + <UMLRealTime:Capsule xmi:id="_bbrhULp2EeaV0fVWRP8bJg"/> + <UMLRealTime:CapsulePart xmi:id="_cita0Lp2EeaV0fVWRP8bJg"/> + <UMLRealTime:RTPort xmi:id="_dVHIILp2EeaV0fVWRP8bJg"/> + <UMLRealTime:RTConnector xmi:id="_etsrsrp2EeaV0fVWRP8bJg"/> + <UMLRealTime:ProtocolContainer xmi:id="_lUsGYNOnEeaFeYmSU0wjMA" base_Package="_lUf5INOnEeaFeYmSU0wjMA"/> + <UMLRealTime:Protocol xmi:id="_lUtUgNOnEeaFeYmSU0wjMA" base_Collaboration="_lUf5IdOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_lUtUgdOnEeaFeYmSU0wjMA" base_Interface="_lUf5JNOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_lUtUgtOnEeaFeYmSU0wjMA" base_Interface="_lUf5JdOnEeaFeYmSU0wjMA" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_lUt7kNOnEeaFeYmSU0wjMA" base_Interface="_lUf5KNOnEeaFeYmSU0wjMA" rtMsgKind="inOut"/> + <UMLRealTime:ProtocolContainer xmi:id="_u-RPytOnEeaFeYmSU0wjMA" base_Package="_u-RPwNOnEeaFeYmSU0wjMA"/> + <UMLRealTime:Protocol xmi:id="_u-R20NOnEeaFeYmSU0wjMA" base_Collaboration="_u-RPwdOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_u-R20dOnEeaFeYmSU0wjMA" base_Interface="_u-RPxNOnEeaFeYmSU0wjMA"/> + <UMLRealTime:RTMessageSet xmi:id="_u-R20tOnEeaFeYmSU0wjMA" base_Interface="_u-RPxdOnEeaFeYmSU0wjMA" rtMsgKind="out"/> + <UMLRealTime:RTMessageSet xmi:id="_u-R209OnEeaFeYmSU0wjMA" base_Interface="_u-RPyNOnEeaFeYmSU0wjMA" rtMsgKind="inOut"/> + <UMLRealTime:Capsule xmi:id="_gM3gYNT5EeafW_l8XPEIlA"/> + <UMLRealTime:RTPort xmi:id="_gM5VkNT5EeafW_l8XPEIlA"/> + <UMLRealTime:RTPort xmi:id="_fWjG89T6EeafW_l8XPEIlA"/> + <UMLRealTime:RTPort xmi:id="_fWjG9NT6EeafW_l8XPEIlA"/> + <UMLRealTime:CapsulePart xmi:id="_fWjG9dT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTConnector xmi:id="_fWjG9tT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTRedefinedElement xmi:id="_1lxiMNT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTRedefinedElement xmi:id="_3Al6YNT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTRedefinedElement xmi:id="_4FnBsNT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTRedefinedElement xmi:id="_5mV0oNT6EeafW_l8XPEIlA"/> + <UMLRealTime:RTRedefinedElement xmi:id="_B3sfcNT-EeafW_l8XPEIlA" base_RedefinableElement="_0yY2ENT9EeafW_l8XPEIlA" rootFragment="_l58soK5lEeab8Ykik38t7Q"/> + <UMLRealTime:RTRedefinedElement xmi:id="_GJS3gNT-EeafW_l8XPEIlA" base_RedefinableElement="_1YzV0NT9EeafW_l8XPEIlA" rootFragment="_t4x58NT9EeafW_l8XPEIlA"/> + <UMLRealTime:RTRedefinedElement xmi:id="_JqcDANT-EeafW_l8XPEIlA" base_RedefinableElement="_2JFjQNT9EeafW_l8XPEIlA" rootFragment="_wiV9MNT9EeafW_l8XPEIlA"/> +</xmi:XMI> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/labels/LabelProviderTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/labels/LabelProviderTest.java index 837dd0a2c..5ffcd2699 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/labels/LabelProviderTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/labels/LabelProviderTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2016 CEA LIST and others. + * Copyright (c) 2016 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Christian W. Damus - bug 467545 * *****************************************************************************/ package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests.labels; @@ -25,6 +26,7 @@ import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrusrt.junit.rules.ElementTypesRule; +import org.eclipse.papyrusrt.junit.rules.PapyrusRTEditorFixture; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.provider.UMLRTFilteredLabelProvider; import org.eclipse.swt.graphics.Image; @@ -58,7 +60,7 @@ public class LabelProviderTest extends AbstractPapyrusTest { public static final TestRule uiThread = new UIThreadRule(); @ClassRule - public static final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + public static final PapyrusEditorFixture editor = new PapyrusRTEditorFixture(); private static ILabelProvider labelProvider; diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/AbstractRTQueryTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/AbstractRTQueryTest.java new file mode 100644 index 000000000..e49e372ac --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/AbstractRTQueryTest.java @@ -0,0 +1,158 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests.queries; + +import static org.hamcrest.CoreMatchers.hasItem; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.fail; + +import java.lang.reflect.Proxy; +import java.util.stream.Stream; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; +import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManagerFactory; +import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory; +import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; +import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; +import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueListFactory2; +import org.eclipse.papyrusrt.junit.rules.ElementTypesRule; +import org.eclipse.papyrusrt.junit.rules.UMLRTModelSetFixture; +import org.hamcrest.Matcher; +import org.junit.AssumptionViolatedException; +import org.junit.ClassRule; +import org.junit.rules.TestRule; + +/** + * A convenient superclass for facet query tests. + */ +public abstract class AbstractRTQueryTest<T extends EObject> { + + /** Some of the tests depend on element-type matchers. */ + @ClassRule + public static final TestRule elementTypes = new ElementTypesRule(); + + @ClassRule + public static final UMLRTModelSetFixture model = new UMLRTModelSetFixture(); + + private static IFacetManager facetManager; + + @SuppressWarnings("unchecked") + private static final Matcher<Object> IGNORE_MATCHER = (Matcher<Object>) Proxy.newProxyInstance(AbstractRTQueryTest.class.getClassLoader(), + new Class<?>[] { Matcher.class }, + (proxy, method, args) -> { + if (method.getDeclaringClass() == Object.class) { + switch (method.getName()) { + case "equals": + return args[0] == proxy; + case "hashCode": + return System.identityHashCode(proxy); + case "toString": + return "IgnoreMatcher"; + default: + // No other methods of class Object can be proxied, so fall through to assert the weirdness + } + } + throw new AssertionError("Attempt to use ignore matcher"); + }); + + private final IJavaQuery2<T, ?> fixture; + + public AbstractRTQueryTest(IJavaQuery2<T, ?> fixture) throws Exception { + super(); + + this.fixture = fixture; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected void positiveTestTemplate(T subject, Matcher<Object> queryResultMatcher, Object... queryParameter) { + ignoreCheck(queryResultMatcher, true); + + String failure = "Query result not matched"; + + Object result = evaluate(subject, queryParameter); + + if (result instanceof Iterable<?>) { + failure = "No matching results found"; + queryResultMatcher = (Matcher) hasItem(queryResultMatcher); + } + + assertThat(failure, result, queryResultMatcher); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected void negativeTestTemplate(T subject, Matcher<Object> queryResultMatcher, Object... queryParameter) { + ignoreCheck(queryResultMatcher, false); + + String failure = "Query result matched"; + + Object result = evaluate(subject, queryParameter); + + if (result instanceof Iterable<?>) { + failure = "At least one result found"; + queryResultMatcher = (Matcher) hasItem(queryResultMatcher); + } + + assertThat(failure, result, not(queryResultMatcher)); + } + + private void ignoreCheck(Matcher<Object> queryResultMatcher, boolean isHappyPath) { + if (queryResultMatcher == IGNORE_MATCHER) { + throw new AssumptionViolatedException( + String.format("There is no %s path for this test case", isHappyPath ? "happy" : "failure")); + } + } + + /** Obtains a matcher that signals that the particular test case is to be ignored. */ + protected static Matcher<Object> ignoreMatcher() { + return IGNORE_MATCHER; + } + + Object evaluate(T source, Object... queryParameter) { + Object result = null; + + try { + result = fixture.evaluate(source, parameters(queryParameter), facetManager()); + } catch (Exception e) { + e.printStackTrace(); + fail("Query invocation failed: " + e.getMessage()); + } + + return result; + } + + IParameterValueList2 parameters(Object... param) { + return IParameterValueListFactory2.INSTANCE.createParameterValueList( + Stream.of(param) + .map(this::createParameter) + .toArray(ParameterValue[]::new)); + } + + <V> ParameterValue createParameter(V value) { + ParameterValue result = EFacetFactory.eINSTANCE.createParameterValue(); + result.setValue(value); + return result; + } + + static IFacetManager facetManager() { + if (facetManager == null) { + facetManager = IFacetManagerFactory.DEFAULT.getOrCreateFacetManager(new ResourceSetImpl()); + } + + return facetManager; + } +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/GetRTMessagesQueryTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/GetRTMessagesQueryTest.java new file mode 100644 index 000000000..7d2f578ef --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/GetRTMessagesQueryTest.java @@ -0,0 +1,165 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests.queries; + +import java.util.List; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrusrt.umlrt.core.utils.RTMessageUtils; +import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTMessagesQuery; +import org.eclipse.uml2.uml.Collaboration; +import org.eclipse.uml2.uml.Operation; +import org.eclipse.uml2.uml.UMLPackage; +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +/** + * Test suite for the RT protocol messages query. + */ +@PluginResource("resource/inheritance/protocols.di") +@RunWith(Parameterized.class) +public class GetRTMessagesQueryTest extends AbstractRTQueryTest<EObject> { + + private final QueryKind kind; + + public GetRTMessagesQueryTest(QueryKind kind) throws Exception { + super(kind.getQuery()); + + this.kind = kind; + } + + @Test + public void getLocalMessages_positive() { + // This one defines local messages + positiveTestTemplate(getProtocol("RootProtocol"), false, false); + } + + @Test + public void getLocalMessages_negative() { + // This one only redefines messages + negativeTestTemplate(getProtocol("Subprotocol"), false, false); + } + + @Test + public void getRedefinedMessages_positive() { + // This one redefines its inherited messages + positiveTestTemplate(getProtocol("Subprotocol"), true, false); + } + + @Test + public void getRedefinedMessages_negative() { + // This one redefines no messages + negativeTestTemplate(getProtocol("Subsubprotocol"), true, false); + } + + @Test + public void getInheritedMessages_positive() { + // This one inherits messages + positiveTestTemplate(getProtocol("Subsubprotocol"), true, true); + } + + @Test + public void getInheritedMessages_negative() { + negativeTestTemplate(getProtocol("RootProtocol"), true, true); + } + + // + // Test framework + // + + @Parameters(name = "{0}") + public static Iterable<Object[]> parameters() { + return Stream.of(QueryKind.values()) + .map(v -> new Object[] { v }) + .collect(Collectors.toList()); + } + + Collaboration getProtocol(String name) { + return (Collaboration) model.getModel().getNestedPackage(name).getOwnedType(name, false, UMLPackage.Literals.COLLABORATION, false); + } + + void positiveTestTemplate(Collaboration protocol, boolean inherited, boolean includeVirtual) { + positiveTestTemplate(protocol, kind.rtMatcher(), kind.direction().getLiteral(), inherited, includeVirtual); + } + + void negativeTestTemplate(Collaboration protocol, boolean inherited, boolean includeVirtual) { + negativeTestTemplate(protocol, kind.rtMatcher(), kind.direction().getLiteral(), inherited, includeVirtual); + } + + enum QueryKind { + IN, OUT, IN_OUT; + + Predicate<Object> umlFilter() { + return Operation.class::isInstance; + } + + Predicate<Object> rtFilter() { + Predicate<Object> result = umlFilter(); + result = result.and(o -> RTMessageUtils.isRTMessage((Operation) o, direction())); + return result; + } + + Matcher<Object> umlMatcher() { + return new BaseMatcher<Object>() { + @Override + public void describeTo(Description description) { + description.appendText("matches UML " + QueryKind.this); + } + + @Override + public boolean matches(Object item) { + return umlFilter().test(item); + } + }; + } + + RTMessageKind direction() { + return RTMessageKind.values()[ordinal()]; + } + + Matcher<Object> rtMatcher() { + return new BaseMatcher<Object>() { + @Override + public void describeTo(Description description) { + description.appendText("matches RT " + QueryKind.this); + } + + @Override + public boolean matches(Object item) { + return rtFilter().test(item); + } + }; + } + + IJavaQuery2<EObject, ? extends List<?>> getQuery() { + return new GetRTMessagesQuery(); + } + + @Override + public String toString() { + return name().toLowerCase().replace('_', ' '); + } + } +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/GetStructuralFeaturesQueriesTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/GetStructuralFeaturesQueriesTest.java new file mode 100644 index 000000000..c243a4551 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/GetStructuralFeaturesQueriesTest.java @@ -0,0 +1,210 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests.queries; + +import java.util.List; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrusrt.umlrt.core.utils.CapsulePartUtils; +import org.eclipse.papyrusrt.umlrt.core.utils.RTPortUtils; +import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTConnector; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTAttributesQuery; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTConnectorsQuery; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetRTPortsQuery; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Connector; +import org.eclipse.uml2.uml.Port; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.util.UMLUtil; +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +/** + * Test suite for the family of queries that get structural features. + */ +@PluginResource("resource/inheritance/connectors.di") +@RunWith(Parameterized.class) +public class GetStructuralFeaturesQueriesTest extends AbstractRTQueryTest<Class> { + + private final QueryKind kind; + + public GetStructuralFeaturesQueriesTest(QueryKind kind) throws Exception { + super(kind.getQuery()); + + this.kind = kind; + } + + @Test + public void getLocalRTFeatures_positive() { + // This one defines local features + positiveTestTemplate(getCapsule("RootCapsule"), kind.rtMatcher(), true, false, false); + } + + @Test + public void getLocalRTFeatures_negative() { + // This one only redefines features + negativeTestTemplate(getCapsule("Subcapsule"), kind.rtMatcher(), true, false, false); + } + + @Test + public void getRedefinedRTFeatures_positive() { + // This one redefines its inherited features + positiveTestTemplate(getCapsule("Subcapsule"), kind.rtMatcher(), true, true, false); + } + + @Test + public void getRedefinedRTFeatures_negative() { + // This one redefines no features + negativeTestTemplate(getCapsule("Subsubcapsule"), kind.rtMatcher(), true, true, false); + } + + @Test + public void getInheritedRTFeatures_positive() { + // This one inherits features + positiveTestTemplate(getCapsule("Subsubcapsule"), kind.rtMatcher(), true, true, true); + } + + @Test + public void getInheritedRTFeatures_negative() { + negativeTestTemplate(getCapsule("RootCapsule"), kind.rtMatcher(), true, true, true); + } + + @Test + public void getNonRTFeatures_positive() { + // This one has non-RT features + positiveTestTemplate(getCapsule("BogusCapsule"), kind.umlMatcher(), false, false, false); + } + + @Test + public void getNonRTFeatures_negative() { + // This one has only RT features + negativeTestTemplate(getCapsule("RootCapsule"), kind.umlMatcher(), false, false, false); + } + + // + // Test framework + // + + @Parameters(name = "{0}") + public static Iterable<Object[]> parameters() { + return Stream.of(QueryKind.values()) + .map(v -> new Object[] { v }) + .collect(Collectors.toList()); + } + + Class getCapsule(String name) { + return (Class) model.getModel().getOwnedType(name, false, UMLPackage.Literals.CLASS, false); + } + + enum QueryKind { + PORTS, CAPSULE_PARTS, CONNECTORS; + + Predicate<Object> umlFilter() { + Predicate<Object> result; + + switch (this) { + case PORTS: + result = Port.class::isInstance; + break; + case CAPSULE_PARTS: + result = Property.class::isInstance; + result = result.and(PORTS.umlFilter().negate()); + break; + case CONNECTORS: + result = Connector.class::isInstance; + break; + default: + throw new AssertionError(this); + } + + return result; + } + + Predicate<Object> rtFilter() { + Predicate<Object> result = umlFilter(); + + switch (this) { + case PORTS: + result = result.and(p -> RTPortUtils.isRTPort((Port) p)); + break; + case CAPSULE_PARTS: + result = result.and(p -> CapsulePartUtils.isCapsulePart((Property) p)); + break; + case CONNECTORS: + result = result.and(c -> UMLUtil.getStereotypeApplication((Connector) c, RTConnector.class) != null); + break; + default: + throw new AssertionError(this); + } + + return result; + } + + Matcher<Object> umlMatcher() { + return new BaseMatcher<Object>() { + @Override + public void describeTo(Description description) { + description.appendText("matches UML " + QueryKind.this); + } + + @Override + public boolean matches(Object item) { + return umlFilter().test(item); + } + }; + } + + Matcher<Object> rtMatcher() { + return new BaseMatcher<Object>() { + @Override + public void describeTo(Description description) { + description.appendText("matches RT " + QueryKind.this); + } + + @Override + public boolean matches(Object item) { + return rtFilter().test(item); + } + }; + } + + IJavaQuery2<Class, ? extends List<?>> getQuery() { + switch (this) { + case PORTS: + return new GetRTPortsQuery(); + case CAPSULE_PARTS: + return new GetRTAttributesQuery(); + case CONNECTORS: + return new GetRTConnectorsQuery(); + default: + throw new AssertionError(this); + } + } + + @Override + public String toString() { + return name().toLowerCase().replace('_', ' '); + } + } +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/SimpleQueryTests.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/SimpleQueryTests.java new file mode 100644 index 000000000..ce60a575c --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/tests/queries/SimpleQueryTests.java @@ -0,0 +1,207 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.tests.queries; + +import static org.hamcrest.CoreMatchers.anything; +import static org.hamcrest.CoreMatchers.either; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; + +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.AllButStructuralFeaturesQuery; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.EmptyReferencesListQuery; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetGeneralizationQuery; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsCapsuleQuery; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsExcludedQuery; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsInheritedOrRedefinedQuery; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolContainerQuery; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolContainersContainerQuery; +import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolQuery; +import org.eclipse.uml2.uml.Generalization; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.StructuredClassifier; +import org.eclipse.uml2.uml.UMLPackage; +import org.hamcrest.Matcher; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +/** + * Test cases for various simple queries. + */ +@PluginResource("resource/allelements/various.di") +@RunWith(Parameterized.class) +public class SimpleQueryTests extends AbstractRTQueryTest<EObject> { + + private final QueryKind kind; + + @SuppressWarnings("unchecked") + public SimpleQueryTests(QueryKind kind) throws Exception { + super((IJavaQuery2<EObject, ?>) kind.getQuery()); + + this.kind = kind; + } + + @Test + public void happyPath() { + kind.subjects(model.getModel(), true).forEach(this::positiveTestTemplate); + } + + @Test + public void negativePath() { + kind.subjects(model.getModel(), false).forEach(this::negativeTestTemplate); + } + + // + // Test framework + // + + @Parameters(name = "{0}") + public static Iterable<Object[]> parameters() { + return Stream.of(QueryKind.values()) + .map(v -> new Object[] { v }) + .collect(Collectors.toList()); + } + + void positiveTestTemplate(EObject subject) { + // The queries we test have no parameters + positiveTestTemplate(subject, kind.matcher(true)); + } + + void negativeTestTemplate(EObject subject) { + // The queries we test have no parameters + negativeTestTemplate(subject, kind.matcher(false)); + } + + enum QueryKind { + IS_CAPSULE, IS_PROTOCOL, IS_INHERITED, IS_REDEFINED, IS_EXCLUDED, // + IS_PROTOCOL_CONTAINER, IS_PROTOCOL_CONTAINERS_CONTAINER, // + GET_GENERALIZATION, // + EMPTY_REFERENCES_LIST, ALL_BUT_STRUCTURAL_FEATURES; + + IJavaQuery2<? extends EObject, ?> getQuery() { + switch (this) { + case IS_CAPSULE: + return new IsCapsuleQuery(); + case IS_PROTOCOL: + return new IsProtocolQuery(); + case IS_INHERITED: + case IS_REDEFINED: + return new IsInheritedOrRedefinedQuery(); + case IS_EXCLUDED: + return new IsExcludedQuery(); + case IS_PROTOCOL_CONTAINER: + return new IsProtocolContainerQuery(); + case IS_PROTOCOL_CONTAINERS_CONTAINER: + return new IsProtocolContainersContainerQuery(); + case GET_GENERALIZATION: + return new GetGeneralizationQuery(); + case EMPTY_REFERENCES_LIST: + return new EmptyReferencesListQuery(); + case ALL_BUT_STRUCTURAL_FEATURES: + return new AllButStructuralFeaturesQuery(); + default: + throw new AssertionError(this); + } + } + + Stream<EObject> subjects(Package root, boolean isHappyPath) { + switch (this) { + case IS_CAPSULE: + return isHappyPath + ? Stream.of(root.getOwnedType("Subcapsule")) + : Stream.of(root.getOwnedType("PassiveClass")); + case IS_PROTOCOL: + return isHappyPath + ? Stream.of(root.getNestedPackage("Protocol1").getOwnedType("Protocol1")) + : Stream.of(root.getOwnedType("DesignCollaboration")); + case IS_INHERITED: + return isHappyPath + ? Stream.of(((Namespace) root.getOwnedType("Subsubcapsule")).getOwnedMember("redefProtocol1")) + : Stream.of(((Namespace) root.getOwnedType("RootCapsule")).getOwnedMember("protocol1")); + case IS_REDEFINED: + return isHappyPath + ? Stream.of(((Namespace) root.getOwnedType("Subcapsule")).getOwnedMember("redefProtocol1")) + : Stream.of(((Namespace) root.getOwnedType("RootCapsule")).getOwnedMember("protocol1")); + case IS_EXCLUDED: + return isHappyPath + ? Stream.of(((Namespace) root.getOwnedType("Subcapsule")).getOwnedMember("excludedProtocol2")) + : Stream.of(((Namespace) root.getOwnedType("Subcapsule")).getOwnedMember("redefProtocol1")); + case IS_PROTOCOL_CONTAINER: + return isHappyPath + ? Stream.of(root.getNestedPackage("Protocol1"), root.getNestedPackage("Protocol2")) + : Stream.of(root, root.getNestedPackage("nested")); + case GET_GENERALIZATION: + return isHappyPath + ? Stream.of(root.getOwnedType("Subcapsule"), + root.getNestedPackage("Subprotocol").getOwnedType("Subprotocol")) + : Stream.of(root.getOwnedType("RootCapsule"), + root.getNestedPackage("Protocol1").getOwnedType("Protocol1")); + case EMPTY_REFERENCES_LIST: + return Stream.of(((StructuredClassifier) root.getOwnedType("RootCapsule")).getOwnedConnector("connector1")); + case IS_PROTOCOL_CONTAINERS_CONTAINER: + return isHappyPath + ? Stream.of(root) + : Stream.of(root.getNestedPackage("Protocol1"), root.getNestedPackage("nested")); + case ALL_BUT_STRUCTURAL_FEATURES: + return Stream.of(root.getOwnedType("RootCapsule")); + default: + throw new AssertionError(this); + } + } + + Matcher<Object> matcher(boolean isHappyPath) { + switch (this) { + case IS_CAPSULE: + case IS_PROTOCOL: + case IS_INHERITED: + case IS_REDEFINED: + case IS_EXCLUDED: + case IS_PROTOCOL_CONTAINER: + case IS_PROTOCOL_CONTAINERS_CONTAINER: + return is(true); + case GET_GENERALIZATION: + return isHappyPath + ? instanceOf(Generalization.class) + : notNullValue(); // The test framework negates this to assert a null generalization + case EMPTY_REFERENCES_LIST: + // This query is a bit weird inasmuch as its happy path is a failure path + return isHappyPath + ? ignoreMatcher() + : anything(); + case ALL_BUT_STRUCTURAL_FEATURES: + return isHappyPath + ? is(UMLPackage.Literals.BEHAVIORED_CLASSIFIER__OWNED_BEHAVIOR) + : either(is((Object) UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE)) + .or(is(UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_CONNECTOR)) + .or(is(UMLPackage.Literals.ENCAPSULATED_CLASSIFIER__OWNED_PORT)); + default: + throw new AssertionError(this); + } + } + + @Override + public String toString() { + return name().toLowerCase().replace('_', ' '); + } + } +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/org.eclipse.papyrusrt.umlrt.tooling.ui.tests.launch b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/org.eclipse.papyrusrt.umlrt.tooling.ui.tests.launch index 7fc2c5106..700386e2c 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/org.eclipse.papyrusrt.umlrt.tooling.ui.tests.launch +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/org.eclipse.papyrusrt.umlrt.tooling.ui.tests.launch @@ -9,6 +9,9 @@ <booleanAttribute key="clearConfig" value="true"/> <booleanAttribute key="clearws" value="true"/> <booleanAttribute key="clearwslog" value="false"/> +<listAttribute key="com.mountainminds.eclemma.core.SCOPE_IDS"> +<listEntry value="=org.eclipse.papyrusrt.umlrt.tooling.ui/src"/> +</listAttribute> <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/> <booleanAttribute key="default" value="true"/> <booleanAttribute key="includeOptional" value="true"/> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/resource/modelelement/library.uml b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/resource/modelelement/library.uml index f68a0befe..e88d5b98c 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/resource/modelelement/library.uml +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/resource/modelelement/library.uml @@ -12,10 +12,10 @@ </packagedElement> <packagedElement xmi:type="uml:Package" xmi:id="_Rl0ZQJTrEeW50dEfV7kAUw" name="LibraryProtocol"> <packagedElement xmi:type="uml:Collaboration" xmi:id="_RlykEJTrEeW50dEfV7kAUw" name="LibraryProtocol"> - <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_Rl3ckJTrEeW50dEfV7kAUw" client="_RlykEJTrEeW50dEfV7kAUw" supplier="_Rl2OcJTrEeW50dEfV7kAUw" contract="_Rl2OcJTrEeW50dEfV7kAUw"> + <interfaceRealization xmi:id="_Rl3ckJTrEeW50dEfV7kAUw" client="_RlykEJTrEeW50dEfV7kAUw" supplier="_Rl2OcJTrEeW50dEfV7kAUw" contract="_Rl2OcJTrEeW50dEfV7kAUw"> <name xsi:nil="true"/> </interfaceRealization> - <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_Rl7uAJTrEeW50dEfV7kAUw" client="_RlykEJTrEeW50dEfV7kAUw" supplier="_Rl6f4JTrEeW50dEfV7kAUw" contract="_Rl6f4JTrEeW50dEfV7kAUw"> + <interfaceRealization xmi:id="_Rl7uAJTrEeW50dEfV7kAUw" client="_RlykEJTrEeW50dEfV7kAUw" supplier="_Rl6f4JTrEeW50dEfV7kAUw" contract="_Rl6f4JTrEeW50dEfV7kAUw"> <name xsi:nil="true"/> </interfaceRealization> </packagedElement> @@ -30,11 +30,11 @@ <name xsi:nil="true"/> </packagedElement> </packagedElement> - <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_KEpt4JTrEeW50dEfV7kAUw"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_KEpt4ZTrEeW50dEfV7kAUw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <profileApplication xmi:id="_KEpt4JTrEeW50dEfV7kAUw"> + <eAnnotations xmi:id="_KEpt4ZTrEeW50dEfV7kAUw" source="http://www.eclipse.org/uml2/2.0.0/UML"> <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt#/"/> </eAnnotations> - <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/> + <appliedProfile href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/> </profileApplication> </uml:Model> <UMLRealTime:Capsule xmi:id="_OeA60JTrEeW50dEfV7kAUw" base_Class="_OZxUAJTrEeW50dEfV7kAUw"/> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/resource/modelelement/model.uml b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/resource/modelelement/model.uml index 3601f4bd8..4677a75f4 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/resource/modelelement/model.uml +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/resource/modelelement/model.uml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:UMLRTStateMachines="http://www.eclipse.org/papyrus/umlrt/statemachine" xmlns:UMLRealTime="http://www.eclipse.org/papyrus/umlrt" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> <uml:Model xmi:id="_0iHZgJTqEeW50dEfV7kAUw" name="model"> - <packageImport xmi:type="uml:PackageImport" xmi:id="_NSLZ0JTrEeW50dEfV7kAUw"> + <packageImport xmi:id="_NSLZ0JTrEeW50dEfV7kAUw"> <importedPackage xmi:type="uml:Model" href="library.uml#_J-JdQJTrEeW50dEfV7kAUw"/> </packageImport> - <packageImport xmi:type="uml:PackageImport" xmi:id="_nBnz0HaVEeao4KHw1bDb-w"> + <packageImport xmi:id="_nBnz0HaVEeao4KHw1bDb-w"> <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> </packageImport> <packagedElement xmi:type="uml:Class" xmi:id="_2FYjEJTqEeW50dEfV7kAUw" name="Capsule" classifierBehavior="_ye9nQLAkEeaAyq05NkOz7g" isActive="true"> @@ -22,15 +22,15 @@ <type xmi:type="uml:Collaboration" href="pathmap://UMLRTRTSLIB/UMLRT-RTS.uml#_TWVjwGtVEeSCmtGQ-V4nzg"/> </ownedAttribute> <ownedBehavior xmi:type="uml:StateMachine" xmi:id="_ye9nQLAkEeaAyq05NkOz7g" name="StateMachine" isReentrant="false"> - <region xmi:type="uml:Region" xmi:id="_ys9nALAkEeaAyq05NkOz7g" name="Region"> - <transition xmi:type="uml:Transition" xmi:id="_ytr_wLAkEeaAyq05NkOz7g" name="Initial" source="_ytH_ELAkEeaAyq05NkOz7g" target="_3qHdgLAkEeaAyq05NkOz7g"/> - <transition xmi:type="uml:Transition" xmi:id="_6rIXcLAkEeaAyq05NkOz7g" name="local_transition" kind="local" source="_3qHdgLAkEeaAyq05NkOz7g" target="_5XT_ILAkEeaAyq05NkOz7g"/> + <region xmi:id="_ys9nALAkEeaAyq05NkOz7g" name="Region"> + <transition xmi:id="_ytr_wLAkEeaAyq05NkOz7g" name="Initial" source="_ytH_ELAkEeaAyq05NkOz7g" target="_3qHdgLAkEeaAyq05NkOz7g"/> + <transition xmi:id="_6rIXcLAkEeaAyq05NkOz7g" name="local_transition" kind="local" source="_3qHdgLAkEeaAyq05NkOz7g" target="_5XT_ILAkEeaAyq05NkOz7g"/> <subvertex xmi:type="uml:Pseudostate" xmi:id="_ytH_ELAkEeaAyq05NkOz7g"> <name xsi:nil="true"/> </subvertex> <subvertex xmi:type="uml:State" xmi:id="_ytkrALAkEeaAyq05NkOz7g" name="State1"> - <connectionPoint xmi:type="uml:Pseudostate" xmi:id="_3qHdgLAkEeaAyq05NkOz7g" name="entry" kind="entryPoint"/> - <region xmi:type="uml:Region" xmi:id="_3p8eYLAkEeaAyq05NkOz7g" name="Region1"> + <connectionPoint xmi:id="_3qHdgLAkEeaAyq05NkOz7g" name="entry" kind="entryPoint"/> + <region xmi:id="_3p8eYLAkEeaAyq05NkOz7g" name="Region1"> <subvertex xmi:type="uml:State" xmi:id="_5XT_ILAkEeaAyq05NkOz7g" name="State1"/> </region> </subvertex> @@ -39,26 +39,38 @@ </packagedElement> <packagedElement xmi:type="uml:Package" xmi:id="_5K_CEJTqEeW50dEfV7kAUw" name="Protocol1"> <packagedElement xmi:type="uml:Collaboration" xmi:id="_5K7XsJTqEeW50dEfV7kAUw" name="Protocol1"> - <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_5LWOcJTqEeW50dEfV7kAUw" client="_5K7XsJTqEeW50dEfV7kAUw" supplier="_5LIMAJTqEeW50dEfV7kAUw" contract="_5LIMAJTqEeW50dEfV7kAUw"> + <interfaceRealization xmi:id="_5LWOcJTqEeW50dEfV7kAUw" client="_5K7XsJTqEeW50dEfV7kAUw" supplier="_5LIMAJTqEeW50dEfV7kAUw" contract="_5LIMAJTqEeW50dEfV7kAUw"> <name xsi:nil="true"/> </interfaceRealization> - <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_5Luo8JTqEeW50dEfV7kAUw" client="_5K7XsJTqEeW50dEfV7kAUw" supplier="_5LmtIJTqEeW50dEfV7kAUw" contract="_5LmtIJTqEeW50dEfV7kAUw"> + <interfaceRealization xmi:id="_5Luo8JTqEeW50dEfV7kAUw" client="_5K7XsJTqEeW50dEfV7kAUw" supplier="_5LmtIJTqEeW50dEfV7kAUw" contract="_5LmtIJTqEeW50dEfV7kAUw"> <name xsi:nil="true"/> </interfaceRealization> </packagedElement> <packagedElement xmi:type="uml:Interface" xmi:id="_5LIMAJTqEeW50dEfV7kAUw" name="Protocol1"> - <ownedOperation xmi:type="uml:Operation" xmi:id="_V9XBkHaVEeao4KHw1bDb-w" name="greet"> - <ownedParameter xmi:type="uml:Parameter" xmi:id="_oafEMHaVEeao4KHw1bDb-w" name="data"> + <ownedOperation xmi:id="_V9XBkHaVEeao4KHw1bDb-w" name="greet"> + <ownedParameter xmi:id="_oafEMHaVEeao4KHw1bDb-w" name="data"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> + </ownedParameter> + </ownedOperation> + </packagedElement> + <packagedElement xmi:type="uml:Interface" xmi:id="_5LcVEJTqEeW50dEfV7kAUw" name="Protocol1~"> + <ownedOperation xmi:id="_SvUXYM9tEeaeF57775zDjg" name="reply"> + <ownedParameter xmi:id="_SvUXYc9tEeaeF57775zDjg" name="data"> <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> </ownedParameter> </ownedOperation> </packagedElement> - <packagedElement xmi:type="uml:Interface" xmi:id="_5LcVEJTqEeW50dEfV7kAUw" name="Protocol1~"/> <packagedElement xmi:type="uml:Usage" xmi:id="_5LgmgJTqEeW50dEfV7kAUw" client="_5K7XsJTqEeW50dEfV7kAUw" supplier="_5LcVEJTqEeW50dEfV7kAUw"> <name xsi:nil="true"/> </packagedElement> <packagedElement xmi:type="uml:AnyReceiveEvent" xmi:id="_5LibsJTqEeW50dEfV7kAUw" name="*"/> - <packagedElement xmi:type="uml:Interface" xmi:id="_5LmtIJTqEeW50dEfV7kAUw" name="Protocol1IO"/> + <packagedElement xmi:type="uml:Interface" xmi:id="_5LmtIJTqEeW50dEfV7kAUw" name="Protocol1IO"> + <ownedOperation xmi:id="_ToVDAM9tEeaeF57775zDjg" name="exchange"> + <ownedParameter xmi:id="_ToVDAc9tEeaeF57775zDjg" name="data"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> + </ownedParameter> + </ownedOperation> + </packagedElement> <packagedElement xmi:type="uml:Usage" xmi:id="_5Lv3EJTqEeW50dEfV7kAUw" client="_5K7XsJTqEeW50dEfV7kAUw" supplier="_5LmtIJTqEeW50dEfV7kAUw"> <name xsi:nil="true"/> </packagedElement> @@ -70,58 +82,58 @@ <ownedAttribute xmi:type="uml:Port" xmi:id="_uujC85TrEeW50dEfV7kAUw" name="relay" visibility="public" type="_5K7XsJTqEeW50dEfV7kAUw" aggregation="composite"/> <ownedAttribute xmi:type="uml:Port" xmi:id="_uujC9JTrEeW50dEfV7kAUw" name="spp" visibility="public" type="_5K7XsJTqEeW50dEfV7kAUw" aggregation="composite" isBehavior="true"/> <ownedAttribute xmi:type="uml:Port" xmi:id="_uujC9ZTrEeW50dEfV7kAUw" name="sap" visibility="protected" type="_5K7XsJTqEeW50dEfV7kAUw" aggregation="composite" isBehavior="true" isService="false"/> - <ownedAttribute xmi:type="uml:Property" xmi:id="_xFbawJTrEeW50dEfV7kAUw" name="libraryCapsule" visibility="protected" isOrdered="true" aggregation="composite"> + <ownedAttribute xmi:id="_xFbawJTrEeW50dEfV7kAUw" name="libraryCapsule" visibility="protected" isOrdered="true" aggregation="composite"> <type xmi:type="uml:Class" href="library.uml#_OZxUAJTrEeW50dEfV7kAUw"/> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_xFbawpTrEeW50dEfV7kAUw" value="1"/> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_xFhhYJTrEeW50dEfV7kAUw" value="1"/> </ownedAttribute> <ownedAttribute xmi:type="uml:Port" xmi:id="_B3KqEJUiEeW98PTE4--NLw" name="legacySpp" visibility="protected" type="_5K7XsJTqEeW50dEfV7kAUw" aggregation="composite" isBehavior="true" isService="false"/> <ownedAttribute xmi:type="uml:Port" xmi:id="_EkS-sJUiEeW98PTE4--NLw" name="legacySap" visibility="protected" type="_5K7XsJTqEeW50dEfV7kAUw" aggregation="composite" isBehavior="true"/> - <ownedAttribute xmi:type="uml:Property" xmi:id="_9_ofkJy7EeWzdt_55Z9oIQ" name="capsule" visibility="protected" type="_2FYjEJTqEeW50dEfV7kAUw" isOrdered="true" aggregation="composite"> + <ownedAttribute xmi:id="_9_ofkJy7EeWzdt_55Z9oIQ" name="capsule" visibility="protected" type="_2FYjEJTqEeW50dEfV7kAUw" isOrdered="true" aggregation="composite"> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_-AOVcJy7EeWzdt_55Z9oIQ" value="1"/> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_-AOVcZy7EeWzdt_55Z9oIQ" value="1"/> </ownedAttribute> - <ownedConnector xmi:type="uml:Connector" xmi:id="_4HOCgJTrEeW50dEfV7kAUw" name="RTConnector1"> - <end xmi:type="uml:ConnectorEnd" xmi:id="_4HUJIJTrEeW50dEfV7kAUw" role="_uujC8ZTrEeW50dEfV7kAUw"/> - <end xmi:type="uml:ConnectorEnd" xmi:id="_4HUJIZTrEeW50dEfV7kAUw" partWithPort="_xFbawJTrEeW50dEfV7kAUw"> + <ownedConnector xmi:id="_4HOCgJTrEeW50dEfV7kAUw" name="RTConnector1"> + <end xmi:id="_4HUJIJTrEeW50dEfV7kAUw" role="_uujC8ZTrEeW50dEfV7kAUw"/> + <end xmi:id="_4HUJIZTrEeW50dEfV7kAUw" partWithPort="_xFbawJTrEeW50dEfV7kAUw"> <role xmi:type="uml:Port" href="library.uml#_QuskAJTrEeW50dEfV7kAUw"/> </end> </ownedConnector> - <ownedConnector xmi:type="uml:Connector" xmi:id="_4-JqgJTrEeW50dEfV7kAUw" name="RTConnector2"> - <end xmi:type="uml:ConnectorEnd" xmi:id="_4-JqgZTrEeW50dEfV7kAUw" role="_uujC85TrEeW50dEfV7kAUw"/> - <end xmi:type="uml:ConnectorEnd" xmi:id="_4-JqgpTrEeW50dEfV7kAUw" partWithPort="_xFbawJTrEeW50dEfV7kAUw"> + <ownedConnector xmi:id="_4-JqgJTrEeW50dEfV7kAUw" name="RTConnector2"> + <end xmi:id="_4-JqgZTrEeW50dEfV7kAUw" role="_uujC85TrEeW50dEfV7kAUw"/> + <end xmi:id="_4-JqgpTrEeW50dEfV7kAUw" partWithPort="_xFbawJTrEeW50dEfV7kAUw"> <role xmi:type="uml:Port" href="library.uml#_WiMMoJTrEeW50dEfV7kAUw"/> </end> </ownedConnector> - <ownedConnector xmi:type="uml:Connector" xmi:id="_50gqwJTrEeW50dEfV7kAUw" name="RTConnector3"> - <end xmi:type="uml:ConnectorEnd" xmi:id="_50gqwZTrEeW50dEfV7kAUw" role="_uujC9JTrEeW50dEfV7kAUw"/> - <end xmi:type="uml:ConnectorEnd" xmi:id="_50gqwpTrEeW50dEfV7kAUw" partWithPort="_xFbawJTrEeW50dEfV7kAUw"> + <ownedConnector xmi:id="_50gqwJTrEeW50dEfV7kAUw" name="RTConnector3"> + <end xmi:id="_50gqwZTrEeW50dEfV7kAUw" role="_uujC9JTrEeW50dEfV7kAUw"/> + <end xmi:id="_50gqwpTrEeW50dEfV7kAUw" partWithPort="_xFbawJTrEeW50dEfV7kAUw"> <role xmi:type="uml:Port" href="library.uml#_XfOcoJTrEeW50dEfV7kAUw"/> </end> </ownedConnector> - <ownedConnector xmi:type="uml:Connector" xmi:id="_7QMloJTrEeW50dEfV7kAUw" name="RTConnector4"> - <end xmi:type="uml:ConnectorEnd" xmi:id="_7QSsQJTrEeW50dEfV7kAUw" role="_uujC8pTrEeW50dEfV7kAUw"/> - <end xmi:type="uml:ConnectorEnd" xmi:id="_7QSsQZTrEeW50dEfV7kAUw" partWithPort="_xFbawJTrEeW50dEfV7kAUw"> + <ownedConnector xmi:id="_7QMloJTrEeW50dEfV7kAUw" name="RTConnector4"> + <end xmi:id="_7QSsQJTrEeW50dEfV7kAUw" role="_uujC8pTrEeW50dEfV7kAUw"/> + <end xmi:id="_7QSsQZTrEeW50dEfV7kAUw" partWithPort="_xFbawJTrEeW50dEfV7kAUw"> <role xmi:type="uml:Port" href="library.uml#_VpBwAJTrEeW50dEfV7kAUw"/> </end> </ownedConnector> - <ownedConnector xmi:type="uml:Connector" xmi:id="_WKmOwJy8EeWzdt_55Z9oIQ" name="RTConnector5"> - <end xmi:type="uml:ConnectorEnd" xmi:id="_WKnc4Jy8EeWzdt_55Z9oIQ" partWithPort="_9_ofkJy7EeWzdt_55Z9oIQ" role="_4LjlYJTqEeW50dEfV7kAUw"/> - <end xmi:type="uml:ConnectorEnd" xmi:id="_WKoD8Jy8EeWzdt_55Z9oIQ" role="_uujC8ZTrEeW50dEfV7kAUw"/> + <ownedConnector xmi:id="_WKmOwJy8EeWzdt_55Z9oIQ" name="RTConnector5"> + <end xmi:id="_WKnc4Jy8EeWzdt_55Z9oIQ" partWithPort="_9_ofkJy7EeWzdt_55Z9oIQ" role="_4LjlYJTqEeW50dEfV7kAUw"/> + <end xmi:id="_WKoD8Jy8EeWzdt_55Z9oIQ" role="_uujC8ZTrEeW50dEfV7kAUw"/> </ownedConnector> - <ownedConnector xmi:type="uml:Connector" xmi:id="_afbhAJy8EeWzdt_55Z9oIQ" name="RTConnector6"> - <end xmi:type="uml:ConnectorEnd" xmi:id="_afcvIJy8EeWzdt_55Z9oIQ" partWithPort="_9_ofkJy7EeWzdt_55Z9oIQ" role="_7rMVAJTqEeW50dEfV7kAUw"/> - <end xmi:type="uml:ConnectorEnd" xmi:id="_afdWMJy8EeWzdt_55Z9oIQ" role="_uujC85TrEeW50dEfV7kAUw"/> + <ownedConnector xmi:id="_afbhAJy8EeWzdt_55Z9oIQ" name="RTConnector6"> + <end xmi:id="_afcvIJy8EeWzdt_55Z9oIQ" partWithPort="_9_ofkJy7EeWzdt_55Z9oIQ" role="_7rMVAJTqEeW50dEfV7kAUw"/> + <end xmi:id="_afdWMJy8EeWzdt_55Z9oIQ" role="_uujC85TrEeW50dEfV7kAUw"/> </ownedConnector> - <ownedConnector xmi:type="uml:Connector" xmi:id="_d2aq8Jy8EeWzdt_55Z9oIQ" name="RTConnector7"> - <end xmi:type="uml:ConnectorEnd" xmi:id="_d2b5EJy8EeWzdt_55Z9oIQ" partWithPort="_9_ofkJy7EeWzdt_55Z9oIQ" role="_6rNesJTqEeW50dEfV7kAUw"/> - <end xmi:type="uml:ConnectorEnd" xmi:id="_d2b5EZy8EeWzdt_55Z9oIQ" role="_uujC8pTrEeW50dEfV7kAUw"/> + <ownedConnector xmi:id="_d2aq8Jy8EeWzdt_55Z9oIQ" name="RTConnector7"> + <end xmi:id="_d2b5EJy8EeWzdt_55Z9oIQ" partWithPort="_9_ofkJy7EeWzdt_55Z9oIQ" role="_6rNesJTqEeW50dEfV7kAUw"/> + <end xmi:id="_d2b5EZy8EeWzdt_55Z9oIQ" role="_uujC8pTrEeW50dEfV7kAUw"/> </ownedConnector> </packagedElement> <packagedElement xmi:type="uml:Package" xmi:id="_CVjz8ID7EeaFAPnQW2yTGQ" name="Protocol2"> <packagedElement xmi:type="uml:Collaboration" xmi:id="_CRiPkID7EeaFAPnQW2yTGQ" name="Protocol2"> - <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_CV5yMID7EeaFAPnQW2yTGQ" client="_CRiPkID7EeaFAPnQW2yTGQ" supplier="_CV2H0ID7EeaFAPnQW2yTGQ" contract="_CV2H0ID7EeaFAPnQW2yTGQ"/> - <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_CWDjMID7EeaFAPnQW2yTGQ" client="_CRiPkID7EeaFAPnQW2yTGQ" supplier="_CWAf4ID7EeaFAPnQW2yTGQ" contract="_CWAf4ID7EeaFAPnQW2yTGQ"/> + <interfaceRealization xmi:id="_CV5yMID7EeaFAPnQW2yTGQ" client="_CRiPkID7EeaFAPnQW2yTGQ" supplier="_CV2H0ID7EeaFAPnQW2yTGQ" contract="_CV2H0ID7EeaFAPnQW2yTGQ"/> + <interfaceRealization xmi:id="_CWDjMID7EeaFAPnQW2yTGQ" client="_CRiPkID7EeaFAPnQW2yTGQ" supplier="_CWAf4ID7EeaFAPnQW2yTGQ" contract="_CWAf4ID7EeaFAPnQW2yTGQ"/> </packagedElement> <packagedElement xmi:type="uml:Interface" xmi:id="_CV2H0ID7EeaFAPnQW2yTGQ" name="Protocol2"/> <packagedElement xmi:type="uml:Interface" xmi:id="_CV8OcID7EeaFAPnQW2yTGQ" name="Protocol2~"/> @@ -130,17 +142,17 @@ <packagedElement xmi:type="uml:Interface" xmi:id="_CWAf4ID7EeaFAPnQW2yTGQ" name="Protocol2IO"/> <packagedElement xmi:type="uml:Usage" xmi:id="_CWFYYID7EeaFAPnQW2yTGQ" client="_CRiPkID7EeaFAPnQW2yTGQ" supplier="_CWAf4ID7EeaFAPnQW2yTGQ"/> </packagedElement> - <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_0paUUJTqEeW50dEfV7kAUw"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_0pcwkJTqEeW50dEfV7kAUw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <profileApplication xmi:id="_0paUUJTqEeW50dEfV7kAUw"> + <eAnnotations xmi:id="_0pcwkJTqEeW50dEfV7kAUw" source="http://www.eclipse.org/uml2/2.0.0/UML"> <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt#/"/> </eAnnotations> - <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/> + <appliedProfile href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/> </profileApplication> - <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_xF6JoLAkEeaAyq05NkOz7g"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_xGCFcLAkEeaAyq05NkOz7g" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <profileApplication xmi:id="_xF6JoLAkEeaAyq05NkOz7g"> + <eAnnotations xmi:id="_xGCFcLAkEeaAyq05NkOz7g" source="http://www.eclipse.org/uml2/2.0.0/UML"> <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt/statemachine#/"/> </eAnnotations> - <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_RT_PROFILE/UMLRealTimeSM-addendum.profile.uml#_KLcn0FDtEeOA4ecmvfqvaw"/> + <appliedProfile href="pathmap://UML_RT_PROFILE/UMLRealTimeSM-addendum.profile.uml#_KLcn0FDtEeOA4ecmvfqvaw"/> </profileApplication> </uml:Model> <UMLRealTime:Capsule xmi:id="_2Lcu0JTqEeW50dEfV7kAUw" base_Class="_2FYjEJTqEeW50dEfV7kAUw"/> diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/tests/RTPropertyEditorFactoryTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/tests/RTPropertyEditorFactoryTest.java index f8d66978f..81fd54b08 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/tests/RTPropertyEditorFactoryTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/internal/modelelement/properties/tests/RTPropertyEditorFactoryTest.java @@ -42,6 +42,7 @@ import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrusrt.junit.rules.ElementTypesRule; import org.eclipse.papyrusrt.junit.rules.FixtureElementRule; +import org.eclipse.papyrusrt.junit.rules.UMLRTModelSetFixture; import org.eclipse.papyrusrt.umlrt.core.types.UMLRTElementTypesEnumerator; import org.eclipse.papyrusrt.umlrt.core.utils.CapsuleUtils; import org.eclipse.papyrusrt.umlrt.tooling.ui.internal.modelelement.properties.RTPropertyEditorFactory; @@ -68,7 +69,7 @@ public class RTPropertyEditorFactoryTest { public final HouseKeeper houseKeeper = new HouseKeeper(); @Rule - public final ModelSetFixture model = new ModelSetFixture(); + public final ModelSetFixture model = new UMLRTModelSetFixture(); @Rule public final FixtureElementRule elements = new FixtureElementRule(); diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/databinding/facade/CapsulePropertiesTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/databinding/facade/CapsulePropertiesTest.java new file mode 100644 index 000000000..174a75849 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/databinding/facade/CapsulePropertiesTest.java @@ -0,0 +1,400 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.tests.databinding.facade; + +import static java.util.stream.Collectors.collectingAndThen; +import static java.util.stream.Collectors.toList; +import static org.hamcrest.CoreMatchers.hasItem; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assume.assumeThat; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.function.Predicate; +import java.util.function.Supplier; +import java.util.stream.Stream; + +import org.eclipse.core.databinding.observable.list.IObservableList; +import org.eclipse.core.databinding.property.list.IListProperty; +import org.eclipse.papyrus.junit.utils.rules.AbstractHouseKeeperRule.CleanUp; +import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrus.uml.tools.listeners.StereotypeElementListener; +import org.eclipse.papyrusrt.junit.rules.DataBindingsRule; +import org.eclipse.papyrusrt.junit.rules.UMLRTModelSetFixture; +import org.eclipse.papyrusrt.umlrt.core.commands.ExclusionCommand; +import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind; +import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.IFilteredObservableList; +import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade.CapsuleProperties; +import org.eclipse.papyrusrt.umlrt.tooling.ui.databinding.facade.ProtocolProperties; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTClassifier; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTConnector; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPackage; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocol; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocolMessage; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTReplicatedElement; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +import com.google.common.base.Strings; + +/** + * Test suite for the observable list properties provided by the + * {@link CapsuleProperties} and {@link ProtocolProperties} factories. + */ +@PluginResource("resource/modelelement/model.di") +@RunWith(Parameterized.class) +public class CapsulePropertiesTest { + @Rule + public final TestRule dataBindings = new DataBindingsRule(); + + @Rule + public final HouseKeeper housekeeper = new HouseKeeper(); + + @Rule + public final UMLRTModelSetFixture modelSet = new UMLRTModelSetFixture(); + + private final PropertyKind propertyKind; + + @CleanUp + private UMLRTClassifier subtype; + private IObservableList<UMLRTNamedElement> elements; + + public CapsulePropertiesTest(PropertyKind propertyKind) { + super(); + + this.propertyKind = propertyKind; + } + + /** + * Basic test for getting elements from the list. + */ + @Test + public void getElements() { + assertThat("No elements", elements.isEmpty(), is(false)); + + elements.forEach(e -> assertThat("Wrong kind of element", e, instanceOf(propertyKind.getElementType()))); + elements.forEach(e -> assertThat("Non-inherited element", e.isVirtualRedefinition(), is(true))); + } + + @Test + public void excludeElement() { + assumeThat("No elements", elements.isEmpty(), is(false)); + + UMLRTNamedElement element = any(elements); + + elements.remove(element); + + // Not actually removed, but excluded + assertThat("Element actually removed", elements, hasItem(element)); + assertThat("Element not excluded", element.isExcluded(), is(true)); + } + + @Test + public void addElement() { + // Create an element in a scratch capsule, to be added to our test capsule from there + UMLRTNamedElement newElement = createScratchElement("newThing"); + + elements.add(newElement); + + assertThat("Element not added", elements, hasItem(newElement)); + + // It was moved in the model + UMLRTClassifier owner = getContextClassifier(newElement); + assertThat(owner, is(subtype)); + assertThat("New element is a redefinition?!", newElement.isInherited(), is(false)); + } + + @Test + public void destroyElement() { + // Create an element in a scratch capsule, to be added to our test capsule from there + UMLRTNamedElement newElement = createScratchElement("newThing"); + + elements.add(newElement); + + assumeThat("Element not added", elements, hasItem(newElement)); + + elements.remove(newElement); + + assertThat("Element not detached", newElement.toUML().eResource(), nullValue()); + assertThat("Element not destroyed", newElement.toUML().eContainer(), nullValue()); + } + + @Test + public void filterList() { + assertThat("Not a filtered list", elements, instanceOf(IFilteredObservableList.class)); + + @SuppressWarnings("unchecked") + IFilteredObservableList<UMLRTNamedElement> filtered = (IFilteredObservableList<UMLRTNamedElement>) elements; + + assumeThat("No elements", elements.isEmpty(), is(false)); + + UMLRTNamedElement element = any(elements); + + Predicate<UMLRTNamedElement> isExcluded = UMLRTNamedElement::isExcluded; + Predicate<UMLRTNamedElement> notExcluded = isExcluded.negate(); + + filtered.addFilter(notExcluded); + + assertThat("Filter suppressed inherited element", elements, hasItem(element)); + + modelSet.execute(ExclusionCommand.getExclusionCommand(element.toUML(), true)); + assertThat("Filter did not suppress excluded element", elements, not(hasItem(element))); + + filtered.removeFilter(notExcluded); + + assertThat("List still filtered", elements, hasItem(element)); + } + + @Test + public void observeAddition() { + ListObservation obs = ListObservation.createAdditionsOnly(); + + elements.addListChangeListener(obs); + UMLRTNamedElement newElement; + + try { + // Let it be inherited, for extra fun! + newElement = modelSet.execute(() -> propertyKind.createNewElement(subtype, "newThing")); + } finally { + elements.removeListChangeListener(obs); + } + + assertThat("Addition not notified", obs.getAdded(), hasItem(newElement)); + } + + @Test + public void observeRemoval() { + UMLRTNamedElement newElement = modelSet.execute(() -> propertyKind.createNewElement(subtype, "newThing")); + + ListObservation obs = ListObservation.createRemovalsOnly(); + + elements.addListChangeListener(obs); + + try { + modelSet.execute(newElement::destroy); + } finally { + elements.removeListChangeListener(obs); + } + + assertThat("Removal not notified", obs.getRemoved(), hasItem(newElement)); + } + + // + // Test framework + // + + @Parameters(name = "{0}") + public static Iterable<Object[]> parameters() { + return Stream.of(PropertyKind.values()) + .map(v -> new Object[] { v }) + .collect(collectingAndThen(toList(), Collections::unmodifiableList)); + } + + @Before + public void configureResourceSet() { + // We need the injected stereotype notifications to trigger updates to observed lists + StereotypeElementListener listener = new StereotypeElementListener(modelSet.getEditingDomain()); + modelSet.getEditingDomain().addResourceSetListener(listener); + } + + @Before + public void createSubtypeAndObservableList() { + UMLRTPackage root = UMLRTPackage.getInstance(modelSet.getModel()); + + subtype = modelSet.execute(() -> propertyKind.createSubtypeFixture(root)); + + elements = housekeeper.cleanUpLater(propertyKind.getListProperty().observe(subtype)); + } + + UMLRTNamedElement createScratchElement(String name) { + UMLRTPackage root = UMLRTPackage.getInstance(modelSet.getModel()); + + return modelSet.execute(() -> propertyKind.createScratchElement(root, name)); + } + + UMLRTClassifier getContextClassifier(UMLRTNamedElement element) { + return (element instanceof UMLRTReplicatedElement) + ? ((UMLRTReplicatedElement) element).getCapsule() + : (element instanceof UMLRTConnector) + ? ((UMLRTConnector) element).getCapsule() + : (element instanceof UMLRTProtocolMessage) + ? ((UMLRTProtocolMessage) element).getProtocol() + : (element instanceof UMLRTClassifier) + ? (UMLRTClassifier) element + : null; + } + + static String initialUpper(String s) { + String result = s; + + if (!Strings.isNullOrEmpty(s)) { + StringBuilder buf = new StringBuilder(s); + buf.setCharAt(0, Character.toUpperCase(buf.charAt(0))); + result = buf.toString(); + } + + return result; + } + + static <T> T any(Collection<T> collection) { + List<T> list = new ArrayList<>(collection); + // Randomize the order + Collections.shuffle(list); + return list.get(0); + } + + static UMLRTPort anyPort(UMLRTCapsule capsule) { + return any(capsule.getPorts()); + } + + enum PropertyKind { + PORTS(UMLRTPort.class, CapsuleProperties::ports), // + CAPSULE_PARTS(UMLRTCapsulePart.class, CapsuleProperties::capsuleParts), // + CONNECTORS(UMLRTConnector.class, CapsuleProperties::connectors), // + IN_MESSAGES(UMLRTProtocolMessage.class, () -> ProtocolProperties.messages(RTMessageKind.IN)), // + OUT_MESSAGES(UMLRTProtocolMessage.class, () -> ProtocolProperties.messages(RTMessageKind.OUT)), // + INOUT_MESSAGES(UMLRTProtocolMessage.class, () -> ProtocolProperties.messages(RTMessageKind.IN_OUT)); // + + private final Class<? extends UMLRTNamedElement> elementType; + private final Supplier<IListProperty<? extends UMLRTClassifier, ? extends UMLRTNamedElement>> listPropertySupplier; + + PropertyKind(Class<? extends UMLRTNamedElement> elementType, + Supplier<IListProperty<? extends UMLRTClassifier, ? extends UMLRTNamedElement>> listPropertySupplier) { + + this.elementType = elementType; + this.listPropertySupplier = listPropertySupplier; + } + + public Class<? extends UMLRTNamedElement> getElementType() { + return elementType; + } + + @SuppressWarnings("unchecked") + public IListProperty<UMLRTClassifier, UMLRTNamedElement> getListProperty() { + // We will be careful in the test only to try to add elements of a compatible kind + return (IListProperty<UMLRTClassifier, UMLRTNamedElement>) listPropertySupplier.get(); + } + + public UMLRTNamedElement createNewElement(UMLRTClassifier classifier, String name) { + switch (this) { + case PORTS: + UMLRTProtocol newProtocol = classifier.getPackage().createProtocol(initialUpper(name)); + return ((UMLRTCapsule) classifier).createPort(newProtocol); + case CAPSULE_PARTS: + UMLRTCapsule newCapsule = classifier.getPackage().createCapsule(initialUpper(name)); + return ((UMLRTCapsule) classifier).createCapsulePart(newCapsule); + case CONNECTORS: + // Look for ports in a capsule that is known to have some. Yes, this means that + // the resulting connector may connect ports of a different capsule, but that + // doesn't matter for our tests here. Nor does it matter that it may connect + // the same port to itself, or some other invalid combination + UMLRTCapsule portOwner = classifier.getPackage().getCapsule("SubcapsuleForTest"); + return ((UMLRTCapsule) classifier).createConnector(name, anyPort(portOwner), null, anyPort(portOwner), null); + case IN_MESSAGES: + return ((UMLRTProtocol) classifier).createMessage(RTMessageKind.IN, name); + case OUT_MESSAGES: + return ((UMLRTProtocol) classifier).createMessage(RTMessageKind.OUT, name); + case INOUT_MESSAGES: + return ((UMLRTProtocol) classifier).createMessage(RTMessageKind.IN_OUT, name); + default: + throw new AssertionError("Invalid test property kind: " + this); + } + } + + public UMLRTClassifier createSubtypeFixture(UMLRTPackage package_) { + UMLRTClassifier result; + + switch (this) { + case PORTS: + case CAPSULE_PARTS: + case CONNECTORS: + + UMLRTCapsule capsule = package_.createCapsule("SubcapsuleForTest"); + capsule.setSuperclass(package_.getCapsule("ConnectedCapsule")); + result = capsule; + break; + case IN_MESSAGES: + case OUT_MESSAGES: + case INOUT_MESSAGES: + UMLRTProtocol protocol = package_.createProtocol("SubprotocolForTest"); + protocol.setSuperProtocol(package_.getProtocol("Protocol1")); + result = protocol; + break; + default: + throw new AssertionError("Invalid test property kind: " + this); + } + + return result; + } + + public UMLRTNamedElement createScratchElement(UMLRTPackage package_, String name) { + UMLRTNamedElement result; + + switch (this) { + case PORTS: + case CAPSULE_PARTS: + case CONNECTORS: + UMLRTCapsule capsule = package_.createCapsule("ScratchPad"); + result = createNewElement(capsule, name); + break; + case IN_MESSAGES: + case OUT_MESSAGES: + case INOUT_MESSAGES: + UMLRTProtocol protocol = package_.createProtocol("ScratchPad"); + result = createNewElement(protocol, name); + break; + default: + throw new AssertionError("Invalid test property kind: " + this); + } + + return result; + } + + @Override + public String toString() { + switch (this) { + case PORTS: + return "port"; + case CAPSULE_PARTS: + return "capsule-part"; + case CONNECTORS: + return "connector"; + case IN_MESSAGES: + return "in msg"; + case OUT_MESSAGES: + return "out msg"; + case INOUT_MESSAGES: + return "inout msg"; + default: + return super.toString(); + } + } + } +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/databinding/facade/ListObservation.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/databinding/facade/ListObservation.java new file mode 100644 index 000000000..bc3616d20 --- /dev/null +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/databinding/facade/ListObservation.java @@ -0,0 +1,104 @@ +/***************************************************************************** + * Copyright (c) 2017 Christian W. Damus and others. + * + * 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.ui.tests.databinding.facade; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Stream; + +import org.eclipse.core.databinding.observable.list.IListChangeListener; +import org.eclipse.core.databinding.observable.list.ListChangeEvent; +import org.eclipse.core.databinding.observable.list.ListDiffEntry; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; + +/** + * Observation of changes in an observable list that tracks and optionally + * asserts the actual changes. + */ +class ListObservation implements IListChangeListener<UMLRTNamedElement> { + private final List<UMLRTNamedElement> added = new ArrayList<>(); + private final List<UMLRTNamedElement> removed = new ArrayList<>(); + + private final Constraint constraint; + + private ListObservation(Constraint constraint) { + super(); + + this.constraint = (constraint == null) ? Constraint.NONE : constraint; + } + + static ListObservation create() { + return new ListObservation(Constraint.NONE); + } + + static ListObservation createAdditionsOnly() { + return new ListObservation(Constraint.ADDITIONS_ONLY); + } + + static ListObservation createRemovalsOnly() { + return new ListObservation(Constraint.REMOVALS_ONLY); + } + + @Override + public void handleListChange(ListChangeEvent<? extends UMLRTNamedElement> event) { + Stream.of(event.diff.getDifferences()).forEach(diff -> { + constraint.verify(diff); + + if (diff.isAddition()) { + added.add(diff.getElement()); + } else { + removed.add(diff.getElement()); + } + }); + } + + public List<UMLRTNamedElement> getAdded() { + return Collections.unmodifiableList(added); + } + + public List<UMLRTNamedElement> getRemoved() { + return Collections.unmodifiableList(removed); + } + + public void reset() { + added.clear(); + removed.clear(); + } + + // + // Nested types + // + + private enum Constraint { + NONE, ADDITIONS_ONLY, REMOVALS_ONLY; + + void verify(ListDiffEntry<?> diff) { + switch (this) { + case ADDITIONS_ONLY: + assertThat("Should not get a removal", diff.isAddition(), is(true)); + break; + case REMOVALS_ONLY: + assertThat("Should not get an addition", diff.isAddition(), is(false)); + break; + default: + // Pass + break; + } + } + } +} diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/modelelement/ModelElementTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/modelelement/ModelElementTest.java index 3d566502e..78c7a1a30 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/modelelement/ModelElementTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/modelelement/ModelElementTest.java @@ -8,7 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation - * Christian W. Damus - bugs 491543, 479628, 497801 + * Christian W. Damus - bugs 491543, 479628, 497801, 467545 * Young-Soo Roh - bug 483636 * *****************************************************************************/ @@ -24,12 +24,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Collection; +import java.util.Optional; + import org.eclipse.core.databinding.observable.IObservable; +import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.validation.IValidator; import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement; import org.eclipse.papyrus.infra.properties.ui.modelelement.ModelElement; import org.eclipse.papyrus.infra.widgets.util.IPapyrusConverter; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; @@ -38,12 +41,20 @@ import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrusrt.junit.rules.ElementTypesRule; import org.eclipse.papyrusrt.junit.rules.UIThread; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; +import org.eclipse.papyrusrt.junit.rules.UMLRTModelSetFixture; import org.eclipse.papyrusrt.umlrt.core.utils.IRealTimeConstants; import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolUtils; import org.eclipse.papyrusrt.umlrt.core.utils.RTPortKindEnum; import org.eclipse.papyrusrt.umlrt.core.utils.RTPortUtils; import org.eclipse.papyrusrt.umlrt.tooling.ui.modelelement.RTStereotypeModelElement; import org.eclipse.papyrusrt.umlrt.tooling.ui.modelelement.UMLRTExtModelElement; +import org.eclipse.papyrusrt.umlrt.tooling.ui.modelelement.UMLRTFacadeModelElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTClassifier; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTFactory; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocolMessage; import org.eclipse.uml2.uml.Class; import org.eclipse.uml2.uml.Collaboration; import org.eclipse.uml2.uml.Interface; @@ -51,6 +62,7 @@ import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.Operation; import org.eclipse.uml2.uml.Parameter; import org.eclipse.uml2.uml.Port; +import org.eclipse.uml2.uml.Property; import org.eclipse.uml2.uml.StateMachine; import org.eclipse.uml2.uml.Transition; import org.eclipse.uml2.uml.UMLPackage; @@ -62,7 +74,7 @@ import org.junit.Test; import org.junit.rules.TestRule; /** - * Unit tests for {@link UMLRTExtModelElement} + * Unit tests for {@link UMLRTExtModelElement} and {@link UMLRTFacadeModelElement}. */ @PluginResource("resource/modelelement/model.di") public class ModelElementTest extends AbstractPapyrusTest { @@ -89,6 +101,7 @@ public class ModelElementTest extends AbstractPapyrusTest { protected static Port connectedCapsule_relay; protected static Port connectedCapsule_sap; protected static Port connectedCapsule_spp; + protected static Property connectedCapsule_capsule; protected static Port libraryCapsule_externalBehavior; protected static Port libraryCapsule_internalBehavior; @@ -100,7 +113,11 @@ public class ModelElementTest extends AbstractPapyrusTest { protected static Collaboration protocol1; protected static Interface protocol1In; + protected static Interface protocol1Out; + protected static Interface protocol1InOut; protected static Operation greetIn; + protected static Operation replyOut; + protected static Operation exchangeInOut; protected static StateMachine statemachine; protected static Transition transition1; @@ -136,9 +153,9 @@ public class ModelElementTest extends AbstractPapyrusTest { protected static final String TRANSITION_KIND_MESSAGE = "Kind must be enabled"; @ClassRule - public final static ModelSetFixture modelSetFixture = new ModelSetFixture(); + public final static ModelSetFixture modelSetFixture = new UMLRTModelSetFixture(); - // Sopme of the observables tested herein are exercised and, therefore, must + // Some of the observables tested herein are exercised and, therefore, must // be accessed on the UI thread (which provides their default realm) @Rule public final TestRule uiThread = new UIThreadRule(true); @@ -208,6 +225,10 @@ public class ModelElementTest extends AbstractPapyrusTest { libraryCapsule_legacySpp = libraryCapsule.getOwnedPort("legacySpp", null); Assert.assertNotNull(libraryCapsule_legacySpp); + // capsule-parts + connectedCapsule_capsule = connectedCapsule.getOwnedAttribute("capsule", null); + Assert.assertNotNull(connectedCapsule_capsule); + // Protocols protocol1 = (Collaboration) modelSetFixture.getModel().getNestedPackage("Protocol1") @@ -216,7 +237,15 @@ public class ModelElementTest extends AbstractPapyrusTest { protocol1In = ProtocolUtils.getMessageSetIn(protocol1); assertThat("Protocol1 IN message-set not found in test model", protocol1In, notNullValue()); greetIn = protocol1In.getOperation("greet", null, null); - assertThat("Protocol1 IN message 'greet' not found in test model", protocol1In, notNullValue()); + assertThat("Protocol1 IN message 'greet' not found in test model", greetIn, notNullValue()); + protocol1Out = ProtocolUtils.getMessageSetOut(protocol1); + assertThat("Protocol1 OUT message-set not found in test model", protocol1Out, notNullValue()); + replyOut = protocol1Out.getOperation("reply", null, null); + assertThat("Protocol1 OUT message 'reply' not found in test model", replyOut, notNullValue()); + protocol1InOut = ProtocolUtils.getMessageSetInOut(protocol1); + assertThat("Protocol1 INOUT message-set not found in test model", protocol1InOut, notNullValue()); + exchangeInOut = protocol1InOut.getOperation("exchange", null, null); + assertThat("Protocol1 INOUT message 'exchange' not found in test model", exchangeInOut, notNullValue()); statemachine = (StateMachine) capsule.getOwnedBehaviors().get(0); Assert.assertNotNull(statemachine); @@ -227,7 +256,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateTransition() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(transition1, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(transition1); assertFalse(TRANSITION_KIND_MESSAGE, isDeactivated(umlrtExtModelElement, TRANSITION_KIND)); // it is connected outside } @@ -235,7 +264,7 @@ public class ModelElementTest extends AbstractPapyrusTest { public void validateStandardCapsuleExternalBehaviorPort() throws Exception { assertEquals(RTPortKindEnum.EXTERNAL, RTPortUtils.getKind(capsule_externalBehavior)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_externalBehavior, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_externalBehavior); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE));// it is connected outside assertFalse(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -256,7 +285,7 @@ public class ModelElementTest extends AbstractPapyrusTest { public void validateStandardCapsuleInternalBehaviorPort() throws Exception { assertEquals(RTPortKindEnum.INTERNAL, RTPortUtils.getKind(capsule_internalBehavior)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_internalBehavior, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_internalBehavior); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); // is is connected outside assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -277,7 +306,7 @@ public class ModelElementTest extends AbstractPapyrusTest { public void validateStandardCapsuleRelayPort() throws Exception { assertEquals(RTPortKindEnum.RELAY, RTPortUtils.getKind(capsule_relay)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_relay, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_relay); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertFalse(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -299,7 +328,7 @@ public class ModelElementTest extends AbstractPapyrusTest { public void validateStandardCapsuleExternalBehaviorNotConnectedPort() throws Exception { assertEquals(RTPortKindEnum.EXTERNAL, RTPortUtils.getKind(capsule_externalBehaviorNotConnected)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_externalBehaviorNotConnected, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_externalBehaviorNotConnected); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertFalse(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertFalse(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -321,7 +350,7 @@ public class ModelElementTest extends AbstractPapyrusTest { public void validateStandardCapsuleInternalBehaviorNotConnectedPort() throws Exception { assertEquals(RTPortKindEnum.INTERNAL, RTPortUtils.getKind(capsule_internalBehaviorNotConnected)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_internalBehaviorNotConnected, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_internalBehaviorNotConnected); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertFalse(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -343,7 +372,7 @@ public class ModelElementTest extends AbstractPapyrusTest { public void validateStandardCapsuleRelayNotConnectedPort() throws Exception { assertEquals(RTPortKindEnum.RELAY, RTPortUtils.getKind(capsule_relayNotConnected)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_relayNotConnected, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_relayNotConnected); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertFalse(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -367,7 +396,7 @@ public class ModelElementTest extends AbstractPapyrusTest { assertEquals(RTPortKindEnum.SAP, RTPortUtils.getKind(capsule_system_sap)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_system_sap, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_system_sap); assertTrue(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -391,7 +420,7 @@ public class ModelElementTest extends AbstractPapyrusTest { assertFalse(RTPortUtils.isLegacySap(capsule_sap)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_sap, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_sap); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertFalse(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -415,7 +444,7 @@ public class ModelElementTest extends AbstractPapyrusTest { assertFalse(RTPortUtils.isLegacySap(capsule_spp)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_spp, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_spp); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertFalse(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -439,7 +468,7 @@ public class ModelElementTest extends AbstractPapyrusTest { assertTrue(RTPortUtils.isLegacySap(capsule_legacySap)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_legacySap, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_legacySap); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertFalse(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -463,7 +492,7 @@ public class ModelElementTest extends AbstractPapyrusTest { assertFalse(RTPortUtils.isLegacySap(capsule_legacySpp)); // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(capsule_legacySpp, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(capsule_legacySpp); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertFalse(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -483,7 +512,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateConnectedCapsuleExternalBehaviorPort() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(connectedCapsule_externalBehavior, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(connectedCapsule_externalBehavior); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertFalse(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -504,7 +533,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateConnectedCapsuleInternalBehaviorPort() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(connectedCapsule_internalBehavior, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(connectedCapsule_internalBehavior); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -525,7 +554,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateConnectedCapsuleRelayPort() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(connectedCapsule_relay, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(connectedCapsule_relay); assertFalse(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); // is is connected inside @@ -549,7 +578,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateLibraryCapsuleExternalBehaviorPort() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(libraryCapsule_externalBehavior, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(libraryCapsule_externalBehavior); assertTrue(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -570,7 +599,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateLibraryCapsuleInternalBehaviorPort() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(libraryCapsule_internalBehavior, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(libraryCapsule_internalBehavior); assertTrue(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -591,7 +620,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateLibraryCapsuleRelayPort() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(libraryCapsule_relay, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(libraryCapsule_relay); assertTrue(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -611,7 +640,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateLibraryCapsuleSAP() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(libraryCapsule_sap, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(libraryCapsule_sap); assertTrue(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -631,7 +660,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateLibraryCapsuleSPP() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(libraryCapsule_spp, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(libraryCapsule_spp); assertTrue(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -651,7 +680,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateLibraryCapsuleLegacySAP() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(libraryCapsule_legacySap, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(libraryCapsule_legacySap); assertTrue(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -671,7 +700,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void validateLibraryCapsuleLegacySPP() throws Exception { // test Property paths on UML Element - UMLRTExtModelElement umlrtExtModelElement = new UMLRTExtModelElement(libraryCapsule_legacySpp, modelSetFixture.getEditingDomain()); + ModelElement umlrtExtModelElement = modelElement(libraryCapsule_legacySpp); assertTrue(IS_CONJUGATED_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_CONJUGATED)); assertTrue(IS_SERVICE_ERROR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_SERVICE)); assertTrue(IS_BEHAVIOR_MESSAGE, isDeactivated(umlrtExtModelElement, IS_BEHAVIOR)); @@ -688,7 +717,7 @@ public class ModelElementTest extends AbstractPapyrusTest { assertTrue(REGISTRATION_OVERRIDE_MESSAGE, isDeactivated(rtStereotypeModelElement, REGISTRATION_OVERRIDE));// isWired, but read only (library) } - protected boolean isDeactivated(EMFModelElement modelElement, String propertyPath) { + protected boolean isDeactivated(ModelElement modelElement, String propertyPath) { return !modelElement.isEditable(propertyPath); } @@ -725,7 +754,7 @@ public class ModelElementTest extends AbstractPapyrusTest { @Test public void protocolMessageParameterTypeProperty() { Parameter data = greetIn.getOwnedParameters().get(0); - ModelElement modelElement = new UMLRTExtModelElement(data, modelSetFixture.getEditingDomain()); + ModelElement modelElement = modelElement(data); // Check that we are presenting the correct labels ILabelProvider labels = modelElement.getLabelProvider("type"); @@ -745,8 +774,57 @@ public class ModelElementTest extends AbstractPapyrusTest { } + @UIThread + @Test + public void capsulePortsProperty() { + ModelElement modelElement = modelElement(capsule); + IObservableList<?> list = (IObservableList<?>) modelElement.getObservable("port"); + UMLRTPort port = require(list, UMLRTPort.class, capsule_relay.getName()); + assertThat(port.toUML(), is(capsule_relay)); + } + + @UIThread + @Test + public void capsuleCapsulePartsProperty() { + ModelElement modelElement = modelElement(connectedCapsule); + IObservableList<?> list = (IObservableList<?>) modelElement.getObservable("capsulePart"); + UMLRTCapsulePart part = require(list, UMLRTCapsulePart.class, connectedCapsule_capsule.getName()); + assertThat(part.toUML(), is(connectedCapsule_capsule)); + } + + @UIThread + @Test + public void protocolInMessagesProperty() { + ModelElement modelElement = modelElement(protocol1); + IObservableList<?> list = (IObservableList<?>) modelElement.getObservable("Incoming"); + UMLRTProtocolMessage msg = require(list, UMLRTProtocolMessage.class, greetIn.getName()); + assertThat(msg.toUML(), is(greetIn)); + } + + @UIThread + @Test + public void protocolOutMessagesProperty() { + ModelElement modelElement = modelElement(protocol1); + IObservableList<?> list = (IObservableList<?>) modelElement.getObservable("Outgoing"); + UMLRTProtocolMessage msg = require(list, UMLRTProtocolMessage.class, replyOut.getName()); + assertThat(msg.toUML(), is(replyOut)); + } + + @UIThread + @Test + public void protocolInOutMessagesProperty() { + ModelElement modelElement = modelElement(protocol1); + IObservableList<?> list = (IObservableList<?>) modelElement.getObservable("InOut"); + UMLRTProtocolMessage msg = require(list, UMLRTProtocolMessage.class, exchangeInOut.getName()); + assertThat(msg.toUML(), is(exchangeInOut)); + } + + // + // Test framework + // + void assertNameProperty(NamedElement element) { - ModelElement modelElement = new UMLRTExtModelElement(element, modelSetFixture.getEditingDomain()); + ModelElement modelElement = modelElement(element); IObservable obs = modelElement.getObservable("name"); assertThat("No observable value provided for 'name'", obs, instanceOf(IObservableValue.class)); @@ -763,7 +841,7 @@ public class ModelElementTest extends AbstractPapyrusTest { } void assertNameValidation(NamedElement element, String clashingName) { - ModelElement modelElement = new UMLRTExtModelElement(element, modelSetFixture.getEditingDomain()); + ModelElement modelElement = modelElement(element); IValidator validator = modelElement.getValidator("name"); assertThat("No validator provided for 'name'", validator, notNullValue()); assertThat("Current name rejected", validator.validate(element.getName()), hasSeverity(IStatus.OK)); @@ -771,4 +849,28 @@ public class ModelElementTest extends AbstractPapyrusTest { assertThat("No error on blank name", validator.validate(" "), hasSeverity(IStatus.ERROR)); } + ModelElement modelElement(NamedElement element) { + ModelElement result; + + UMLRTNamedElement facade = UMLRTFactory.create(element); + if (facade instanceof UMLRTClassifier) { + result = new UMLRTFacadeModelElement(facade); + } else { + result = new UMLRTExtModelElement(element, modelSetFixture.getEditingDomain()); + } + + return result; + } + + <T extends UMLRTNamedElement> Optional<T> find(Collection<?> collection, java.lang.Class<T> type, String name) { + return collection.stream() + .filter(type::isInstance).map(type::cast) + .filter(e -> name.equals(e.getName())) + .findAny(); + } + + <T extends UMLRTNamedElement> T require(Collection<?> collection, java.lang.Class<T> type, String name) { + return find(collection, type, name) + .orElseThrow(() -> new AssertionError(String.format("%s not found: %s", type.getSimpleName(), name))); + } } diff --git a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/modelelement/ObservableRegressionTest.java b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/modelelement/ObservableRegressionTest.java index 99fa27a99..382a751f1 100644 --- a/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/modelelement/ObservableRegressionTest.java +++ b/tests/junit/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.ui.tests/src/org/eclipse/papyrusrt/umlrt/tooling/ui/tests/modelelement/ObservableRegressionTest.java @@ -30,6 +30,7 @@ import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture; import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrusrt.junit.rules.FixtureElementRule; import org.eclipse.papyrusrt.junit.rules.UIThreadRule; +import org.eclipse.papyrusrt.junit.rules.UMLRTModelSetFixture; import org.eclipse.papyrusrt.umlrt.tooling.ui.widgets.CapsulePartKindObservableValue; import org.eclipse.papyrusrt.umlrt.tooling.ui.widgets.PortRTKindObservableValue; import org.eclipse.uml2.uml.Port; @@ -48,7 +49,7 @@ import org.junit.rules.TestRule; public class ObservableRegressionTest { @Rule - public final ModelSetFixture model = new ModelSetFixture(); + public final ModelSetFixture model = new UMLRTModelSetFixture(); @Rule public final FixtureElementRule elements = new FixtureElementRule(); |
