Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintLinkEditPart.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintLinkEditPart.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintLinkEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintLinkEditPart.java
index cf50423a1b6..8f2d81ff47d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintLinkEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintLinkEditPart.java
@@ -43,28 +43,35 @@ public class CustomDurationConstraintLinkEditPart extends DurationConstraintLink
@Override
protected void refreshVisuals() {
+ refreshArrowDelta();
+ super.refreshVisuals();
+ }
+
+ protected void refreshArrowDelta() {
Connector connector = (Connector) getNotationView();
NamedStyle namedStyle = connector.getNamedStyle(NotationPackage.Literals.INT_VALUE_STYLE, "delta");
if (namedStyle instanceof IntValueStyle) {
- refreshArrowDelta((IntValueStyle) namedStyle);
+ int delta = ((IntValueStyle) namedStyle).getIntValue();
+ ((DurationLinkFigure) getFigure()).setArrowPositionDelta(delta);
+ } else {
+ // no style - reset value
+ ((DurationLinkFigure) getFigure()).setArrowPositionDelta(0);
}
- super.refreshVisuals();
}
@Override
protected void handleNotificationEvent(Notification event) {
- if (event.getNotifier() instanceof IntValueStyle
- && "delta".equals(((IntValueStyle) event.getNotifier()).getName())) {
- refreshArrowDelta((IntValueStyle) event.getNotifier());
- } else if (event.getNotifier() == getNotationView()
- && event.getFeature() == NotationPackage.Literals.VIEW__STYLES) {
- refreshVisuals();
+ if (isDeltaIntValueStyle(event.getNotifier()) ||
+ (event.getNotifier() == getNotationView()
+ && event.getFeature() == NotationPackage.Literals.VIEW__STYLES &&
+ (isDeltaIntValueStyle(event.getNewValue()) ||
+ (event.getNewValue() == null && isDeltaIntValueStyle(event.getOldValue()))))) {
+ refreshArrowDelta();
}
super.handleNotificationEvent(event);
}
- private void refreshArrowDelta(IntValueStyle deltaStyle) {
- int delta = deltaStyle.getIntValue();
- ((DurationLinkFigure) getFigure()).setArrowPositionDelta(delta);
+ private boolean isDeltaIntValueStyle(Object object) {
+ return object instanceof IntValueStyle && "delta".equals(((IntValueStyle) object).getName());
}
}

Back to the top