diff options
author | Sebastien Gabel | 2016-07-11 08:07:24 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-11-18 12:01:41 +0000 |
commit | f438ae8702cb90dd8b260e4afcbc6626fb9bea8c (patch) | |
tree | a2be8133f3266743525c6d10f25d9f00b28467ab /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml | |
parent | df16ecc19e699b98c3ff5316d1882c49476ceb28 (diff) | |
download | org.eclipse.papyrus-f438ae8702cb90dd8b260e4afcbc6626fb9bea8c.tar.gz org.eclipse.papyrus-f438ae8702cb90dd8b260e4afcbc6626fb9bea8c.tar.xz org.eclipse.papyrus-f438ae8702cb90dd8b260e4afcbc6626fb9bea8c.zip |
Bug 497644: [Activity Diagram] Check the AcceptEventAction before
updating it
Change-Id: I41b5a475b4f0f0cd6e646cd9156e9645617c0ac9
Signed-off-by: Sebastien Gabel <sebastien.gabel@esterel-technologies.com>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/AcceptEventActionSwitchHelper.java | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/AcceptEventActionSwitchHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/AcceptEventActionSwitchHelper.java index 1d38d1d71fd..bb0354b368e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/AcceptEventActionSwitchHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/AcceptEventActionSwitchHelper.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 Atos Origin. + * Copyright (c) 2010, 2016 Atos Origin, Esterel Technologies SAS and others. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,7 @@ * * Contributors: * Atos Origin - Initial API and implementation + * Sebastien Bordes (Esterel Technologies SAS) - Bug 497644 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.activity.helper; @@ -119,32 +120,34 @@ public class AcceptEventActionSwitchHelper extends NotificationHelper { * representation */ public void updateAcceptEventActionFigure() { - AcceptEventActionFigure actionFigure = editPart.getPrimaryShape(); - boolean useHourglassFigure = CustomAcceptEventActionEditHelper.isAcceptTimeEventAction(getAction()); - boolean hourglassAlreadyUsed = actionFigure.isTemplateForAcceptTimeEventActionUsed(); - - - if (useHourglassFigure != hourglassAlreadyUsed) { - - // set usage of the correct figure - // actionFigure.useTemplateForAcceptTimeEventAction(useHourglassFigure); - - // arrange the figure so that style remains coherent - // if (editPart.getModel() instanceof View) { - // int locX = actionFigure.getLocation().x; - // int width = actionFigure.getSize().width; - // int newWidth = width; - // if (useHourglassFigure) { - // // switching to hourglass, reduce width - // newWidth = width / REDUCE_WIDTH_FACTOR_FOR_HOURGLASS; - // } else { - // // switching to pentagon, augment width - // newWidth = width * REDUCE_WIDTH_FACTOR_FOR_HOURGLASS; - // } - // // adapt location to keep same center - // ViewUtil.setStructuralFeatureValue((View) editPart.getModel(), NotationPackage.eINSTANCE.getLocation_X(), locX + (width - newWidth) / 2); - // ViewUtil.setStructuralFeatureValue((View) editPart.getModel(), NotationPackage.eINSTANCE.getSize_Width(), newWidth); - // } + if (getAction() != null) { + AcceptEventActionFigure actionFigure = editPart.getPrimaryShape(); + boolean useHourglassFigure = CustomAcceptEventActionEditHelper.isAcceptTimeEventAction(getAction()); + boolean hourglassAlreadyUsed = actionFigure.isTemplateForAcceptTimeEventActionUsed(); + + + if (useHourglassFigure != hourglassAlreadyUsed) { + + // set usage of the correct figure + // actionFigure.useTemplateForAcceptTimeEventAction(useHourglassFigure); + + // arrange the figure so that style remains coherent + // if (editPart.getModel() instanceof View) { + // int locX = actionFigure.getLocation().x; + // int width = actionFigure.getSize().width; + // int newWidth = width; + // if (useHourglassFigure) { + // // switching to hourglass, reduce width + // newWidth = width / REDUCE_WIDTH_FACTOR_FOR_HOURGLASS; + // } else { + // // switching to pentagon, augment width + // newWidth = width * REDUCE_WIDTH_FACTOR_FOR_HOURGLASS; + // } + // // adapt location to keep same center + // ViewUtil.setStructuralFeatureValue((View) editPart.getModel(), NotationPackage.eINSTANCE.getLocation_X(), locX + (width - newWidth) / 2); + // ViewUtil.setStructuralFeatureValue((View) editPart.getModel(), NotationPackage.eINSTANCE.getSize_Width(), newWidth); + // } + } } } |