diff --git a/plugins/org.eclipse.sirius.diagram.model/src/org/eclipse/sirius/diagram/model/business/internal/query/DDiagramElementContainerExperimentalQuery.java b/plugins/org.eclipse.sirius.diagram.model/src/org/eclipse/sirius/diagram/model/business/internal/query/DDiagramElementContainerExperimentalQuery.java index c3f426a17a..3009ff3d40 100644 --- a/plugins/org.eclipse.sirius.diagram.model/src/org/eclipse/sirius/diagram/model/business/internal/query/DDiagramElementContainerExperimentalQuery.java +++ b/plugins/org.eclipse.sirius.diagram.model/src/org/eclipse/sirius/diagram/model/business/internal/query/DDiagramElementContainerExperimentalQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2021 THALES GLOBAL SERVICES and others. + * Copyright (c) 2013, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,13 +12,14 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.model.business.internal.query; +import java.util.Optional; + import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.diagram.DDiagramElementContainer; import org.eclipse.sirius.diagram.DNodeContainer; import org.eclipse.sirius.diagram.FlatContainerStyle; import org.eclipse.sirius.diagram.description.style.FlatContainerStyleDescription; import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.viewpoint.description.style.LabelBorderStyleDescription; import org.eclipse.sirius.viewpoint.description.style.StyleDescription; @@ -94,14 +95,14 @@ public boolean isRegionInVerticalStack() { * * @return an {@link Option} with the found label border style if it exists. */ - public Option getLabelBorderStyle() { + public Optional getLabelBorderStyle() { if (container.getStyle() instanceof FlatContainerStyle) { StyleDescription description = container.getStyle().getDescription(); if (description instanceof FlatContainerStyleDescription) { FlatContainerStyleDescription fcsd = (FlatContainerStyleDescription) description; - return Options.newSome(fcsd.getLabelBorderStyle()); + return Optional.ofNullable(fcsd.getLabelBorderStyle()); } } - return Options.newNone(); + return Optional.empty(); } } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/command/TreeLayoutSetConnectionAnchorsCommand.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/command/TreeLayoutSetConnectionAnchorsCommand.java index ad1f1c78c4..2b67d9c9d7 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/command/TreeLayoutSetConnectionAnchorsCommand.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/command/TreeLayoutSetConnectionAnchorsCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2018 THALES GLOBAL SERVICES and others. + * Copyright (c) 2012, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.ui.business.internal.command; +import java.util.Optional; + import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; @@ -33,7 +35,6 @@ import org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper; import org.eclipse.sirius.diagram.ui.provider.Messages; import org.eclipse.sirius.diagram.ui.tools.internal.util.GMFNotationUtilities; -import org.eclipse.sirius.ext.base.Option; /** * Controls the movement of source and target edge anchor. Use to move vertical @@ -92,8 +93,8 @@ protected void setComplementaryData(boolean sourceAnchorChanged, boolean targetA } else { // We are in reconnection (compute the sourceRefPoint using // GMF model data) - Option optionalSourceBounds = GMFHelper.getAbsoluteBounds(edge.getSource()); - if (optionalSourceBounds.some()) { + Optional optionalSourceBounds = GMFHelper.getAbsoluteBounds(edge.getSource()); + if (optionalSourceBounds.isPresent()) { sourceBounds = optionalSourceBounds.get(); } } @@ -117,8 +118,8 @@ protected void setComplementaryData(boolean sourceAnchorChanged, boolean targetA } else { // We are in reconnection (compute the sourceRefPoint using // GMF model data) - Option optionalTargetBounds = GMFHelper.getAbsoluteBounds(edge.getTarget()); - if (optionalTargetBounds.some()) { + Optional optionalTargetBounds = GMFHelper.getAbsoluteBounds(edge.getTarget()); + if (optionalTargetBounds.isPresent()) { targetBounds = optionalTargetBounds.get(); } } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramContainerEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramContainerEditPart.java index be4b71d029..70a717f117 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramContainerEditPart.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramContainerEditPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2022 THALES GLOBAL SERVICES and others. + * Copyright (c) 2007, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,6 +13,7 @@ package org.eclipse.sirius.diagram.ui.edit.api.part; import java.util.Iterator; +import java.util.Optional; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.draw2d.IFigure; @@ -59,7 +60,6 @@ import org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutUtils; import org.eclipse.sirius.diagram.ui.tools.api.policy.CompoundEditPolicy; import org.eclipse.sirius.diagram.ui.tools.internal.ui.NoCopyDragEditPartsTrackerEx; -import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.gmf.runtime.diagram.ui.tools.RubberbandDragTracker; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.LabelBorderStyleIds; import org.eclipse.sirius.viewpoint.description.style.LabelBorderStyleDescription; @@ -267,8 +267,8 @@ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { private boolean hasFullLabelBorder() { EObject element = resolveSemanticElement(); if (element instanceof DDiagramElementContainer) { - Option labelBorderStyle = new DDiagramElementContainerExperimentalQuery((DDiagramElementContainer) element).getLabelBorderStyle(); - return labelBorderStyle.some() && LabelBorderStyleIds.LABEL_FULL_BORDER_STYLE_FOR_CONTAINER_ID.equals(labelBorderStyle.get().getId()); + Optional labelBorderStyle = new DDiagramElementContainerExperimentalQuery((DDiagramElementContainer) element).getLabelBorderStyle(); + return labelBorderStyle.isPresent() && LabelBorderStyleIds.LABEL_FULL_BORDER_STYLE_FOR_CONTAINER_ID.equals(labelBorderStyle.get().getId()); } return false; } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java index d1e4af8d49..a68660b90e 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2022 THALES GLOBAL SERVICES and others. + * Copyright (c) 2007, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -15,6 +15,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -95,8 +96,6 @@ import org.eclipse.sirius.diagram.ui.tools.internal.layout.LayoutUtil; import org.eclipse.sirius.diagram.ui.tools.internal.util.EditPartQuery; import org.eclipse.sirius.diagram.ui.tools.internal.util.NotificationQuery; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.AlphaDropShadowBorder; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusDefaultSizeNodeFigure; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusWrapLabel; @@ -183,7 +182,7 @@ private List getBrotherRegionParts() { EditPart editPart = this; //@formatter:off @SuppressWarnings("unchecked") - List regionParts = (List) getParent().getChildren().stream() + List regionParts = getParent().getChildren().stream() .filter(ed -> ed instanceof AbstractDiagramElementContainerEditPart && !ed.equals(editPart)) .map(AbstractDiagramElementContainerEditPart.class::cast) .collect(Collectors.toList()); @@ -491,6 +490,7 @@ public Dimension getDefaultDimension() { * @return the default figure dimension of this edit part * @deprecated Only here as security if user activates {@link LayoutUtil#isArrangeAtOpeningChangesDisabled()}. */ + @Deprecated public Dimension oldGetDefaultDimension() { DDiagramElement dde = resolveDiagramElement(); Dimension defaultSize = LayoutUtils.NEW_DEFAULT_CONTAINER_DIMENSION; @@ -513,8 +513,8 @@ protected NodeFigure createNodePlate() { NodeFigure result; DDiagramElement dde = resolveDiagramElement(); Dimension defaultSize = getDefaultDimension(); - Option getLabelBorderStyle = getLabelBorderStyle(dde); - if (getLabelBorderStyle.some()) { + Optional getLabelBorderStyle = getLabelBorderStyle(dde); + if (getLabelBorderStyle.isPresent()) { result = new ContainerWithTitleBlockFigure(getMapMode().DPtoLP(defaultSize.width), getMapMode().DPtoLP(defaultSize.height), dde, getLabelBorderStyle.get()); } else { result = new SiriusDefaultSizeNodeFigure(getMapMode().DPtoLP(defaultSize.width), getMapMode().DPtoLP(defaultSize.height)); @@ -523,11 +523,11 @@ protected NodeFigure createNodePlate() { return result; } - private Option getLabelBorderStyle(DStylizable viewNode) { + private Optional getLabelBorderStyle(DStylizable viewNode) { if (viewNode instanceof DDiagramElementContainer) { return new DDiagramElementContainerExperimentalQuery((DDiagramElementContainer) viewNode).getLabelBorderStyle(); } - return Options.newNone(); + return Optional.empty(); } /** diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/AbstractDNodeContainerCompartmentEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/AbstractDNodeContainerCompartmentEditPart.java index c3d273020d..5a914b74d2 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/AbstractDNodeContainerCompartmentEditPart.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/AbstractDNodeContainerCompartmentEditPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2023 THALES GLOBAL SERVICES and others. + * Copyright (c) 2009, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -221,8 +221,8 @@ public IFigure createFigure() { */ protected void configureBorder(ResizableCompartmentFigure rcf) { boolean shouldHaveBorder = isRegionContainerCompartment(); - Option labelBorderStyle = getLabelBorderStyle(); - if (labelBorderStyle.some()) { + Optional labelBorderStyle = getLabelBorderStyle(); + if (labelBorderStyle.isPresent()) { shouldHaveBorder = shouldHaveBorder || LabelBorderStyleIds.LABEL_FULL_BORDER_STYLE_FOR_CONTAINER_ID.equals(labelBorderStyle.get().getId()); } @@ -266,8 +266,8 @@ protected void configureScrollPaneBorder(ScrollPane scrollPane, ContainerStyle o } boolean fullLabelBorder = false; - Option labelBorderStyle = getLabelBorderStyle(); - if (labelBorderStyle.some()) { + Optional labelBorderStyle = getLabelBorderStyle(); + if (labelBorderStyle.isPresent()) { fullLabelBorder = LabelBorderStyleIds.LABEL_FULL_BORDER_STYLE_FOR_CONTAINER_ID.equals(labelBorderStyle.get().getId()); } @@ -319,12 +319,12 @@ private boolean isCollapsed() { return style == null ? false : style.isCollapsed(); } - private Option getLabelBorderStyle() { + private Optional getLabelBorderStyle() { EObject element = resolveSemanticElement(); if (element instanceof DDiagramElementContainer) { return new DDiagramElementContainerExperimentalQuery((DDiagramElementContainer) element).getLabelBorderStyle(); } - return Options.newNone(); + return Optional.empty(); } @Override diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/AbstractDNodeListCompartmentEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/AbstractDNodeListCompartmentEditPart.java index c99b659f3b..7a47e2420a 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/AbstractDNodeListCompartmentEditPart.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/AbstractDNodeListCompartmentEditPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2021 THALES GLOBAL SERVICES and others. + * Copyright (c) 2011, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -68,7 +68,6 @@ import org.eclipse.sirius.diagram.ui.internal.edit.policies.RegionCollapseAwarePropertyHandlerEditPolicy; import org.eclipse.sirius.diagram.ui.internal.operation.ComparisonHelper; import org.eclipse.sirius.diagram.ui.tools.api.requests.RequestConstants; -import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.LabelBorderStyleIds; import org.eclipse.sirius.viewpoint.DRepresentationElement; import org.eclipse.sirius.viewpoint.description.RepresentationElementMapping; @@ -214,8 +213,8 @@ private boolean isLabelHidden() { private boolean hasLabelBorderStyle() { EObject element = resolveSemanticElement(); if (element instanceof DDiagramElementContainer) { - Option labelBorderStyle = new DDiagramElementContainerExperimentalQuery((DDiagramElementContainer) element).getLabelBorderStyle(); - return labelBorderStyle.some() && !LabelBorderStyleIds.LABEL_FULL_BORDER_STYLE_FOR_CONTAINER_ID.equals(labelBorderStyle.get().getId()); + Optional labelBorderStyle = new DDiagramElementContainerExperimentalQuery((DDiagramElementContainer) element).getLabelBorderStyle(); + return labelBorderStyle.isPresent() && !LabelBorderStyleIds.LABEL_FULL_BORDER_STYLE_FOR_CONTAINER_ID.equals(labelBorderStyle.get().getId()); } return false; } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/operation/CenterEdgeEndModelChangeOperation.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/operation/CenterEdgeEndModelChangeOperation.java index f915ee12e1..b84a52d1bd 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/operation/CenterEdgeEndModelChangeOperation.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/operation/CenterEdgeEndModelChangeOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 THALES GLOBAL SERVICES and others. + * Copyright (c) 2014, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -58,8 +58,6 @@ import org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper; import org.eclipse.sirius.diagram.ui.tools.internal.routers.RectilinearEdgeUtil; import org.eclipse.sirius.diagram.ui.tools.internal.util.GMFNotationUtilities; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.ext.gmf.runtime.editparts.GraphicalHelper; import org.eclipse.ui.IEditorPart; @@ -207,10 +205,10 @@ private void centerEdgeEnds(CenteringStyle center, Routing routingValue) { // We get the edge source and target nodes absolute bounds to // compute absolute anchors coordinates - Option sourceBounds = getAbsoluteSourceBounds(edgeSourceView); - Option targetBounds = getAbsoluteTargetBounds(edgeTargetView); + Optional sourceBounds = getAbsoluteSourceBounds(edgeSourceView); + Optional targetBounds = getAbsoluteTargetBounds(edgeTargetView); - if (sourceBounds.some() && targetBounds.some()) { + if (sourceBounds.isPresent() && targetBounds.isPresent()) { // Calculate the existing anchors absolute location retrieveAndSetExistingAnchorsAbsoluteLocation(sourceBounds.get(), targetBounds.get()); @@ -249,7 +247,7 @@ private void centerEdgeEnds(CenteringStyle center, Routing routingValue) { * true if it represents the edge source, false otherwise. * @return the absolute bounds. */ - private Option getAbsoluteBounds(View gmfView, boolean isSource) { + private Optional getAbsoluteBounds(View gmfView, boolean isSource) { if (connectionEditPart != null) { EditPart editPart = null; if (isSource) { @@ -258,24 +256,24 @@ private Option getAbsoluteBounds(View gmfView, boolean isSource) { editPart = connectionEditPart.getTarget(); } if (editPart instanceof GraphicalEditPart) { - return Options.newSome(GraphicalHelper.getAbsoluteBoundsIn100Percent((GraphicalEditPart) editPart)); + return Optional.ofNullable(GraphicalHelper.getAbsoluteBoundsIn100Percent((GraphicalEditPart) editPart)); } } return GMFHelper.getAbsoluteBounds(gmfView, true, true); } - private Option getAbsoluteSourceBounds(View edgeSourceView) { - Option option = getAbsoluteBounds(edgeSourceView, true); - if (sourceFigureSize != null && option.some()) { + private Optional getAbsoluteSourceBounds(View edgeSourceView) { + Optional option = getAbsoluteBounds(edgeSourceView, true); + if (sourceFigureSize != null && option.isPresent()) { Rectangle rectangle = option.get(); rectangle.setSize(sourceFigureSize); } return option; } - private Option getAbsoluteTargetBounds(View edgeTargetView) { - Option option = getAbsoluteBounds(edgeTargetView, false); - if (targetFigureSize != null && option.some()) { + private Optional getAbsoluteTargetBounds(View edgeTargetView) { + Optional option = getAbsoluteBounds(edgeTargetView, false); + if (targetFigureSize != null && option.isPresent()) { Rectangle rectangle = option.get(); rectangle.setSize(targetFigureSize); } @@ -517,7 +515,7 @@ private void setConnectionIfNull() { if (connection != null || !useFigure) { return; } - Option option = Options.newNone(); + Optional option = Optional.empty(); final IEditorPart editorPart = EclipseUIUtil.getActiveEditor(); if (editorPart instanceof DiagramEditor) { option = GMFHelper.getGraphicalEditPart(edge, (DiagramEditor) editorPart); @@ -533,14 +531,14 @@ private void setConnectionIfNull() { if (object instanceof DiagramEditor) { option = GMFHelper.getGraphicalEditPart(edge, (DiagramEditor) object); } - if (option.some()) { + if (option.isPresent()) { break; } } } - if (option.some()) { + if (option.isPresent()) { GraphicalEditPart editPart = option.get(); if (editPart instanceof DEdgeEditPart) { connectionEditPart = (DEdgeEditPart) editPart; 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 0346d6baf3..ab2f913243 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 @@ -22,6 +22,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import org.eclipse.core.runtime.IAdaptable; @@ -576,8 +577,8 @@ private LayoutDataResult updateAbstractDNode_ownedBorderedNodes_Bounds(View crea if (size == null) { if (new ViewQuery(createdView).isForNameEditPart()) { - Option optionalRect = GMFHelper.getAbsoluteBounds(createdView); - if (optionalRect.some()) { + Optional optionalRect = GMFHelper.getAbsoluteBounds(createdView); + if (optionalRect.isPresent()) { size = optionalRect.get().getSize(); } } 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 39400b170b..2253a40689 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 @@ -89,8 +89,6 @@ import org.eclipse.sirius.diagram.ui.provider.Messages; import org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutUtils; import org.eclipse.sirius.diagram.ui.tools.api.util.GMFNotationHelper; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.AlphaDropShadowBorder; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.IContainerLabelOffsets; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.LabelBorderStyleIds; @@ -484,8 +482,8 @@ private static void translateWithInsets(Point locationToTranslate, Node currentN } private static boolean hasFullLabelBorder(DDiagramElementContainer ddec) { - Option labelBorderStyle = new DDiagramElementContainerExperimentalQuery(ddec).getLabelBorderStyle(); - return labelBorderStyle.some() && LabelBorderStyleIds.LABEL_FULL_BORDER_STYLE_FOR_CONTAINER_ID.equals(labelBorderStyle.get().getId()); + Optional labelBorderStyle = new DDiagramElementContainerExperimentalQuery(ddec).getLabelBorderStyle(); + return labelBorderStyle.isPresent() && LabelBorderStyleIds.LABEL_FULL_BORDER_STYLE_FOR_CONTAINER_ID.equals(labelBorderStyle.get().getId()); } private static boolean isFirstRegion(DDiagramElementContainer ddec) { @@ -586,7 +584,7 @@ public static Rectangle getAbsoluteBounds(Node node, boolean insetsAware, boolea * * @return the absolute bounds of the edge relative to the origin (Diagram) */ - public static Option getAbsoluteBounds(Edge edge) { + public static Optional getAbsoluteBounds(Edge edge) { return getAbsoluteBounds(edge, false, false); } @@ -604,14 +602,14 @@ public static Option getAbsoluteBounds(Edge edge) { * * @return the absolute bounds of the edge relative to the origin (Diagram) */ - public static Option getAbsoluteBounds(Edge edge, boolean insetsAware, boolean boxForConnection) { + public static Optional getAbsoluteBounds(Edge edge, boolean insetsAware, boolean boxForConnection) { // Workaround for canonical refresh about edge on edge - Option optionalSourceBounds = getAbsoluteBounds(edge.getSource(), insetsAware, boxForConnection); - Option optionalTargetBounds = getAbsoluteBounds(edge.getTarget(), insetsAware, boxForConnection); - if (optionalSourceBounds.some() && optionalTargetBounds.some()) { - return Options.newSome(optionalSourceBounds.get().union(optionalTargetBounds.get())); + Optional optionalSourceBounds = getAbsoluteBounds(edge.getSource(), insetsAware, boxForConnection); + Optional optionalTargetBounds = getAbsoluteBounds(edge.getTarget(), insetsAware, boxForConnection); + if (optionalSourceBounds.isPresent() && optionalTargetBounds.isPresent()) { + return Optional.ofNullable(optionalSourceBounds.get().union(optionalTargetBounds.get())); } - return Options.newNone(); + return Optional.empty(); } /** @@ -622,7 +620,7 @@ public static Option getAbsoluteBounds(Edge edge, boolean insetsAware * * @return an optional absolute bounds of the node or edge relative to the origin (Diagram) */ - public static Option getAbsoluteBounds(View view) { + public static Optional getAbsoluteBounds(View view) { return getAbsoluteBounds(view, false); } @@ -637,7 +635,7 @@ public static Option getAbsoluteBounds(View view) { * * @return an optional absolute bounds of the node or edge relative to the origin (Diagram) */ - public static Option getAbsoluteBounds(View view, boolean insetsAware) { + public static Optional getAbsoluteBounds(View view, boolean insetsAware) { return getAbsoluteBounds(view, insetsAware, false); } @@ -655,10 +653,10 @@ public static Option getAbsoluteBounds(View view, boolean insetsAware * * @return an optional absolute bounds of the node or edge relative to the origin (Diagram) */ - public static Option getAbsoluteBounds(View view, boolean insetsAware, boolean boxForConnection) { - Option result = Options.newNone(); + public static Optional getAbsoluteBounds(View view, boolean insetsAware, boolean boxForConnection) { + Optional result = Optional.empty(); if (view instanceof Node) { - result = Options.newSome(getAbsoluteBounds((Node) view, insetsAware, boxForConnection, false, true)); + result = Optional.ofNullable(getAbsoluteBounds((Node) view, insetsAware, boxForConnection, false, true)); } else if (view instanceof Edge) { result = getAbsoluteBounds((Edge) view, insetsAware, boxForConnection); } @@ -839,9 +837,9 @@ private static void replaceAutoSize(Node node, PrecisionRectangle bounds, boolea if (useFigureForAutoSizeConstraint) { // Use the figure (if founded) to set width and height // instead of (-1, -1) - Option optionalTargetEditPart = getGraphicalEditPart(node); + Optional optionalTargetEditPart = getGraphicalEditPart(node); // CHECKSTYLE:OFF - if (optionalTargetEditPart.some()) { + if (optionalTargetEditPart.isPresent()) { GraphicalEditPart graphicalEditPart = optionalTargetEditPart.get(); if (graphicalEditPart instanceof AbstractDiagramElementContainerEditPart abstractDiagramElementContainerEditPart) { abstractDiagramElementContainerEditPart.forceFigureAutosize(); @@ -989,11 +987,11 @@ private static Rectangle getChildrenBounds(Node container, boolean considerBorde } } else { for (Iterator children = Iterators.filter(container.getChildren().iterator(), Node.class); children.hasNext(); /* */) { - Node child = children.next(); + Node nodeChild = children.next(); // The border nodes are ignored, except if it is expected to consider it (auto-size of a container with // children having border nodes) - if (considerBorderNodes || !(new NodeQuery(child).isBorderedNode())) { - Rectangle childAbsoluteBounds = getAbsoluteBounds(child, true, false, true, false); + if (considerBorderNodes || !(new NodeQuery(nodeChild).isBorderedNode())) { + Rectangle childAbsoluteBounds = getAbsoluteBounds(nodeChild, true, false, true, false); if (result == null) { result = childAbsoluteBounds.getCopy(); } else { @@ -1036,7 +1034,7 @@ private static Dimension getDefaultSize(AbstractDNode abstractDNode) { * The view element that is searched * @return The optional corresponding edit part. */ - public static Option getGraphicalEditPart(View view) { + public static Optional getGraphicalEditPart(View view) { if (view != null) { Diagram gmfDiagram = view.getDiagram(); // Try the active editor first (most likely case in practice) @@ -1053,7 +1051,7 @@ public static Option getGraphicalEditPart(View view) { } } } - return Options. newNone(); + return Optional.empty(); } private static boolean isEditorFor(IEditorPart editor, Diagram diagram) { @@ -1070,12 +1068,12 @@ private static boolean isEditorFor(IEditorPart editor, Diagram diagram) { * the editor where looking for the edit part. * @return The optional corresponding edit part. */ - public static Option getGraphicalEditPart(View view, DiagramEditor editor) { - Option result = Options.newNone(); + public static Optional getGraphicalEditPart(View view, DiagramEditor editor) { + Optional result = Optional.empty(); final Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry(); final EditPart targetEditPart = (EditPart) editPartRegistry.get(view); if (targetEditPart instanceof GraphicalEditPart graphicalEditPart) { - result = Options.newSome(graphicalEditPart); + result = Optional.of(graphicalEditPart); } return result; } @@ -1293,14 +1291,9 @@ public static List getAttachedPGE(View view) { List noteAttachments = getIncomingOutgoingEdges(view).stream() // .filter(GMFNotationHelper::isNoteAttachment).toList(); - return noteAttachments.stream().flatMap(edge -> Stream.of(edge.getSource(), edge.getTarget())).filter(attachedView -> { // all - // nodes - // linked - // to - // note - // attachment: - // filter - // notes/texts + return noteAttachments.stream().flatMap(edge -> { + return Stream.of(edge.getSource(), edge.getTarget()); + }).filter(attachedView -> { // all nodes linked to note attachment: filter notes/texts if (attachedView instanceof Node attachedNode) { return GMFNotationHelper.isNote(attachedNode) || GMFNotationHelper.isTextNote(attachedNode); } else { diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/diagram/ConnectionsFactory.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/diagram/ConnectionsFactory.java index b527e22e8a..8f879edbe5 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/diagram/ConnectionsFactory.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/diagram/ConnectionsFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2021 THALES GLOBAL SERVICES and others. + * Copyright (c) 2011, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -230,7 +230,7 @@ private void getAttributes(Edge edge, EdgeTarget sourceEdgeTarget, EdgeTarget ta getAttributesForSourceOrTargetMove(edgeLayoutData, edge, source, target); } } else { - Option optionalSourceBounds = GMFHelper.getAbsoluteBounds(source); + Optional optionalSourceBounds = GMFHelper.getAbsoluteBounds(source); LayoutData sourceLayoutData = null; if (sourceEdgeTarget instanceof AbstractDNode) { AbstractDNode sourceDNode = (AbstractDNode) sourceEdgeTarget; @@ -238,14 +238,14 @@ private void getAttributes(Edge edge, EdgeTarget sourceEdgeTarget, EdgeTarget ta } Point firstClick = getFirstClick(sourceLayoutData, optionalSourceBounds); - if (optionalSourceBounds.some()) { + if (optionalSourceBounds.isPresent()) { PrecisionPoint sourceRelativeLocation = BaseSlidableAnchor.getAnchorRelativeLocation(firstClick, optionalSourceBounds.get()); sourceTerminal = GMFNotationUtilities.getTerminalString(sourceRelativeLocation.preciseX(), sourceRelativeLocation.preciseY()); } else { sourceTerminal = GMFNotationUtilities.getTerminalString(0.5d, 0.5d); } - Option optionaltargetBounds = GMFHelper.getAbsoluteBounds(target); + Optional optionaltargetBounds = GMFHelper.getAbsoluteBounds(target); LayoutData targetLayoutData = null; if (targetEdgeTarget instanceof AbstractDNode) { AbstractDNode targetDNode = (AbstractDNode) targetEdgeTarget; @@ -253,7 +253,7 @@ private void getAttributes(Edge edge, EdgeTarget sourceEdgeTarget, EdgeTarget ta } Point secondClick = getSecondClick(targetLayoutData, optionaltargetBounds); - if (optionaltargetBounds.some()) { + if (optionaltargetBounds.isPresent()) { PrecisionPoint targetRelativeLocation = BaseSlidableAnchor.getAnchorRelativeLocation(secondClick, optionaltargetBounds.get()); targetTerminal = GMFNotationUtilities.getTerminalString(targetRelativeLocation.preciseX(), targetRelativeLocation.preciseY()); } else { @@ -323,10 +323,12 @@ protected void getAttributesForSourceOrTargetMove(EdgeLayoutData edgeLayoutData, } if (edgeLayoutData.getPointList() != null) { - GraphicalEditPart srceEditPart = GMFHelper.getGraphicalEditPart(source).get(); - GraphicalEditPart tgtEditPart = GMFHelper.getGraphicalEditPart(target).get(); + Optional optionalSrceEditPart = GMFHelper.getGraphicalEditPart(source); + Optional optionalTgtEditPart = GMFHelper.getGraphicalEditPart(target); - if (srceEditPart != null && tgtEditPart != null) { + if (optionalSrceEditPart.isPresent() && optionalTgtEditPart.isPresent()) { + GraphicalEditPart srceEditPart = optionalSrceEditPart.get(); + GraphicalEditPart tgtEditPart = optionalTgtEditPart.get(); GraphicalHelper.screen2logical(sourceRefPoint, srceEditPart); GraphicalHelper.screen2logical(targetRefPoint, tgtEditPart); @@ -422,10 +424,10 @@ private void getAttributesForSourceAndTargetMove(EdgeLayoutData edgeLayoutData, } } - private Point getFirstClick(LayoutData sourceLayoutData, Option optionalSourceBounds) { + private Point getFirstClick(LayoutData sourceLayoutData, Optional optionalSourceBounds) { Point firstClick = new Point(0, 0); if (sourceLayoutData == null) { - if (optionalSourceBounds.some()) { + if (optionalSourceBounds.isPresent()) { firstClick = optionalSourceBounds.get().getCenter(); } } else { @@ -435,10 +437,10 @@ private Point getFirstClick(LayoutData sourceLayoutData, Option optio return firstClick; } - private Point getSecondClick(LayoutData targetLayoutData, Option optionaltargetBounds) { + private Point getSecondClick(LayoutData targetLayoutData, Optional optionaltargetBounds) { Point secondClick = new Point(0, 0); if (targetLayoutData == null) { - if (optionaltargetBounds.some()) { + if (optionaltargetBounds.isPresent()) { secondClick = optionaltargetBounds.get().getCenter(); } } else { diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/edge/SlidableAnchor.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/edge/SlidableAnchor.java index f49ac25095..bbb9bf109d 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/edge/SlidableAnchor.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/edge/SlidableAnchor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2021 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2024 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.ui.internal.refresh.edge; +import java.util.Optional; + import org.eclipse.draw2d.PositionConstants; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.PointList; @@ -27,7 +29,6 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper; -import org.eclipse.sirius.ext.base.Option; /** * Provides the GMF implementation of Slidable anchor. @@ -115,8 +116,8 @@ protected Rectangle getBox() { } } } else if (owner instanceof Edge) { - Option optionalRect = GMFHelper.getAbsoluteBounds((Edge) owner); - if (optionalRect.some()) { + Optional optionalRect = GMFHelper.getAbsoluteBounds((Edge) owner); + if (optionalRect.isPresent()) { box = optionalRect.get(); } } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/EdgeLayoutUpdaterModelChangeTrigger.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/EdgeLayoutUpdaterModelChangeTrigger.java index 36eefdbadd..42c47d3b0e 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/EdgeLayoutUpdaterModelChangeTrigger.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/EdgeLayoutUpdaterModelChangeTrigger.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 THALES GLOBAL SERVICES. + * Copyright (c) 2014, 2024 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -446,7 +446,7 @@ private Optional getCorrespondingNode(Notification notification, Map option = Options.newNone(); + Optional option = Optional.empty(); final IEditorPart editorPart = EclipseUIUtil.getActiveEditor(); if (editorPart instanceof DiagramEditor) { option = GMFHelper.getGraphicalEditPart(edge, (DiagramEditor) editorPart); @@ -460,12 +460,12 @@ private DEdgeEditPart getEdgeEditPart(Edge edge) { if (object instanceof DiagramEditor) { option = GMFHelper.getGraphicalEditPart(edge, (DiagramEditor) object); } - if (option.some()) { + if (option.isPresent()) { break; } } } - if (option.some()) { + if (option.isPresent()) { GraphicalEditPart editPart = option.get(); if (editPart instanceof DEdgeEditPart) { edgeEditPart = ((DEdgeEditPart) editPart); diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/provider/BorderItemAwareLayoutProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/provider/BorderItemAwareLayoutProvider.java index 69867744bd..da597b147c 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/provider/BorderItemAwareLayoutProvider.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/provider/BorderItemAwareLayoutProvider.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -102,8 +103,6 @@ import org.eclipse.sirius.diagram.ui.tools.internal.graphical.edit.policies.ChangeBoundRequestRecorder; import org.eclipse.sirius.diagram.ui.tools.internal.layout.ArrangeAllWithAutoSize; import org.eclipse.sirius.diagram.ui.tools.internal.part.SiriusDiagramGraphicalViewer; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.ext.gmf.runtime.editparts.GraphicalHelper; import org.eclipse.sirius.viewpoint.DSemanticDecorator; @@ -704,8 +703,8 @@ private Command layoutBorderItems(final List selectedObjects, final int nbIte for (Entry> requestByView : getViewsToChangeBoundsRequest().entrySet()) { View view = requestByView.getKey(); // Get corresponding edit part - Option optionalPart = getCorrespondingEditPart(view); - if (optionalPart.some()) { + Optional optionalPart = getCorrespondingEditPart(view); + if (optionalPart.isPresent()) { // In theory we are always in this case... IBorderItemEditPart borderItemEditPart = optionalPart.get(); List requests = requestByView.getValue(); @@ -766,11 +765,11 @@ public void resetBendpoints(Edge edge, CompoundCommand cc, IBorderItemEditPart b } else { edgeOtherExtremityView = edge.getSource(); } - Option optionalOtherExtremityPart = getCorrespondingEditPart(edgeOtherExtremityView); - if (!(optionalOtherExtremityPart.some())) { + Optional optionalOtherExtremityPart = getCorrespondingEditPart(edgeOtherExtremityView); + if (optionalOtherExtremityPart.isEmpty()) { optionalOtherExtremityPart = GMFHelper.getGraphicalEditPart(edgeOtherExtremityView); } - if (optionalOtherExtremityPart.some()) { + if (optionalOtherExtremityPart.isPresent()) { Point secondAnchorLocation; if (sourceEdge) { secondAnchorLocation = GraphicalHelper.getAnchorPoint(optionalOtherExtremityPart.get(), edge.getTargetAnchor()); @@ -846,13 +845,13 @@ private void clearBorderItemLocations() { previousIterationDatasbyEditPart.clear(); } - private Option getCorrespondingEditPart(View view) { + private Optional getCorrespondingEditPart(View view) { for (IBorderItemEditPart borderItemEditPart : previousIterationDatasbyEditPart.keySet()) { if (view.equals(borderItemEditPart.getModel())) { - return Options.newSome(borderItemEditPart); + return Optional.of(borderItemEditPart); } } - return Options.newNone(); + return Optional.empty(); } /** diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/compartment/CompartmentsLayoutTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/compartment/CompartmentsLayoutTest.java index cfe9ab887c..caa959f6a1 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/compartment/CompartmentsLayoutTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/compartment/CompartmentsLayoutTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2022 Obeo. + * Copyright (c) 2015, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -18,6 +18,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Optional; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.draw2d.Border; @@ -81,7 +82,6 @@ import org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutUtils; import org.eclipse.sirius.diagram.ui.tools.internal.figure.RegionRoundedGradientRectangle; import org.eclipse.sirius.diagram.ui.tools.internal.preferences.SiriusDiagramUiInternalPreferencesKeys; -import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.AlphaDropShadowBorder; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.LabelBorderStyleIds; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.RoundedCornerMarginBorder; @@ -1091,7 +1091,7 @@ private void checkContentPanes(String label, boolean separatedContentPane, boole private Insets getExpectedScrollPaneInsets(DNodeContainer dnc) { DDiagramElementContainerExperimentalQuery query = new DDiagramElementContainerExperimentalQuery(dnc); - Option labelBorderStyle = query.getLabelBorderStyle(); + Optional labelBorderStyle = query.getLabelBorderStyle(); final int defaultMargin = AbstractDNodeContainerCompartmentEditPart.DEFAULT_MARGIN; int borderSize = 0; @@ -1102,7 +1102,7 @@ private Insets getExpectedScrollPaneInsets(DNodeContainer dnc) { Insets insets = new Insets(1, 0, 0, 0); if (new DNodeContainerExperimentalQuery(dnc).isRegionContainer()) { insets = new Insets(0, 0, -1, -1); - } else if (labelBorderStyle.some() && LabelBorderStyleIds.LABEL_FULL_BORDER_STYLE_FOR_CONTAINER_ID.equals(labelBorderStyle.get().getId())) { + } else if (labelBorderStyle.isPresent() && LabelBorderStyleIds.LABEL_FULL_BORDER_STYLE_FOR_CONTAINER_ID.equals(labelBorderStyle.get().getId())) { insets = new Insets(defaultMargin, defaultMargin, defaultMargin, defaultMargin); } else if (query.isRegionInVerticalStack()) { insets = new Insets(borderSize + defaultMargin, defaultMargin, defaultMargin, defaultMargin);