Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2018-04-23 19:36:28 +0000
committerNicolas FAUVERGUE2018-05-29 13:30:23 +0000
commite65c18ff964d6407a3c750de581984eafd9044ee (patch)
tree5cf684ab932e46d69000886d5e9bf624e605f49f
parentc18fa4d3b4a2c896323a3be417f13c58541b2166 (diff)
downloadorg.eclipse.papyrus-e65c18ff964d6407a3c750de581984eafd9044ee.tar.gz
org.eclipse.papyrus-e65c18ff964d6407a3c750de581984eafd9044ee.tar.xz
org.eclipse.papyrus-e65c18ff964d6407a3c750de581984eafd9044ee.zip
Bug 533676: [Sequence Diagram] Validation should be triggered after
creation of CombinedFragment or InteractionOperand Add custom well-formedness rules to check that messages and execution specifications do not cross interaction operand boundaries. Ensure that re-sizing of an interaction operand triggers validation of that operand and the interaction fragments that it contains, plus any messages originating or terminating within it. Because the default operand of a new combined fragment is now resized upon creation, a new operand is likewise validated for its contents. Fix validation hook and diagnostician extension point schema definitions to match reality of the extension point implementations. Remove UI contributions for validation, to avoid workflow interrution. Validation framework is still slow, but less intrusive for the user. A preference may control the validation activation on user actions. Update the failing compilation on gmfdiag.common.tests. Add a preference to switch on or off the validation. Change-Id: Ic7d83eb18315ce714dc7c71bff38276f330ef260 Also-by: RĂ©mi Schnekenburger <rschnekenburger@eclipsesource.com> Signed-off-by: Christian W. Damus <give.a.damus@gmail.com>
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/schema/diagnosticians.exsd4
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/schema/validationHooks.exsd4
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF18
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/Messages.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/messages.properties1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/preferences/CustomDiagramGeneralPreferencePage.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java18
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/AsyncValidateCommand.java157
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/OperandDiagnostician.java103
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/OperandFilter.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/SequenceOCLRegistration.java46
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/seqd_constraints.ocl44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml10
-rw-r--r--tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/DiagramMatchers.java87
-rw-r--r--tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java35
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/tests/MasterSlaveNotationSyncTest.java8
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/tests/NotationSyncOverrideTest.java8
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF4
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.di2
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.notation152
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.uml41
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.di2
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.notation115
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.uml29
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java50
26 files changed, 968 insertions, 36 deletions
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/schema/diagnosticians.exsd b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/schema/diagnosticians.exsd
index ad07037e09d..62f772dfcad 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/schema/diagnosticians.exsd
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/schema/diagnosticians.exsd
@@ -3,7 +3,7 @@
<schema targetNamespace="org.eclipse.papyrus.infra.services.validation" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.eclipse.papyrus.infra.services.validation" id="diagnostician" name="Registered diagnostician"/>
+ <meta.schema plugin="org.eclipse.papyrus.infra.services.validation" id="diagnosticians" name="Registered diagnosticians"/>
</appinfo>
<documentation>
Manage the relation between a language (such as UML) and the associated diagnostician
@@ -61,7 +61,7 @@
</documentation>
</annotation>
</attribute>
- <attribute name="filter" type="string">
+ <attribute name="filter" type="string" use="required">
<annotation>
<documentation>
A filter class that determines whether this diagnostician is chosen for a certain element
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/schema/validationHooks.exsd b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/schema/validationHooks.exsd
index f046ce5eb9f..5ea0f25989b 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/schema/validationHooks.exsd
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/schema/validationHooks.exsd
@@ -3,7 +3,7 @@
<schema targetNamespace="org.eclipse.papyrus.infra.services.validation" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.eclipse.papyrus.infra.services.validation" id="validationHook" name="Registered validation hooks"/>
+ <meta.schema plugin="org.eclipse.papyrus.infra.services.validation" id="validationHooks" name="Registered validation hooks"/>
</appinfo>
<documentation>
Associate hooks with a modeling language. These hooks are executed before and after validation of a model in this language.
@@ -64,7 +64,7 @@
</documentation>
</annotation>
</attribute>
- <attribute name="filter" type="string">
+ <attribute name="filter" type="string" use="required">
<annotation>
<documentation>
A filter class that determines whether this hook is active for a certain model element
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java
index 3ded8a6fb2a..889b1fbccc0 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2010, 2018 CEA LIST, Christian W. Damus, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -12,7 +12,7 @@
* Christian W. Damus (CEA) - refactor for non-workspace abstraction of problem markers (CDO)
* Patrick Tessier (CEA LIST) refacor to add allowing adding validation specific to UML
* Christian W. Damus (CEA) - bug 432813
- * Christian W. Damus - bug 497379
+ * Christian W. Damus - bugs 497379, 533676
*
*****************************************************************************/
package org.eclipse.papyrus.infra.services.validation.commands;
@@ -38,6 +38,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.papyrus.infra.emf.gmf.command.INonDirtying;
import org.eclipse.papyrus.infra.services.validation.IPapyrusDiagnostician;
import org.eclipse.papyrus.infra.services.validation.Messages;
import org.eclipse.papyrus.infra.services.validation.ValidationTool;
@@ -59,7 +60,7 @@ import org.eclipse.ui.PlatformUI;
*
* @author Ansgar Radermacher (CEA LIST)
*/
-public abstract class AbstractValidateCommand extends AbstractTransactionalCommand {
+public abstract class AbstractValidateCommand extends AbstractTransactionalCommand implements INonDirtying {
final String modelValidationViewID = "org.eclipse.papyrus.views.validation.ModelValidationView"; //$NON-NLS-1$
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF
index e960778de98..f4da8ebfc22 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF
@@ -15,7 +15,7 @@ Bundle-ClassPath: .
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.ui.navigator;visibility:=reexport;bundle-version="[3.6.0,4.0.0)",
+Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibility:=reexport,
org.eclipse.ui.navigator.resources;bundle-version="[3.5.0,4.0.0)",
org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)",
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)",
@@ -25,10 +25,10 @@ Require-Bundle: org.eclipse.ui.navigator;visibility:=reexport;bundle-version="[3
org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version="[1.7.0,2.0.0)",
org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.uml.appearance;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.emf.ecore;visibility:=reexport;bundle-version="[2.12.0,3.0.0)",
- org.eclipse.emf.ecore;visibility:=reexport;bundle-version="[2.12.0,3.0.0)",
- org.eclipse.emf.ecore.edit;visibility:=reexport;bundle-version="[2.9.0,3.0.0)",
- org.eclipse.emf.validation;visibility:=reexport;bundle-version="[1.8.0,2.0.0)",
+ org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport,
+ org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport,
+ org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)";visibility:=reexport,
+ org.eclipse.emf.validation;bundle-version="[1.8.0,2.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.gmfdiag.hyperlink;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
@@ -53,8 +53,8 @@ Require-Bundle: org.eclipse.ui.navigator;visibility:=reexport;bundle-version="[3
org.eclipse.gmf.runtime.diagram.ui.properties,
org.eclipse.gmf.runtime.diagram.ui.providers,
org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.uml2.uml;visibility:=reexport;bundle-version="[5.3.0,6.0.0)",
- org.eclipse.uml2.uml.edit;visibility:=reexport;bundle-version="[5.3.0,6.0.0)",
+ org.eclipse.uml2.uml;bundle-version="[5.3.0,6.0.0)";visibility:=reexport,
+ org.eclipse.uml2.uml.edit;bundle-version="[5.3.0,6.0.0)";visibility:=reexport,
org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
org.eclipse.gef,
org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
@@ -65,7 +65,9 @@ Require-Bundle: org.eclipse.ui.navigator;visibility:=reexport;bundle-version="[3
org.eclipse.papyrus.uml.diagram.menu,
org.eclipse.draw2d;visibility:=reexport,
org.eclipse.gmf.runtime.notation;visibility:=reexport,
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,4.0.0)"
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,4.0.0)",
+ org.eclipse.papyrus.uml.service.validation;bundle-version="[2.1.0,3.0.0)",
+ org.eclipse.papyrus.infra.services.validation;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %providerName
Bundle-Version: 5.0.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/Messages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/Messages.java
index 7fbd29d4eb7..9967bbfe3ff 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/Messages.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/Messages.java
@@ -71,6 +71,11 @@ public class Messages extends NLS {
*/
public static String DiagramsPreferencePage_createNoExecutionSpecification;
+ /**
+ * label specifying that validation should be triggered after edition
+ */
+ public static String DiagramsPreferencePage_triggerValidation_label;
+
/*************************************************************************
* Command labels
************************************************************************/
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/messages.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/messages.properties
index 527a9404009..d4e3ecb55bc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/messages.properties
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/messages.properties
@@ -6,6 +6,7 @@ DiagramsPreferencePage_createBehaviorExecutionSpecification=A Behavior Execution
DiagramsPreferencePage_createActionExecutionSpecificationAndReply=An Action Execution Specification and a Reply Message
DiagramsPreferencePage_createActionExecutionSpecification=An Action Execution Specification
DiagramsPreferencePage_createNoExecutionSpecification=Nothing
+DiagramsPreferencePage_triggerValidation_label=Trigger validation when editing the diagram (This may have effect on performances)
Commands_DropDestructionOccurenceSpecification_Label=Drop Destruction Occurrence Specification
Commands_CreateExecutionSpecification_Label=Execution Specification Automatic Creation with Message
Commands_DropDestructionOccurenceSpecification_Label=Drop Destruction Occurrence Specification
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/preferences/CustomDiagramGeneralPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/preferences/CustomDiagramGeneralPreferencePage.java
index 4762396a4be..a72e526a228 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/preferences/CustomDiagramGeneralPreferencePage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/preferences/CustomDiagramGeneralPreferencePage.java
@@ -39,6 +39,8 @@ public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
*/
private RadioGroupFieldEditor executionSpecificationWithAsyncMsg = null;
+ private BooleanFieldEditor triggerValidation;
+
/**
* preference key for asynchronous messages
*/
@@ -71,6 +73,13 @@ public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
public static final int PREF_MOVE_BELOW_ELEMENTS_AT_MESSAGE_CREATION_VALUE = 40;
/**
+ * preference key to trigger model validation after edition.
+ *
+ * @since 5.0
+ */
+ public static final String PREF_TRIGGER_ASYNC_VALIDATION = "PREF_TRIGGER_ASYNC_VALIDATION"; //$NON-NLS-1$
+
+ /**
* possible preference values
*/
public static final String CHOICE_BEHAVIOR_AND_REPLY = "CHOICE_BEHAVIOR_AND_REPLY"; //$NON-NLS-1$
@@ -106,6 +115,7 @@ public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
addField(executionSpecificationWithSyncMsg);
addField(executionSpecificationWithAsyncMsg);
+
Group otherGroup = new Group(parent, SWT.NONE);
otherGroup.setLayout(new GridLayout(2, false));
GridData otherGroupGridData = new GridData(GridData.FILL_HORIZONTAL);
@@ -115,6 +125,9 @@ public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
otherGroup.setText(Messages.CustomDiagramGeneralPreferencePage_othersGroupLabel);
addField(new BooleanFieldEditor(PREF_MOVE_BELOW_ELEMENTS_AT_MESSAGE_DOWN, Messages.CustomDiagramGeneralPreferencePage_MoveBelowElementsAtMessageDownDescription, otherGroup));
addField(new IntegerFieldEditor(PREF_MOVE_BELOW_ELEMENTS_AT_MESSAGE_CREATION, Messages.CustomDiagramGeneralPreferencePage_MinimumSpaceBelowMessageAtCreation, otherGroup));
+ triggerValidation = new BooleanFieldEditor(PREF_TRIGGER_ASYNC_VALIDATION,
+ Messages.DiagramsPreferencePage_triggerValidation_label, otherGroup);
+ addField(triggerValidation);
}
/**
@@ -143,6 +156,7 @@ public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
{ Messages.DiagramsPreferencePage_createActionExecutionSpecification, CHOICE_ACTION },
{ Messages.DiagramsPreferencePage_createNoExecutionSpecification, CHOICE_NONE }
}, composite);
+
}
/**
@@ -158,5 +172,8 @@ public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
preferenceStore.setDefault(PREF_MOVE_BELOW_ELEMENTS_AT_MESSAGE_DOWN, true);
preferenceStore.setDefault(PREF_MOVE_BELOW_ELEMENTS_AT_MESSAGE_CREATION, PREF_MOVE_BELOW_ELEMENTS_AT_MESSAGE_CREATION_VALUE);
+ // by default, validation is activated.
+ preferenceStore.setDefault(PREF_TRIGGER_ASYNC_VALIDATION, false);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java
index 9bc2572c095..b5a925b1ae0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2017, 2018 CEA LIST, EclipseSource and others.
+ * Copyright (c) 2017, 2018 CEA LIST, EclipseSource, 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:
* CEA LIST - Initial API and implementation
* EclipseSource - Bug 533770
+ * Christian W. Damus - bug 533676
*
*****************************************************************************/
@@ -20,6 +21,7 @@ import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
@@ -29,11 +31,14 @@ import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.validation.AsyncValidateCommand;
+import org.eclipse.uml2.uml.InteractionOperand;
/**
@@ -81,6 +86,17 @@ public class ResizeOperandEditPolicy extends GraphicalEditPolicy {
Object currentEditPart = editParts.get(0);
updateCurrentChildSize(compositeCommand, changeBoundsRequest, editingDomain, currentEditPart);
+
+ if (!compositeCommand.isEmpty() && (currentEditPart instanceof IGraphicalEditPart)
+ && compositeCommand.canExecute()) {
+
+ EObject object = ((IGraphicalEditPart) currentEditPart).resolveSemanticElement();
+ if (object instanceof InteractionOperand) {
+ InteractionOperand operand = (InteractionOperand) object;
+ // In case the containment of interaction fragments changes, validate
+ AsyncValidateCommand.get(operand).ifPresent(compositeCommand::add);
+ }
+ }
return new ICommandProxy(compositeCommand);
}
return null;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/AsyncValidateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/AsyncValidateCommand.java
new file mode 100644
index 00000000000..4f43cc45447
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/AsyncValidateCommand.java
@@ -0,0 +1,157 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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.papyrus.uml.diagram.sequence.validation;
+
+import static org.eclipse.papyrus.uml.diagram.sequence.util.OccurrenceSpecificationHelper.findExecutionWith;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.emf.gmf.command.INonDirtying;
+import org.eclipse.papyrus.infra.services.validation.ValidationTool;
+import org.eclipse.papyrus.infra.services.validation.commands.ValidateSubtreeCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.command.AsynchronousCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.ExecutionSpecification;
+import org.eclipse.uml2.uml.InteractionOperand;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.util.UMLSwitch;
+
+/**
+ * An asynchronous validation command.
+ */
+public class AsyncValidateCommand extends AsynchronousCommand implements INonDirtying {
+
+ /**
+ * Initializes me with the {@code object to validate}.
+ *
+ * @param object
+ * the object to validate later
+ */
+ public AsyncValidateCommand(EObject object) {
+ super("Validate", TransactionUtil.getEditingDomain(object), () -> validate(object));
+ }
+
+ private static ICommand validate(EObject object) {
+ ValidateSubtreeCommand cmd = new UMLSwitch<ValidateSubtreeCommand>() {
+
+ @Override
+ public ValidateSubtreeCommand caseInteractionOperand(InteractionOperand operand) {
+ return new ValidateOperandCommand(operand);
+ }
+
+ @Override
+ public ValidateSubtreeCommand defaultCase(EObject object) {
+ return new ValidateSubtreeCommand(object);
+ }
+ }.doSwitch(object);
+
+ cmd.disableUIFeedback();
+
+ return cmd;
+ }
+
+ /**
+ * Returns a new {@link AsyncValidateCommand} if preference to validate after edition is set to <code>true</code>.
+ *
+ * @return a {@link Optional} {@link AsyncValidateCommand} or an empty one if the preference is set to no validation.
+ */
+ public static Optional<AsyncValidateCommand> get(EObject object) {
+ IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ Boolean triggerValidation = store.getBoolean(org.eclipse.papyrus.uml.diagram.sequence.preferences.CustomDiagramGeneralPreferencePage.PREF_TRIGGER_ASYNC_VALIDATION);
+ return Optional.ofNullable(triggerValidation ? new AsyncValidateCommand(object) : null);
+ }
+
+ static Stream<Message> messages(InteractionOperand operand) {
+ return operand.getFragments().stream()
+ .filter(MessageEnd.class::isInstance).map(MessageEnd.class::cast)
+ .map(MessageEnd::getMessage)
+ .filter(Objects::nonNull).distinct();
+ }
+
+ static Stream<ExecutionSpecification> nonOwnedExecutions(InteractionOperand operand) {
+ return operand.getFragments().stream()
+ .filter(OccurrenceSpecification.class::isInstance).map(OccurrenceSpecification.class::cast)
+ .map(AsyncValidateCommand::getExecution)
+ .filter(Objects::nonNull)
+ .filter(exec -> exec.getOwner() != operand)
+ .distinct();
+ }
+
+ static ExecutionSpecification getExecution(OccurrenceSpecification occurrence) {
+ return Optional.ofNullable(findExecutionWith(occurrence, true))
+ .orElseGet(() -> findExecutionWith(occurrence, false));
+ }
+
+ //
+ // Nested types
+ //
+
+ private static class ValidateOperandCommand extends ValidateSubtreeCommand {
+ private final InteractionOperand operand;
+
+ ValidateOperandCommand(InteractionOperand operand) {
+ super(operand, new OperandDiagnostician());
+
+ this.operand = operand;
+ }
+
+ @Override
+ protected void handleDiagnostic(IProgressMonitor monitor, Diagnostic diagnostic, EObject validateElement, Shell shell) {
+ // Do not show a dialog, as in the original version since the user sees the result directly
+ // in the model explorer
+ Resource resource = getValidationResource();
+ // final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ if (resource != null) {
+ if (validateElement != null) {
+ // In an interaction operand, we validate also the messages and execution
+ // specifications that are at least partially within it. We have to be
+ // careful about also removing existing markers for these related elements
+ // because the Diagnostician isn't responsible for that
+ List<NamedElement> others = Stream.concat(messages(operand), nonOwnedExecutions(operand))
+ .collect(Collectors.toList());
+ int markersToCreate = diagnostic.getChildren().size();
+
+ SubMonitor sub = SubMonitor.convert(monitor, 1 + others.size() + markersToCreate);
+
+ ValidationTool vt = new ValidationTool(validateElement, resource);
+
+ // Delete existing markers
+ vt.deleteSubMarkers(sub.newChild(1));
+ others.forEach(el -> new ValidationTool(el, resource).deleteSubMarkers(sub.newChild(1)));
+
+ // Create new markers
+ vt.createMarkers(diagnostic, sub.newChild(markersToCreate));
+
+ sub.done();
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/OperandDiagnostician.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/OperandDiagnostician.java
new file mode 100644
index 00000000000..959cef67e2a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/OperandDiagnostician.java
@@ -0,0 +1,103 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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.papyrus.uml.diagram.sequence.validation;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.DiagnosticChain;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.uml.diagram.sequence.util.OccurrenceSpecificationHelper;
+import org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician;
+import org.eclipse.uml2.uml.ExecutionSpecification;
+import org.eclipse.uml2.uml.InteractionOperand;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+
+/**
+ * A diagnostician for validation of an {@link InteractionOperand} sub-tree only.
+ * This includes messages that have at least one end within the operand.
+ * <b>Note</b> that this diagnostician should never be used in context of
+ * general user-driven model validation.
+ */
+@SuppressWarnings("restriction")
+public class OperandDiagnostician extends UMLDiagnostician {
+
+ /**
+ * Initializes me.
+ */
+ public OperandDiagnostician() {
+ super();
+ }
+
+ @Override
+ protected boolean doValidateContents(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ boolean result = true;
+
+ // Note that a message end can also be an occurrence specification, so
+ // do both of these validations (not an 'else if')
+ if (eObject instanceof MessageEnd) {
+ // Validate the message, also
+ result = validateMessage((MessageEnd) eObject, diagnostics, context);
+ }
+ if (eObject instanceof OccurrenceSpecification) {
+ // Validate the execution specification, also (if any)
+ result &= validateExecutionSpecification((OccurrenceSpecification) eObject, diagnostics, context);
+ }
+
+ if (result || diagnostics != null) {
+ result &= super.doValidateContents(eObject, diagnostics, context);
+ }
+
+ return result;
+ }
+
+ protected boolean validateMessage(MessageEnd messageEnd, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ Message message = messageEnd.getMessage();
+
+ return (message == null) || validate(message, diagnostics, context);
+ }
+
+ protected boolean validateExecutionSpecification(OccurrenceSpecification occurrence, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ ExecutionSpecification execution = OccurrenceSpecificationHelper.findExecutionWith(occurrence, true);
+ if (execution == null) {
+ // Maybe it's finished by this occurrence
+ execution = OccurrenceSpecificationHelper.findExecutionWith(occurrence, false);
+ }
+
+ return (execution == null) || validate(execution, diagnostics, context);
+ }
+
+ @Override
+ public boolean validate(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ // Avoid redundant validation of things in operands that we might also validate
+ // even when they aren't contained by those operands (per the above)
+ if (context != null && (eObject instanceof Message || eObject instanceof ExecutionSpecification)) {
+ @SuppressWarnings("unchecked")
+ Set<EObject> validated = (Set<EObject>) context.get("operand.validated");
+ if (validated == null) {
+ validated = new HashSet<>();
+ context.put("operand.validated", validated);
+ }
+ if (!validated.add(eObject)) {
+ // Already checked it
+ return true;
+ }
+ }
+
+ return super.validate(eObject, diagnostics, context);
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/OperandFilter.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/OperandFilter.java
new file mode 100644
index 00000000000..9410d96a9b9
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/OperandFilter.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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.papyrus.uml.diagram.sequence.validation;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.services.validation.IValidationFilter;
+import org.eclipse.uml2.uml.InteractionOperand;
+
+/**
+ * A validation filter that matches {@link InteractionOperand}s.
+ */
+public class OperandFilter implements IValidationFilter {
+
+ /**
+ * Initializes me.
+ */
+ public OperandFilter() {
+ super();
+ }
+
+ @Override
+ public boolean isApplicable(EObject element) {
+ return element instanceof InteractionOperand;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/SequenceOCLRegistration.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/SequenceOCLRegistration.java
new file mode 100644
index 00000000000..0837f9658f1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/SequenceOCLRegistration.java
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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.papyrus.uml.diagram.sequence.validation;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.service.validation.AbstractOCLRegistration;
+import org.eclipse.uml2.uml.Profile;
+
+/**
+ * Validation extension for OCL constraints specific to Interactions in a sequence diagram.
+ */
+public class SequenceOCLRegistration extends AbstractOCLRegistration {
+
+ /**
+ * Initializes me.
+ */
+ public SequenceOCLRegistration() {
+ super();
+ }
+
+ @Override
+ protected URI getOCLFileURI() {
+ return URI.createPlatformPluginURI(UMLDiagramEditorPlugin.ID + "/model/seqd_constraints.ocl", true); //$NON-NLS-1$
+ }
+
+ @Override
+ protected boolean isApplicable(EObject element) {
+ EObject root = EcoreUtil.getRootContainer(element);
+ return root instanceof org.eclipse.uml2.uml.Package && !(root instanceof Profile);
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/seqd_constraints.ocl b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/seqd_constraints.ocl
new file mode 100644
index 00000000000..debcd0d3cd6
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/seqd_constraints.ocl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018 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
+ *
+ */
+
+import 'http://www.eclipse.org/uml2/5.0.0/UML'
+
+package UML
+
+context Element
+
+-- A helper operation that reports a problem as error severity instead of warning.
+def: asError(ok: Boolean): Boolean = if ok then ok else null endif
+
+context Message
+
+--
+-- The ends of a message that are not Gates are all owned by the same
+-- Interaction or InteractionOperand.
+--
+inv crosses_no_boundaries('Message crosses an interaction operand boundary.'):
+ let ends = Set{sendEvent, receiveEvent}->excluding(null)->reject(oclIsKindOf(Gate)) in
+ asError(ends->notEmpty() implies ends.owner->asSet()->size() = 1)
+
+
+context ExecutionSpecification
+
+--
+-- The start and finish events if an execution specification are both owned
+-- by the same Interaction or InteractionOperand.
+--
+inv crosses_no_boundaries('Execution specification crosses an interaction operand boundary.'):
+ let events = Set{start, finish}->excluding(null) in
+ asError(events->notEmpty() implies events.owner->asSet()->size() = 1)
+
+endpackage
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml
index c321e41f226..981de30f226 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
- Copyright (c) 2009, 2014, 2017 CEA and others.
+ Copyright (c) 2009, 2018 CEA, 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
@@ -11,6 +11,7 @@
Contributors:
CEA - Initial API and implementation
Christian W. Damus (CEA) - bug 323802
+ Christian W. Damus - bug 533676
-->
<plugin>
@@ -637,4 +638,11 @@
<?gmfgen generated="true"?>
</extension>
+ <extension
+ point="org.eclipse.papyrus.infra.services.validation.validationHooks">
+ <validationHook
+ id="org.eclipse.papyrus.uml.diagram.sequence.ocl"
+ filter="org.eclipse.papyrus.uml.service.validation.internal.UMLFilter"
+ hook="org.eclipse.papyrus.uml.diagram.sequence.validation.SequenceOCLRegistration"/>
+ </extension>
</plugin>
diff --git a/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/DiagramMatchers.java b/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/DiagramMatchers.java
index f46dd40d599..8267e6b3529 100644
--- a/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/DiagramMatchers.java
+++ b/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/DiagramMatchers.java
@@ -8,17 +8,27 @@
*
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
- * Christian W. Damus - bug 533673
+ * Christian W. Damus - bugs 533673, 533676
*
*/
package org.eclipse.papyrus.junit.matchers;
+import static org.hamcrest.CoreMatchers.hasItem;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.palette.PaletteDrawer;
import org.eclipse.gef.ui.palette.PaletteViewer;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
+import org.eclipse.papyrus.infra.services.decoration.DecorationService;
+import org.eclipse.papyrus.infra.services.decoration.IDecorationService;
+import org.eclipse.papyrus.infra.services.decoration.util.IPapyrusDecoration;
+import org.eclipse.papyrus.infra.services.markerlistener.IPapyrusMarker;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
@@ -135,6 +145,81 @@ public class DiagramMatchers {
return viewThat(elementThat(elementMatcher));
}
+ /**
+ * Match an edit-part that has an {@linkplain IPapyrusMarker#SEVERITY_ERROR error}
+ * decoration having a message matching a given matcher.
+ *
+ * @param messageMatcher
+ * matcher for the decoration message
+ *
+ * @return the decoration matcher
+ *
+ * @since 2.2
+ *
+ * @see #hasDecorationThat(int, Matcher)
+ * @see IPapyrusMarker#SEVERITY_ERROR
+ */
+ public static Matcher<EditPart> hasErrorDecorationThat(Matcher<? super String> messageMatcher) {
+ return hasDecorationThat(IPapyrusMarker.SEVERITY_ERROR, messageMatcher);
+ }
+
+ /**
+ * Match an edit-part that has a decoration of a given severity having a message matching
+ * a given matcher.
+ *
+ * @param severity
+ * severity, as per the {@link IPapyrusMarker#SEVERITY} marker attribute values
+ * @param messageMatcher
+ * matcher for the decoration message
+ *
+ * @return the decoration matcher
+ *
+ * @since 2.2
+ */
+ public static Matcher<EditPart> hasDecorationThat(int severity, Matcher<? super String> messageMatcher) {
+
+ return new TypeSafeDiagnosingMatcher<EditPart>() {
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("has error decoration that ").appendDescriptionOf(messageMatcher);
+ }
+
+ @Override
+ protected boolean matchesSafely(EditPart item, Description mismatchDescription) {
+ IDecorationService service = null;
+ try {
+ // For some reason, the service is registered under the implementation class instead
+ // of the interface. For maximal compatibility, we try both
+ service = ServiceUtilsForEditPart.getInstance().getService(IDecorationService.class, item);
+ } catch (Exception e) {
+ try {
+ service = ServiceUtilsForEditPart.getInstance().getService(DecorationService.class, item);
+ } catch (Exception e2) {
+ // Will fail, below
+ }
+ }
+
+ if (service == null) {
+ mismatchDescription.appendText("no decoration service");
+ return false;
+ }
+
+ List<IPapyrusDecoration> decorations = service.getDecorations(item, false);
+ List<String> messages = decorations.stream()
+ .filter(d -> d.getPriority() == severity)
+ .map(IPapyrusDecoration::getMessage)
+ .collect(Collectors.toList());
+
+ Matcher<Iterable<? super String>> delegate = hasItem(messageMatcher);
+ boolean result = delegate.matches(messages);
+ if (!result) {
+ delegate.describeMismatch(messages, mismatchDescription);
+ }
+ return result;
+ }
+ };
+ }
+
//
// Nested types
//
diff --git a/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java b/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java
index d0f96b18492..818ac24103b 100644
--- a/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java
+++ b/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java
@@ -8,7 +8,7 @@
*
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
- * Christian W. Damus - bugs 433206, 465416, 434983, 483721, 469188, 485220, 491542, 497865, 533673, 533682
+ * Christian W. Damus - bugs 433206, 465416, 434983, 483721, 469188, 485220, 491542, 497865, 533673, 533682, 533676
* Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 521550
*****************************************************************************/
package org.eclipse.papyrus.junit.utils.rules;
@@ -39,8 +39,11 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
@@ -59,11 +62,11 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.workspace.IWorkspaceCommandStack;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.RootEditPart;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.ui.palette.PaletteViewer;
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IDiagramPreferenceSupport;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
@@ -1151,12 +1154,26 @@ public class PapyrusEditorFixture extends AbstractModelFixture<TransactionalEdit
editPart.getViewer().getSelectionManager().deselect(editPart);
}
- public void move(EditPart editPart, Point newLocation) {
- execute(new ICommandProxy(new SetBoundsCommand(getEditingDomain(), "Move Node", editPart, newLocation)));
- }
-
- public void resize(EditPart editPart, Dimension newSize) {
- execute(new ICommandProxy(new SetBoundsCommand(getEditingDomain(), "Resize Node", editPart, newSize)));
+ public void move(GraphicalEditPart editPart, Point newLocation) {
+ ChangeBoundsRequest move = new ChangeBoundsRequest(RequestConstants.REQ_MOVE);
+ IFigure figure = editPart.getFigure();
+ Rectangle bounds = figure.getBounds();
+ move.setEditParts(editPart);
+ move.setConstrainedMove(false);
+ move.setMoveDelta(at(newLocation.x() - bounds.x(), newLocation.y() - bounds.y()));
+ execute(editPart.getCommand(move));
+ }
+
+ public void resize(GraphicalEditPart editPart, Dimension newSize) {
+ ChangeBoundsRequest resize = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE);
+ IFigure figure = editPart.getFigure();
+ Rectangle bounds = figure.getBounds();
+ resize.setEditParts(editPart);
+ resize.setResizeDirection(PositionConstants.SOUTH_WEST);
+ resize.setCenteredResize(false);
+ resize.setConstrainedResize(false);
+ resize.setSizeDelta(sized(newSize.width() - bounds.width(), newSize.height() - bounds.height()));
+ execute(editPart.getCommand(resize));
}
public void execute(org.eclipse.gef.commands.Command command) {
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/tests/MasterSlaveNotationSyncTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/tests/MasterSlaveNotationSyncTest.java
index 1f5e77d73af..ba02ecda633 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/tests/MasterSlaveNotationSyncTest.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/tests/MasterSlaveNotationSyncTest.java
@@ -74,9 +74,9 @@ public class MasterSlaveNotationSyncTest {
private DiagramEditPart master;
- private EditPart class1EP;
+ private GraphicalEditPart class1EP;
- private EditPart class2EP;
+ private GraphicalEditPart class2EP;
public MasterSlaveNotationSyncTest() {
super();
@@ -266,8 +266,8 @@ public class MasterSlaveNotationSyncTest {
class1_class2 = class1.getOwnedAttribute(null, class2).getAssociation();
master = editor.getActiveDiagramEditor().getDiagramEditPart();
- class1EP = editor.requireEditPart(master, class1);
- class2EP = editor.requireEditPart(master, class2);
+ class1EP = (GraphicalEditPart) editor.requireEditPart(master, class1);
+ class2EP = (GraphicalEditPart) editor.requireEditPart(master, class2);
}
DiagramEditPart activate(String diagramName) {
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/tests/NotationSyncOverrideTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/tests/NotationSyncOverrideTest.java
index 269fa55d580..08c64209ed4 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/tests/NotationSyncOverrideTest.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/sync/tests/NotationSyncOverrideTest.java
@@ -58,7 +58,7 @@ public class NotationSyncOverrideTest {
private DiagramEditPart master;
- private EditPart class2EP;
+ private GraphicalEditPart class2EP;
public NotationSyncOverrideTest() {
super();
@@ -76,7 +76,7 @@ public class NotationSyncOverrideTest {
editor.move(class2EP, newBounds.getLocation());
- EditPart class2Slave = editor.requireEditPart(slave, class2);
+ GraphicalEditPart class2Slave = (GraphicalEditPart) editor.requireEditPart(slave, class2);
if (verificationPoint()) {
assertThat(getBounds(class2Slave), is(newBounds));
@@ -127,7 +127,7 @@ public class NotationSyncOverrideTest {
editor.resize(class2EP, newBounds.getSize());
- EditPart class2Slave = editor.requireEditPart(slave, class2);
+ GraphicalEditPart class2Slave = (GraphicalEditPart) editor.requireEditPart(slave, class2);
if (verificationPoint()) {
assertThat(getBounds(class2Slave), is(newBounds));
@@ -177,7 +177,7 @@ public class NotationSyncOverrideTest {
class2 = (Class) rootPackage.getOwnedType("Class2");
master = editor.getActiveDiagramEditor().getDiagramEditPart();
- class2EP = editor.requireEditPart(master, class2);
+ class2EP = (GraphicalEditPart) editor.requireEditPart(master, class2);
}
DiagramEditPart activate(String diagramName) {
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF
index f66bf1554bb..0878ba1c853 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF
@@ -20,7 +20,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.infra.gmfdiag.preferences,
- org.eclipse.ui.workbench
+ org.eclipse.ui.workbench,
+ org.eclipse.papyrus.uml.services.decoration;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.uml.oclconstraintevaluation;bundle-version="[1.2.0,2.0.0)"
Export-Package: org.eclipse.papyrus.uml.diagram.sequence.tests
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.di b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.di
new file mode 100644
index 00000000000..8c549eecdc6
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrus.infra.services.edit.TypeContext"/>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.notation b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.notation
new file mode 100644
index 00000000000..290624cedf7
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.notation
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_4dbIsEY5Eeiq37bXGi3QbQ" type="PapyrusUMLSequenceDiagram" name="sequence" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_4dbIsUY5Eeiq37bXGi3QbQ" type="Interaction_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_4dbIskY5Eeiq37bXGi3QbQ" type="Interaction_NameLabel"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_4dbIs0Y5Eeiq37bXGi3QbQ" type="Interaction_SubfragmentCompartment">
+ <children xmi:type="notation:Shape" xmi:id="_ou3g4EcEEei509ztwo7HDQ" type="CombinedFragment_Shape">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_ou7LQEcEEei509ztwo7HDQ" type="CombinedFragment_SubfragmentCompartment">
+ <children xmi:type="notation:Shape" xmi:id="_ou7LREcEEei509ztwo7HDQ" type="InteractionOperand_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_ou7LRkcEEei509ztwo7HDQ" type="InteractionOperand_Guard">
+ <element xmi:type="uml:InteractionConstraint" href="bug533676.uml#_ouj-4UcEEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ou7LR0cEEei509ztwo7HDQ" x="5" y="5"/>
+ </children>
+ <element xmi:type="uml:InteractionOperand" href="bug533676.uml#_ouj-4EcEEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ou7LRUcEEei509ztwo7HDQ" width="100" height="82"/>
+ </children>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_ou7LQUcEEei509ztwo7HDQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_ou7LQkcEEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ou7LQ0cEEei509ztwo7HDQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_e9f4AEcFEei509ztwo7HDQ" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_e9f4AUcFEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_e9f4AkcFEei509ztwo7HDQ"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_lUyKMEcFEei509ztwo7HDQ" type="Gate_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_lUyKMkcFEei509ztwo7HDQ" type="Gate_NameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_lUyKM0cFEei509ztwo7HDQ" x="25" y="3"/>
+ </children>
+ <element xmi:type="uml:Gate" href="bug533676.uml#_lUpnUEcFEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_lUyKMUcFEei509ztwo7HDQ" x="353" y="172"/>
+ </children>
+ <element xmi:type="uml:CombinedFragment" href="bug533676.uml#_ouV8cEcEEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ou3g4UcEEei509ztwo7HDQ" x="14" y="40" width="361" height="202"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_5d8KgEY5Eeiq37bXGi3QbQ" type="Lifeline_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_5d8xkEY5Eeiq37bXGi3QbQ" type="Lifeline_NameLabel"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_mJmu0EcEEei509ztwo7HDQ" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_mJmu0UcEEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_mJmu0kcEEei509ztwo7HDQ"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_Ad13oEcFEei509ztwo7HDQ" type="BehaviorExecutionSpecification_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_Ad2esEcFEei509ztwo7HDQ" type="BehaviorExecutionSpecification_Behavior">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Ad2esUcFEei509ztwo7HDQ" x="18" y="18"/>
+ </children>
+ <element xmi:type="uml:BehaviorExecutionSpecification" href="bug533676.uml#_AdkK0EcFEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Ad13oUcFEei509ztwo7HDQ" x="40" y="190" width="20" height="100"/>
+ </children>
+ <element xmi:type="uml:Lifeline" href="bug533676.uml#_5dwkUEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_5d8KgUY5Eeiq37bXGi3QbQ" x="49" y="10"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_58sjEEY5Eeiq37bXGi3QbQ" type="Lifeline_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_58tKIEY5Eeiq37bXGi3QbQ" type="Lifeline_NameLabel"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_580e4EY5Eeiq37bXGi3QbQ" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_580e4UY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_580e4kY5Eeiq37bXGi3QbQ"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="__nvaUEY5Eeiq37bXGi3QbQ" type="BehaviorExecutionSpecification_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="__nvaUkY5Eeiq37bXGi3QbQ" type="BehaviorExecutionSpecification_Behavior">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__nvaU0Y5Eeiq37bXGi3QbQ" x="18" y="18"/>
+ </children>
+ <element xmi:type="uml:BehaviorExecutionSpecification" href="bug533676.uml#__nrv8EY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__nvaUUY5Eeiq37bXGi3QbQ" x="40" y="70" width="20" height="100"/>
+ </children>
+ <element xmi:type="uml:Lifeline" href="bug533676.uml#_58nDgEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_58sjEUY5Eeiq37bXGi3QbQ" x="244" y="10"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_s26UUEcEEei509ztwo7HDQ" type="Lifeline_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_s267YEcEEei509ztwo7HDQ" type="Lifeline_NameLabel"/>
+ <element xmi:type="uml:Lifeline" href="bug533676.uml#_s2uuIEcEEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_s26UUUcEEei509ztwo7HDQ" x="454" y="10"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4dbItEY5Eeiq37bXGi3QbQ"/>
+ </children>
+ <element xmi:type="uml:Interaction" href="bug533676.uml#_3_vHIEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4dbItUY5Eeiq37bXGi3QbQ"/>
+ </children>
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_4dbItkY5Eeiq37bXGi3QbQ" name="diagram_compatibility_version" stringValue="1.4.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_4dbIt0Y5Eeiq37bXGi3QbQ"/>
+ <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_4dbIuEY5Eeiq37bXGi3QbQ" diagramKindId="org.eclipse.papyrus.uml.diagram.sequence">
+ <owner xmi:type="uml:Class" href="bug533676.uml#_xvHdoEY5Eeiq37bXGi3QbQ"/>
+ </styles>
+ <element xmi:type="uml:Interaction" href="bug533676.uml#_3_vHIEY5Eeiq37bXGi3QbQ"/>
+ <edges xmi:type="notation:Connector" xmi:id="__mPlgEY5Eeiq37bXGi3QbQ" type="Message_SynchEdge" source="_5d8KgEY5Eeiq37bXGi3QbQ" target="_58sjEEY5Eeiq37bXGi3QbQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="__mQMkEY5Eeiq37bXGi3QbQ" type="Message_SynchNameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__mQMkUY5Eeiq37bXGi3QbQ" x="1" y="-13"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="__mQzoEY5Eeiq37bXGi3QbQ" type="Message_SynchStereotypeLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__mQzoUY5Eeiq37bXGi3QbQ" x="1" y="-33"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="__mPlgUY5Eeiq37bXGi3QbQ"/>
+ <styles xmi:type="notation:LineStyle" xmi:id="__mRasEY5Eeiq37bXGi3QbQ"/>
+ <element xmi:type="uml:Message" href="bug533676.uml#__l6OUEY5Eeiq37bXGi3QbQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="__mPlgkY5Eeiq37bXGi3QbQ" points="[0, 0, -195, 0]$[195, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="__nYN8EY5Eeiq37bXGi3QbQ" id="(0.5,0.1)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="__nYN8UY5Eeiq37bXGi3QbQ" id="(0.5,0.1)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="__n2vEEY5Eeiq37bXGi3QbQ" type="Message_ReplyEdge" source="_58sjEEY5Eeiq37bXGi3QbQ" target="_5d8KgEY5Eeiq37bXGi3QbQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="__n2vE0Y5Eeiq37bXGi3QbQ" type="Message_ReplyNameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__n2vFEY5Eeiq37bXGi3QbQ" x="1" y="-13"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="__n3WIEY5Eeiq37bXGi3QbQ" type="Message_ReplyStereotypeLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__n3WIUY5Eeiq37bXGi3QbQ" x="1" y="-33"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="__n2vEUY5Eeiq37bXGi3QbQ"/>
+ <styles xmi:type="notation:LineStyle" xmi:id="__n3WIkY5Eeiq37bXGi3QbQ"/>
+ <element xmi:type="uml:Message" href="bug533676.uml#__n054EY5Eeiq37bXGi3QbQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="__n2vEkY5Eeiq37bXGi3QbQ" points="[0, 0, 195, 0]$[-195, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="__n39MEY5Eeiq37bXGi3QbQ" id="(0.5,0.24285714285714285)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="__n39MUY5Eeiq37bXGi3QbQ" id="(0.5,0.24285714285714285)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_wfAcYEcEEei509ztwo7HDQ" type="Message_AsynchEdge" source="_58sjEEY5Eeiq37bXGi3QbQ" target="_s26UUEcEEei509ztwo7HDQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="_wfAcY0cEEei509ztwo7HDQ" type="Message_AsynchNameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_wfBDcEcEEei509ztwo7HDQ" x="1" y="-13"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_wfBDcUcEEei509ztwo7HDQ" type="Message_AsynchStereotypeLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_wfBDckcEEei509ztwo7HDQ" x="1" y="-33"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_wfAcYUcEEei509ztwo7HDQ"/>
+ <styles xmi:type="notation:LineStyle" xmi:id="_wfBDc0cEEei509ztwo7HDQ"/>
+ <element xmi:type="uml:Message" href="bug533676.uml#_weuvkEcEEei509ztwo7HDQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_wfAcYkcEEei509ztwo7HDQ" points="[-10, 5, -220, -20]$[210, 25, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_wfeWcEcEEei509ztwo7HDQ" id="(0.5,0.15714285714285714)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_wfeWcUcEEei509ztwo7HDQ" id="(0.5,0.15714285714285714)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_ncdoYEcFEei509ztwo7HDQ" type="Message_AsynchEdge" source="_5d8KgEY5Eeiq37bXGi3QbQ" target="_lUyKMEcFEei509ztwo7HDQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="_ncdoY0cFEei509ztwo7HDQ" type="Message_AsynchNameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_ncdoZEcFEei509ztwo7HDQ" x="1" y="-13"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_ncdoZUcFEei509ztwo7HDQ" type="Message_AsynchStereotypeLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_ncdoZkcFEei509ztwo7HDQ" x="1" y="-33"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_ncdoYUcFEei509ztwo7HDQ"/>
+ <styles xmi:type="notation:LineStyle" xmi:id="_ncdoZ0cFEei509ztwo7HDQ"/>
+ <element xmi:type="uml:Message" href="bug533676.uml#_ncUecEcFEei509ztwo7HDQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_ncdoYkcFEei509ztwo7HDQ" points="[-10, 10, -284, 21]$[274, -11, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_nc4fIEcFEei509ztwo7HDQ" id="(0.5,0.3)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_nc5GMEcFEei509ztwo7HDQ" id="(0.0,0.5)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_ncdoYEcFGei509ztwo7HDQ" type="Message_AsynchEdge" source="_lUyKMEcFEei509ztwo7HDQ" target="_s26UUEcEEei509ztwo7HDQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="_ncdoY0cFGei509ztwo7HDQ" type="Message_AsynchNameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_ncdoZEcFGei509ztwo7HDQ" x="1" y="-13"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_ncdoZUcFGei509ztwo7HDQ" type="Message_AsynchStereotypeLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_ncdoZkcFGei509ztwo7HDQ" x="1" y="-33"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_ncdoYUcFGei509ztwo7HDQ"/>
+ <styles xmi:type="notation:LineStyle" xmi:id="_ncdoZ0cFGei509ztwo7HDQ"/>
+ <element xmi:type="uml:Message" href="bug533676.uml#_9rM7cEcFEei509ztwo7HDQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_ncdoYkcFGei509ztwo7HDQ" points="[-10, 10, -284, 21]$[274, -11, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_nc4fIEcFGei509ztwo7HDQ" id="(0.0,0.5)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_nc5GMEcFGei509ztwo7HDQ" id="(0.5,0.3)"/>
+ </edges>
+</notation:Diagram>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.uml b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.uml
new file mode 100644
index 00000000000..f3874fcf5fb
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676.uml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_vdeLIEY5Eeiq37bXGi3QbQ" name="bug533676">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_voSUAEY5Eeiq37bXGi3QbQ">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_xvHdoEY5Eeiq37bXGi3QbQ" name="Foo">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_z1Z0sEY5Eeiq37bXGi3QbQ" name="a" visibility="public"/>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_1ovakEY5Eeiq37bXGi3QbQ" name="b" visibility="public"/>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_qdb7gEcEEei509ztwo7HDQ" name="c" visibility="public"/>
+ <ownedBehavior xmi:type="uml:Interaction" xmi:id="_3_vHIEY5Eeiq37bXGi3QbQ" name="doIt">
+ <lifeline xmi:type="uml:Lifeline" xmi:id="_5dwkUEY5Eeiq37bXGi3QbQ" name="a" represents="_z1Z0sEY5Eeiq37bXGi3QbQ" coveredBy="_ouj-4EcEEei509ztwo7HDQ __mCxMEY5Eeiq37bXGi3QbQ __n2IAUY5Eeiq37bXGi3QbQ _AdqRcEcFEei509ztwo7HDQ _AdkK0EcFEei509ztwo7HDQ _ncVFgEcFEei509ztwo7HDQ _Adq4gEcFEei509ztwo7HDQ"/>
+ <lifeline xmi:type="uml:Lifeline" xmi:id="_58nDgEY5Eeiq37bXGi3QbQ" name="b" represents="_1ovakEY5Eeiq37bXGi3QbQ" coveredBy="_ouj-4EcEEei509ztwo7HDQ __mD_UEY5Eeiq37bXGi3QbQ _we02MEcEEei509ztwo7HDQ __n2IAEY5Eeiq37bXGi3QbQ __nrv8EY5Eeiq37bXGi3QbQ"/>
+ <lifeline xmi:type="uml:Lifeline" xmi:id="_s2uuIEcEEei509ztwo7HDQ" name="c" represents="_qdb7gEcEEei509ztwo7HDQ" coveredBy="_we1dQEcEEei509ztwo7HDQ _ouj-4EcEEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:CombinedFragment" xmi:id="_ouV8cEcEEei509ztwo7HDQ" name="cfrag" interactionOperator="opt">
+ <cfragmentGate xmi:type="uml:Gate" xmi:id="_lUpnUEcFEei509ztwo7HDQ" name="gate" message="_ncUecEcFEei509ztwo7HDQ"/>
+ <operand xmi:type="uml:InteractionOperand" xmi:id="_ouj-4EcEEei509ztwo7HDQ" name="opt" covered="_s2uuIEcEEei509ztwo7HDQ _58nDgEY5Eeiq37bXGi3QbQ _5dwkUEY5Eeiq37bXGi3QbQ">
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="__mCxMEY5Eeiq37bXGi3QbQ" name="request-send" covered="_5dwkUEY5Eeiq37bXGi3QbQ" message="__l6OUEY5Eeiq37bXGi3QbQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="__mD_UEY5Eeiq37bXGi3QbQ" name="request-recv" covered="_58nDgEY5Eeiq37bXGi3QbQ" message="__l6OUEY5Eeiq37bXGi3QbQ"/>
+ <fragment xmi:type="uml:BehaviorExecutionSpecification" xmi:id="__nrv8EY5Eeiq37bXGi3QbQ" name="exec1" covered="_58nDgEY5Eeiq37bXGi3QbQ" finish="__n2IAEY5Eeiq37bXGi3QbQ" start="__mD_UEY5Eeiq37bXGi3QbQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_we02MEcEEei509ztwo7HDQ" name="async-send" covered="_58nDgEY5Eeiq37bXGi3QbQ" message="_weuvkEcEEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="__n2IAEY5Eeiq37bXGi3QbQ" name="reply-send" covered="_58nDgEY5Eeiq37bXGi3QbQ" message="__n054EY5Eeiq37bXGi3QbQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="__n2IAUY5Eeiq37bXGi3QbQ" name="reply-recv" covered="_5dwkUEY5Eeiq37bXGi3QbQ" message="__n054EY5Eeiq37bXGi3QbQ"/>
+ <fragment xmi:type="uml:ExecutionOccurrenceSpecification" xmi:id="_AdqRcEcFEei509ztwo7HDQ" name="exec2-start" covered="_5dwkUEY5Eeiq37bXGi3QbQ" execution="_AdkK0EcFEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:BehaviorExecutionSpecification" xmi:id="_AdkK0EcFEei509ztwo7HDQ" name="exec2" covered="_5dwkUEY5Eeiq37bXGi3QbQ" finish="_Adq4gEcFEei509ztwo7HDQ" start="_AdqRcEcFEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_ncVFgEcFEei509ztwo7HDQ" name="to-gate-send" covered="_5dwkUEY5Eeiq37bXGi3QbQ" message="_ncUecEcFEei509ztwo7HDQ"/>
+ <guard xmi:type="uml:InteractionConstraint" xmi:id="_ouj-4UcEEei509ztwo7HDQ" name="guard">
+ <specification xmi:type="uml:LiteralBoolean" xmi:id="_3b5WAEcEEei509ztwo7HDQ"/>
+ </guard>
+ </operand>
+ </fragment>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_we1dQEcEEei509ztwo7HDQ" name="async-recv" covered="_s2uuIEcEEei509ztwo7HDQ" message="_weuvkEcEEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_G-MJwEcGEei509ztwo7HDQ" name="from-gate-recv" covered="_s2uuIEcEEei509ztwo7HDQ" message="_9rM7cEcFEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:ExecutionOccurrenceSpecification" xmi:id="_Adq4gEcFEei509ztwo7HDQ" name="exec2-finish" covered="_5dwkUEY5Eeiq37bXGi3QbQ" execution="_AdkK0EcFEei509ztwo7HDQ"/>
+ <message xmi:type="uml:Message" xmi:id="__l6OUEY5Eeiq37bXGi3QbQ" name="request" receiveEvent="__mD_UEY5Eeiq37bXGi3QbQ" sendEvent="__mCxMEY5Eeiq37bXGi3QbQ"/>
+ <message xmi:type="uml:Message" xmi:id="__n054EY5Eeiq37bXGi3QbQ" messageSort="reply" receiveEvent="__n2IAUY5Eeiq37bXGi3QbQ" sendEvent="__n2IAEY5Eeiq37bXGi3QbQ"/>
+ <message xmi:type="uml:Message" xmi:id="_weuvkEcEEei509ztwo7HDQ" name="async" messageSort="asynchCall" receiveEvent="_we1dQEcEEei509ztwo7HDQ" sendEvent="_we02MEcEEei509ztwo7HDQ"/>
+ <message xmi:type="uml:Message" xmi:id="_ncUecEcFEei509ztwo7HDQ" name="to-gate" messageSort="asynchCall" receiveEvent="_lUpnUEcFEei509ztwo7HDQ" sendEvent="_ncVFgEcFEei509ztwo7HDQ"/>
+ <message xmi:type="uml:Message" xmi:id="_9rM7cEcFEei509ztwo7HDQ" name="from-gate" messageSort="asynchCall" receiveEvent="_G-MJwEcGEei509ztwo7HDQ" sendEvent="_lUpnUEcFEei509ztwo7HDQ"/>
+ </ownedBehavior>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.di b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.di
new file mode 100644
index 00000000000..8c549eecdc6
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrus.infra.services.edit.TypeContext"/>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.notation b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.notation
new file mode 100644
index 00000000000..ac62c506b32
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.notation
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_4dbIsEY5Eeiq37bXGi3QbQ" type="PapyrusUMLSequenceDiagram" name="sequence" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_4dbIsUY5Eeiq37bXGi3QbQ" type="Interaction_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_4dbIskY5Eeiq37bXGi3QbQ" type="Interaction_NameLabel">
+ <element xmi:type="uml:Interaction" href="bug533676a.uml#_3_vHIEY5Eeiq37bXGi3QbQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_4dbIs0Y5Eeiq37bXGi3QbQ" type="Interaction_SubfragmentCompartment">
+ <children xmi:type="notation:Shape" xmi:id="_5d8KgEY5Eeiq37bXGi3QbQ" type="Lifeline_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_5d8xkEY5Eeiq37bXGi3QbQ" type="Lifeline_NameLabel">
+ <element xmi:type="uml:Lifeline" href="bug533676a.uml#_5dwkUEY5Eeiq37bXGi3QbQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_mJmu0EcEEei509ztwo7HDQ" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_mJmu0UcEEei509ztwo7HDQ"/>
+ <element xmi:type="uml:Lifeline" href="bug533676a.uml#_5dwkUEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_mJmu0kcEEei509ztwo7HDQ"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_Ad13oEcFEei509ztwo7HDQ" type="BehaviorExecutionSpecification_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_Ad2esEcFEei509ztwo7HDQ" type="BehaviorExecutionSpecification_Behavior">
+ <element xmi:type="uml:BehaviorExecutionSpecification" href="bug533676a.uml#_AdkK0EcFEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Ad2esUcFEei509ztwo7HDQ" x="18" y="18"/>
+ </children>
+ <element xmi:type="uml:BehaviorExecutionSpecification" href="bug533676a.uml#_AdkK0EcFEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Ad13oUcFEei509ztwo7HDQ" x="40" y="190" width="20" height="100"/>
+ </children>
+ <element xmi:type="uml:Lifeline" href="bug533676a.uml#_5dwkUEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_5d8KgUY5Eeiq37bXGi3QbQ" x="49" y="10"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_58sjEEY5Eeiq37bXGi3QbQ" type="Lifeline_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_58tKIEY5Eeiq37bXGi3QbQ" type="Lifeline_NameLabel">
+ <element xmi:type="uml:Lifeline" href="bug533676a.uml#_58nDgEY5Eeiq37bXGi3QbQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_580e4EY5Eeiq37bXGi3QbQ" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_580e4UY5Eeiq37bXGi3QbQ"/>
+ <element xmi:type="uml:Lifeline" href="bug533676a.uml#_58nDgEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_580e4kY5Eeiq37bXGi3QbQ"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="__nvaUEY5Eeiq37bXGi3QbQ" type="BehaviorExecutionSpecification_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="__nvaUkY5Eeiq37bXGi3QbQ" type="BehaviorExecutionSpecification_Behavior">
+ <element xmi:type="uml:BehaviorExecutionSpecification" href="bug533676a.uml#__nrv8EY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__nvaU0Y5Eeiq37bXGi3QbQ" x="18" y="18"/>
+ </children>
+ <element xmi:type="uml:BehaviorExecutionSpecification" href="bug533676a.uml#__nrv8EY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__nvaUUY5Eeiq37bXGi3QbQ" x="40" y="70" width="20" height="100"/>
+ </children>
+ <element xmi:type="uml:Lifeline" href="bug533676a.uml#_58nDgEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_58sjEUY5Eeiq37bXGi3QbQ" x="244" y="10"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_s26UUEcEEei509ztwo7HDQ" type="Lifeline_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_s267YEcEEei509ztwo7HDQ" type="Lifeline_NameLabel">
+ <element xmi:type="uml:Lifeline" href="bug533676a.uml#_s2uuIEcEEei509ztwo7HDQ"/>
+ </children>
+ <element xmi:type="uml:Lifeline" href="bug533676a.uml#_s2uuIEcEEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_s26UUUcEEei509ztwo7HDQ" x="454" y="10"/>
+ </children>
+ <element xmi:type="uml:Interaction" href="bug533676a.uml#_3_vHIEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4dbItEY5Eeiq37bXGi3QbQ"/>
+ </children>
+ <element xmi:type="uml:Interaction" href="bug533676a.uml#_3_vHIEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4dbItUY5Eeiq37bXGi3QbQ"/>
+ </children>
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_4dbItkY5Eeiq37bXGi3QbQ" name="diagram_compatibility_version" stringValue="1.4.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_4dbIt0Y5Eeiq37bXGi3QbQ"/>
+ <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_4dbIuEY5Eeiq37bXGi3QbQ" diagramKindId="org.eclipse.papyrus.uml.diagram.sequence">
+ <owner xmi:type="uml:Class" href="bug533676a.uml#_xvHdoEY5Eeiq37bXGi3QbQ"/>
+ </styles>
+ <element xmi:type="uml:Interaction" href="bug533676a.uml#_3_vHIEY5Eeiq37bXGi3QbQ"/>
+ <edges xmi:type="notation:Connector" xmi:id="__mPlgEY5Eeiq37bXGi3QbQ" type="Message_SynchEdge" source="_5d8KgEY5Eeiq37bXGi3QbQ" target="_58sjEEY5Eeiq37bXGi3QbQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="__mQMkEY5Eeiq37bXGi3QbQ" type="Message_SynchNameLabel">
+ <element xmi:type="uml:Message" href="bug533676a.uml#__l6OUEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__mQMkUY5Eeiq37bXGi3QbQ" x="1" y="-13"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="__mQzoEY5Eeiq37bXGi3QbQ" type="Message_SynchStereotypeLabel">
+ <element xmi:type="uml:Message" href="bug533676a.uml#__l6OUEY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__mQzoUY5Eeiq37bXGi3QbQ" x="1" y="-33"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="__mPlgUY5Eeiq37bXGi3QbQ"/>
+ <styles xmi:type="notation:LineStyle" xmi:id="__mRasEY5Eeiq37bXGi3QbQ"/>
+ <element xmi:type="uml:Message" href="bug533676a.uml#__l6OUEY5Eeiq37bXGi3QbQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="__mPlgkY5Eeiq37bXGi3QbQ" points="[0, 0, -195, 0]$[195, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="__nYN8EY5Eeiq37bXGi3QbQ" id="(0.5,0.1)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="__nYN8UY5Eeiq37bXGi3QbQ" id="(0.5,0.1)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="__n2vEEY5Eeiq37bXGi3QbQ" type="Message_ReplyEdge" source="_58sjEEY5Eeiq37bXGi3QbQ" target="_5d8KgEY5Eeiq37bXGi3QbQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="__n2vE0Y5Eeiq37bXGi3QbQ" type="Message_ReplyNameLabel">
+ <element xmi:type="uml:Message" href="bug533676a.uml#__n054EY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__n2vFEY5Eeiq37bXGi3QbQ" x="1" y="-13"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="__n3WIEY5Eeiq37bXGi3QbQ" type="Message_ReplyStereotypeLabel">
+ <element xmi:type="uml:Message" href="bug533676a.uml#__n054EY5Eeiq37bXGi3QbQ"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__n3WIUY5Eeiq37bXGi3QbQ" x="1" y="-33"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="__n2vEUY5Eeiq37bXGi3QbQ"/>
+ <styles xmi:type="notation:LineStyle" xmi:id="__n3WIkY5Eeiq37bXGi3QbQ"/>
+ <element xmi:type="uml:Message" href="bug533676a.uml#__n054EY5Eeiq37bXGi3QbQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="__n2vEkY5Eeiq37bXGi3QbQ" points="[0, 0, 195, 0]$[-195, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="__n39MEY5Eeiq37bXGi3QbQ" id="(0.5,0.24285714285714285)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="__n39MUY5Eeiq37bXGi3QbQ" id="(0.5,0.24285714285714285)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_wfAcYEcEEei509ztwo7HDQ" type="Message_AsynchEdge" source="_58sjEEY5Eeiq37bXGi3QbQ" target="_s26UUEcEEei509ztwo7HDQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="_wfAcY0cEEei509ztwo7HDQ" type="Message_AsynchNameLabel">
+ <element xmi:type="uml:Message" href="bug533676a.uml#_weuvkEcEEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_wfBDcEcEEei509ztwo7HDQ" x="1" y="-13"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_wfBDcUcEEei509ztwo7HDQ" type="Message_AsynchStereotypeLabel">
+ <element xmi:type="uml:Message" href="bug533676a.uml#_weuvkEcEEei509ztwo7HDQ"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_wfBDckcEEei509ztwo7HDQ" x="1" y="-33"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_wfAcYUcEEei509ztwo7HDQ"/>
+ <styles xmi:type="notation:LineStyle" xmi:id="_wfBDc0cEEei509ztwo7HDQ"/>
+ <element xmi:type="uml:Message" href="bug533676a.uml#_weuvkEcEEei509ztwo7HDQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_wfAcYkcEEei509ztwo7HDQ" points="[-10, 5, -220, -20]$[210, 25, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_wfeWcEcEEei509ztwo7HDQ" id="(0.5,0.15714285714285714)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_wfeWcUcEEei509ztwo7HDQ" id="(0.5,0.15714285714285714)"/>
+ </edges>
+</notation:Diagram>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.uml b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.uml
new file mode 100644
index 00000000000..a7880ecb207
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533676a.uml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_vdeLIEY5Eeiq37bXGi3QbQ" name="bug533676">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_voSUAEY5Eeiq37bXGi3QbQ">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_xvHdoEY5Eeiq37bXGi3QbQ" name="Foo">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_z1Z0sEY5Eeiq37bXGi3QbQ" name="a" visibility="public"/>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_1ovakEY5Eeiq37bXGi3QbQ" name="b" visibility="public"/>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_qdb7gEcEEei509ztwo7HDQ" name="c" visibility="public"/>
+ <ownedBehavior xmi:type="uml:Interaction" xmi:id="_3_vHIEY5Eeiq37bXGi3QbQ" name="doIt">
+ <lifeline xmi:type="uml:Lifeline" xmi:id="_5dwkUEY5Eeiq37bXGi3QbQ" name="a" represents="_z1Z0sEY5Eeiq37bXGi3QbQ" coveredBy="__mCxMEY5Eeiq37bXGi3QbQ __n2IAUY5Eeiq37bXGi3QbQ _AdqRcEcFEei509ztwo7HDQ _AdkK0EcFEei509ztwo7HDQ _Adq4gEcFEei509ztwo7HDQ"/>
+ <lifeline xmi:type="uml:Lifeline" xmi:id="_58nDgEY5Eeiq37bXGi3QbQ" name="b" represents="_1ovakEY5Eeiq37bXGi3QbQ" coveredBy="__mD_UEY5Eeiq37bXGi3QbQ _we02MEcEEei509ztwo7HDQ __n2IAEY5Eeiq37bXGi3QbQ __nrv8EY5Eeiq37bXGi3QbQ"/>
+ <lifeline xmi:type="uml:Lifeline" xmi:id="_s2uuIEcEEei509ztwo7HDQ" name="c" represents="_qdb7gEcEEei509ztwo7HDQ" coveredBy="_we1dQEcEEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="__mCxMEY5Eeiq37bXGi3QbQ" name="request-send" covered="_5dwkUEY5Eeiq37bXGi3QbQ" message="__l6OUEY5Eeiq37bXGi3QbQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="__mD_UEY5Eeiq37bXGi3QbQ" name="request-recv" covered="_58nDgEY5Eeiq37bXGi3QbQ" message="__l6OUEY5Eeiq37bXGi3QbQ"/>
+ <fragment xmi:type="uml:BehaviorExecutionSpecification" xmi:id="__nrv8EY5Eeiq37bXGi3QbQ" name="exec1" covered="_58nDgEY5Eeiq37bXGi3QbQ" finish="__n2IAEY5Eeiq37bXGi3QbQ" start="__mD_UEY5Eeiq37bXGi3QbQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_we02MEcEEei509ztwo7HDQ" name="async-send" covered="_58nDgEY5Eeiq37bXGi3QbQ" message="_weuvkEcEEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_we1dQEcEEei509ztwo7HDQ" name="async-recv" covered="_s2uuIEcEEei509ztwo7HDQ" message="_weuvkEcEEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="__n2IAEY5Eeiq37bXGi3QbQ" name="reply-send" covered="_58nDgEY5Eeiq37bXGi3QbQ" message="__n054EY5Eeiq37bXGi3QbQ"/>
+ <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="__n2IAUY5Eeiq37bXGi3QbQ" name="reply-recv" covered="_5dwkUEY5Eeiq37bXGi3QbQ" message="__n054EY5Eeiq37bXGi3QbQ"/>
+ <fragment xmi:type="uml:ExecutionOccurrenceSpecification" xmi:id="_AdqRcEcFEei509ztwo7HDQ" name="exec2-start" covered="_5dwkUEY5Eeiq37bXGi3QbQ" execution="_AdkK0EcFEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:BehaviorExecutionSpecification" xmi:id="_AdkK0EcFEei509ztwo7HDQ" name="exec2" covered="_5dwkUEY5Eeiq37bXGi3QbQ" finish="_Adq4gEcFEei509ztwo7HDQ" start="_AdqRcEcFEei509ztwo7HDQ"/>
+ <fragment xmi:type="uml:ExecutionOccurrenceSpecification" xmi:id="_Adq4gEcFEei509ztwo7HDQ" name="exec2-finish" covered="_5dwkUEY5Eeiq37bXGi3QbQ" execution="_AdkK0EcFEei509ztwo7HDQ"/>
+ <message xmi:type="uml:Message" xmi:id="__l6OUEY5Eeiq37bXGi3QbQ" name="request" receiveEvent="__mD_UEY5Eeiq37bXGi3QbQ" sendEvent="__mCxMEY5Eeiq37bXGi3QbQ"/>
+ <message xmi:type="uml:Message" xmi:id="__n054EY5Eeiq37bXGi3QbQ" messageSort="reply" receiveEvent="__n2IAUY5Eeiq37bXGi3QbQ" sendEvent="__n2IAEY5Eeiq37bXGi3QbQ"/>
+ <message xmi:type="uml:Message" xmi:id="_weuvkEcEEei509ztwo7HDQ" name="async" messageSort="asynchCall" receiveEvent="_we1dQEcEEei509ztwo7HDQ" sendEvent="_we02MEcEEei509ztwo7HDQ"/>
+ </ownedBehavior>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java
index cf1add4893b..84ce45bde15 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java
@@ -13,6 +13,7 @@
package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
+import static org.eclipse.papyrus.junit.matchers.DiagramMatchers.hasErrorDecorationThat;
import static org.eclipse.papyrus.junit.matchers.MoreMatchers.greaterThan;
import static org.eclipse.papyrus.junit.matchers.MoreMatchers.greaterThanOrEqual;
import static org.eclipse.papyrus.junit.matchers.MoreMatchers.isEmpty;
@@ -28,6 +29,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assume.assumeThat;
@@ -44,6 +46,9 @@ import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.emf.validation.service.IValidationListener;
+import org.eclipse.emf.validation.service.ModelValidationService;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.Request;
@@ -638,6 +643,51 @@ public class CombinedFragmentRegressionTest extends AbstractPapyrusTest {
});
}
+ /**
+ * Verify the validation of an interaction operand when it is resized.
+ */
+ @Test
+ @PluginResource("resource/bugs/bug533676.di")
+ public void validateResizedInteractionOperand_533676() {
+ GraphicalEditPart operandEP = (GraphicalEditPart) editor.findEditPart("opt", InteractionOperand.class);
+ InteractionOperand operand = (InteractionOperand) operandEP.getAdapter(EObject.class);
+ Interaction interaction = (Interaction) operand.eContainer().eContainer();
+
+ editor.resize(operandEP, sized(100, 185));
+
+ EditPart messageEP = editor.requireEditPart(editor.getActiveDiagram(), interaction.getMessage("async"));
+ assertThat(messageEP, hasErrorDecorationThat(startsWith("Message crosses")));
+
+ EditPart execEP = editor.requireEditPart(editor.getActiveDiagram(), operand.getFragment("exec2"));
+ assertThat(execEP, hasErrorDecorationThat(startsWith("Execution specification crosses")));
+ }
+
+ /**
+ * Verify the validation of an interaction operand when it is created.
+ * Note that <em>what</em> is validated depends on how well the new interaction operand
+ * encloses and adopts interaction fragments. We do not test that here as that is an
+ * orthogonal concern to the fact of running validation.
+ */
+ @Test
+ @PluginResource("resource/bugs/bug533676a.di")
+ public void validateCreatedInteractionOperand_533676() {
+ EditPart interactionEP = editor.findEditPart("doIt", Interaction.class);
+ EditPart interactionCompartment = editor.getShapeCompartment(interactionEP);
+
+ boolean[] validationOccurred = { false };
+ // Lots of live validations occur; we don't want those
+ IValidationListener listener = event -> validationOccurred[0] |= (event.getEvaluationMode() == EvaluationMode.BATCH);
+
+ ModelValidationService.getInstance().addValidationListener(listener);
+ try {
+ editor.createShape(interactionCompartment, UMLElementTypes.CombinedFragment_Shape, at(15, 40), sized(360, 200));
+ } finally {
+ ModelValidationService.getInstance().removeValidationListener(listener);
+ }
+
+ assertThat("No batch validation occurred", validationOccurred[0], is(true));
+ }
+
//
// Test framework
//

Back to the top