From 3524dbfb147f844bc07c63942e9bf163648d7321 Mon Sep 17 00:00:00 2001 From: Laurent Redor Date: Tue, 9 Jul 2024 17:25:33 +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 | 7 +++++-- 1 file changed, 5 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 0e6bb63eea..d921174887 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 @@ -39,6 +39,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; @@ -704,7 +705,7 @@ public static double getShadowBorderSize(Node node) { public static boolean isShadowBorderNeeded(Node node) { boolean needShadowBorder = false; EObject element = node.getElement(); - if (element instanceof DDiagramElementContainer) { + if (!new ViewQuery(node).isFreeFormCompartment() && element instanceof DDiagramElementContainer) { DDiagramElementContainer ddec = (DDiagramElementContainer) element; needShadowBorder = !(new DDiagramElementContainerExperimentalQuery(ddec).isRegion() || ddec.getOwnedStyle() instanceof WorkspaceImage); } @@ -733,7 +734,9 @@ private static void replaceAutoSize(Node node, Rectangle bounds, boolean useFigu // 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); } }