Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2016-07-01 07:58:00 +0000
committerLaurent Redor2016-07-06 14:57:56 +0000
commit7f3323ca36c9c6b1c67e6cb579f963710f1c3a33 (patch)
treefb5affb40eeb3986d53d00f278311f98c099f427
parent12753e93be56799d11e6fee53cb32314f9e9d444 (diff)
downloadorg.eclipse.sirius-7f3323ca36c9c6b1c67e6cb579f963710f1c3a33.tar.gz
org.eclipse.sirius-7f3323ca36c9c6b1c67e6cb579f963710f1c3a33.tar.xz
org.eclipse.sirius-7f3323ca36c9c6b1c67e6cb579f963710f1c3a33.zip
[496985] Fix pb of regions container d'n'd
The regions container has now the same behavior as other containers. This commits reverts a part of an old commit (before Sirius will be an open source project (for reference commit id in old git repo is 3a3d0064a465fda7e3126604c9a74c85816b1a46). Bug: 496985 Change-Id: I3426fdbbdc53910192204e2bcccbe5357bd17640 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/internal/refresh/AbstractCanonicalSynchronizer.java100
1 files changed, 46 insertions, 54 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/AbstractCanonicalSynchronizer.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/AbstractCanonicalSynchronizer.java
index a18b72924b..7b09761cbb 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/AbstractCanonicalSynchronizer.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/AbstractCanonicalSynchronizer.java
@@ -631,68 +631,60 @@ public abstract class AbstractCanonicalSynchronizer implements CanonicalSynchron
EObject parent = element.eContainer();
boolean isAlreadylayouted = false;
if (element instanceof AbstractDNode && parent instanceof DNodeContainer) {
- if (new DNodeContainerExperimentalQuery((DNodeContainer) parent).isRegionContainer()) {
+ Dimension size = null;
+ Point location = null;
+
+ AbstractDNode abstractDNode = (AbstractDNode) element;
+ LayoutData layoutData = SiriusLayoutDataManager.INSTANCE.getData(abstractDNode);
+ if (layoutData == null) {
+ layoutData = SiriusLayoutDataManager.INSTANCE.getData(abstractDNode, true);
+ }
+ if (layoutData != null) {
+ location = layoutData.getLocation();
+ size = layoutData.getSize();
isAlreadylayouted = true;
- } else {
- isAlreadylayouted = updateFreeFormContainerChildButNotBorderedNodeBounds(createdView, previousCreatedView, element);
}
- }
- return isAlreadylayouted;
- }
- private boolean updateFreeFormContainerChildButNotBorderedNodeBounds(View createdView, View previousCreatedView, EObject element) {
- boolean isAlreadylayouted = false;
- Dimension size = null;
- Point location = null;
-
- AbstractDNode abstractDNode = (AbstractDNode) element;
- LayoutData layoutData = SiriusLayoutDataManager.INSTANCE.getData(abstractDNode);
- if (layoutData == null) {
- layoutData = SiriusLayoutDataManager.INSTANCE.getData(abstractDNode, true);
- }
- if (layoutData != null) {
- location = layoutData.getLocation();
- size = layoutData.getSize();
- isAlreadylayouted = true;
- }
-
- if (size == null) {
- size = getDefaultSize(abstractDNode);
- }
- if (location == null) {
- if (previousCreatedView instanceof Node && ((Node) previousCreatedView).getLayoutConstraint() instanceof Bounds) {
-
- // if a location has been registered in
- // SiriusLayoutDataManager but we were not able to
- // retrieve it before -> Set a center location for child
- // DNode of DNodeContainer
- // like
- // in AirXYLayoutEditPolicy#getConstraintFor(request)
- if (previousCreatedView.eAdapters().contains(SiriusLayoutDataManager.INSTANCE.getCenterAdapterMarker())) {
- markCreatedViewsWithCenterLayout(createdView);
- } else {
- Bounds previousBounds = (Bounds) ((Node) previousCreatedView).getLayoutConstraint();
- location = new Point(previousBounds.getX(), previousBounds.getY()).getTranslated(SiriusLayoutDataManager.PADDING, SiriusLayoutDataManager.PADDING);
- }
+ if (size == null) {
+ size = getDefaultSize(abstractDNode);
+ }
+ if (location == null) {
+ if (previousCreatedView instanceof Node && ((Node) previousCreatedView).getLayoutConstraint() instanceof Bounds) {
+
+ // if a location has been registered in
+ // SiriusLayoutDataManager but we were not able to
+ // retrieve it before -> Set a center location for child
+ // DNode of DNodeContainer
+ // like
+ // in AirXYLayoutEditPolicy#getConstraintFor(request)
+ if (previousCreatedView.eAdapters().contains(SiriusLayoutDataManager.INSTANCE.getCenterAdapterMarker())) {
+ markCreatedViewsWithCenterLayout(createdView);
+ } else {
+ Bounds previousBounds = (Bounds) ((Node) previousCreatedView).getLayoutConstraint();
+ location = new Point(previousBounds.getX(), previousBounds.getY()).getTranslated(SiriusLayoutDataManager.PADDING, SiriusLayoutDataManager.PADDING);
+ }
- isAlreadylayouted = true;
- } else {
- // if a location has been registered in
- // SiriusLayoutDataManager but we were not able to
- // retrieve it before -> Set a center location for child
- // DNode of DNodeContainer like
- // in AirXYLayoutEditPolicy#getConstraintFor(request)
- if (layoutData == null && SiriusLayoutDataManager.INSTANCE.getData().some()) {
- // mark with special layout
- markCreatedViewsWithCenterLayout(createdView);
isAlreadylayouted = true;
+ } else {
+ // if a location has been registered in
+ // SiriusLayoutDataManager but we were not able to
+ // retrieve it before -> Set a center location for child
+ // DNode of DNodeContainer like
+ // in AirXYLayoutEditPolicy#getConstraintFor(request),
+ // except for children of regions container for which layout
+ // is managed with RegionContainerUpdateLayoutOperation.
+ if (layoutData == null && SiriusLayoutDataManager.INSTANCE.getData().some() && !(new DNodeContainerExperimentalQuery((DNodeContainer) parent).isRegionContainer())) {
+ // mark with special layout
+ markCreatedViewsWithCenterLayout(createdView);
+ isAlreadylayouted = true;
+ }
}
}
- }
- if (createdView instanceof Node) {
- Node createdNode = (Node) createdView;
- updateLocationConstraint(createdNode, size, location, abstractDNode);
+ if (createdView instanceof Node) {
+ Node createdNode = (Node) createdView;
+ updateLocationConstraint(createdNode, size, location, abstractDNode);
+ }
}
return isAlreadylayouted;
}

Back to the top