summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-04-18 10:45:26 (EDT)
committerBenoit Maggi2014-04-18 10:45:26 (EDT)
commit784ad759af65fb9b92be595a45967f49c25efcae (patch)
tree562129d2d389bee91fb15cf8eb467c1b80133689
parent3dcbee22275fbd39a8bb6db0fe2bc77fa8981ec6 (diff)
downloadorg.eclipse.papyrus-784ad759af65fb9b92be595a45967f49c25efcae.zip
org.eclipse.papyrus-784ad759af65fb9b92be595a45967f49c25efcae.tar.gz
org.eclipse.papyrus-784ad759af65fb9b92be595a45967f49c25efcae.tar.bz2
Bug 433081 - [Sequence diagram] CastException while working on Guardrefs/changes/77/25277/1
Change-Id: I6d700bee1edcec1d8a1804bbc8ef0d086d5b0f0b Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java116
1 files changed, 59 insertions, 57 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
index d162c87..e648ac4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
@@ -1,57 +1,59 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA
- *
- *
- * 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:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart.GuardFigure;
-import org.eclipse.swt.graphics.Image;
-
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class InteractionOperandAppliedStereotypeLabelDisplayEditPolicy extends AppliedStereotypeNodeLabelDisplayEditPolicy {
-
- @Override
- protected void refreshStereotypeDisplay() {
- EditPart host = getHost();
- if(!(host instanceof CustomInteractionOperandEditPart)) {
- return;
- }
- IGraphicalEditPart guard = ((CustomInteractionOperandEditPart)host).getChildBySemanticHint(InteractionOperandGuardEditPart.GUARD_TYPE);
- if(!(guard instanceof InteractionOperandGuardEditPart)) {
- return;
- }
- GuardFigure figure = ((InteractionOperandGuardEditPart)guard).getPrimaryFigure();
- // calculate text and icon to display
- final String stereotypesToDisplay = stereotypesOnlyToDisplay();
- // computes the icon to be displayed
- final Image imageToDisplay = stereotypeIconToDisplay();
-
- // if the string is not empty, then, the figure has to display it.
- // Else, it displays
- // nothing
- // if (stereotypesToDisplay != "" || imageToDisplay != null) {
- if(figure instanceof IPapyrusNodeUMLElementFigure) {
- ((IPapyrusNodeUMLElementFigure)figure).setStereotypeDisplay(tag + (stereotypesOnlyToDisplay().equals("") ? stereotypesToDisplay : stereotypesToDisplay), imageToDisplay);
- refreshAppliedStereotypesProperties(((IPapyrusNodeNamedElementFigure) figure));
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA
+ *
+ *
+ * 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:
+ * Soyatec - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart.GuardFigure;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * @author Jin Liu (jin.liu@soyatec.com)
+ */
+public class InteractionOperandAppliedStereotypeLabelDisplayEditPolicy extends AppliedStereotypeNodeLabelDisplayEditPolicy {
+
+ @Override
+ protected void refreshStereotypeDisplay() {
+ EditPart host = getHost();
+ if(!(host instanceof CustomInteractionOperandEditPart)) {
+ return;
+ }
+ IGraphicalEditPart guard = ((CustomInteractionOperandEditPart)host).getChildBySemanticHint(InteractionOperandGuardEditPart.GUARD_TYPE);
+ if(!(guard instanceof InteractionOperandGuardEditPart)) {
+ return;
+ }
+ GuardFigure figure = ((InteractionOperandGuardEditPart)guard).getPrimaryFigure();
+ // calculate text and icon to display
+ final String stereotypesToDisplay = stereotypesOnlyToDisplay();
+ // computes the icon to be displayed
+ final Image imageToDisplay = stereotypeIconToDisplay();
+
+ // if the string is not empty, then, the figure has to display it.
+ // Else, it displays
+ // nothing
+ // if (stereotypesToDisplay != "" || imageToDisplay != null) {
+ if(figure instanceof IPapyrusNodeUMLElementFigure) {
+ ((IPapyrusNodeUMLElementFigure)figure).setStereotypeDisplay(tag + ("".equals(stereotypesOnlyToDisplay()) ? stereotypesToDisplay : stereotypesToDisplay), imageToDisplay);
+ if (figure instanceof IPapyrusNodeNamedElementFigure){
+ refreshAppliedStereotypesProperties((IPapyrusNodeNamedElementFigure) figure);
+ }
+ }
+ }
+}