Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2017-07-31 03:40:54 -0400
committerNicolas FAUVERGUE2017-08-09 03:06:10 -0400
commitbc8bb8279dd858dcca30bd48d496a167e7a2ca45 (patch)
tree27c0b546d43240a2b0f97482c8a46cc022874ae6
parent05cf08c58c9038b7ab6c26898efc7ecaa9af912e (diff)
downloadorg.eclipse.papyrus-bc8bb8279dd858dcca30bd48d496a167e7a2ca45.tar.gz
org.eclipse.papyrus-bc8bb8279dd858dcca30bd48d496a167e7a2ca45.tar.xz
org.eclipse.papyrus-bc8bb8279dd858dcca30bd48d496a167e7a2ca45.zip
Bug 520294: [Sequence Diagram] CombinedFragment creation must create
InteractionOperand https://bugs.eclipse.org/bugs/show_bug.cgi?id=520294 CombinedFragment is now created with InteractionOperand. Change-Id: I2ffcb74208ccc66cab5c001dd69665de5db000cd Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java6
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations1
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/CombinedFragmentEditHelperAdvice.java69
3 files changed, 73 insertions, 3 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
index 88ff997022f..74d463f44dc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
@@ -228,9 +228,9 @@ public class CustomViewProvider extends UMLViewProvider {
Node compartment = createCompartment(node, UMLVisualIDRegistry.getType(CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID),
false, false, true, true);
// Add by default InteractionOperand
- // for (InteractionOperand interactionOperand : ((CombinedFragment) domainElement).getOperands()) {
- // createInteractionOperand_Shape(interactionOperand, compartment, -1, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- // }
+ for (InteractionOperand interactionOperand : ((CombinedFragment) domainElement).getOperands()) {
+ createInteractionOperand_Shape(interactionOperand, compartment, -1, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ }
// initialization for the compartment visibility
PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(
node, prefStore, "CombinedFragment");
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations b/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations
index 760cb1c2562..aad181b5970 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations
@@ -1170,4 +1170,5 @@
<adviceBindingsConfigurations xsi:type="elementtypesconfigurations:AdviceBindingConfiguration" xmi:id="_Biq00Ks0Eear0ZssjsCjIQ" description="This advice add automatically the event in before and after" identifier="org.eclipse.papyrus.uml.service.types.helper.advice.GeneralOrderingHelperAdvice" target="org.eclipse.papyrus.uml.GeneralOrdering" editHelperAdviceClassName="org.eclipse.papyrus.uml.service.types.helper.advice.GeneralOrderingHelperAdvice"/>
<adviceBindingsConfigurations xsi:type="elementtypesconfigurations:AdviceBindingConfiguration" xmi:id="_sk_AgANEEeeK2pILzAGx9w" identifier="org.eclipse.papyrus.uml.advice.Element" target="org.eclipse.papyrus.uml.Element" inheritance="all" editHelperAdviceClassName="org.eclipse.papyrus.uml.service.types.helper.advice.ElementHelperAdvice"/>
<adviceBindingsConfigurations xsi:type="elementtypesconfigurations:AdviceBindingConfiguration" xmi:id="_pUAxYDKLEee2hdQGBOZDMQ" identifier="org.eclipse.papyrus.uml.advice.DurationConstraint" target="org.eclipse.papyrus.uml.DurationConstraint" inheritance="all" editHelperAdviceClassName="org.eclipse.papyrus.uml.service.types.helper.advice.DurationConstraintEditHelperAdvice"/>
+ <adviceBindingsConfigurations xsi:type="elementtypesconfigurations:AdviceBindingConfiguration" xmi:id="_RDj3kHOtEeer__BSotNaQg" identifier="org.eclipse.papyrus.uml.advice.CombinedFragment" target="org.eclipse.papyrus.uml.CombinedFragment" inheritance="all" editHelperAdviceClassName="org.eclipse.papyrus.uml.service.types.helper.advice.CombinedFragmentEditHelperAdvice"/>
</elementtypesconfigurations:ElementTypeSetConfiguration>
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/CombinedFragmentEditHelperAdvice.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/CombinedFragmentEditHelperAdvice.java
new file mode 100644
index 00000000000..505c2fe8764
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/CombinedFragmentEditHelperAdvice.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * 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:
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.service.types.helper.advice;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
+import org.eclipse.uml2.uml.CombinedFragment;
+import org.eclipse.uml2.uml.InteractionOperand;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * This allows to manage the combined fragment creation with an interaction operand at the same moment.
+ *
+ * @since 3.0
+ */
+public class CombinedFragmentEditHelperAdvice extends AbstractEditHelperAdvice {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getBeforeConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest)
+ */
+ @Override
+ protected ICommand getBeforeConfigureCommand(final ConfigureRequest request) {
+ return new ConfigureElementCommand(request) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
+ final CombinedFragment combinedFragment = (CombinedFragment) request.getElementToConfigure();
+
+ // Create InteractionOperand
+ final InteractionOperand interactionOperand = createInteractionOperand();
+ interactionOperand.setName(NamedElementUtil.getDefaultNameWithIncrement(interactionOperand, combinedFragment.eContents()));
+ combinedFragment.getOperands().add(interactionOperand);
+
+ return CommandResult.newOKCommandResult(combinedFragment);
+ }
+
+ };
+ }
+
+ /**
+ * Create an interaction operand.
+ */
+ public static InteractionOperand createInteractionOperand() {
+ final InteractionOperand interactionOperand = UMLFactory.eINSTANCE.createInteractionOperand();
+ interactionOperand.createGuard("guard"); //$NON-NLS-1$
+ return interactionOperand;
+ }
+
+}

Back to the top