Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF152
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-messages.properties12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CustomMessages.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateCoordinateCommand.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateExecutionSpecificationWithMessage.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/DropDestructionOccurenceSpecification.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentCombinedFragmentCompartmentEditPart.java180
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/Messages.java83
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/messages.properties12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/preferences/CustomDiagramGeneralPreferencePage.java58
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java50
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectToGridEditPolicy.java183
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridBasedXYLayoutEditPolicy.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java52
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingEditpart.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineXYLayoutEditPolicy.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifelineCreationEditPolicy.java276
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LogOptions.java38
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageConnectionHelper.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SelectMessagesEditPartTracker.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/SequenceDiagramEditPart.java126
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF66
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCreationUndo_384618.java575
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestMessagesDeletion_364828.java608
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramLink.java539
27 files changed, 1618 insertions, 1515 deletions
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 487254f0d3a..843ed844c5f 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
@@ -1,75 +1,77 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.sequence,
- org.eclipse.papyrus.uml.diagram.sequence.edit.parts,
- org.eclipse.papyrus.uml.diagram.sequence.edit.policies,
- org.eclipse.papyrus.uml.diagram.sequence.figures,
- org.eclipse.papyrus.uml.diagram.sequence.internal.constraints;x-internal:=true,
- org.eclipse.papyrus.uml.diagram.sequence.part,
- org.eclipse.papyrus.uml.diagram.sequence.providers,
- org.eclipse.papyrus.uml.diagram.sequence.util
-Bundle-ActivationPolicy: lazy
-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)",
- 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)",
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)",
- 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.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)",
- org.apache.batik.util;bundle-version="[1.6.0,1.7.0)",
- org.apache.batik.svggen;bundle-version="[1.6.0,1.7.0)",
- org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)",
- org.apache.batik.css;bundle-version="[1.6.0,1.7.0)",
- 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)",
- org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.core.expressions,
- org.eclipse.jface,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="[1.2.0,2.0.0)",
- 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,
- org.eclipse.uml2.uml.edit;visibility:=reexport,
- org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
- org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.uml.diagram.stereotype.edition,
- org.eclipse.papyrus.infra.properties,
- org.eclipse.papyrus.infra.properties.ui,
- org.eclipse.papyrus.uml.diagram.menu,
- org.eclipse.draw2d;visibility:=reexport,
- org.eclipse.gmf.runtime.notation;visibility:=reexport
-Bundle-Vendor: %providerName
-Bundle-Version: 3.0.0.qualifier
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence; singleton:=true
-Import-Package: com.google.common.collect;version="21.0.0"
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.uml.diagram.sequence,
+ org.eclipse.papyrus.uml.diagram.sequence.edit.parts,
+ org.eclipse.papyrus.uml.diagram.sequence.edit.policies,
+ org.eclipse.papyrus.uml.diagram.sequence.figures,
+ org.eclipse.papyrus.uml.diagram.sequence.internal.constraints;x-internal:=true,
+ org.eclipse.papyrus.uml.diagram.sequence.messages,
+ org.eclipse.papyrus.uml.diagram.sequence.part,
+ org.eclipse.papyrus.uml.diagram.sequence.preferences,
+ org.eclipse.papyrus.uml.diagram.sequence.providers,
+ org.eclipse.papyrus.uml.diagram.sequence.util
+Bundle-ActivationPolicy: lazy
+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)",
+ 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)",
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)",
+ 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.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.util;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.svggen;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.css;bundle-version="[1.6.0,1.7.0)",
+ 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)",
+ org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.core.expressions,
+ org.eclipse.jface,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.views,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.gmf.runtime.emf.core,
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.gmf.runtime.emf.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="[1.2.0,2.0.0)",
+ 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,
+ org.eclipse.uml2.uml.edit;visibility:=reexport,
+ org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
+ org.eclipse.gef,
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.uml.diagram.stereotype.edition,
+ org.eclipse.papyrus.infra.properties,
+ org.eclipse.papyrus.infra.properties.ui,
+ org.eclipse.papyrus.uml.diagram.menu,
+ org.eclipse.draw2d;visibility:=reexport,
+ org.eclipse.gmf.runtime.notation;visibility:=reexport
+Bundle-Vendor: %providerName
+Bundle-Version: 3.0.0.qualifier
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence; singleton:=true
+Import-Package: com.google.common.collect;version="21.0.0"
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-messages.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-messages.properties
index cd5ad921e93..1e485099d1e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-messages.properties
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-messages.properties
@@ -13,14 +13,4 @@ DropError_DefaultTxt=For an unknown reason, this link can not be dropped between
DropError_UphillMessageTitle=Message can not be dropped
DropError_UphillMessageTxt=This message goes uphill ({0} should be at least {2}px lower compared to {1}).
Warning_ResizeInteractionOperandTitle=Resize of Interaction Operands may be erratic
-Warning_ResizeInteractionOperandTxt=The resize of the Interaction Operands you have just performed may be erratic.{0}Check contained fragments and slightly move them inside the Operand if necessary.
-DiagramsPreferencePage_notificationGroup_label=Automatic creations
-DiagramsPreferencePage_executionSpecificationWithSyncMsg_label=When creating a synchronous message, also create:
-DiagramsPreferencePage_executionSpecificationWithAsyncMsg_label=When creating an asynchronous message, also create:
-DiagramsPreferencePage_createBehaviorExecutionSpecificationAndReply=A Behavior Execution Specification and a Reply Message
-DiagramsPreferencePage_createBehaviorExecutionSpecification=A Behavior Execution Specification
-DiagramsPreferencePage_createActionExecutionSpecificationAndReply=An Action Execution Specification and a Reply Message
-DiagramsPreferencePage_createActionExecutionSpecification=An Action Execution Specification
-DiagramsPreferencePage_createNoExecutionSpecification=Nothing
-Commands_DropDestructionOccurenceSpecification_Label=Drop Destruction Occurrence Specification
-Commands_CreateExecutionSpecification_Label=Execution Specification Automatic Creation with Message \ No newline at end of file
+Warning_ResizeInteractionOperandTxt=The resize of the Interaction Operands you have just performed may be erratic.{0}Check contained fragments and slightly move them inside the Operand if necessary. \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CustomMessages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CustomMessages.java
index 298da9ab5bf..ed184ee87fc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CustomMessages.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CustomMessages.java
@@ -17,6 +17,7 @@ import org.eclipse.osgi.util.NLS;
/**
* @author Jin Liu (jin.liu@soyatec.com)
+ * @since 3.0
*/
public class CustomMessages extends NLS {
@@ -43,9 +44,6 @@ public class CustomMessages extends NLS {
public static String CommandHelper_CreateMessage;
- public static String Commands_DropDestructionOccurenceSpecification_Label;
-
- public static String Commands_CreateExecutionSpecification_Label;
/**
* Error message for when an error occurs in FragmentOrderingKeeper evaluation.
*/
@@ -87,38 +85,5 @@ public class CustomMessages extends NLS {
*/
public static String Warning_ResizeInteractionOperandTxt;
- /**
- * Preference messages
- *@since 3.0
- **/
- public static String DiagramsPreferencePage_notificationGroup_label;
-
- public static String DiagramsPreferencePage_executionSpecificationWithSyncMsg_label;
-
- public static String DiagramsPreferencePage_executionSpecificationWithAsyncMsg_label;
-
- public static String DiagramsPreferencePage_createBehaviorExecutionSpecificationAndReply;
-
- public static String DiagramsPreferencePage_createBehaviorExecutionSpecification;
-
- public static String DiagramsPreferencePage_createActionExecutionSpecificationAndReply;
-
- public static String DiagramsPreferencePage_createActionExecutionSpecification;
-
- public static String DiagramsPreferencePage_createNoExecutionSpecification;
-
- /**
- * the preferences
- */
- public static String PREF_EXECUTION_SPECIFICATION_SYNC_MSG;
-
- public static String PREF_EXECUTION_SPECIFICATION_ASYNC_MSG; //$NON-NLS-1$
-
- /** trace messages */
- public static String SEQUENCE_DEBUG = "SequenceDebug"; // //$NON-NLS-0$
-
- public static String SEQUENCE_DEBUG_REFERENCEGRID = "SequenceDebugGrid"; // //$NON-NLS-0$
-
- public static String SEQUENCE_DEBUG_UTIL = "SequenceDebugUtil"; // //$NON-NLS-0$
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateCoordinateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateCoordinateCommand.java
index 96ad41b3b5d..e7f8f4be79d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateCoordinateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateCoordinateCommand.java
@@ -22,7 +22,8 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.GrillingEditpart;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions;
+import org.eclipse.papyrus.uml.diagram.sequence.messages.Messages;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.GridManagementEditPolicy;
import org.eclipse.uml2.uml.Element;
@@ -51,7 +52,7 @@ public class CreateCoordinateCommand extends RecordingCommand {
* The EditPart view of the Compartment
*/
public CreateCoordinateCommand(TransactionalEditingDomain domain, BasicCompartment compartment, String name, Element semantic, int position) {
- super(domain, "create Grilling Structure");
+ super(domain, "create Grilling Structure"); //$NON-NLS-1$
this.compartment = compartment;
this.name = name;
this.position = position;
@@ -73,7 +74,7 @@ public class CreateCoordinateCommand extends RecordingCommand {
}
if (name.startsWith(GridManagementEditPolicy.ROW)) {
linelocation.setY(position);
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, ">>>Create row at " + position); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, ">>>Create row at " + position); //$NON-NLS-1$
}
coordinate.setLayoutConstraint(linelocation);
if (semantic != null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateExecutionSpecificationWithMessage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateExecutionSpecificationWithMessage.java
index 504e984f9c9..12854dd9e77 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateExecutionSpecificationWithMessage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateExecutionSpecificationWithMessage.java
@@ -19,15 +19,12 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
@@ -36,11 +33,11 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElemen
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
+import org.eclipse.papyrus.uml.diagram.sequence.messages.Messages;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomActionExecutionSpecificationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.preferences.CustomDiagramGeneralPreferencePage;
import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes;
import org.eclipse.uml2.uml.Message;
@@ -64,12 +61,10 @@ public class CreateExecutionSpecificationWithMessage extends AbstractTransaction
* @param graphicalContainer the lifeline that will contain the event representation
*/
public CreateExecutionSpecificationWithMessage(TransactionalEditingDomain domain, CreateConnectionViewAndElementRequest request, EditPart graphicalContainer) {
- super(domain, CustomMessages.Commands_CreateExecutionSpecification_Label, null);
+ super(domain, Messages.Commands_CreateExecutionSpecification_Label, null);
this.request=request;
this.graphicalContainer= graphicalContainer;
- this.preference = "CHOICE_BEHAVIOR";
- this.type = UMLDIElementTypes.BEHAVIOR_EXECUTION_SPECIFICATION_SHAPE;
this.createReply = false;
}
@@ -86,13 +81,13 @@ public class CreateExecutionSpecificationWithMessage extends AbstractTransaction
//1. look for the message triggering the creation of the execution specification
Message message=getMessage();
if( message==null){
- throw new ExecutionException("null message");
+ throw new ExecutionException("null message"); //$NON-NLS-1$
}
//2. retrieve preferences to apply
// according to the message sort
retrievePreferences();
- if( type==null || preference=="CHOICE_NONE") {
- throw new ExecutionException("undefined preference");
+ if( type==null || CustomDiagramGeneralPreferencePage.CHOICE_NONE.equals(preference)) {
+ throw new ExecutionException("undefined preference"); //$NON-NLS-1$
}
//3. create execution specification at target
createExecutionSpecification();
@@ -170,27 +165,26 @@ public class CreateExecutionSpecificationWithMessage extends AbstractTransaction
* retrieve preferences concerned with automatic creation of execution specifications
*/
private void retrievePreferences() {
- this.preference = "CHOICE_BEHAVIOR";
this.type = null;
IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
if (request.getConnectionViewAndElementDescriptor().getSemanticHint().equals(UMLDIElementTypes.MESSAGE_ASYNCH_EDGE.getSemanticHint())) {
//for asynchronous messages
- this.preference = store.getString(CustomMessages.PREF_EXECUTION_SPECIFICATION_ASYNC_MSG);
+ this.preference = store.getString(CustomDiagramGeneralPreferencePage.PREF_EXECUTION_SPECIFICATION_ASYNC_MSG);
}
if (request.getConnectionViewAndElementDescriptor().getSemanticHint().equals(UMLDIElementTypes.MESSAGE_SYNCH_EDGE.getSemanticHint())) {
//for synchronous messages
- this.preference = store.getString(CustomMessages.PREF_EXECUTION_SPECIFICATION_SYNC_MSG);
+ this.preference = store.getString(CustomDiagramGeneralPreferencePage.PREF_EXECUTION_SPECIFICATION_SYNC_MSG);
}
// case where a behavior execution specification must be created at target
- if ("CHOICE_BEHAVIOR".equals(preference) || "CHOICE_BEHAVIOR_AND_REPLY".equals(preference)) {
+ if (CustomDiagramGeneralPreferencePage.CHOICE_BEHAVIOR.equals(preference) || CustomDiagramGeneralPreferencePage.CHOICE_BEHAVIOR_AND_REPLY.equals(preference)) {
this.type = UMLDIElementTypes.BEHAVIOR_EXECUTION_SPECIFICATION_SHAPE;
}
// case where an action execution specification must be created at target
- if ("CHOICE_ACTION".equals(preference) || "CHOICE_ACTION_AND_REPLY".equals(preference)) {
+ if (CustomDiagramGeneralPreferencePage.CHOICE_ACTION.equals(preference) || CustomDiagramGeneralPreferencePage.CHOICE_ACTION_AND_REPLY.equals(preference)) {
this.type = UMLDIElementTypes.ACTION_EXECUTION_SPECIFICATION_SHAPE;
}
// case where a message reply must also be created
- if ("CHOICE_BEHAVIOR_AND_REPLY".equals(preference) || "CHOICE_ACTION_AND_REPLY".equals(preference)) {
+ if (CustomDiagramGeneralPreferencePage.CHOICE_BEHAVIOR_AND_REPLY.equals(preference) || CustomDiagramGeneralPreferencePage.CHOICE_ACTION_AND_REPLY.equals(preference)) {
this.createReply = true;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/DropDestructionOccurenceSpecification.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/DropDestructionOccurenceSpecification.java
index b10c74e08ee..08269802f10 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/DropDestructionOccurenceSpecification.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/DropDestructionOccurenceSpecification.java
@@ -31,8 +31,8 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElemen
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest.ConnectionViewAndElementDescriptor;
import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
import org.eclipse.papyrus.uml.diagram.sequence.figures.DestructionEventFigure;
+import org.eclipse.papyrus.uml.diagram.sequence.messages.Messages;
import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
import org.eclipse.uml2.uml.Message;
import org.eclipse.uml2.uml.MessageEnd;
@@ -54,7 +54,7 @@ public class DropDestructionOccurenceSpecification extends AbstractTransactional
* @param graphicalContainer for example the lifeline that will contain the representation of the event
*/
public DropDestructionOccurenceSpecification(TransactionalEditingDomain domain, CreateConnectionViewAndElementRequest request, EditPart graphicalContainer, Point absolutePosition) {
- super(domain, CustomMessages.Commands_DropDestructionOccurenceSpecification_Label, null);
+ super(domain, Messages.Commands_DropDestructionOccurenceSpecification_Label, null);
this.request=request;
this.graphicalContainer= graphicalContainer;
this.absolutePosition=absolutePosition;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentCombinedFragmentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentCombinedFragmentCompartmentEditPart.java
index 7bc29860e0f..a76d93ec751 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentCombinedFragmentCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentCombinedFragmentCompartmentEditPart.java
@@ -1,90 +1,90 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.BoundForEditPart;
-
-/**
- * This class has been modified for 2 reasons:
- * - refresh in order to ensure the refresh about size of children
- * - compute the ratio for each children.
- *
- * @since 3.0
- *
- */
-public class CCombinedFragmentCombinedFragmentCompartmentEditPart extends CombinedFragmentCombinedFragmentCompartmentEditPart {
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CCombinedFragmentCombinedFragmentCompartmentEditPart(View view) {
- super(view);
- }
-
- /**
- * this method has been overloaded in order to ensure the refresh about children size
- */
- protected void refreshBounds() {
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- Dimension size = new Dimension(width, height);
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
-
- // this code has been added in order to force the refresh of Sub Combined fragment
- if (children != null) {
- for (Object child : children) {
- if (child instanceof EditPart) {
- ((EditPart) child).refresh();
- }
- }
- }
- }
-
- /**
- * This code is specific an use to constraint the size of sub compartments.
- * the ratio has to be recompute in order to have a good display
- *
- * @see GraphicalEditPart#setLayoutConstraint(EditPart, IFigure, Object)
- */
- public void setLayoutConstraint(EditPart child, IFigure childFigure,
- Object childConstraint) {
- EditPart parentEditPart = this.getParent();
- // compute the ratio for each children
- int parentHeight = BoundForEditPart.getHeightFromView((Node) parentEditPart.getModel())-27;
- if (childConstraint instanceof Rectangle) {
- double ratio = ((double) ((Rectangle) childConstraint).height) / parentHeight;
- if (ratio >= 1.0) {
- ratio = 0.95;
- }
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG, ((Rectangle) childConstraint).height +"--> ratio" + ratio); //$NON-NLS-1$
- childFigure.getParent().setConstraint(childFigure, ratio);
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.BoundForEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions;
+
+/**
+ * This class has been modified for 2 reasons:
+ * - refresh in order to ensure the refresh about size of children
+ * - compute the ratio for each children.
+ *
+ * @since 3.0
+ *
+ */
+public class CCombinedFragmentCombinedFragmentCompartmentEditPart extends CombinedFragmentCombinedFragmentCompartmentEditPart {
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ */
+ public CCombinedFragmentCombinedFragmentCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * this method has been overloaded in order to ensure the refresh about children size
+ */
+ protected void refreshBounds() {
+ int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ Dimension size = new Dimension(width, height);
+ int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+
+ // this code has been added in order to force the refresh of Sub Combined fragment
+ if (children != null) {
+ for (Object child : children) {
+ if (child instanceof EditPart) {
+ ((EditPart) child).refresh();
+ }
+ }
+ }
+ }
+
+ /**
+ * This code is specific an use to constraint the size of sub compartments.
+ * the ratio has to be recompute in order to have a good display
+ *
+ * @see GraphicalEditPart#setLayoutConstraint(EditPart, IFigure, Object)
+ */
+ public void setLayoutConstraint(EditPart child, IFigure childFigure,
+ Object childConstraint) {
+ EditPart parentEditPart = this.getParent();
+ // compute the ratio for each children
+ int parentHeight = BoundForEditPart.getHeightFromView((Node) parentEditPart.getModel())-27;
+ if (childConstraint instanceof Rectangle) {
+ double ratio = ((double) ((Rectangle) childConstraint).height) / parentHeight;
+ if (ratio >= 1.0) {
+ ratio = 0.95;
+ }
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG, ((Rectangle) childConstraint).height +"--> ratio" + ratio); //$NON-NLS-1$
+ childFigure.getParent().setConstraint(childFigure, ratio);
+ }
+ }
+}
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
new file mode 100644
index 00000000000..ceb992fc543
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/Messages.java
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @since 3.0
+ */
+public class Messages {
+
+ static {
+ NLS.initializeMessages("org.eclipse.papyrus.uml.diagram.sequence.messages.messages", Messages.class); //$NON-NLS-1$
+ }
+
+ private Messages() {
+ }
+
+ /*************************************************************************
+ * Preference messages
+ ************************************************************************/
+
+ /**
+ * label for the part of the preference page involved with automatic creations of elements when creating a message
+ */
+ public static String DiagramsPreferencePage_notificationGroup_label;
+
+ /**
+ * label to ask which behavior should be triggered when creating a synchronous message
+ */
+ public static String DiagramsPreferencePage_executionSpecificationWithSyncMsg_label;
+
+ /**
+ * label to ask which behavior should be triggered when creating an asynchronous message
+ */
+ public static String DiagramsPreferencePage_executionSpecificationWithAsyncMsg_label;
+
+ /**
+ * label specifying that a behavior execution specification and a message reply should be created
+ */
+ public static String DiagramsPreferencePage_createBehaviorExecutionSpecificationAndReply;
+
+ /**
+ * label specifying that a behavior execution specification should be created at message target
+ */
+ public static String DiagramsPreferencePage_createBehaviorExecutionSpecification;
+
+ /**
+ * label specifying that an action execution specification and a message reply should be created
+ */
+ public static String DiagramsPreferencePage_createActionExecutionSpecificationAndReply;
+
+ /**
+ * label specifying that an action execution specification should be created at message target
+ */
+ public static String DiagramsPreferencePage_createActionExecutionSpecification;
+
+ /**
+ * label specifying that only the message should be created
+ */
+ public static String DiagramsPreferencePage_createNoExecutionSpecification;
+
+ /*************************************************************************
+ * Command labels
+ ************************************************************************/
+
+ public static String Commands_CreateExecutionSpecification_Label;
+
+ public static String Commands_DropDestructionOccurenceSpecification_Label;
+
+}
+
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
new file mode 100644
index 00000000000..0f4b02254d1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/messages/messages.properties
@@ -0,0 +1,12 @@
+DiagramsPreferencePage_notificationGroup_label=Automatic creations
+DiagramsPreferencePage_executionSpecificationWithSyncMsg_label=When creating a synchronous message, also create:
+DiagramsPreferencePage_executionSpecificationWithAsyncMsg_label=When creating an asynchronous message, also create:
+DiagramsPreferencePage_createBehaviorExecutionSpecificationAndReply=A Behavior Execution Specification and a Reply Message
+DiagramsPreferencePage_createBehaviorExecutionSpecification=A Behavior Execution Specification
+DiagramsPreferencePage_createActionExecutionSpecificationAndReply=An Action Execution Specification and a Reply Message
+DiagramsPreferencePage_createActionExecutionSpecification=An Action Execution Specification
+DiagramsPreferencePage_createNoExecutionSpecification=Nothing
+Commands_DropDestructionOccurenceSpecification_Label=Drop Destruction Occurrence Specification
+Commands_CreateExecutionSpecification_Label=Execution Specification Automatic Creation with Message
+Commands_DropDestructionOccurenceSpecification_Label=Drop Destruction Occurrence Specification
+Commands_CreateExecutionSpecification_Label=Execution Specification Automatic Creation with Message
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 5f8caba4537..46d5e4a834d 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
@@ -14,7 +14,7 @@ package org.eclipse.papyrus.uml.diagram.sequence.preferences;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
+import org.eclipse.papyrus.uml.diagram.sequence.messages.Messages;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.SequenceDiagramEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.swt.SWT;
@@ -23,9 +23,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
-/**
- * @generated
- */
+
public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
/**
@@ -37,10 +35,26 @@ public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
* preference page editor control for choosing if and which execution specifications should be automatically created with asynchronous messages
*/
private RadioGroupFieldEditor executionSpecificationWithAsyncMsg = null;
+
+ /**
+ * preference key for asynchronous messages
+ */
+ public static String PREF_EXECUTION_SPECIFICATION_ASYNC_MSG = "PREF_EXECUTION_SPECIFICATION_ASYNC_MSG"; //$NON-NLS-1$
+
+ /**
+ * preference key for synchronous messages
+ */
+ public static String PREF_EXECUTION_SPECIFICATION_SYNC_MSG = "PREF_EXECUTION_SPECIFICATION_SYNC_MSG"; //$NON-NLS-1$
/**
- * @generated
+ * possible preference values
*/
+ public static final String CHOICE_BEHAVIOR_AND_REPLY= "CHOICE_BEHAVIOR_AND_REPLY"; //$NON-NLS-1$
+ public static final String CHOICE_ACTION_AND_REPLY= "CHOICE_ACTION_AND_REPLY"; //$NON-NLS-1$
+ public static final String CHOICE_BEHAVIOR= "CHOICE_BEHAVIOR"; //$NON-NLS-1$
+ public static final String CHOICE_ACTION= "CHOICE_ACTION"; //$NON-NLS-1$
+ public static final String CHOICE_NONE= "CHOICE_NONE"; //$NON-NLS-1$
+
public CustomDiagramGeneralPreferencePage() {
setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
setPreferenceKey(SequenceDiagramEditPart.MODEL_ID);
@@ -62,7 +76,7 @@ public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalSpan = 2;
notificationsGroup.setLayoutData(gridData);
- notificationsGroup.setText(CustomMessages.DiagramsPreferencePage_notificationGroup_label);
+ notificationsGroup.setText(Messages.DiagramsPreferencePage_notificationGroup_label);
Composite composite = new Composite(notificationsGroup, SWT.NONE);
createFieldEditors(composite);
addField(executionSpecificationWithSyncMsg);
@@ -76,24 +90,24 @@ public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
protected void createFieldEditors(Composite composite) {
// preference for choosing if and which execution specifications should be automatically created with synchronous message
// choice between behavior execution specification, action execution specification or nothing
- executionSpecificationWithSyncMsg = new RadioGroupFieldEditor(CustomMessages.PREF_EXECUTION_SPECIFICATION_SYNC_MSG,
- CustomMessages.DiagramsPreferencePage_executionSpecificationWithSyncMsg_label, 1,
+ executionSpecificationWithSyncMsg = new RadioGroupFieldEditor(PREF_EXECUTION_SPECIFICATION_SYNC_MSG,
+ Messages.DiagramsPreferencePage_executionSpecificationWithSyncMsg_label, 1,
new String[][] {
- { CustomMessages.DiagramsPreferencePage_createBehaviorExecutionSpecificationAndReply, "CHOICE_BEHAVIOR_AND_REPLY" },
- { CustomMessages.DiagramsPreferencePage_createActionExecutionSpecificationAndReply, "CHOICE_ACTION_AND_REPLY" },
- { CustomMessages.DiagramsPreferencePage_createBehaviorExecutionSpecification, "CHOICE_BEHAVIOR" },
- { CustomMessages.DiagramsPreferencePage_createActionExecutionSpecification, "CHOICE_ACTION" },
- { CustomMessages.DiagramsPreferencePage_createNoExecutionSpecification, "CHOICE_NONE" }
+ { Messages.DiagramsPreferencePage_createBehaviorExecutionSpecificationAndReply, CHOICE_BEHAVIOR_AND_REPLY },
+ { Messages.DiagramsPreferencePage_createActionExecutionSpecificationAndReply, CHOICE_ACTION_AND_REPLY },
+ { Messages.DiagramsPreferencePage_createBehaviorExecutionSpecification, CHOICE_BEHAVIOR },
+ { Messages.DiagramsPreferencePage_createActionExecutionSpecification, CHOICE_ACTION },
+ { Messages.DiagramsPreferencePage_createNoExecutionSpecification, CHOICE_NONE }
}, composite);
// preference for choosing if and which execution specifications should be automatically created with asynchronous message
// choice between behavior execution specification, action execution specification or nothing
- executionSpecificationWithAsyncMsg = new RadioGroupFieldEditor(CustomMessages.PREF_EXECUTION_SPECIFICATION_ASYNC_MSG,
- CustomMessages.DiagramsPreferencePage_executionSpecificationWithAsyncMsg_label, 1,
+ executionSpecificationWithAsyncMsg = new RadioGroupFieldEditor(PREF_EXECUTION_SPECIFICATION_ASYNC_MSG,
+ Messages.DiagramsPreferencePage_executionSpecificationWithAsyncMsg_label, 1,
new String[][] {
- { CustomMessages.DiagramsPreferencePage_createBehaviorExecutionSpecification, "CHOICE_BEHAVIOR" },
- { CustomMessages.DiagramsPreferencePage_createActionExecutionSpecification, "CHOICE_ACTION" },
- { CustomMessages.DiagramsPreferencePage_createNoExecutionSpecification, "CHOICE_NONE" }
+ { Messages.DiagramsPreferencePage_createBehaviorExecutionSpecification, CHOICE_BEHAVIOR },
+ { Messages.DiagramsPreferencePage_createActionExecutionSpecification, CHOICE_ACTION },
+ { Messages.DiagramsPreferencePage_createNoExecutionSpecification, CHOICE_NONE }
}, composite);
}
@@ -104,10 +118,10 @@ public class CustomDiagramGeneralPreferencePage extends DiagramPreferencePage {
* preferenceStore
*/
public static void initSpecificDefaults(IPreferenceStore preferenceStore) {
- preferenceStore.setDefault(CustomMessages.PREF_EXECUTION_SPECIFICATION_SYNC_MSG,
- "CHOICE_BEHAVIOR");
- preferenceStore.setDefault(CustomMessages.PREF_EXECUTION_SPECIFICATION_ASYNC_MSG,
- "CHOICE_BEHAVIOR");
+ preferenceStore.setDefault(PREF_EXECUTION_SPECIFICATION_SYNC_MSG,
+ CHOICE_BEHAVIOR_AND_REPLY);
+ preferenceStore.setDefault(PREF_EXECUTION_SPECIFICATION_ASYNC_MSG,
+ CHOICE_NONE);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java
index f17d56d337c..419cc374e02 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java
@@ -39,7 +39,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEd
import org.eclipse.papyrus.infra.gmfdiag.common.helper.IdentityAnchorHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.uml2.uml.Message;
import org.eclipse.uml2.uml.NamedElement;
@@ -49,9 +49,9 @@ import org.eclipse.uml2.uml.NamedElement;
*/
public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implements AutomaticNotationEditPolicy, NotificationListener, IGrillingEditpolicy {
- protected GrillingEditpart grillingCompartment = null;
+ protected GrillingEditpart gridCompartment = null;
- public static String CONNECT_TO_GRILLING_MANAGEMENT = "CONNECT_TO_GRILLING_MANAGEMENT";
+ public static String CONNECT_TO_GRID_MANAGEMENT = "CONNECT_TO_GRID_MANAGEMENT"; //$NON-NLS-1$
protected int displayImprecision = 2;
@@ -80,13 +80,13 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
protected void updatePositionGridAxis(DecorationNode axis, int x, int y) {
Location currentBounds = (Location) axis.getLayoutConstraint();
if (x < currentBounds.getX() - displayImprecision || x > currentBounds.getX() + displayImprecision) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS to x=" + x + " y=" + y);//$NON-NLS-1$
- execute(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Column", new EObjectAdapter(axis), new Point(x, y)));
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS to x=" + x + " y=" + y);//$NON-NLS-1$ //$NON-NLS-2$
+ execute(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Column", new EObjectAdapter(axis), new Point(x, y))); //$NON-NLS-1$
}
if (y < currentBounds.getY() - displayImprecision || y > currentBounds.getY() + displayImprecision) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS to x=" + x + " y=" + y);//$NON-NLS-1$
- execute(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update row", new EObjectAdapter(axis), new Point(x, y)));
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS to x=" + x + " y=" + y);//$NON-NLS-1$ //$NON-NLS-2$
+ execute(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update row", new EObjectAdapter(axis), new Point(x, y))); //$NON-NLS-1$
}
}
@@ -100,7 +100,7 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
getDiagramEventBroker().addNotificationListener(((EObject) getHost().getModel()), this);
DiagramEditPart diagramEditPart = getDiagramEditPart(getHost());
try {
- GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
if (grilling != null) {
ConnectionEditPart connectionEditPart = (ConnectionEditPart) getHost();
Edge edge = (Edge) connectionEditPart.getModel();
@@ -183,7 +183,7 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
if (diagramEditPart != null) {
// CREATION
if (notification.getNotifier().equals(((EObject) getHost().getModel())) && NotationPackage.eINSTANCE.getEdge_SourceAnchor().equals(notification.getFeature()) && notification.getNewValue() != null) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT :CREATION add SourceAnchor " + notification.getNotifier());//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT :CREATION add SourceAnchor " + notification.getNotifier());//$NON-NLS-1$
IdentityAnchor anchor = (IdentityAnchor) notification.getNewValue();
if (anchor.getId() != null && !(anchor.getId().equals(""))) {
ConnectionEditPart connectionEditPart = (ConnectionEditPart) getHost();
@@ -191,7 +191,7 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
NamedElementEditPart sourceEditpart = (NamedElementEditPart) connectionEditPart.getSource();
int anchorY = computeAnchorPositionNotation(anchor, sourceEditpart);
try {
- GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
if (grilling != null) {
if (rowSource == null) {
if (m.getSendEvent() == null) {
@@ -211,7 +211,7 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
// CREATION
if (notification.getNotifier().equals(((EObject) getHost().getModel())) && NotationPackage.eINSTANCE.getEdge_TargetAnchor().equals(notification.getFeature()) && notification.getNewValue() != null) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: CREATION add targetAnchor " + notification.getNotifier());//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: CREATION add targetAnchor " + notification.getNotifier());//$NON-NLS-1$
IdentityAnchor anchor = (IdentityAnchor) notification.getNewValue();
if (anchor.getId() != null && !(anchor.getId().equals(""))) {
ConnectionEditPart connectionEditPart = (ConnectionEditPart) getHost();
@@ -219,7 +219,7 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
Message m = (Message) connectionEditPart.resolveSemanticElement();
int anchorY = computeAnchorPositionNotation(anchor, editpart);
try {
- GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
if (grilling != null) {
if (rowTarget == null) {
if (m.getReceiveEvent() == null) {
@@ -236,28 +236,28 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
}
}
if (notification.getEventType() == Notification.SET && notification.getFeature().equals(NotationPackage.eINSTANCE.getEdge_Source())) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+EVENT Source change " + notification.getNotifier());//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+EVENT Source change " + notification.getNotifier());//$NON-NLS-1$
ConnectionEditPart connectionEditPart = (ConnectionEditPart) getHost();
Edge edge = (Edge) connectionEditPart.getNotationView();
if (edge.getSourceAnchor()!=null && rowSource != null) {
IdentityAnchor anchor = (IdentityAnchor) edge.getSourceAnchor();
NamedElementEditPart sourceEditpart = (NamedElementEditPart) connectionEditPart.getSource();
int anchorY = computeAnchorPositionNotation(anchor, sourceEditpart);
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+--> SOURCE change for " + ((NamedElement) connectionEditPart.resolveSemanticElement()).getName() + " to " + anchorY + " ");//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+--> SOURCE change for " + ((NamedElement) connectionEditPart.resolveSemanticElement()).getName() + " to " + anchorY + " ");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
updatePositionGridAxis((DecorationNode) rowSource, 0, anchorY);
}
}
if (notification.getEventType() == Notification.SET && notification.getFeature().equals(NotationPackage.eINSTANCE.getEdge_Target())) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+EVENT target change " + notification.getNotifier());//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+EVENT target change " + notification.getNotifier());//$NON-NLS-1$
ConnectionEditPart connectionEditPart = (ConnectionEditPart) getHost();
Edge edge = (Edge) connectionEditPart.getNotationView();
if (edge.getTargetAnchor()!=null && rowTarget != null) {
IdentityAnchor anchor = (IdentityAnchor) edge.getTargetAnchor();
NamedElementEditPart targetEditpart = (NamedElementEditPart) connectionEditPart.getTarget();
int anchorY = computeAnchorPositionNotation(anchor, targetEditpart);
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+--> SOURCE change for " + ((NamedElement) connectionEditPart.resolveSemanticElement()).getName() + " to " + anchorY + " ");//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+--> SOURCE change for " + ((NamedElement) connectionEditPart.resolveSemanticElement()).getName() + " to " + anchorY + " ");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
updatePositionGridAxis((DecorationNode) rowTarget, 0, anchorY);
}
@@ -265,21 +265,21 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
// A move has been done by the user
if (notification.getEventType() == Notification.SET && notification.getNotifier() instanceof IdentityAnchor) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+EVENT IdentificationAnchor change " + notification.getNotifier());//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+EVENT IdentificationAnchor change " + notification.getNotifier());//$NON-NLS-1$
ConnectionEditPart connectionEditPart = (ConnectionEditPart) getHost();
Edge edge = (Edge) connectionEditPart.getNotationView();
if (notification.getNotifier().equals(edge.getSourceAnchor()) && rowSource != null) {
IdentityAnchor anchor = (IdentityAnchor) edge.getSourceAnchor();
NamedElementEditPart sourceEditpart = (NamedElementEditPart) connectionEditPart.getSource();
int anchorY = computeAnchorPositionNotation(anchor, sourceEditpart);
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+--> SOURCE change for " + ((NamedElement) connectionEditPart.resolveSemanticElement()).getName() + " to " + anchorY + " ");//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+--> SOURCE change for " + ((NamedElement) connectionEditPart.resolveSemanticElement()).getName() + " to " + anchorY + " ");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
updatePositionGridAxis((DecorationNode) rowSource, 0, anchorY);
}
if (notification.getNotifier().equals(edge.getTargetAnchor()) && rowTarget != null) {
IdentityAnchor anchor = (IdentityAnchor) edge.getTargetAnchor();
NamedElementEditPart editpart = (NamedElementEditPart) connectionEditPart.getTarget();
int anchorY = computeAnchorPositionNotation(anchor, editpart);
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+-->TARGET change " + ((NamedElement) connectionEditPart.resolveSemanticElement()).getName() + " to " + anchorY + " ");//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+-->TARGET change " + ((NamedElement) connectionEditPart.resolveSemanticElement()).getName() + " to " + anchorY + " ");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
updatePositionGridAxis((DecorationNode) rowTarget, 0, anchorY);
}
@@ -288,8 +288,8 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
// a ROW AXIS has changed at Source
if (notification.getEventType() == Notification.SET && notification.getNotifier() instanceof Location && (((EObject) notification.getNotifier()).eContainer().equals(rowSource))) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT source Axis modified :" + notification);//$NON-NLS-1$
- GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT source Axis modified :" + notification);//$NON-NLS-1$
+ GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
if (grilling != null) {
if (Math.abs(notification.getOldIntValue() - notification.getNewIntValue()) > grilling.threshold) {
ConnectionEditPart connectionEditPart = (ConnectionEditPart) getHost();
@@ -303,8 +303,8 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
// a ROW has changed at target
if (notification.getEventType() == Notification.SET && notification.getNotifier() instanceof Location && (((EObject) notification.getNotifier()).eContainer().equals(rowTarget))) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT target Axis modified :" + notification);//$NON-NLS-1$
- GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT target Axis modified :" + notification);//$NON-NLS-1$
+ GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
if (grilling != null) {
if (Math.abs(notification.getOldIntValue() - notification.getNewIntValue()) > grilling.threshold) {
ConnectionEditPart connectionEditPart = (ConnectionEditPart) getHost();
@@ -332,7 +332,7 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
double oldPosition=oldPercentY*bounds.preciseHeight();
double newPosition=newPercentY*bounds.preciseHeight();
DiagramEditPart diagramEditPart = getDiagramEditPart(getHost());
- GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
if (grilling != null) {
if (Math.abs(oldPosition - newPosition) >grilling.threshold ) {
if (newPercentY > 1) {
@@ -343,7 +343,7 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
}
if (newPercentY <= 1 && newPercentY >= 0 && newPercentY <= 1 && newPercentY >= 0) {
final String newIdValue = IdentityAnchorHelper.createNewAnchorIdValue(xpercent, newPercentY);
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modify anchor to precentY=" + newPercentY);//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modify anchor to precentY=" + newPercentY);//$NON-NLS-1$
execute(new SetCommand(getDiagramEditPart(getHost()).getEditingDomain(), anchor, NotationPackage.eINSTANCE.getIdentityAnchor_Id(), newIdValue));
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java
index c8bcd4a589d..f891827617e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java
@@ -33,8 +33,8 @@ import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.IdentityAnchorHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions;
import org.eclipse.uml2.uml.Element;
/**
@@ -46,7 +46,7 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
protected GrillingEditpart grillingCompartment=null;
- public static String CONNECT_TO_GRILLING_MANAGEMENT="CONNECT_TO_GRILLING_MANAGEMENT";
+ public static String CONNECT_TO_GRILLING_MANAGEMENT="CONNECT_TO_GRILLING_MANAGEMENT"; //$NON-NLS-1$
protected DecorationNode rowStart=null;
protected DecorationNode rowFinish=null;
@@ -73,7 +73,7 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
DiagramEditPart diagramEditPart=getDiagramEditPart(getHost());
Node node=((Node)((GraphicalEditPart)getHost()).getNotationView());
try{
- GridManagementEditPolicy grilling=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grilling=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
Node nodeContainer=(Node)(((GraphicalEditPart)getHost()).getNotationView()).eContainer();
Element element=(Element) ((GraphicalEditPart)getHost()).resolveSemanticElement();
if (grilling!=null){
@@ -218,11 +218,11 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
//UPDATE COLUM AND ROW of THE GRID
if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Bounds){
PrecisionRectangle bounds=NotationHelper.getAbsoluteBounds((Node)((GraphicalEditPart)getHost()).getNotationView());
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: BOUNDS change " +notification.getNewValue());//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: BOUNDS change " +notification.getNewValue());//$NON-NLS-1$
if( notification.getFeature().equals(NotationPackage.eINSTANCE.getSize_Height())){
updateRowFinishFromHeightNotification(bounds);
- //update acnchors
+ //update anchors
if( (((EObject)notification.getNotifier()).eContainer().equals(((EObject)getHost().getModel())))){
Node node=(Node)this.getHost().getModel();
java.util.List<Edge> sourceEdge= node.getSourceEdges();
@@ -280,7 +280,7 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
protected void updateColumFinishFromWitdhNotification(PrecisionRectangle notationBound) {
int newX=notationBound.x+notationBound.width;
updatePositionGridAxis(columnFinish, newX,0);
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS to x=" + newX);//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS to x=" + newX);//$NON-NLS-1$
}
@@ -308,7 +308,7 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
protected void updateColumnStartFromXNotification(PrecisionRectangle bounds) {
int newX=bounds.x();
updatePositionGridAxis(columnStart, newX, 0);
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS START to x=" + newX);//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS START to x=" + newX);//$NON-NLS-1$
}
/**
@@ -319,7 +319,7 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
protected void updateWidthFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
Location boundsColumn=(Location) ((Node)columnFinish).getLayoutConstraint();
int newX=boundsColumn.getX()-originPosition.x()-currentBounds.getX();
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: AXIS ROW FINISH change " +newX);//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: AXIS ROW FINISH change " +newX);//$NON-NLS-1$
updateSizeOfControler(newX, currentBounds.getHeight());
}
@@ -331,7 +331,7 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
protected void updateHeightFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
Location boundsColumn=(Location) ((Node)rowFinish).getLayoutConstraint();
int newHeight=boundsColumn.getY()-originPosition.y()-currentBounds.getY()-margin;
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: AXIS ROW FINISH change " +newHeight);//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: AXIS ROW FINISH change " +newHeight);//$NON-NLS-1$
updateSizeOfControler(currentBounds.getWidth(), newHeight);
}
@@ -343,7 +343,7 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
protected void updateXFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
Location boundsColumn=(Location) ((Node)columnStart).getLayoutConstraint();
int newX=boundsColumn.getX()-originPosition.x();
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: AXIS COLUMN START change " +newX);//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: AXIS COLUMN START change " +newX);//$NON-NLS-1$
updateNodePositionOfControler(newX, currentBounds.getY());
}
@@ -356,7 +356,7 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
protected void updateYFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
Location boundsRow=(Location) ((Node)rowStart).getLayoutConstraint();
int newY=boundsRow.getY()-originPosition.y()-margin;
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: AXIS ROW START change " +newY);//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+ EVENT: AXIS ROW START change " +newY);//$NON-NLS-1$
updateNodePositionOfControler(currentBounds.getX(), newY);
if( rowFinish!=null) {
@@ -405,7 +405,7 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
else{
anchor=(IdentityAnchor)edge.getTargetAnchor();
}
- if(!anchor.getId().trim().equals("")){
+ if(!anchor.getId().trim().equals("")){ //$NON-NLS-1$
double yPercent=IdentityAnchorHelper.getYPercentage(anchor);
double xPercent=IdentityAnchorHelper.getXPercentage(anchor);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectToGridEditPolicy.java
index cc17d413372..35d1947ee27 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectToGridEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectToGridEditPolicy.java
@@ -1,92 +1,93 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
-
-
-
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-
-/**
- * This class is a class that contains method to set position to the grid
- *
- */
-public abstract class ConnectToGridEditPolicy extends GraphicalEditPolicyEx implements AutomaticNotationEditPolicy, IGrillingEditpolicy {
-
- protected int displayImprecision=2;
- /**
- * Update the position of the node that is displayed
- * @param x the position X
- * @param y the position Y
- */
- protected void updateNodePositionOfControler(int x, int y) {
- Bounds currentBounds=(Bounds) ((Node)((GraphicalEditPart)getHost()).getNotationView()).getLayoutConstraint();
- if(x<currentBounds.getX()-displayImprecision||x>currentBounds.getX()+displayImprecision){
- execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update notation from Column", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
- new Point(x,y))));
- }
- if(y<currentBounds.getY()-displayImprecision||y>currentBounds.getY()+displayImprecision){
- execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update notation from Row", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
- new Point(x,y))));
- }
- }
- /**
- * Update the size of the Node from the given data
- * @param width the width of the node
- * @param height the height of the node
- */
- protected void updateSizeOfControler(int width, int height) {
- Bounds currentBounds=(Bounds) ((Node)((GraphicalEditPart)getHost()).getNotationView()).getLayoutConstraint();
- if(width<currentBounds.getWidth()-displayImprecision||width>currentBounds.getWidth()+displayImprecision){
- execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update notation from Column", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
- new Dimension(width,currentBounds.getHeight()))));
- }
- if(height<currentBounds.getHeight()-displayImprecision||height>currentBounds.getHeight()+displayImprecision){
- execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update notation from Row", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
- new Dimension(currentBounds.getWidth(),height))));
- }
- }
- /**
- * update an axis of the grid from coordinate X or Y
- * @param axis the axis to update
- * @param x the coordinate x
- * @param y the coordinate y
- */
- protected void updatePositionGridAxis(DecorationNode axis, int x, int y) {
- Location currentBounds=(Location) axis.getLayoutConstraint();
- if(x<currentBounds.getX()-displayImprecision||x>currentBounds.getX()+displayImprecision){
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS FINISH to x=" + x);//$NON-NLS-1$
- execute( new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Column", new EObjectAdapter(axis), new Point(x,y)));
-
- }
- if(y<currentBounds.getY()-displayImprecision||y>currentBounds.getY()+displayImprecision){
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS FINISH to y=" + y);//$NON-NLS-1$
- execute( new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update row", new EObjectAdapter(axis), new Point(x,y)));
- }
- }
-
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
+
+
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
+import org.eclipse.gmf.runtime.notation.Bounds;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions;
+
+/**
+ * This class is a class that contains method to set position to the grid
+ *
+ */
+public abstract class ConnectToGridEditPolicy extends GraphicalEditPolicyEx implements AutomaticNotationEditPolicy, IGrillingEditpolicy {
+
+ protected int displayImprecision=2;
+ /**
+ * Update the position of the node that is displayed
+ * @param x the position X
+ * @param y the position Y
+ */
+ protected void updateNodePositionOfControler(int x, int y) {
+ Bounds currentBounds=(Bounds) ((Node)((GraphicalEditPart)getHost()).getNotationView()).getLayoutConstraint();
+ if(x<currentBounds.getX()-displayImprecision||x>currentBounds.getX()+displayImprecision){
+ execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update notation from Column", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
+ new Point(x,y))));
+ }
+ if(y<currentBounds.getY()-displayImprecision||y>currentBounds.getY()+displayImprecision){
+ execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update notation from Row", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
+ new Point(x,y))));
+ }
+ }
+ /**
+ * Update the size of the Node from the given data
+ * @param width the width of the node
+ * @param height the height of the node
+ */
+ protected void updateSizeOfControler(int width, int height) {
+ Bounds currentBounds=(Bounds) ((Node)((GraphicalEditPart)getHost()).getNotationView()).getLayoutConstraint();
+ if(width<currentBounds.getWidth()-displayImprecision||width>currentBounds.getWidth()+displayImprecision){
+ execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update notation from Column", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
+ new Dimension(width,currentBounds.getHeight()))));
+ }
+ if(height<currentBounds.getHeight()-displayImprecision||height>currentBounds.getHeight()+displayImprecision){
+ execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update notation from Row", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
+ new Dimension(currentBounds.getWidth(),height))));
+ }
+ }
+ /**
+ * update an axis of the grid from coordinate X or Y
+ * @param axis the axis to update
+ * @param x the coordinate x
+ * @param y the coordinate y
+ */
+ protected void updatePositionGridAxis(DecorationNode axis, int x, int y) {
+ Location currentBounds=(Location) axis.getLayoutConstraint();
+ if(x<currentBounds.getX()-displayImprecision||x>currentBounds.getX()+displayImprecision){
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS FINISH to x=" + x);//$NON-NLS-1$
+ execute( new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Column", new EObjectAdapter(axis), new Point(x,y)));
+
+ }
+ if(y<currentBounds.getY()-displayImprecision||y>currentBounds.getY()+displayImprecision){
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS FINISH to y=" + y);//$NON-NLS-1$
+ execute( new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update row", new EObjectAdapter(axis), new Point(x,y)));
+ }
+ }
+
} \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridBasedXYLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridBasedXYLayoutEditPolicy.java
index 3319b8983e4..0e1e7f99644 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridBasedXYLayoutEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridBasedXYLayoutEditPolicy.java
@@ -36,7 +36,7 @@ public class GridBasedXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedE
@Override
protected Command getCreateCommand(CreateRequest request) {
DiagramEditPart diagramEditPart=getDiagramEditPart(getHost());
- GridManagementEditPolicy grid=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grid=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
if (grid!=null){
CompoundCommand cmd= new CompoundCommand();
SetMoveAllLineAtSamePositionCommand setMoveAllLineAtSamePositionCommand= new SetMoveAllLineAtSamePositionCommand(grid, false);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java
index d380c7c3f74..9bc33704497 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java
@@ -46,11 +46,11 @@ import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
import org.eclipse.papyrus.uml.diagram.sequence.command.CreateCoordinateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CreateGrillingStructureCommand;
import org.eclipse.papyrus.uml.diagram.sequence.keyboardlistener.KeyToSetMoveLinesListener;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions;
import org.eclipse.swt.SWT;
import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Element;
@@ -64,13 +64,13 @@ import org.eclipse.uml2.uml.UMLPackage;
*
*/
public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements AutomaticNotationEditPolicy, NotificationListener, IGrillingEditpolicy {
- public static final String GRILL_CONNECTION = "Grill Connection";
- protected GrillingEditpart grillingCompartment = null;
+ public static final String GRID_CONNECTION = "Grid Connection"; //$NON-NLS-1$
+ protected GrillingEditpart gridCompartment = null;
- public static String GRILLING_MANAGEMENT = "GRILLING_MANAGEMENT";
- public static String COLUMN = "COLUMN_";
- public static String ROW = "ROW_";
+ public static String GRID_MANAGEMENT = "GRID_MANAGEMENT"; //$NON-NLS-1$
+ public static String COLUMN = "COLUMN_"; //$NON-NLS-1$
+ public static String ROW = "ROW_"; //$NON-NLS-1$
public int threshold = 5;
/**
@@ -116,7 +116,7 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
*/
public void setMoveAllLinesAtSamePosition(boolean moveAllLinesAtSamePosition) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, ">> set moveAllLinesAtSamePosition=" + moveAllLinesAtSamePosition);//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, ">> set moveAllLinesAtSamePosition=" + moveAllLinesAtSamePosition);//$NON-NLS-1$
this.moveAllLinesAtSamePosition = moveAllLinesAtSamePosition;
}
@@ -201,22 +201,22 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
private void refreshGrillingStructure() {
EditPart host = getHost();
int i = 0;
- while (grillingCompartment == null && i < host.getChildren().size()) {
+ while (gridCompartment == null && i < host.getChildren().size()) {
if (host.getChildren().get(i) instanceof GrillingEditpart) {
- grillingCompartment = (GrillingEditpart) (host.getChildren().get(i));
+ gridCompartment = (GrillingEditpart) (host.getChildren().get(i));
}
i++;
}
- if (grillingCompartment == null) {
+ if (gridCompartment == null) {
CreateGrillingStructureCommand createGrillingStructureCommand = new CreateGrillingStructureCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), (View) getHost().getModel());
// Record for undo if possible, otherwise unprotected
execute(createGrillingStructureCommand);
}
- while (grillingCompartment == null && i < host.getChildren().size()) {
+ while (gridCompartment == null && i < host.getChildren().size()) {
if (host.getChildren().get(i) instanceof GrillingEditpart) {
- grillingCompartment = (GrillingEditpart) (host.getChildren().get(i));
+ gridCompartment = (GrillingEditpart) (host.getChildren().get(i));
}
i++;
}
@@ -232,10 +232,10 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
rows.clear();
columns.clear();
- if (grillingCompartment != null) {
- for (int j = 0; j < grillingCompartment.getNotationView().getChildren().size(); j++) {
- if (grillingCompartment.getNotationView().getChildren().get(j) instanceof DecorationNode) {
- DecorationNode decorationNode = (DecorationNode) grillingCompartment.getNotationView().getChildren().get(j);
+ if (gridCompartment != null) {
+ for (int j = 0; j < gridCompartment.getNotationView().getChildren().size(); j++) {
+ if (gridCompartment.getNotationView().getChildren().get(j) instanceof DecorationNode) {
+ DecorationNode decorationNode = (DecorationNode) gridCompartment.getNotationView().getChildren().get(j);
if (decorationNode.getType().startsWith(ROW)) {
rows.add(decorationNode);
@@ -248,10 +248,10 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
}
Collections.sort(rows, RowComparator);
Collections.sort(columns, ColumnComparator);
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "____ROWS_____");//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "____ROWS_____");//$NON-NLS-1$
for (int i=0; i<rows.size();i++) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "row "+i +" y="+getPositionY(rows.get(i)));//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "row "+i +" y="+getPositionY(rows.get(i)));//$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -316,14 +316,14 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
}
if (covered.size() == lifeline.getCoveredBys().size()) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "equality");//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "equality");//$NON-NLS-1$
execute(new SetCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), lifeline, UMLPackage.eINSTANCE.getLifeline_CoveredBy(), covered));
} else if (covered.size() < lifeline.getCoveredBys().size()) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "Event not managed or being created");//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "Event not managed or being created");//$NON-NLS-1$
// covered.addAll(lifeline.getCoveredBys());
execute(new SetCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), lifeline, UMLPackage.eINSTANCE.getLifeline_CoveredBy(), covered));
} else if (covered.size() > lifeline.getCoveredBys().size()) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_REFERENCEGRID, "more event than in the lifeline due to combined fragment");//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "more event than in the lifeline due to combined fragment");//$NON-NLS-1$
execute(new SetCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), lifeline, UMLPackage.eINSTANCE.getLifeline_CoveredBy(), covered));
}
}
@@ -384,7 +384,7 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
}
for (Iterator<DecorationNode> iterator = rowlist.iterator(); iterator.hasNext();) {
DecorationNode axis = (DecorationNode) iterator.next();
- execute(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Line", new EObjectAdapter(axis), new Point(0, notification.getNewIntValue())));
+ execute(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Line", new EObjectAdapter(axis), new Point(0, notification.getNewIntValue()))); //$NON-NLS-1$
}
((EObject) getHost().getModel()).eResource().eAdapters().add(contentDiagramListener);
@@ -406,7 +406,7 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
* @return the decoration node
*/
public DecorationNode createColumnTolisten(int x, Element semantic) throws NoGrillElementFound {
- execute(new CreateCoordinateCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), ((BasicCompartment) grillingCompartment.getNotationView()), COLUMN + columns.size(), semantic, x));
+ execute(new CreateCoordinateCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), ((BasicCompartment) gridCompartment.getNotationView()), COLUMN + columns.size(), semantic, x));
refreshGrillingStructure();
return getLastCreatedAxis();
}
@@ -419,7 +419,7 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
* @return the decoration node
*/
public DecorationNode createRowTolisten(int y, Element semantic) throws NoGrillElementFound {
- execute(new CreateCoordinateCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), ((BasicCompartment) grillingCompartment.getNotationView()), ROW + rows.size(), semantic, y));
+ execute(new CreateCoordinateCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), ((BasicCompartment) gridCompartment.getNotationView()), ROW + rows.size(), semantic, y));
DecorationNode row = getLastCreatedAxis();
refreshGrillingStructure();
return row;
@@ -430,7 +430,7 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
* @return get the last created Axis
**/
public DecorationNode getLastCreatedAxis() throws NoGrillElementFound {
- BasicCompartment grid = ((BasicCompartment) grillingCompartment.getNotationView());
+ BasicCompartment grid = ((BasicCompartment) gridCompartment.getNotationView());
if (grid.getChildren().size() == 0) {
throw new NoGrillElementFound();
} else {
@@ -540,7 +540,7 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
}
public static List<EObject> getRef(DecorationNode current) {
- EAnnotation eAnnotation = current.getEAnnotation(GRILL_CONNECTION);
+ EAnnotation eAnnotation = current.getEAnnotation(GRID_CONNECTION);
if (eAnnotation == null) {
return null;
} else {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingEditpart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingEditpart.java
index 991b76519f4..33c9b019abe 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingEditpart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingEditpart.java
@@ -76,7 +76,7 @@ public class GrillingEditpart extends GraphicalEditPart {
getFigure().setBounds(new Rectangle (0,0,50,1000));
((ReferencialGrid)getFigure()).cleanAllLines();
DiagramEditPart diagramEditPart=(DiagramEditPart)this.getParent();
- GridManagementEditPolicy grid=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grid=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
for (int i=0; i<grid.rows.size();i++) {
if( grid.rows.get(i)!=null) {
Location location= (Location)grid.rows.get(i).getLayoutConstraint();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java
index 9da8e72d63f..343b271e10b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java
@@ -159,7 +159,7 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol
new Point(bounds.getX(),relativePt.y-5));
CompoundCommand compoundCommand= new CompoundCommand();
DiagramEditPart diagramEditPart=getDiagramEditPart(getHost());
- GridManagementEditPolicy grid=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grid=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
SetMoveAllLineAtSamePositionCommand setMoveAllLineAtSamePositionCommand= new SetMoveAllLineAtSamePositionCommand(grid,false);
compoundCommand.add(setMoveAllLineAtSamePositionCommand);
compoundCommand.add(cmd);
@@ -184,7 +184,7 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol
// in the case of messages of sort: synchCall, asynchCall or asynchSignal
// an execution specification may be created at target
DiagramEditPart diagramEditPart=getDiagramEditPart(getHost());
- GridManagementEditPolicy grid=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grid=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
CreateExecutionSpecificationWithMessage createExecutionSpecificationwithMsg= new CreateExecutionSpecificationWithMessage(getDiagramEditPart(getHost()).getEditingDomain(), request, (NodeEditPart)request.getTargetEditPart());
CompoundCommand compoundCommand= new CompoundCommand();
SetMoveAllLineAtSamePositionCommand setMoveAllLineAtSamePositionCommand= new SetMoveAllLineAtSamePositionCommand(grid,false);
@@ -234,7 +234,7 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol
LifelineEditPart lifelineEditPart= (LifelineEditPart)getHost();
Lifeline lifeline=(Lifeline) lifelineEditPart.resolveSemanticElement();
try{
- GridManagementEditPolicy grilling=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grilling=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
if(grilling!=null) {
for (DecorationNode row : grilling.rows) {
Point currentPoint=GridManagementEditPolicy.getLocation(row);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineXYLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineXYLayoutEditPolicy.java
index 874a51ffa14..abb17275073 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineXYLayoutEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineXYLayoutEditPolicy.java
@@ -41,6 +41,8 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.XYLayoutWithConstrainedResizedEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions;
import org.eclipse.papyrus.uml.diagram.sequence.command.SetMoveAllLineAtSamePositionCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart;
import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes;
@@ -70,7 +72,6 @@ public class LifeLineXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedEd
*/
@Override
public void setHost(EditPart host) {
- // TODO Auto-generated method stub
super.setHost(host);
displayEvent = new DisplayEvent(getHost());
}
@@ -146,6 +147,7 @@ public class LifeLineXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedEd
RootEditPart drep = getHost().getRoot();
Rectangle parentBound = getHostFigure().getBounds().getCopy();
getHostFigure().getParent().translateToAbsolute(parentBound);
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "LifeLineBounds On Screen:" + parentBound); //$NON-NLS-1$
if (drep instanceof DiagramRootEditPart) {
double spacing = ((DiagramRootEditPart) drep).getGridSpacing();
if (request instanceof org.eclipse.papyrus.infra.gmfdiag.common.service.palette.AspectUnspecifiedTypeCreationTool.CreateAspectUnspecifiedTypeRequest) {
@@ -254,7 +256,7 @@ public class LifeLineXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedEd
@Override
protected Command getCreateCommand(CreateRequest request) {
DiagramEditPart diagramEditPart = getDiagramEditPart(getHost());
- GridManagementEditPolicy grid = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ GridManagementEditPolicy grid = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
if (grid != null) {
CompoundCommand cmd = new CompoundCommand();
SetMoveAllLineAtSamePositionCommand setMoveAllLineAtSamePositionCommand = new SetMoveAllLineAtSamePositionCommand(grid, false);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifelineCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifelineCreationEditPolicy.java
index 63a739bf3d7..77c1f957018 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifelineCreationEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifelineCreationEditPolicy.java
@@ -1,138 +1,138 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest.ViewAndElementDescriptor;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.command.SetMoveAllLineAtSamePositionCommand;
-import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes;
-import org.eclipse.papyrus.uml.service.types.utils.ElementUtil;
-import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
-
-/**
- * This editPolicy has in charge to redirect creation of element to interaction
- *
- */
-public class LifelineCreationEditPolicy extends DefaultCreationEditPolicy implements IGrillingEditpolicy {
- protected DisplayEvent displayEvent;
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy#getCreateElementAndViewCommand(org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected Command getCreateElementAndViewCommand(CreateViewAndElementRequest request) {
- // Used during the drop from the model explorer
- if (request instanceof CreateViewAndElementRequest) {
- CreateViewAndElementRequest req = (CreateViewAndElementRequest) request;
- ViewAndElementDescriptor descriptor = (req).getViewAndElementDescriptor();
- IElementType elementType = (IElementType) descriptor.getElementAdapter().getAdapter(IElementType.class);
- if (isControlledByLifeline(elementType)) {
- // get the element descriptor
- CreateElementRequestAdapter requestAdapter = req.getViewAndElementDescriptor().getCreateElementRequestAdapter();
- // get the semantic request
- CreateElementRequest createElementRequest = (CreateElementRequest) requestAdapter.getAdapter(
- CreateElementRequest.class);
- View view = (View) getHost().getModel();
- EObject hostElement = ViewUtil.resolveSemanticElement(view);
- createElementRequest.setContainer(hostElement.eContainer());
- createElementRequest.setParameter(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.COVERED, hostElement);
- // case of Message Occurence Specification
- MessageOccurrenceSpecification mos = displayEvent.getMessageEvent(getHostFigure().getParent().getParent(), ((CreateRequest) request).getLocation());
- if (mos != null) {
- createElementRequest.setParameter(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.REPLACE_EXECUTION_SPECIFICATION_START, mos);
- }
- }
- }
- DiagramEditPart diagramEditPart=getDiagramEditPart(getHost());
- GridManagementEditPolicy grid=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
- if (grid!=null){
- CompoundCommand cmd= new CompoundCommand();
- SetMoveAllLineAtSamePositionCommand setMoveAllLineAtSamePositionCommand= new SetMoveAllLineAtSamePositionCommand(grid, false);
- cmd.add(setMoveAllLineAtSamePositionCommand);
- cmd.add(super.getCreateElementAndViewCommand(request));
- setMoveAllLineAtSamePositionCommand= new SetMoveAllLineAtSamePositionCommand( grid, true);
- cmd.add(setMoveAllLineAtSamePositionCommand);
- return cmd;
- }
- return super.getCreateElementAndViewCommand(request);
- }
-
- /**
- * test if the element Type that is normally not a child of the Lifeline should be controlled by the lifeline.
- * Then The lifeline will be set as the parent editpart, but not as the semantic parent.
- *
- * This is the case of most of the affixed node.
- *
- * @param elementType
- * the tested element type
- * @return true if the Lifeline should be the
- */
- protected boolean isControlledByLifeline(IElementType elementType) {
- boolean controlledByLifeline = false;
-
- if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.ACTION_EXECUTION_SPECIFICATION_SHAPE)) {
- controlledByLifeline = true;
- } else if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.BEHAVIOR_EXECUTION_SPECIFICATION_SHAPE)) {
- controlledByLifeline = true;
- } else if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.TIME_CONSTRAINT_SHAPE)) {
- controlledByLifeline = true;
- } else if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.STATE_INVARIANT_SHAPE)) {
- controlledByLifeline = true;
- } else if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.COMBINED_FRAGMENT_CO_REGION_SHAPE)) {
- controlledByLifeline = true;
- } else if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.DURATION_CONSTRAINT_SHAPE)) {
- controlledByLifeline = true;
- }
-
- return controlledByLifeline;
-
- }
-
- /**
- * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#setHost(org.eclipse.gef.EditPart)
- *
- * @param host
- */
- @Override
- public void setHost(EditPart host) {
- super.setHost(host);
- displayEvent = new DisplayEvent(getHost());
- }
-
- /**
- * Return the host's figure.
- * The super calls getFigure(). This is a problem when used with shapecompartments. Instead,
- * return getContextPane(). In shape comaprtments this will return the correct containing figure.
- */
- protected IFigure getHostFigure() {
- return ((GraphicalEditPart) getHost()).getContentPane();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest.ViewAndElementDescriptor;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.command.SetMoveAllLineAtSamePositionCommand;
+import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes;
+import org.eclipse.papyrus.uml.service.types.utils.ElementUtil;
+import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
+
+/**
+ * This editPolicy has in charge to redirect creation of element to interaction
+ *
+ */
+public class LifelineCreationEditPolicy extends DefaultCreationEditPolicy implements IGrillingEditpolicy {
+ protected DisplayEvent displayEvent;
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy#getCreateElementAndViewCommand(org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest)
+ *
+ * @param request
+ * @return
+ */
+ @Override
+ protected Command getCreateElementAndViewCommand(CreateViewAndElementRequest request) {
+ // Used during the drop from the model explorer
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateViewAndElementRequest req = (CreateViewAndElementRequest) request;
+ ViewAndElementDescriptor descriptor = (req).getViewAndElementDescriptor();
+ IElementType elementType = (IElementType) descriptor.getElementAdapter().getAdapter(IElementType.class);
+ if (isControlledByLifeline(elementType)) {
+ // get the element descriptor
+ CreateElementRequestAdapter requestAdapter = req.getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ // get the semantic request
+ CreateElementRequest createElementRequest = (CreateElementRequest) requestAdapter.getAdapter(
+ CreateElementRequest.class);
+ View view = (View) getHost().getModel();
+ EObject hostElement = ViewUtil.resolveSemanticElement(view);
+ createElementRequest.setContainer(hostElement.eContainer());
+ createElementRequest.setParameter(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.COVERED, hostElement);
+ // case of Message Occurence Specification
+ MessageOccurrenceSpecification mos = displayEvent.getMessageEvent(getHostFigure().getParent().getParent(), ((CreateRequest) request).getLocation());
+ if (mos != null) {
+ createElementRequest.setParameter(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.REPLACE_EXECUTION_SPECIFICATION_START, mos);
+ }
+ }
+ }
+ DiagramEditPart diagramEditPart=getDiagramEditPart(getHost());
+ GridManagementEditPolicy grid=(GridManagementEditPolicy)diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
+ if (grid!=null){
+ CompoundCommand cmd= new CompoundCommand();
+ SetMoveAllLineAtSamePositionCommand setMoveAllLineAtSamePositionCommand= new SetMoveAllLineAtSamePositionCommand(grid, false);
+ cmd.add(setMoveAllLineAtSamePositionCommand);
+ cmd.add(super.getCreateElementAndViewCommand(request));
+ setMoveAllLineAtSamePositionCommand= new SetMoveAllLineAtSamePositionCommand( grid, true);
+ cmd.add(setMoveAllLineAtSamePositionCommand);
+ return cmd;
+ }
+ return super.getCreateElementAndViewCommand(request);
+ }
+
+ /**
+ * test if the element Type that is normally not a child of the Lifeline should be controlled by the lifeline.
+ * Then The lifeline will be set as the parent editpart, but not as the semantic parent.
+ *
+ * This is the case of most of the affixed node.
+ *
+ * @param elementType
+ * the tested element type
+ * @return true if the Lifeline should be the
+ */
+ protected boolean isControlledByLifeline(IElementType elementType) {
+ boolean controlledByLifeline = false;
+
+ if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.ACTION_EXECUTION_SPECIFICATION_SHAPE)) {
+ controlledByLifeline = true;
+ } else if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.BEHAVIOR_EXECUTION_SPECIFICATION_SHAPE)) {
+ controlledByLifeline = true;
+ } else if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.TIME_CONSTRAINT_SHAPE)) {
+ controlledByLifeline = true;
+ } else if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.STATE_INVARIANT_SHAPE)) {
+ controlledByLifeline = true;
+ } else if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.COMBINED_FRAGMENT_CO_REGION_SHAPE)) {
+ controlledByLifeline = true;
+ } else if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.DURATION_CONSTRAINT_SHAPE)) {
+ controlledByLifeline = true;
+ }
+
+ return controlledByLifeline;
+
+ }
+
+ /**
+ * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#setHost(org.eclipse.gef.EditPart)
+ *
+ * @param host
+ */
+ @Override
+ public void setHost(EditPart host) {
+ super.setHost(host);
+ displayEvent = new DisplayEvent(getHost());
+ }
+
+ /**
+ * Return the host's figure.
+ * The super calls getFigure(). This is a problem when used with shapecompartments. Instead,
+ * return getContextPane(). In shape comaprtments this will return the correct containing figure.
+ */
+ protected IFigure getHostFigure() {
+ return ((GraphicalEditPart) getHost()).getContentPane();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LogOptions.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LogOptions.java
new file mode 100644
index 00000000000..fe32a0abc80
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LogOptions.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.util;
+
+/**
+ * This class contains various options related to sequence diagram debug
+ * @since 3.0
+ */
+public class LogOptions {
+
+ /**
+ * tracing option for general sequence diagram debug
+ */
+ public static String SEQUENCE_DEBUG = "SequenceDebug"; //$NON-NLS-1$
+ /**
+ * tracing option for sequence diagram grid debug
+ */
+ public static String SEQUENCE_DEBUG_REFERENCEGRID = "SequenceDebugGrid"; //$NON-NLS-1$
+ /**
+ * tracing option for sequence diagram util debug
+ */
+ public static String SEQUENCE_DEBUG_UTIL = "SequenceDebugUtil"; //$NON-NLS-1$
+
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageConnectionHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageConnectionHelper.java
index 63b1e3b51b3..998756461ed 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageConnectionHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageConnectionHelper.java
@@ -155,7 +155,7 @@ public class MessageConnectionHelper {
buf.append("null");
}
buf.append("]");
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_UTIL, buf.toString());// $NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_UTIL, buf.toString());// $NON-NLS-1$
}
public static boolean canExistReplyMessage(Message message, Element source, Element target) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SelectMessagesEditPartTracker.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SelectMessagesEditPartTracker.java
index 98638240ef4..5c0ce75293f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SelectMessagesEditPartTracker.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SelectMessagesEditPartTracker.java
@@ -25,7 +25,6 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.selection.SelectSeveralLinksEditPartTracker;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractMessageEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.swt.SWT;
@@ -183,13 +182,13 @@ public class SelectMessagesEditPartTracker extends SelectSeveralLinksEditPartTra
Dimension computedDelta = getLocation().getDifference(getStartLocation());
delta = null;
if (computedDelta.height < 0) {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_UTIL, "Move " + computedDelta.height + " MinDistancetop" + MinDistancetop);//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_UTIL, "Move " + computedDelta.height + " MinDistancetop" + MinDistancetop);//$NON-NLS-1$
if (MinDistancetop + computedDelta.height < 0) {
computedDelta.height = -MinDistancetop;
delta = computedDelta.getCopy();
}
} else {
- UMLDiagramEditorPlugin.log.trace(CustomMessages.SEQUENCE_DEBUG_UTIL, "Move " + computedDelta.height + " MinDistancebottom" + MinDistancebottom);//$NON-NLS-1$
+ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_UTIL, "Move " + computedDelta.height + " MinDistancebottom" + MinDistancebottom);//$NON-NLS-1$
if (MinDistancebottom - computedDelta.height - 10 < 0) {
computedDelta.height = MinDistancebottom - 10;
delta = computedDelta.getCopy();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/SequenceDiagramEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/SequenceDiagramEditPart.java
index 1649797e1ec..cb0c54b2a9c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/SequenceDiagramEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/SequenceDiagramEditPart.java
@@ -1,63 +1,63 @@
-/**
- * Copyright (c) 2016 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.GridManagementEditPolicy;
-
-/**
- * @generated
- */
-public class SequenceDiagramEditPart extends PapyrusDiagramEditPart {
-
- /**
- * @generated
- */
- public final static String MODEL_ID = "PapyrusUMLSequenceDiagram"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Package_SequenceDiagram";
-
- /**
- * @generated
- */
- public SequenceDiagramEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
-
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
- installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
-
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.sequence.edit.policies.PackageCanonicalEditPolicy());
-
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT, new GridManagementEditPolicy());
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
- }
-}
+/**
+ * Copyright (c) 2016 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
+
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.GridManagementEditPolicy;
+
+/**
+ * @generated
+ */
+public class SequenceDiagramEditPart extends PapyrusDiagramEditPart {
+
+ /**
+ * @generated
+ */
+ public final static String MODEL_ID = "PapyrusUMLSequenceDiagram"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final String VISUAL_ID = "Package_SequenceDiagram";
+
+ /**
+ * @generated
+ */
+ public SequenceDiagramEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
+ installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
+
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ // in Papyrus diagrams are not strongly synchronised
+ // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.sequence.edit.policies.PackageCanonicalEditPolicy());
+
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT, new GridManagementEditPolicy());
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
+ }
+}
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 3ffd65a71c8..a0335d60e04 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
@@ -1,33 +1,33 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.core.runtime,
- org.junit;bundle-version="4.11.0",
- org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.7.0",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.uml.diagram.tests;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.uml.diagram.sequence;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.junit.framework;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.junit.utils;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.xtend.lib;bundle-version="2.8.1",
- 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
-Export-Package: org.eclipse.papyrus.uml.diagram.sequence.tests,
- org.eclipse.papyrus.uml.diagram.sequence.tests.generation
-Bundle-Vendor: %Bundle-Vendor
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %Bundle-Name
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.sequence.tests.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence.tests;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.core.runtime,
+ org.junit;bundle-version="4.11.0",
+ org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.7.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.uml.diagram.tests;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.uml.diagram.sequence;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.emf.appearance;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.junit.framework;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.junit.utils;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.xtend.lib;bundle-version="2.8.1",
+ 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
+Export-Package: org.eclipse.papyrus.uml.diagram.sequence.tests,
+ org.eclipse.papyrus.uml.diagram.sequence.tests.generation
+Bundle-Vendor: %Bundle-Vendor
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %Bundle-Name
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.sequence.tests.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCreationUndo_384618.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCreationUndo_384618.java
index 1085ba65122..43209369f2d 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCreationUndo_384618.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCreationUndo_384618.java
@@ -1,287 +1,288 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.CreateSequenceDiagramCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.TestLink;
-import org.junit.Test;
-
-/**
- * Undo doesn't work anymore for creation of the following elements: lifelines, messages, action and behavior executions.
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=384618
- *
- */
-public class TestCreationUndo_384618 extends TestLink {
-
- @Override
- protected ICreationCommand getDiagramCommandCreation() {
- return new CreateSequenceDiagramCommand();
- }
-
- @Override
- protected String getProjectName() {
- return ISequenceDiagramTestsConstants.PROJECT_NAME;
- }
-
- @Override
- protected String getFileName() {
- return ISequenceDiagramTestsConstants.FILE_NAME;
- }
-
- @Test
- public void testLifeline() {
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
- waitForComplete();
- assertTrue(CREATION + TEST_THE_EXECUTION, getRootEditPart().getChildren().size() == 1);
-
- assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
- getEMFCommandStack().undo();
- assertTrue(CREATION + TEST_THE_UNDO, getRootEditPart().getChildren().size() == 0);
-
- assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
- getEMFCommandStack().redo();
- assertTrue(CREATION + TEST_THE_REDO, getRootEditPart().getChildren().size() == 1);
- }
-
- @Test
- public void testActionExecution() {
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
- final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
- waitForComplete();
-
- createNode(UMLElementTypes.ActionExecutionSpecification_Shape, lifeline1, new Point(131, 200), new Dimension(20, 40));
- waitForComplete();
- assertTrue(CREATION + TEST_THE_EXECUTION, lifeline1.getChildren().size() == 2);
-
- assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
- getEMFCommandStack().undo();
- assertTrue(CREATION + TEST_THE_UNDO, lifeline1.getChildren().size() == 1);
-
- assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
- getEMFCommandStack().redo();
- assertTrue(CREATION + TEST_THE_REDO, lifeline1.getChildren().size() == 2);
- }
-
- @Test
- public void testBehaviorExecution() {
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
- final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
- waitForComplete();
-
- createNode(UMLElementTypes.BehaviorExecutionSpecification_Shape, lifeline1, new Point(131, 200), new Dimension(20, 40));
- waitForComplete();
- assertTrue(CREATION + TEST_THE_EXECUTION, lifeline1.getChildren().size() == 2);
-
- assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
- getEMFCommandStack().undo();
- assertTrue(CREATION + TEST_THE_UNDO, lifeline1.getChildren().size() == 1);
-
- assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
- getEMFCommandStack().redo();
- assertTrue(CREATION + TEST_THE_REDO, lifeline1.getChildren().size() == 2);
- }
-
- @Test
- public void testMessageAsync() {
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(300, 100), new Dimension(62, 200));
- final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
- final LifelineEditPart lifeline2 = (LifelineEditPart)getRootEditPart().getChildren().get(1);
- waitForComplete();
-
- createLink(UMLElementTypes.Message_AsynchEdge, lifeline1, lifeline2, getAbsoluteCenter(lifeline1), getAbsoluteCenter(lifeline2).translate(0, 10));
- waitForComplete();
- assertTrue(CREATION + TEST_THE_EXECUTION, lifeline1.getSourceConnections().size() == 1);
-
- assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
- getEMFCommandStack().undo();
- assertTrue(CREATION + TEST_THE_UNDO, lifeline1.getSourceConnections().size() == 0);
-
- assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
- getEMFCommandStack().redo();
- assertTrue(CREATION + TEST_THE_REDO, lifeline1.getSourceConnections().size() == 1);
- }
-
- @Test
- public void testMessageDelete() {
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(300, 100), new Dimension(62, 200));
- final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
- final LifelineEditPart lifeline2 = (LifelineEditPart)getRootEditPart().getChildren().get(1);
- waitForComplete();
-
- createLink(UMLElementTypes.Message_DeleteEdge, lifeline1, lifeline2, getAbsoluteCenter(lifeline1), getAbsoluteCenter(lifeline2).translate(0, 10));
- waitForComplete();
- assertTrue(CREATION + TEST_THE_EXECUTION, lifeline1.getSourceConnections().size() == 1);
-
- assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
- getEMFCommandStack().undo();
- assertEquals(CREATION + TEST_THE_UNDO, 0, lifeline1.getSourceConnections().size());
-
- assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
- getEMFCommandStack().redo();
- assertTrue(CREATION + TEST_THE_REDO, lifeline1.getSourceConnections().size() == 1);
- }
-
-
- @Test
- public void testMessageCreate() {
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(150, 150), new Dimension(62, 200));
- final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
- final LifelineEditPart lifeline2 = (LifelineEditPart)getRootEditPart().getChildren().get(1);
- waitForComplete();
-
- createLink(UMLElementTypes.Message_CreateEdge, lifeline1, lifeline2, getAbsoluteCenter(lifeline1), getAbsoluteCenter(lifeline2));
- waitForComplete();
- assertTrue(CREATION + TEST_THE_EXECUTION, lifeline1.getSourceConnections().size() == 1);
-
- assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
- getEMFCommandStack().undo();
- assertTrue(CREATION + TEST_THE_UNDO, lifeline1.getSourceConnections().size() == 0);
-
- assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
- getEMFCommandStack().redo();
- assertTrue(CREATION + TEST_THE_REDO, lifeline1.getSourceConnections().size() == 1);
- }
-
- @Test
- public void testMessageSync() {
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- store.setValue(CustomMessages.PREF_EXECUTION_SPECIFICATION_SYNC_MSG, "CHOICE_NONE");
-
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(300, 100), new Dimension(62, 200));
- final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
- final LifelineEditPart lifeline2 = (LifelineEditPart)getRootEditPart().getChildren().get(1);
- waitForComplete();
-
- createNode(UMLElementTypes.BehaviorExecutionSpecification_Shape, lifeline1, new Point(131, 140), new Dimension(20, 60));
- createNode(UMLElementTypes.BehaviorExecutionSpecification_Shape, lifeline2, new Point(331, 200), new Dimension(20, 60));
- waitForComplete();
-
- IGraphicalEditPart source = (IGraphicalEditPart)lifeline1.getChildren().get(1);
- IGraphicalEditPart target = (IGraphicalEditPart)lifeline2.getChildren().get(1);
-
- createLink(UMLElementTypes.Message_SynchEdge, source, target, getAbsoluteCenter(source), getAbsoluteCenter(target).translate(0, -28));
- waitForComplete();
- assertTrue(CREATION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 1);
-
- assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
- getEMFCommandStack().undo();
- assertTrue(CREATION + TEST_THE_UNDO, source.getSourceConnections().size() == 0);
-
- assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
- getEMFCommandStack().redo();
- assertTrue(CREATION + TEST_THE_REDO, source.getSourceConnections().size() == 1);
-
- }
-
- @Test
- public void testMessageReply() {
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(300, 100), new Dimension(62, 200));
- final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
- final LifelineEditPart lifeline2 = (LifelineEditPart)getRootEditPart().getChildren().get(1);
- waitForComplete();
-
- createNode(UMLElementTypes.BehaviorExecutionSpecification_Shape, lifeline1, new Point(131, 140), new Dimension(20, 60));
- createNode(UMLElementTypes.BehaviorExecutionSpecification_Shape, lifeline2, new Point(331, 200), new Dimension(20, 60));
- waitForComplete();
-
- IGraphicalEditPart source = (IGraphicalEditPart)lifeline1;
- IGraphicalEditPart target = (IGraphicalEditPart)lifeline2;
-
- createLink(UMLElementTypes.Message_ReplyEdge, source, target, getAbsoluteCenter(source), getAbsoluteCenter(target).translate(0, -28));
- waitForComplete();
- assertTrue(CREATION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 1);
-
- assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
- getEMFCommandStack().undo();
- assertTrue(CREATION + TEST_THE_UNDO, source.getSourceConnections().size() == 0);
-
- assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
- getEMFCommandStack().redo();
- assertTrue(CREATION + TEST_THE_REDO, source.getSourceConnections().size() == 1);
-
- }
-
- public void createLink(IElementType linkType, EditPart source, EditPart target, Point sourcePoint, Point targetPoint) {
- CreateConnectionViewRequest req = createConnectionViewRequest(linkType, source, target, sourcePoint, targetPoint);
- Command command = target.getCommand(req);
- assertNotNull(CREATION + COMMAND_NULL, command);
- assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
-
- getDiagramCommandStack().execute(command);
- }
-
- CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, Point sourcePoint, Point targetPoint) {
- CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, ((IGraphicalEditPart)getDiagramEditPart()).getDiagramPreferencesHint());
- connectionRequest.setLocation(sourcePoint);
-
- connectionRequest.setSourceEditPart(null);
- connectionRequest.setTargetEditPart(source);
- connectionRequest.setType(RequestConstants.REQ_CONNECTION_START);
- Command cmd = source.getCommand(connectionRequest);
- // Now, setup the request in preparation to get the
- // connection end
- // command.
- connectionRequest.setSourceEditPart(source);
- connectionRequest.setTargetEditPart(target);
- connectionRequest.setType(RequestConstants.REQ_CONNECTION_END);
- connectionRequest.setLocation(targetPoint);
-
- EObject container = getRootEditPart().resolveSemanticElement();
- connectionRequest.getExtendedData().put(SOURCE_MODEL_CONTAINER, container);
- connectionRequest.getExtendedData().put(TARGET_MODEL_CONTAINER, container);
-
- return connectionRequest;
- }
-
- public void createNode(IElementType type, EditPart parentPart, Point location, Dimension size) {
- //CREATION
- CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getRootEditPart().getDiagramPreferencesHint());
- requestcreation.setLocation(location);
- requestcreation.setSize(size);
- Command command = parentPart.getCommand(requestcreation);
- assertNotNull(CREATION + COMMAND_NULL, command);
- assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
- assertTrue(CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
-
- getDiagramCommandStack().execute(command);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.preferences.CustomDiagramGeneralPreferencePage;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants;
+import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.CreateSequenceDiagramCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.TestLink;
+import org.junit.Test;
+
+/**
+ * Undo doesn't work anymore for creation of the following elements: lifelines, messages, action and behavior executions.
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=384618
+ *
+ */
+public class TestCreationUndo_384618 extends TestLink {
+
+ @Override
+ protected ICreationCommand getDiagramCommandCreation() {
+ return new CreateSequenceDiagramCommand();
+ }
+
+ @Override
+ protected String getProjectName() {
+ return ISequenceDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return ISequenceDiagramTestsConstants.FILE_NAME;
+ }
+
+ @Test
+ public void testLifeline() {
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
+ waitForComplete();
+ assertTrue(CREATION + TEST_THE_EXECUTION, getRootEditPart().getChildren().size() == 1);
+
+ assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
+ getEMFCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, getRootEditPart().getChildren().size() == 0);
+
+ assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
+ getEMFCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, getRootEditPart().getChildren().size() == 1);
+ }
+
+ @Test
+ public void testActionExecution() {
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
+ final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
+ waitForComplete();
+
+ createNode(UMLElementTypes.ActionExecutionSpecification_Shape, lifeline1, new Point(131, 200), new Dimension(20, 40));
+ waitForComplete();
+ assertTrue(CREATION + TEST_THE_EXECUTION, lifeline1.getChildren().size() == 2);
+
+ assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
+ getEMFCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, lifeline1.getChildren().size() == 1);
+
+ assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
+ getEMFCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, lifeline1.getChildren().size() == 2);
+ }
+
+ @Test
+ public void testBehaviorExecution() {
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
+ final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
+ waitForComplete();
+
+ createNode(UMLElementTypes.BehaviorExecutionSpecification_Shape, lifeline1, new Point(131, 200), new Dimension(20, 40));
+ waitForComplete();
+ assertTrue(CREATION + TEST_THE_EXECUTION, lifeline1.getChildren().size() == 2);
+
+ assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
+ getEMFCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, lifeline1.getChildren().size() == 1);
+
+ assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
+ getEMFCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, lifeline1.getChildren().size() == 2);
+ }
+
+ @Test
+ public void testMessageAsync() {
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(300, 100), new Dimension(62, 200));
+ final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
+ final LifelineEditPart lifeline2 = (LifelineEditPart)getRootEditPart().getChildren().get(1);
+ waitForComplete();
+
+ createLink(UMLElementTypes.Message_AsynchEdge, lifeline1, lifeline2, getAbsoluteCenter(lifeline1), getAbsoluteCenter(lifeline2).translate(0, 10));
+ waitForComplete();
+ assertTrue(CREATION + TEST_THE_EXECUTION, lifeline1.getSourceConnections().size() == 1);
+
+ assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
+ getEMFCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, lifeline1.getSourceConnections().size() == 0);
+
+ assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
+ getEMFCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, lifeline1.getSourceConnections().size() == 1);
+ }
+
+ @Test
+ public void testMessageDelete() {
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(300, 100), new Dimension(62, 200));
+ final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
+ final LifelineEditPart lifeline2 = (LifelineEditPart)getRootEditPart().getChildren().get(1);
+ waitForComplete();
+
+ createLink(UMLElementTypes.Message_DeleteEdge, lifeline1, lifeline2, getAbsoluteCenter(lifeline1), getAbsoluteCenter(lifeline2).translate(0, 10));
+ waitForComplete();
+ assertTrue(CREATION + TEST_THE_EXECUTION, lifeline1.getSourceConnections().size() == 1);
+
+ assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
+ getEMFCommandStack().undo();
+ assertEquals(CREATION + TEST_THE_UNDO, 0, lifeline1.getSourceConnections().size());
+
+ assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
+ getEMFCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, lifeline1.getSourceConnections().size() == 1);
+ }
+
+
+ @Test
+ public void testMessageCreate() {
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(150, 150), new Dimension(62, 200));
+ final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
+ final LifelineEditPart lifeline2 = (LifelineEditPart)getRootEditPart().getChildren().get(1);
+ waitForComplete();
+
+ createLink(UMLElementTypes.Message_CreateEdge, lifeline1, lifeline2, getAbsoluteCenter(lifeline1), getAbsoluteCenter(lifeline2));
+ waitForComplete();
+ assertTrue(CREATION + TEST_THE_EXECUTION, lifeline1.getSourceConnections().size() == 1);
+
+ assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
+ getEMFCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, lifeline1.getSourceConnections().size() == 0);
+
+ assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
+ getEMFCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, lifeline1.getSourceConnections().size() == 1);
+ }
+
+ @Test
+ public void testMessageSync() {
+ IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ store.setValue(CustomDiagramGeneralPreferencePage.PREF_EXECUTION_SPECIFICATION_SYNC_MSG, "CHOICE_NONE");
+
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(300, 100), new Dimension(62, 200));
+ final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
+ final LifelineEditPart lifeline2 = (LifelineEditPart)getRootEditPart().getChildren().get(1);
+ waitForComplete();
+
+ createNode(UMLElementTypes.BehaviorExecutionSpecification_Shape, lifeline1, new Point(131, 140), new Dimension(20, 60));
+ createNode(UMLElementTypes.BehaviorExecutionSpecification_Shape, lifeline2, new Point(331, 200), new Dimension(20, 60));
+ waitForComplete();
+
+ IGraphicalEditPart source = (IGraphicalEditPart)lifeline1.getChildren().get(1);
+ IGraphicalEditPart target = (IGraphicalEditPart)lifeline2.getChildren().get(1);
+
+ createLink(UMLElementTypes.Message_SynchEdge, source, target, getAbsoluteCenter(source), getAbsoluteCenter(target).translate(0, -28));
+ waitForComplete();
+ assertTrue(CREATION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 1);
+
+ assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
+ getEMFCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, source.getSourceConnections().size() == 0);
+
+ assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
+ getEMFCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, source.getSourceConnections().size() == 1);
+
+ }
+
+ @Test
+ public void testMessageReply() {
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200));
+ createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(300, 100), new Dimension(62, 200));
+ final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
+ final LifelineEditPart lifeline2 = (LifelineEditPart)getRootEditPart().getChildren().get(1);
+ waitForComplete();
+
+ createNode(UMLElementTypes.BehaviorExecutionSpecification_Shape, lifeline1, new Point(131, 140), new Dimension(20, 60));
+ createNode(UMLElementTypes.BehaviorExecutionSpecification_Shape, lifeline2, new Point(331, 200), new Dimension(20, 60));
+ waitForComplete();
+
+ IGraphicalEditPart source = (IGraphicalEditPart)lifeline1;
+ IGraphicalEditPart target = (IGraphicalEditPart)lifeline2;
+
+ createLink(UMLElementTypes.Message_ReplyEdge, source, target, getAbsoluteCenter(source), getAbsoluteCenter(target).translate(0, -28));
+ waitForComplete();
+ assertTrue(CREATION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 1);
+
+ assertTrue(CREATION + TEST_THE_UNDO, getDiagramCommandStack().canUndo());
+ getEMFCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, source.getSourceConnections().size() == 0);
+
+ assertTrue(CREATION + TEST_THE_REDO, getDiagramCommandStack().canRedo());
+ getEMFCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, source.getSourceConnections().size() == 1);
+
+ }
+
+ public void createLink(IElementType linkType, EditPart source, EditPart target, Point sourcePoint, Point targetPoint) {
+ CreateConnectionViewRequest req = createConnectionViewRequest(linkType, source, target, sourcePoint, targetPoint);
+ Command command = target.getCommand(req);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+
+ getDiagramCommandStack().execute(command);
+ }
+
+ CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, Point sourcePoint, Point targetPoint) {
+ CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, ((IGraphicalEditPart)getDiagramEditPart()).getDiagramPreferencesHint());
+ connectionRequest.setLocation(sourcePoint);
+
+ connectionRequest.setSourceEditPart(null);
+ connectionRequest.setTargetEditPart(source);
+ connectionRequest.setType(RequestConstants.REQ_CONNECTION_START);
+ Command cmd = source.getCommand(connectionRequest);
+ // Now, setup the request in preparation to get the
+ // connection end
+ // command.
+ connectionRequest.setSourceEditPart(source);
+ connectionRequest.setTargetEditPart(target);
+ connectionRequest.setType(RequestConstants.REQ_CONNECTION_END);
+ connectionRequest.setLocation(targetPoint);
+
+ EObject container = getRootEditPart().resolveSemanticElement();
+ connectionRequest.getExtendedData().put(SOURCE_MODEL_CONTAINER, container);
+ connectionRequest.getExtendedData().put(TARGET_MODEL_CONTAINER, container);
+
+ return connectionRequest;
+ }
+
+ public void createNode(IElementType type, EditPart parentPart, Point location, Dimension size) {
+ //CREATION
+ CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getRootEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(location);
+ requestcreation.setSize(size);
+ Command command = parentPart.getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+
+ getDiagramCommandStack().execute(command);
+ }
+}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestMessagesDeletion_364828.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestMessagesDeletion_364828.java
index d7857f4754d..bfec73e8dde 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestMessagesDeletion_364828.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestMessagesDeletion_364828.java
@@ -1,304 +1,304 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.CreateSequenceDiagramCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.ILinkTestProvider;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.TestLink;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.junit.Test;
-
-/**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=364828
- * When a message is deleted, its associated send and receive events are not
- * deleted. These events must be deleted because new events are systematically
- * created upon the creation of a new message.
- *
- * It fixes the deletion of the associated send MessageSend and receive
- * MessageRecv events for
- * - Message Sync
- * - Message Async
- * - Message Reply
- * - Message Create
- * - Message Delete
- *
- */
-public class TestMessagesDeletion_364828 extends TestLink {
-
- @Override
- protected ICreationCommand getDiagramCommandCreation() {
- return new CreateSequenceDiagramCommand();
- }
-
- @Override
- protected String getProjectName() {
- return ISequenceDiagramTestsConstants.PROJECT_NAME;
- }
-
- @Override
- protected String getFileName() {
- return ISequenceDiagramTestsConstants.FILE_NAME;
- }
-
- @Override
- public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, ILinkTestProvider provider) {
- CreateConnectionViewRequest request = super.createConnectionViewRequest(type, source, target, provider);
- EObject container = getRootEditPart().resolveSemanticElement();
- request.getExtendedData().put(SOURCE_MODEL_CONTAINER, container);
- request.getExtendedData().put(TARGET_MODEL_CONTAINER, container);
- return request;
- }
-
- public void deleteMessageEvents(IElementType sourceType, IElementType targetType, IElementType linkType, ILinkTestProvider provider) {
- installEnvironment(sourceType, targetType, provider);
- Interaction interaction = (Interaction)getRootEditPart().resolveSemanticElement();
-
- // create message link
- CreateConnectionViewRequest req = createConnectionViewRequest(linkType, source, target, provider);
- Command command = target.getCommand(req);
- assertNotNull(CREATION + COMMAND_NULL, command);
- assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute());
- getDiagramCommandStack().execute(command);
-
- // delete message link
- assertEquals(DESTROY_DELETION + INITIALIZATION_TEST,1, provider.getEdgesSize());
- assertEquals(DESTROY_DELETION + INITIALIZATION_TEST,2, getMessageEndCount(interaction.getFragments()));
- Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
- Command delCommand = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
- assertNotNull(DESTROY_DELETION + COMMAND_NULL, delCommand);
- assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, delCommand != UnexecutableCommand.INSTANCE);
- assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, delCommand.canExecute());
- getEMFCommandStack().execute(new GEFtoEMFCommandWrapper(delCommand));
- assertEquals(DESTROY_DELETION + TEST_THE_EXECUTION,0, getMessageEndCount(interaction.getFragments()));
-
- getEMFCommandStack().undo();
- assertEquals(DESTROY_DELETION + TEST_THE_UNDO,2, getMessageEndCount(interaction.getFragments()));
-
- getEMFCommandStack().redo();
- assertEquals(DESTROY_DELETION + TEST_THE_REDO,0, getMessageEndCount(interaction.getFragments()));
- }
-
- private int getMessageEndCount(EList<InteractionFragment> fragments) {
- int count = 0;
- for(InteractionFragment f : fragments) {
- if(f instanceof MessageEnd) {
- count++;
- }
- }
-
- return count;
- }
-
- @Test
- public void testMessageAsync() {
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- store.setValue(CustomMessages.PREF_EXECUTION_SPECIFICATION_ASYNC_MSG, "CHOICE_NONE");
- deleteMessageEvents(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_AsynchEdge, lifelineProvider);
- }
-
- @Test
- public void testMessageSync() {
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- store.setValue(CustomMessages.PREF_EXECUTION_SPECIFICATION_SYNC_MSG, "CHOICE_NONE");
- deleteMessageEvents(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_SynchEdge, lifelineProvider);
- }
-
- @Test
- public void testMessageReply() {
- deleteMessageEvents(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_ReplyEdge, lifelineProvider);
- }
-
- @Test
- public void testMessageDelete() {
- deleteMessageEvents(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_DeleteEdge, lifelineProvider);
- }
-
- @Test
- public void testMessageCreate() {
- deleteMessageEvents(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_CreateEdge, lifelineProvider);
- }
-
- protected ILinkTestProvider executionProvider = new ILinkTestProvider() {
-
-
- public boolean hasSemanticChild() {
- return TestMessagesDeletion_364828.this.lifelineProvider.hasSemanticChild();
- }
-
- public Point getChildLocation(GraphicalEditPart parentEditPart) {
- return TestMessagesDeletion_364828.this.lifelineProvider.getChildLocation(parentEditPart);
- }
-
- public int getEditPartChildrenSize() {
- return TestMessagesDeletion_364828.this.lifelineProvider.getEditPartChildrenSize();
- }
-
- public Element getDropElement() {
- return null;
- }
-
- public int getSemanticChildrenSize() {
- return TestMessagesDeletion_364828.this.lifelineProvider.getSemanticChildrenSize() - 4; // ignore ActionExecution
- }
-
- public int getViewChildrenSize() {
- return TestMessagesDeletion_364828.this.lifelineProvider.getViewChildrenSize();
- }
-
- public GraphicalEditPart getParentEditPart() {
- return TestMessagesDeletion_364828.this.lifelineProvider.getParentEditPart();
- }
-
- public GraphicalEditPart getDestroyEditPart() {
- return null;
- }
-
- public int getEdgesSize() {
- return TestMessagesDeletion_364828.this.lifelineProvider.getEdgesSize();
- }
-
- public Point getConnectionSourceLocation(EditPart source) {
- return TestMessagesDeletion_364828.this.lifelineProvider.getConnectionSourceLocation(source);
- }
-
- public Point getConnectionTargetLocation(EditPart target) {
- return TestMessagesDeletion_364828.this.lifelineProvider.getConnectionTargetLocation(target);
- }
-
- public void setUp() {
- IElementType childNodeType = UMLElementTypes.ActionExecutionSpecification_Shape;
- source = createSubNode(source, childNodeType, getChildLocation(source));
- sourcePlayer = createSubNode(sourcePlayer, childNodeType, getChildLocation(sourcePlayer));
-
- target = createSubNode(target, childNodeType, getChildLocation(target).getTranslated(0, 50));
- targetPlayer = createSubNode(targetPlayer, childNodeType, getChildLocation(targetPlayer).getTranslated(0, 50));
- }
-
- };
-
- protected ILinkTestProvider lifelineProvider = new ILinkTestProvider() {
-
- public int getEdgesSize() {
- return getDiagramEditPart().getDiagramView().getEdges().size();
- }
-
- public int getEditPartChildrenSize() {
- return getRootEditPart().getChildren().size();
- }
-
- public int getSemanticChildrenSize() {
- int count = 0;
- EList<Element> elems = ((Element)getRootEditPart().getNotationView().getElement()).getOwnedElements();
- for(Element f : elems) {
- if(!(f instanceof MessageEnd) && !(f instanceof ExecutionOccurrenceSpecification)) {
- count++;
- }
- }
-
- return count;
- }
-
- public int getViewChildrenSize() {
- return getRootEditPart().getNotationView().getChildren().size();
- }
-
- public Element getDropElement() {
- return null;
- }
-
- public GraphicalEditPart getParentEditPart() {
- return getRootEditPart();
- }
-
- public GraphicalEditPart getDestroyEditPart() {
- return null;
- }
-
- public Point getConnectionSourceLocation(EditPart part) {
- if(part instanceof LifelineEditPart) {
- IFigure f = ((LifelineEditPart)part).getPrimaryShape();
- return getCenter(f);
- }
- if(part instanceof AbstractExecutionSpecificationEditPart || part instanceof InteractionEditPart) { // found message
- return getAbsoluteBounds((IGraphicalEditPart)part).getTopLeft();
- }
- return new Point(0, 0);
- }
-
- public Point getConnectionTargetLocation(EditPart part) {
- if(part instanceof LifelineEditPart) {
- IFigure f = ((LifelineEditPart)part).getPrimaryShape();
- return getCenter(f);
- }
- if(part instanceof AbstractExecutionSpecificationEditPart || part instanceof InteractionEditPart) {
- Rectangle r = getAbsoluteBounds((IGraphicalEditPart)part);
- return r.getBottom();
- }
- return new Point(0, 0);
- }
-
- public boolean hasSemanticChild() {
- return true;
- }
-
- public Point getChildLocation(GraphicalEditPart parentEditPart) {
- IFigure f = ((LifelineEditPart)parentEditPart).getPrimaryShape();
- return getCenter(f).translate(0, 1);
- }
-
- public void setUp() {
- }
- };
-
- private Point getCenter(IFigure f) {
- Rectangle b = f.getBounds().getCopy();
- f.translateToAbsolute(b);
- Point c = b.getCenter().getCopy();
- return c;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.preferences.CustomDiagramGeneralPreferencePage;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants;
+import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.CreateSequenceDiagramCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.ILinkTestProvider;
+import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.TestLink;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.junit.Test;
+
+/**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=364828
+ * When a message is deleted, its associated send and receive events are not
+ * deleted. These events must be deleted because new events are systematically
+ * created upon the creation of a new message.
+ *
+ * It fixes the deletion of the associated send MessageSend and receive
+ * MessageRecv events for
+ * - Message Sync
+ * - Message Async
+ * - Message Reply
+ * - Message Create
+ * - Message Delete
+ *
+ */
+public class TestMessagesDeletion_364828 extends TestLink {
+
+ @Override
+ protected ICreationCommand getDiagramCommandCreation() {
+ return new CreateSequenceDiagramCommand();
+ }
+
+ @Override
+ protected String getProjectName() {
+ return ISequenceDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return ISequenceDiagramTestsConstants.FILE_NAME;
+ }
+
+ @Override
+ public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, ILinkTestProvider provider) {
+ CreateConnectionViewRequest request = super.createConnectionViewRequest(type, source, target, provider);
+ EObject container = getRootEditPart().resolveSemanticElement();
+ request.getExtendedData().put(SOURCE_MODEL_CONTAINER, container);
+ request.getExtendedData().put(TARGET_MODEL_CONTAINER, container);
+ return request;
+ }
+
+ public void deleteMessageEvents(IElementType sourceType, IElementType targetType, IElementType linkType, ILinkTestProvider provider) {
+ installEnvironment(sourceType, targetType, provider);
+ Interaction interaction = (Interaction)getRootEditPart().resolveSemanticElement();
+
+ // create message link
+ CreateConnectionViewRequest req = createConnectionViewRequest(linkType, source, target, provider);
+ Command command = target.getCommand(req);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute());
+ getDiagramCommandStack().execute(command);
+
+ // delete message link
+ assertEquals(DESTROY_DELETION + INITIALIZATION_TEST,1, provider.getEdgesSize());
+ assertEquals(DESTROY_DELETION + INITIALIZATION_TEST,2, getMessageEndCount(interaction.getFragments()));
+ Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
+ Command delCommand = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
+ assertNotNull(DESTROY_DELETION + COMMAND_NULL, delCommand);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, delCommand != UnexecutableCommand.INSTANCE);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, delCommand.canExecute());
+ getEMFCommandStack().execute(new GEFtoEMFCommandWrapper(delCommand));
+ assertEquals(DESTROY_DELETION + TEST_THE_EXECUTION,0, getMessageEndCount(interaction.getFragments()));
+
+ getEMFCommandStack().undo();
+ assertEquals(DESTROY_DELETION + TEST_THE_UNDO,2, getMessageEndCount(interaction.getFragments()));
+
+ getEMFCommandStack().redo();
+ assertEquals(DESTROY_DELETION + TEST_THE_REDO,0, getMessageEndCount(interaction.getFragments()));
+ }
+
+ private int getMessageEndCount(EList<InteractionFragment> fragments) {
+ int count = 0;
+ for(InteractionFragment f : fragments) {
+ if(f instanceof MessageEnd) {
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ @Test
+ public void testMessageAsync() {
+ IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ store.setValue(CustomDiagramGeneralPreferencePage.PREF_EXECUTION_SPECIFICATION_ASYNC_MSG, "CHOICE_NONE");
+ deleteMessageEvents(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_AsynchEdge, lifelineProvider);
+ }
+
+ @Test
+ public void testMessageSync() {
+ IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ store.setValue(CustomDiagramGeneralPreferencePage.PREF_EXECUTION_SPECIFICATION_SYNC_MSG, "CHOICE_NONE");
+ deleteMessageEvents(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_SynchEdge, lifelineProvider);
+ }
+
+ @Test
+ public void testMessageReply() {
+ deleteMessageEvents(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_ReplyEdge, lifelineProvider);
+ }
+
+ @Test
+ public void testMessageDelete() {
+ deleteMessageEvents(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_DeleteEdge, lifelineProvider);
+ }
+
+ @Test
+ public void testMessageCreate() {
+ deleteMessageEvents(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_CreateEdge, lifelineProvider);
+ }
+
+ protected ILinkTestProvider executionProvider = new ILinkTestProvider() {
+
+
+ public boolean hasSemanticChild() {
+ return TestMessagesDeletion_364828.this.lifelineProvider.hasSemanticChild();
+ }
+
+ public Point getChildLocation(GraphicalEditPart parentEditPart) {
+ return TestMessagesDeletion_364828.this.lifelineProvider.getChildLocation(parentEditPart);
+ }
+
+ public int getEditPartChildrenSize() {
+ return TestMessagesDeletion_364828.this.lifelineProvider.getEditPartChildrenSize();
+ }
+
+ public Element getDropElement() {
+ return null;
+ }
+
+ public int getSemanticChildrenSize() {
+ return TestMessagesDeletion_364828.this.lifelineProvider.getSemanticChildrenSize() - 4; // ignore ActionExecution
+ }
+
+ public int getViewChildrenSize() {
+ return TestMessagesDeletion_364828.this.lifelineProvider.getViewChildrenSize();
+ }
+
+ public GraphicalEditPart getParentEditPart() {
+ return TestMessagesDeletion_364828.this.lifelineProvider.getParentEditPart();
+ }
+
+ public GraphicalEditPart getDestroyEditPart() {
+ return null;
+ }
+
+ public int getEdgesSize() {
+ return TestMessagesDeletion_364828.this.lifelineProvider.getEdgesSize();
+ }
+
+ public Point getConnectionSourceLocation(EditPart source) {
+ return TestMessagesDeletion_364828.this.lifelineProvider.getConnectionSourceLocation(source);
+ }
+
+ public Point getConnectionTargetLocation(EditPart target) {
+ return TestMessagesDeletion_364828.this.lifelineProvider.getConnectionTargetLocation(target);
+ }
+
+ public void setUp() {
+ IElementType childNodeType = UMLElementTypes.ActionExecutionSpecification_Shape;
+ source = createSubNode(source, childNodeType, getChildLocation(source));
+ sourcePlayer = createSubNode(sourcePlayer, childNodeType, getChildLocation(sourcePlayer));
+
+ target = createSubNode(target, childNodeType, getChildLocation(target).getTranslated(0, 50));
+ targetPlayer = createSubNode(targetPlayer, childNodeType, getChildLocation(targetPlayer).getTranslated(0, 50));
+ }
+
+ };
+
+ protected ILinkTestProvider lifelineProvider = new ILinkTestProvider() {
+
+ public int getEdgesSize() {
+ return getDiagramEditPart().getDiagramView().getEdges().size();
+ }
+
+ public int getEditPartChildrenSize() {
+ return getRootEditPart().getChildren().size();
+ }
+
+ public int getSemanticChildrenSize() {
+ int count = 0;
+ EList<Element> elems = ((Element)getRootEditPart().getNotationView().getElement()).getOwnedElements();
+ for(Element f : elems) {
+ if(!(f instanceof MessageEnd) && !(f instanceof ExecutionOccurrenceSpecification)) {
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ public int getViewChildrenSize() {
+ return getRootEditPart().getNotationView().getChildren().size();
+ }
+
+ public Element getDropElement() {
+ return null;
+ }
+
+ public GraphicalEditPart getParentEditPart() {
+ return getRootEditPart();
+ }
+
+ public GraphicalEditPart getDestroyEditPart() {
+ return null;
+ }
+
+ public Point getConnectionSourceLocation(EditPart part) {
+ if(part instanceof LifelineEditPart) {
+ IFigure f = ((LifelineEditPart)part).getPrimaryShape();
+ return getCenter(f);
+ }
+ if(part instanceof AbstractExecutionSpecificationEditPart || part instanceof InteractionEditPart) { // found message
+ return getAbsoluteBounds((IGraphicalEditPart)part).getTopLeft();
+ }
+ return new Point(0, 0);
+ }
+
+ public Point getConnectionTargetLocation(EditPart part) {
+ if(part instanceof LifelineEditPart) {
+ IFigure f = ((LifelineEditPart)part).getPrimaryShape();
+ return getCenter(f);
+ }
+ if(part instanceof AbstractExecutionSpecificationEditPart || part instanceof InteractionEditPart) {
+ Rectangle r = getAbsoluteBounds((IGraphicalEditPart)part);
+ return r.getBottom();
+ }
+ return new Point(0, 0);
+ }
+
+ public boolean hasSemanticChild() {
+ return true;
+ }
+
+ public Point getChildLocation(GraphicalEditPart parentEditPart) {
+ IFigure f = ((LifelineEditPart)parentEditPart).getPrimaryShape();
+ return getCenter(f).translate(0, 1);
+ }
+
+ public void setUp() {
+ }
+ };
+
+ private Point getCenter(IFigure f) {
+ Rectangle b = f.getBounds().getCopy();
+ f.translateToAbsolute(b);
+ Point c = b.getCenter().getCopy();
+ return c;
+ }
+}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramLink.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramLink.java
index a89b71428c5..057e9af1f4c 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramLink.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramLink.java
@@ -1,269 +1,270 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.tests.canonical;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.junit.Test;
-
-public class TestSequenceDiagramLink extends TestLink {
-
- @Override
- protected ICreationCommand getDiagramCommandCreation() {
- return new CreateSequenceDiagramCommand();
- }
-
- @Override
- protected String getProjectName() {
- return ISequenceDiagramTestsConstants.PROJECT_NAME;
- }
-
- @Override
- protected String getFileName() {
- return ISequenceDiagramTestsConstants.FILE_NAME;
- }
-
- @Test
- public void testToManageGeneralOrdering() {
- testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.GeneralOrdering_Edge, executionProvider, false);
- }
-
- @Test
- public void testToManageMessageSync_4003() {
- testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_SynchEdge, executionProvider, false);
- }
-
- @Test
- public void testToManageMessageReply_4005() {
- testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_ReplyEdge, executionProvider, false);
- }
-
- @Test
- public void testToManageMessageFound_4009() {
- installEnvironment(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, lifelineProvider);
- source = (GraphicalEditPart)source.getParent().getParent();
- testToCreateALink(UMLElementTypes.Message_FoundEdge, lifelineProvider);
-
- testDestroy(UMLElementTypes.Message_FoundEdge, lifelineProvider);
- getEMFCommandStack().undo();
- testViewDeletion(UMLElementTypes.Message_FoundEdge, lifelineProvider);
- }
-
- @Test
- public void testToManageMessageLost_4008() {
- installEnvironment(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, lifelineProvider);
-
- target = (GraphicalEditPart)target.getParent().getParent();
- testToCreateALink(UMLElementTypes.Message_LostEdge, lifelineProvider);
-
- testDestroy(UMLElementTypes.Message_LostEdge, lifelineProvider);
- getEMFCommandStack().undo();
- testViewDeletion(UMLElementTypes.Message_LostEdge, lifelineProvider);
- }
-
- @Test
- public void testToManageCommentLink() {
- testToManageLink(UMLElementTypes.Comment_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Comment_AnnotatedElementEdge, lifelineProvider, true);
- }
-
- @Test
- public void testToManageConstraintLink() {
- testToManageLink(UMLElementTypes.Constraint_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Constraint_ConstrainedElementEdge, lifelineProvider, true);
- }
-
- @Test
- public void testToManageMessageAsync_4004() {
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- store.setValue(CustomMessages.PREF_EXECUTION_SPECIFICATION_ASYNC_MSG, "CHOICE_NONE");
- testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_AsynchEdge, lifelineProvider, true);
- }
-
- @Test
- public void testToManageMessageDelete_4007() {
- testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_DeleteEdge, lifelineProvider, true);
- }
-
- @Test
- public void testToManageMessageCreate_4006() {
- testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_CreateEdge, lifelineProvider, false);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, ILinkTestProvider provider) {
- CreateConnectionViewRequest request = super.createConnectionViewRequest(type, source, target, provider);
-
- EObject container = getRootEditPart().resolveSemanticElement();
- request.getExtendedData().put(SOURCE_MODEL_CONTAINER, container);
- request.getExtendedData().put(TARGET_MODEL_CONTAINER, container);
- return request;
- }
-
- private Point getCenter(IFigure f) {
- Rectangle b = f.getBounds().getCopy();
- f.translateToAbsolute(b);
- Point c = b.getCenter().getCopy();
- return c;
- }
-
- protected ILinkTestProvider executionProvider = new ILinkTestProvider() {
-
-
- public boolean hasSemanticChild() {
- return TestSequenceDiagramLink.this.lifelineProvider.hasSemanticChild();
- }
-
- public Point getChildLocation(GraphicalEditPart parentEditPart) {
- return TestSequenceDiagramLink.this.lifelineProvider.getChildLocation(parentEditPart);
- }
-
- public int getEditPartChildrenSize() {
- return TestSequenceDiagramLink.this.lifelineProvider.getEditPartChildrenSize();
- }
-
- public Element getDropElement() {
- return null;
- }
-
- public int getSemanticChildrenSize() {
- return TestSequenceDiagramLink.this.lifelineProvider.getSemanticChildrenSize() - 4; // ignore ActionExecution
- }
-
- public int getViewChildrenSize() {
- return TestSequenceDiagramLink.this.lifelineProvider.getViewChildrenSize();
- }
-
- public GraphicalEditPart getParentEditPart() {
- return TestSequenceDiagramLink.this.lifelineProvider.getParentEditPart();
- }
-
- public GraphicalEditPart getDestroyEditPart() {
- return null;
- }
-
- public int getEdgesSize() {
- return TestSequenceDiagramLink.this.lifelineProvider.getEdgesSize();
- }
-
- public Point getConnectionSourceLocation(EditPart source) {
- return TestSequenceDiagramLink.this.lifelineProvider.getConnectionSourceLocation(source);
- }
-
- public Point getConnectionTargetLocation(EditPart target) {
- return TestSequenceDiagramLink.this.lifelineProvider.getConnectionTargetLocation(target);
- }
-
- public void setUp() {
- IElementType childNodeType = UMLElementTypes.ActionExecutionSpecification_Shape;
- source = createSubNode(source, childNodeType, getChildLocation(source));
- sourcePlayer = createSubNode(sourcePlayer, childNodeType, getChildLocation(sourcePlayer));
-
- target = createSubNode(target, childNodeType, getChildLocation(target).translate(0, 50));
- targetPlayer = createSubNode(targetPlayer, childNodeType, getChildLocation(targetPlayer).translate(0, 50));
- }
-
- };
-
- protected ILinkTestProvider lifelineProvider = new ILinkTestProvider() {
-
- public int getEdgesSize() {
- return getDiagramEditPart().getDiagramView().getEdges().size();
- }
-
- public int getEditPartChildrenSize() {
- return getRootEditPart().getChildren().size();
- }
-
- public int getSemanticChildrenSize() {
- int count = 0;
- EList<Element> elems = ((Element)getRootEditPart().getNotationView().getElement()).getOwnedElements();
- for(Element f : elems)
- if(!(f instanceof MessageEnd) && !(f instanceof ExecutionOccurrenceSpecification))
- count++;
-
- return count;
- }
-
- public int getViewChildrenSize() {
- return getRootEditPart().getNotationView().getChildren().size();
- }
-
- public Element getDropElement() {
- return null;
- }
-
- public GraphicalEditPart getParentEditPart() {
- return getRootEditPart();
- }
-
- public GraphicalEditPart getDestroyEditPart() {
- return null;
- }
-
- public Point getConnectionSourceLocation(EditPart part) {
- if(part instanceof LifelineEditPart) {
- IFigure f = ((LifelineEditPart)part).getPrimaryShape();
- return getCenter(f);
- }
- if(part instanceof AbstractExecutionSpecificationEditPart || part instanceof InteractionEditPart) { // found message
- return getAbsoluteBounds((IGraphicalEditPart)part).getTopLeft();
- }
- return new Point(0, 0);
- }
-
- public Point getConnectionTargetLocation(EditPart part) {
- if(part instanceof LifelineEditPart) {
- IFigure f = ((LifelineEditPart)part).getPrimaryShape();
- return getCenter(f);
- }
- if(part instanceof AbstractExecutionSpecificationEditPart || part instanceof InteractionEditPart) {
- Rectangle r = getAbsoluteBounds((IGraphicalEditPart)part);
- return r.getBottom();
- }
- return new Point(0, 0);
- }
-
- public boolean hasSemanticChild() {
- return true;
- }
-
- public Point getChildLocation(GraphicalEditPart parentEditPart) {
- IFigure f = ((LifelineEditPart)parentEditPart).getPrimaryShape();
- return getCenter(f).translate(0, 1);
- }
-
- public void setUp() {
- }
- };
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.tests.canonical;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.preferences.CustomDiagramGeneralPreferencePage;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.junit.Test;
+
+public class TestSequenceDiagramLink extends TestLink {
+
+ @Override
+ protected ICreationCommand getDiagramCommandCreation() {
+ return new CreateSequenceDiagramCommand();
+ }
+
+ @Override
+ protected String getProjectName() {
+ return ISequenceDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return ISequenceDiagramTestsConstants.FILE_NAME;
+ }
+
+ @Test
+ public void testToManageGeneralOrdering() {
+ testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.GeneralOrdering_Edge, executionProvider, false);
+ }
+
+ @Test
+ public void testToManageMessageSync_4003() {
+ testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_SynchEdge, executionProvider, false);
+ }
+
+ @Test
+ public void testToManageMessageReply_4005() {
+ testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_ReplyEdge, executionProvider, false);
+ }
+
+ @Test
+ public void testToManageMessageFound_4009() {
+ installEnvironment(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, lifelineProvider);
+ source = (GraphicalEditPart)source.getParent().getParent();
+ testToCreateALink(UMLElementTypes.Message_FoundEdge, lifelineProvider);
+
+ testDestroy(UMLElementTypes.Message_FoundEdge, lifelineProvider);
+ getEMFCommandStack().undo();
+ testViewDeletion(UMLElementTypes.Message_FoundEdge, lifelineProvider);
+ }
+
+ @Test
+ public void testToManageMessageLost_4008() {
+ installEnvironment(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, lifelineProvider);
+
+ target = (GraphicalEditPart)target.getParent().getParent();
+ testToCreateALink(UMLElementTypes.Message_LostEdge, lifelineProvider);
+
+ testDestroy(UMLElementTypes.Message_LostEdge, lifelineProvider);
+ getEMFCommandStack().undo();
+ testViewDeletion(UMLElementTypes.Message_LostEdge, lifelineProvider);
+ }
+
+ @Test
+ public void testToManageCommentLink() {
+ testToManageLink(UMLElementTypes.Comment_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Comment_AnnotatedElementEdge, lifelineProvider, true);
+ }
+
+ @Test
+ public void testToManageConstraintLink() {
+ testToManageLink(UMLElementTypes.Constraint_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Constraint_ConstrainedElementEdge, lifelineProvider, true);
+ }
+
+ @Test
+ public void testToManageMessageAsync_4004() {
+ IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ store.setValue(CustomDiagramGeneralPreferencePage.PREF_EXECUTION_SPECIFICATION_ASYNC_MSG, "CHOICE_NONE");
+ testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_AsynchEdge, lifelineProvider, true);
+ }
+
+ @Test
+ public void testToManageMessageDelete_4007() {
+ testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_DeleteEdge, lifelineProvider, true);
+ }
+
+ @Test
+ public void testToManageMessageCreate_4006() {
+ testToManageLink(UMLElementTypes.Lifeline_Shape, UMLElementTypes.Lifeline_Shape, UMLElementTypes.Message_CreateEdge, lifelineProvider, false);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, ILinkTestProvider provider) {
+ CreateConnectionViewRequest request = super.createConnectionViewRequest(type, source, target, provider);
+
+ EObject container = getRootEditPart().resolveSemanticElement();
+ request.getExtendedData().put(SOURCE_MODEL_CONTAINER, container);
+ request.getExtendedData().put(TARGET_MODEL_CONTAINER, container);
+ return request;
+ }
+
+ private Point getCenter(IFigure f) {
+ Rectangle b = f.getBounds().getCopy();
+ f.translateToAbsolute(b);
+ Point c = b.getCenter().getCopy();
+ return c;
+ }
+
+ protected ILinkTestProvider executionProvider = new ILinkTestProvider() {
+
+
+ public boolean hasSemanticChild() {
+ return TestSequenceDiagramLink.this.lifelineProvider.hasSemanticChild();
+ }
+
+ public Point getChildLocation(GraphicalEditPart parentEditPart) {
+ return TestSequenceDiagramLink.this.lifelineProvider.getChildLocation(parentEditPart);
+ }
+
+ public int getEditPartChildrenSize() {
+ return TestSequenceDiagramLink.this.lifelineProvider.getEditPartChildrenSize();
+ }
+
+ public Element getDropElement() {
+ return null;
+ }
+
+ public int getSemanticChildrenSize() {
+ return TestSequenceDiagramLink.this.lifelineProvider.getSemanticChildrenSize() - 4; // ignore ActionExecution
+ }
+
+ public int getViewChildrenSize() {
+ return TestSequenceDiagramLink.this.lifelineProvider.getViewChildrenSize();
+ }
+
+ public GraphicalEditPart getParentEditPart() {
+ return TestSequenceDiagramLink.this.lifelineProvider.getParentEditPart();
+ }
+
+ public GraphicalEditPart getDestroyEditPart() {
+ return null;
+ }
+
+ public int getEdgesSize() {
+ return TestSequenceDiagramLink.this.lifelineProvider.getEdgesSize();
+ }
+
+ public Point getConnectionSourceLocation(EditPart source) {
+ return TestSequenceDiagramLink.this.lifelineProvider.getConnectionSourceLocation(source);
+ }
+
+ public Point getConnectionTargetLocation(EditPart target) {
+ return TestSequenceDiagramLink.this.lifelineProvider.getConnectionTargetLocation(target);
+ }
+
+ public void setUp() {
+ IElementType childNodeType = UMLElementTypes.ActionExecutionSpecification_Shape;
+ source = createSubNode(source, childNodeType, getChildLocation(source));
+ sourcePlayer = createSubNode(sourcePlayer, childNodeType, getChildLocation(sourcePlayer));
+
+ target = createSubNode(target, childNodeType, getChildLocation(target).translate(0, 50));
+ targetPlayer = createSubNode(targetPlayer, childNodeType, getChildLocation(targetPlayer).translate(0, 50));
+ }
+
+ };
+
+ protected ILinkTestProvider lifelineProvider = new ILinkTestProvider() {
+
+ public int getEdgesSize() {
+ return getDiagramEditPart().getDiagramView().getEdges().size();
+ }
+
+ public int getEditPartChildrenSize() {
+ return getRootEditPart().getChildren().size();
+ }
+
+ public int getSemanticChildrenSize() {
+ int count = 0;
+ EList<Element> elems = ((Element)getRootEditPart().getNotationView().getElement()).getOwnedElements();
+ for(Element f : elems)
+ if(!(f instanceof MessageEnd) && !(f instanceof ExecutionOccurrenceSpecification))
+ count++;
+
+ return count;
+ }
+
+ public int getViewChildrenSize() {
+ return getRootEditPart().getNotationView().getChildren().size();
+ }
+
+ public Element getDropElement() {
+ return null;
+ }
+
+ public GraphicalEditPart getParentEditPart() {
+ return getRootEditPart();
+ }
+
+ public GraphicalEditPart getDestroyEditPart() {
+ return null;
+ }
+
+ public Point getConnectionSourceLocation(EditPart part) {
+ if(part instanceof LifelineEditPart) {
+ IFigure f = ((LifelineEditPart)part).getPrimaryShape();
+ return getCenter(f);
+ }
+ if(part instanceof AbstractExecutionSpecificationEditPart || part instanceof InteractionEditPart) { // found message
+ return getAbsoluteBounds((IGraphicalEditPart)part).getTopLeft();
+ }
+ return new Point(0, 0);
+ }
+
+ public Point getConnectionTargetLocation(EditPart part) {
+ if(part instanceof LifelineEditPart) {
+ IFigure f = ((LifelineEditPart)part).getPrimaryShape();
+ return getCenter(f);
+ }
+ if(part instanceof AbstractExecutionSpecificationEditPart || part instanceof InteractionEditPart) {
+ Rectangle r = getAbsoluteBounds((IGraphicalEditPart)part);
+ return r.getBottom();
+ }
+ return new Point(0, 0);
+ }
+
+ public boolean hasSemanticChild() {
+ return true;
+ }
+
+ public Point getChildLocation(GraphicalEditPart parentEditPart) {
+ IFigure f = ((LifelineEditPart)parentEditPart).getPrimaryShape();
+ return getCenter(f).translate(0, 1);
+ }
+
+ public void setUp() {
+ }
+ };
+}

Back to the top