Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintEditPart.java9
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestDurationConstraint_402967.java29
2 files changed, 25 insertions, 13 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintEditPart.java
index 255aae98e93..5dfdb40f9f5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintEditPart.java
@@ -58,6 +58,7 @@ import org.eclipse.gmf.runtime.draw2d.ui.geometry.PointListUtilities;
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -288,6 +289,14 @@ public class CustomDurationConstraintEditPart extends DurationConstraintEditPart
return primaryShape = new CustomDurationConstraintFigure();
}
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ nodeShape = super.setupContentPane(nodeShape);
+ DefaultSizeNodeFigure parent = (DefaultSizeNodeFigure) nodeShape.getParent();
+ nodeShape.setPreferredSize(parent.getDefaultSize());
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
/**
* This method creates a specific edit policy for time realted elements
*
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestDurationConstraint_402967.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestDurationConstraint_402967.java
index 4d59019e5ac..671cbf5bb49 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestDurationConstraint_402967.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestDurationConstraint_402967.java
@@ -97,6 +97,8 @@ public class TestDurationConstraint_402967 extends AbstractNodeTest {
private static final String SEP = "..";
+ private static final String DURATION_CONSTRAINT_ROTATE_MENU = "rotate";
+
@Override
protected String getProjectName() {
return ISequenceDiagramTestsConstants.PROJECT_NAME;
@@ -142,7 +144,6 @@ public class TestDurationConstraint_402967 extends AbstractNodeTest {
event.type = SWT.MouseDown;
event.widget = control;
control.notifyListeners(SWT.MouseDown, event);
-
event.type = SWT.MouseUp;
control.notifyListeners(SWT.MouseUp, event);
return p;
@@ -159,14 +160,17 @@ public class TestDurationConstraint_402967 extends AbstractNodeTest {
menu.notifyListeners(SWT.Show, event);
menu.setVisible(true);
MenuItem[] items = menu.getItems();
+ boolean menuItemSelected = false;
for (MenuItem it : items) {
if (it.getText().toLowerCase().contains(itemText)) {
+ menuItemSelected = true;
Event e = createEvent();
e.widget = it;
-
it.notifyListeners(SWT.Selection, e);
+ break;
}
}
+ assertTrue("Menu item '" + itemText + "' not selected.", menuItemSelected);
menu.notifyListeners(SWT.Hide, event);
menu.setVisible(false);
waitForComplete();
@@ -280,22 +284,21 @@ public class TestDurationConstraint_402967 extends AbstractNodeTest {
return null;
}
- @FailingTest
@Test
public void testDurationRotate() {
DurationConstraintEditPart dc = (DurationConstraintEditPart) createNode(UMLElementTypes.DurationConstraint_3021, getRootEditPart(), new Point(100, 200), null);
assertNotNull(dc);
- assertTrue(CREATION + TEST_THE_EXECUTION, getRootEditPart().getChildren().size() == 1);
- assertTrue(CREATION + TEST_THE_EXECUTION, getBorderSides(dc) == (PositionConstants.TOP | PositionConstants.BOTTOM));
+ assertEquals(CREATION + TEST_THE_EXECUTION, 1, getRootEditPart().getChildren().size());
+ assertEquals(CREATION + TEST_THE_EXECUTION, PositionConstants.TOP | PositionConstants.BOTTOM, getBorderSides(dc));
Rectangle before = getAbsoluteBounds(dc);
Point p = selectEditpart(dc);
- clickMenuItem(dc, p, "rotate");
+ clickMenuItem(dc, p, DURATION_CONSTRAINT_ROTATE_MENU);
Rectangle after = getAbsoluteBounds(dc);
- assertTrue("TEST_THE_EXECUTION", before.width == after.height);
- assertTrue("TEST_THE_EXECUTION", before.height == after.width);
- assertTrue("TEST_THE_EXECUTION", getBorderSides(dc) == (PositionConstants.LEFT | PositionConstants.RIGHT));
+ assertEquals("TEST_THE_EXECUTION", before.width, after.height);
+ assertEquals("TEST_THE_EXECUTION", before.height, after.width);
+ assertEquals("TEST_THE_EXECUTION", PositionConstants.LEFT | PositionConstants.RIGHT, getBorderSides(dc));
// undo
assertTrue(TEST_THE_UNDO, getEMFCommandStack().canUndo());
@@ -311,11 +314,11 @@ public class TestDurationConstraint_402967 extends AbstractNodeTest {
// rotate again, should be same as before
p = selectEditpart(dc);
- clickMenuItem(dc, p, "rotate");
+ clickMenuItem(dc, p, DURATION_CONSTRAINT_ROTATE_MENU);
after = getAbsoluteBounds(dc);
- assertTrue("TEST_THE_EXECUTION", before.width == after.width);
- assertTrue("TEST_THE_EXECUTION", before.height == after.height);
- assertTrue("TEST_THE_EXECUTION", getBorderSides(dc) == (PositionConstants.TOP | PositionConstants.BOTTOM));
+ assertEquals("TEST_THE_EXECUTION", before.width, after.width);
+ assertEquals("TEST_THE_EXECUTION", before.height, after.height);
+ assertEquals("TEST_THE_EXECUTION", PositionConstants.TOP | PositionConstants.BOTTOM, getBorderSides(dc));
}
@Test

Back to the top