diff options
| author | Laurent Redor | 2016-07-01 07:58:00 +0000 |
|---|---|---|
| committer | Laurent Redor | 2016-08-23 13:50:02 +0000 |
| commit | 2c6de92b0c405e5722675474917c4714f9b472ee (patch) | |
| tree | 2ff2e923503fdf8238929b7cd2da9c6c41617438 | |
| parent | 56cbc89006024281acff3d94472f03792ebf5d96 (diff) | |
| download | org.eclipse.sirius-2c6de92b0c405e5722675474917c4714f9b472ee.tar.gz org.eclipse.sirius-2c6de92b0c405e5722675474917c4714f9b472ee.tar.xz org.eclipse.sirius-2c6de92b0c405e5722675474917c4714f9b472ee.zip | |
[499830] 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: 499830
Cherry-picked-from: 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.java | 100 |
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 0a302248c4..1401e874f9 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 @@ -659,68 +659,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; } |
