From 8e84e8c9dc214e6e3d48e82c07958284067cfbaa Mon Sep 17 00:00:00 2001 From: Laurent Redor Date: Mon, 29 Jul 2024 11:21:38 +0200 Subject: [PATCH] [426] Specific behavior for free form compartment This compartment is an intermediate GMF Node and should not have the same behavior when computing auto-size: - Minimal size defined by ResizableCompartmentFigure.MIN_CLIENT_DP - No shadow border Bug: https://github.com/eclipse-sirius/sirius-desktop/issues/426 --- .../sirius/diagram/ui/internal/refresh/GMFHelper.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java index 69c31540a0..9be9a8df1a 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java @@ -40,6 +40,7 @@ import org.eclipse.gef.ConnectionEditPart; import org.eclipse.gef.EditPart; import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; import org.eclipse.gmf.runtime.notation.Bounds; @@ -705,7 +706,8 @@ public static double getShadowBorderSize(Node node) { private static boolean isShadowBorderNeeded(Node node) { boolean needShadowBorder = false; EObject element = node.getElement(); - if (element instanceof DDiagramElementContainer) { + ViewQuery viewQuery = new ViewQuery(node); + if (!viewQuery.isFreeFormCompartment() && element instanceof DDiagramElementContainer) { DDiagramElementContainer ddec = (DDiagramElementContainer) element; needShadowBorder = !(new DDiagramElementContainerExperimentalQuery(ddec).isRegion() || ddec.getOwnedStyle() instanceof WorkspaceImage); } @@ -734,7 +736,9 @@ private static void replaceAutoSize(Node node, PrecisionRectangle bounds, boolea // if there is no default size, we compute it from the given // node. EObject element = node.getElement(); - if (element instanceof AbstractDNode) { + if (new ViewQuery(node).isFreeFormCompartment()) { + defaultSize = new Dimension(ResizableCompartmentFigure.MIN_CLIENT_DP, ResizableCompartmentFigure.MIN_CLIENT_DP); + } else if (element instanceof AbstractDNode) { defaultSize = getDefaultSize((AbstractDNode) element); } }