Skip to content

Commit

Permalink
[426] Specific behavior for free form compartment
Browse files Browse the repository at this point in the history
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: #426
  • Loading branch information
lredor committed Jul 26, 2024
1 parent 332a12d commit cca018d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit cca018d

Please sign in to comment.