diff --git a/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/assertions/NodeAssert.java b/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/assertions/NodeAssert.java index c329ea8495..0d5e20baa5 100644 --- a/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/assertions/NodeAssert.java +++ b/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/assertions/NodeAssert.java @@ -17,7 +17,6 @@ import java.util.Set; import org.eclipse.sirius.components.diagrams.CollapsingState; -import org.eclipse.sirius.components.diagrams.CustomizableProperties; import org.eclipse.sirius.components.diagrams.Node; import org.eclipse.sirius.components.diagrams.ViewModifier; @@ -77,11 +76,6 @@ public NodeAssert hasCollapsingState(CollapsingState collapsingState) { return this; } - public NodeAssert hasCustomizedProperties(Set customizedProperties) { - assertThat(this.actual.getCustomizedProperties()).hasSameElementsAs(customizedProperties); - return this; - } - public NodeAssert hasDefaultWidth(int defaultWidth) { assertThat(this.actual.getDefaultWidth()).isEqualTo(defaultWidth); return this; diff --git a/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/IconlabelNodeBuilder.java b/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/IconlabelNodeBuilder.java index 183cc4239d..7dce4b079c 100644 --- a/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/IconlabelNodeBuilder.java +++ b/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/IconlabelNodeBuilder.java @@ -20,7 +20,6 @@ import java.util.UUID; import org.eclipse.sirius.components.diagrams.CollapsingState; -import org.eclipse.sirius.components.diagrams.CustomizableProperties; import org.eclipse.sirius.components.diagrams.INodeStyle; import org.eclipse.sirius.components.diagrams.IconLabelNodeStyle; import org.eclipse.sirius.components.diagrams.InsideLabel; @@ -52,8 +51,6 @@ public class IconlabelNodeBuilder implements NodeBuilder { private NodesBuilder> childNodesBuilder; - private Set customizedProperties = Set.of(); - public IconlabelNodeBuilder(NodesBuilder nodesBuilder, String nodeLabel, boolean isBorderNode) { this.insideLabel = new LabelBuilder().basicInsideLabel(nodeLabel, LabelType.INSIDE_CENTER, false); this.isBorderNode = isBorderNode; @@ -70,11 +67,6 @@ public NodesBuilder> childNodes() { return this.childNodesBuilder; } - public IconlabelNodeBuilder customizedProperties(Set customizedProperties) { - this.customizedProperties = Objects.requireNonNull(customizedProperties); - return this; - } - public NodesBuilder and() { return this.nodesBuilder; } @@ -103,7 +95,6 @@ public Node build(Map targetObjectIdToNodeId) { .borderNode(this.isBorderNode) .borderNodes(borderNodes) .childNodes(childNodes) - .customizedProperties(this.customizedProperties) .descriptionId(descriptionId) .targetObjectId(labelText) .targetObjectKind("") diff --git a/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/ImageNodeBuilder.java b/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/ImageNodeBuilder.java index a3f26003dd..827f3f0d73 100644 --- a/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/ImageNodeBuilder.java +++ b/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/ImageNodeBuilder.java @@ -20,7 +20,6 @@ import java.util.UUID; import org.eclipse.sirius.components.diagrams.CollapsingState; -import org.eclipse.sirius.components.diagrams.CustomizableProperties; import org.eclipse.sirius.components.diagrams.INodeStyle; import org.eclipse.sirius.components.diagrams.ImageNodeStyle; import org.eclipse.sirius.components.diagrams.InsideLabel; @@ -51,8 +50,6 @@ public final class ImageNodeBuilder implements NodeBuilder { private NodesBuilder> childNodesBuilder; - private Set customizedProperties = Set.of(); - public ImageNodeBuilder(NodesBuilder nodesBuilder, String nodeLabel, boolean isBorderNode) { this.insideLabel = new LabelBuilder().basicInsideLabel(nodeLabel, LabelType.OUTSIDE_CENTER, false); this.isBorderNode = isBorderNode; @@ -69,11 +66,6 @@ public NodesBuilder> childNodes() { return this.childNodesBuilder; } - public ImageNodeBuilder customizedProperties(Set customizedProperties) { - this.customizedProperties = Objects.requireNonNull(customizedProperties); - return this; - } - public NodesBuilder and() { return this.nodesBuilder; } @@ -103,7 +95,6 @@ public Node build(Map targetObjectIdToNodeId) { .borderNode(this.isBorderNode) .borderNodes(borderNodes) .childNodes(childNodes) - .customizedProperties(this.customizedProperties) .descriptionId(descriptionId) .targetObjectId(labelText) .targetObjectKind("") diff --git a/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/RectangleNodeBuilder.java b/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/RectangleNodeBuilder.java index 65be161ed3..69eb590eca 100644 --- a/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/RectangleNodeBuilder.java +++ b/packages/diagrams/backend/sirius-components-diagrams-tests/src/main/java/org/eclipse/sirius/components/diagrams/tests/builder/node/RectangleNodeBuilder.java @@ -20,7 +20,6 @@ import java.util.UUID; import org.eclipse.sirius.components.diagrams.CollapsingState; -import org.eclipse.sirius.components.diagrams.CustomizableProperties; import org.eclipse.sirius.components.diagrams.ILayoutStrategy; import org.eclipse.sirius.components.diagrams.INodeStyle; import org.eclipse.sirius.components.diagrams.InsideLabel; @@ -58,8 +57,6 @@ public final class RectangleNodeBuilder implements NodeBuilder { private NodesBuilder> childNodesBuilder; - private Set customizedProperties = Set.of(); - public RectangleNodeBuilder(NodesBuilder nodesBuilder, String nodeLabel, boolean isBorderNode) { this(nodesBuilder, nodeLabel, isBorderNode, false); } @@ -86,11 +83,6 @@ public NodesBuilder> childNodes(ILayoutStrategy layoutSt return this.childNodesBuilder; } - public RectangleNodeBuilder customizedProperties(Set customizedProperties) { - this.customizedProperties = Objects.requireNonNull(customizedProperties); - return this; - } - public NodesBuilder and() { return this.nodesBuilder; } @@ -123,7 +115,6 @@ public Node build(Map targetObjectIdToNodeId) { .borderNode(this.isBorderNode) .borderNodes(borderNodes) .childNodes(childNodes) - .customizedProperties(this.customizedProperties) .descriptionId(descriptionId) .targetObjectId(labeltext) .targetObjectKind("") diff --git a/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/CustomizableProperties.java b/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/CustomizableProperties.java deleted file mode 100644 index c77d442cf7..0000000000 --- a/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/CustomizableProperties.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2021 THALES GLOBAL SERVICES. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.components.diagrams; - -/** - * The list of customizable features on a diagram element. Allows to indicate that a properties (size, style etc) has - * been manually modified and should not be reset to the default value. - * - * @author fbarbin - */ -public enum CustomizableProperties { - Size, -} diff --git a/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/Node.java b/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/Node.java index 2ad94b3427..31ecb2c5c5 100644 --- a/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/Node.java +++ b/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/Node.java @@ -62,8 +62,6 @@ public final class Node implements IDiagramElement { private List childNodes; - private Set customizedProperties; - private Integer defaultWidth; private Integer defaultHeight; @@ -150,10 +148,6 @@ public List getChildNodes() { return this.childNodes; } - public Set getCustomizedProperties() { - return this.customizedProperties; - } - public Integer getDefaultWidth() { return this.defaultWidth; } @@ -221,8 +215,6 @@ public static final class Builder { private List childNodes; - private Set customizedProperties = Set.of(); - private Integer defaultWidth; private Integer defaultHeight; @@ -252,7 +244,6 @@ private Builder(Node node) { this.childrenLayoutStrategy = node.getChildrenLayoutStrategy(); this.borderNodes = node.getBorderNodes(); this.childNodes = node.getChildNodes(); - this.customizedProperties = node.getCustomizedProperties(); this.defaultWidth = node.getDefaultWidth(); this.defaultHeight = node.getDefaultHeight(); this.labelEditable = node.isLabelEditable(); @@ -334,11 +325,6 @@ public Builder childNodes(List childNodes) { return this; } - public Builder customizedProperties(Set customizedProperties) { - this.customizedProperties = Objects.requireNonNull(customizedProperties); - return this; - } - public Builder defaultWidth(Integer defaultWidth) { this.defaultWidth = Objects.requireNonNull(defaultWidth); return this; @@ -377,7 +363,6 @@ public Node build() { node.childrenLayoutStrategy = this.childrenLayoutStrategy; node.borderNodes = Objects.requireNonNull(this.borderNodes); node.childNodes = Objects.requireNonNull(this.childNodes); - node.customizedProperties = this.customizedProperties; node.defaultWidth = this.defaultWidth; // Optional on purpose node.defaultHeight = this.defaultHeight; // Optional on purpose node.labelEditable = this.labelEditable; diff --git a/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/components/NodeComponent.java b/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/components/NodeComponent.java index 81f80f2463..d8e4a01f16 100644 --- a/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/components/NodeComponent.java +++ b/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/components/NodeComponent.java @@ -20,7 +20,6 @@ import java.util.Set; import org.eclipse.sirius.components.diagrams.CollapsingState; -import org.eclipse.sirius.components.diagrams.CustomizableProperties; import org.eclipse.sirius.components.diagrams.ILayoutStrategy; import org.eclipse.sirius.components.diagrams.INodeStyle; import org.eclipse.sirius.components.diagrams.Node; @@ -184,11 +183,6 @@ private Element doRender(VariableManager nodeVariableManager, String targetObjec .build(); Element nodeChildren = new Element(NodeChildrenComponent.class, nodeChildrenComponentProps); - Set customizableProperties = Set.of(); - - if (CollapsingState.EXPANDED.equals(collapsingState)) { - customizableProperties = optionalPreviousNode.map(Node::getCustomizedProperties).orElse(Set.of()); - } Integer defaultWidth = nodeDescription.getDefaultWidthProvider().apply(nodeVariableManager); Integer defaultHeight = nodeDescription.getDefaultHeightProvider().apply(nodeVariableManager); @@ -201,7 +195,6 @@ private Element doRender(VariableManager nodeVariableManager, String targetObjec .borderNode(isBorderNode) .style(style) .children(List.of(nodeChildren)) - .customizableProperties(customizableProperties) .modifiers(modifiers) .state(state) .pinned(isPinned) diff --git a/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/elements/NodeElementProps.java b/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/elements/NodeElementProps.java index d3a95d7d7b..85bb29abe3 100644 --- a/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/elements/NodeElementProps.java +++ b/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/elements/NodeElementProps.java @@ -19,7 +19,6 @@ import org.eclipse.sirius.components.annotations.Immutable; import org.eclipse.sirius.components.diagrams.CollapsingState; -import org.eclipse.sirius.components.diagrams.CustomizableProperties; import org.eclipse.sirius.components.diagrams.ILayoutStrategy; import org.eclipse.sirius.components.diagrams.INodeStyle; import org.eclipse.sirius.components.diagrams.ViewModifier; @@ -64,8 +63,6 @@ public final class NodeElementProps implements IProps { private Integer defaultHeight; - private Set customizableProperties; - private List children; private boolean labelEditable; @@ -136,10 +133,6 @@ public Integer getDefaultHeight() { return this.defaultHeight; } - public Set getCustomizableProperties() { - return this.customizableProperties; - } - @Override public List getChildren() { return this.children; @@ -195,8 +188,6 @@ public static final class Builder { private Integer defaultHeight; - private Set customizableProperties = Set.of(); - private List children; private boolean labelEditable; @@ -272,11 +263,6 @@ public Builder defaultHeight(Integer defaultHeight) { return this; } - public Builder customizableProperties(Set customizableProperties) { - this.customizableProperties = Objects.requireNonNull(customizableProperties); - return this; - } - public Builder children(List children) { this.children = Objects.requireNonNull(children); return this; @@ -308,7 +294,6 @@ public NodeElementProps build() { nodeElementProps.childrenLayoutStrategy = this.childrenLayoutStrategy; nodeElementProps.children = Objects.requireNonNull(this.children); nodeElementProps.labelEditable = this.labelEditable; - nodeElementProps.customizableProperties = Objects.requireNonNull(this.customizableProperties); nodeElementProps.defaultWidth = this.defaultWidth; // Optional on purpose nodeElementProps.defaultHeight = this.defaultHeight; // Optional on purpose nodeElementProps.pinned = this.pinned; diff --git a/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/renderer/DiagramElementFactory.java b/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/renderer/DiagramElementFactory.java index d8656e2484..7aed4ea464 100644 --- a/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/renderer/DiagramElementFactory.java +++ b/packages/diagrams/backend/sirius-components-diagrams/src/main/java/org/eclipse/sirius/components/diagrams/renderer/DiagramElementFactory.java @@ -116,7 +116,6 @@ private Node instantiateNode(IProps props, List children) { .style(nodeElementProps.getStyle()) .borderNodes(borderNodes) .childNodes(childNodes) - .customizedProperties(nodeElementProps.getCustomizableProperties()) .state(nodeElementProps.getState()) .pinned(nodeElementProps.isPinned()) .modifiers(nodeElementProps.getModifiers()) diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/editingcontext/migration/participants/representation/DiagramCustomizedPropertiesAttributeMigrationParticipant.java b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/editingcontext/migration/participants/representation/DiagramCustomizedPropertiesAttributeMigrationParticipant.java new file mode 100644 index 0000000000..f4c66118c5 --- /dev/null +++ b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/editingcontext/migration/participants/representation/DiagramCustomizedPropertiesAttributeMigrationParticipant.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2024 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ + +package org.eclipse.sirius.web.application.editingcontext.migration.participants.representation; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; + +import org.eclipse.sirius.components.collaborative.representations.migration.IRepresentationMigrationParticipant; +import org.springframework.stereotype.Service; + +/** + * Remove the customizedProperties from node. + * + * @author gcoutable + */ +@Service +public class DiagramCustomizedPropertiesAttributeMigrationParticipant implements IRepresentationMigrationParticipant { + + public static final String CUSTOMIZED_PROPERTIES = "customizedProperties"; + + @Override + public String getVersion() { + return "2024.11.0-202409231055"; + } + + @Override + public String getKind() { + return "siriusComponents://representation?type=Diagram"; + } + + @Override + public void replaceJsonNode(ObjectNode root, String currentAttribute, JsonNode currentValue) { + if (currentAttribute.equals(CUSTOMIZED_PROPERTIES)) { + root.remove(CUSTOMIZED_PROPERTIES); + } + } +} diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/RepresentationMigrationParticipantTests.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/RepresentationMigrationParticipantTests.java index ed4f29c22f..e835c11bc0 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/RepresentationMigrationParticipantTests.java +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/RepresentationMigrationParticipantTests.java @@ -201,7 +201,7 @@ public void testRemoveSizeFromDiagramPresentOnDiagramAndNodesAndEdges() { } @ParameterizedTest - @ValueSource(strings = {"alignment", "routingPoints", "sourceAnchorRelativePosition", "targetAnchorRelativePosition", "userResizable"}) + @ValueSource(strings = {"alignment", "routingPoints", "sourceAnchorRelativePosition", "targetAnchorRelativePosition", "userResizable", "customizedProperties"}) @DisplayName("Given a project with an old diagram representation, when the representation is loaded, then the position and size of diagram and nodes have been removed, but not from layout data") @Sql(scripts = {"/scripts/migration.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = {"/scripts/cleanup.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED)) diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/DiagramOperationInterpreterViewSwitch.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/DiagramOperationInterpreterViewSwitch.java index 43f2685a3a..5ab16bff60 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/DiagramOperationInterpreterViewSwitch.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/DiagramOperationInterpreterViewSwitch.java @@ -211,7 +211,6 @@ private Node createView(Optional optionalParentNode, NodeDescription nodeD .childrenLayoutStrategy(new FreeFormLayoutStrategy()) .borderNodes(List.of()) .childNodes(List.of()) - .customizedProperties(Set.of()) .build(); }