Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandra Buzila2018-09-24 11:08:16 -0400
committerAlexandra Buzila2018-09-25 05:31:41 -0400
commitc429f4ce717a5a7ade85f68affdeae4a8c70e8b7 (patch)
tree684795e05c2c52f0acb26313502f1e913756aa61 /plugins
parentd9cbd1b8978a125d833ea6d3e9ebab8528fa5173 (diff)
downloadorg.eclipse.papyrus-c429f4ce717a5a7ade85f68affdeae4a8c70e8b7.tar.gz
org.eclipse.papyrus-c429f4ce717a5a7ade85f68affdeae4a8c70e8b7.tar.xz
org.eclipse.papyrus-c429f4ce717a5a7ade85f68affdeae4a8c70e8b7.zip
Bug 539371 - [Sequence Diagram] Undo doesn't work when resizing a
DurationLink for the first time Change-Id: I0f3a721aec64447c58a42eec1e49fe0d31858c46 Signed-off-by: Alexandra Buzila <abuzila@eclipsesource.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintLinkEditPart.java29
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationLinkEditPart.java30
2 files changed, 36 insertions, 23 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());
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationLinkEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationLinkEditPart.java
index 7e9bfbfe163..ef16c48dc27 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationLinkEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationLinkEditPart.java
@@ -44,29 +44,35 @@ public class CustomDurationObservationLinkEditPart extends DurationObservationLi
@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