Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2016-06-17 19:47:22 +0000
committerLaurent Redor2016-07-06 16:43:00 +0000
commitaec92a71602d9b00e1735951d9ebd7f475cfe334 (patch)
treeb1dad340a4f603baedb81e72a25b986f26b41a13
parentd9b31c458e421589d59903180c34fc8ccf5ab13c (diff)
downloadorg.eclipse.sirius-aec92a71602d9b00e1735951d9ebd7f475cfe334.tar.gz
org.eclipse.sirius-aec92a71602d9b00e1735951d9ebd7f475cfe334.tar.xz
org.eclipse.sirius-aec92a71602d9b00e1735951d9ebd7f475cfe334.zip
[497403] Fix pb of collapsing last region in horizontal stack
Since previous commit for bug 495119 (Compute GMF regions size according to container size), there is a regression on collapsing the last region in horizontal stack (a blank space remains if the regions container is not in auto-size). In AirXYLayoutEditPolicy [1], the constraint of a regions container is force to "-1" for height (see commit 77d6b284 and method getConstraintFor). This is for facility reason to handle the case when the label is hidden/shown. This "-1" explains the difference between HStack and VStack when collapsing the last region. For the same facility reason, the width is also constraint to "-1" here. A clean way would be to set this "-1" directly during the resize command. [1] org.eclipse.sirius.diagram.ui.graphical.edit.policies.AirXYLayoutEditPolicy Bug: 497403 Cherry-picked-from: 495119 Change-Id: I5b9e537bb14bd87c449bb1311456b0c22ba62225 Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/AirXYLayoutEditPolicy.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/AirXYLayoutEditPolicy.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/AirXYLayoutEditPolicy.java
index dc911853d8..7a0128c311 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/AirXYLayoutEditPolicy.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/AirXYLayoutEditPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES.
* 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
@@ -231,12 +231,12 @@ public class AirXYLayoutEditPolicy extends XYLayoutEditPolicy {
*/
childEditPolicy = new RegionRegionContainerResizableEditPolicy();
} else {
- /*
- * If the current element is a region container, each added child
- * will be considered as a region and will receive the expected
- * resizable edit policy.
- */
- childEditPolicy = new RegionResizableEditPolicy();
+ /*
+ * If the current element is a region container, each added
+ * child will be considered as a region and will receive the
+ * expected resizable edit policy.
+ */
+ childEditPolicy = new RegionResizableEditPolicy();
}
} else if (isRegionContainer(child)) {
/* If the added element is a region container. */
@@ -306,6 +306,7 @@ public class AirXYLayoutEditPolicy extends XYLayoutEditPolicy {
Object constraintFor = super.getConstraintFor(request, child, rect);
if (constraintFor instanceof Rectangle && isRegionContainer(child)) {
Rectangle rectangle = (Rectangle) constraintFor;
+ rectangle.setWidth(-1);
rectangle.setHeight(-1);
}
return constraintFor;

Back to the top