Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ Consumers may override this by providing an implementation of `org.eclipse.syson

- https://github.com/eclipse-syson/syson/issues/1314[#1314] [diagrams] (Almost) All node descriptions are now synchronized (based on the exposed elements of ViewUsages).
This contribution allows to switch from one _ViewDefinition_ to another one in a _ViewUsage_ without having to re-create the diagram.
- https://github.com/eclipse-syson/syson/issues/1525[#1525] [diagrams] Add support for the management of the appearance of custom nodes (`Package`, `ImportedPackage`, `Note` and `ViewFrame`) with the extension point `PaletteAppearanceSectionContribution`.
* `DiagramImporterSysMLPackageNodeStyleAppearanceChangeHandler implements IDiagramImporterNodeStyleAppearanceChangeHandler` allows the importation of diagram with `Package` nodes that have custom appearance.
* `EditSysMLPackageNodeAppearanceEventHandler implements IDiagramEventHandler` adds the needed `appearanceChanges` to the `diagramContext` after receiving the mutation.
* `SysMLPackageNodeAppearanceHandler implements INodeAppearanceHandler` handles how the node is updated from the `appearanceChanges`.
* A GraphQL mutation is also added through `editSysMLPackageNodeAppearance`.
* Same mechanism is applied to `ImportedPackage`, `Note` and `ViewFrame` nodes.

== v2025.8.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public static Builder newSysMLImportedPackageNodeStyle() {
return new Builder();
}

public static Builder newSysMLImportedPackageNodeStyle(SysMLImportedPackageNodeStyle nodeStyle) {
return new Builder(nodeStyle);
}

public String getBackground() {
return this.background;
}
Expand Down Expand Up @@ -95,6 +99,14 @@ private Builder() {
// Prevent instantiation
}

private Builder(SysMLImportedPackageNodeStyle nodeStyle) {
this.background = nodeStyle.getBackground();
this.borderColor = nodeStyle.getBorderColor();
this.borderSize = nodeStyle.getBorderSize();
this.borderStyle = nodeStyle.getBorderStyle();
this.childrenLayoutStrategy = nodeStyle.getChildrenLayoutStrategy();
}

public Builder background(String background) {
this.background = Objects.requireNonNull(background);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public static Builder newSysMLNoteNodeStyle() {
return new Builder();
}

public static Builder newSysMLNoteNodeStyle(SysMLNoteNodeStyle nodeStyle) {
return new Builder(nodeStyle);
}

public String getBackground() {
return this.background;
}
Expand Down Expand Up @@ -96,6 +100,14 @@ private Builder() {
// Prevent instantiation
}

private Builder(SysMLNoteNodeStyle nodeStyle) {
this.background = nodeStyle.getBackground();
this.borderColor = nodeStyle.getBorderColor();
this.borderSize = nodeStyle.getBorderSize();
this.borderStyle = nodeStyle.getBorderStyle();
this.childrenLayoutStrategy = nodeStyle.getChildrenLayoutStrategy();
}

public Builder background(String background) {
this.background = Objects.requireNonNull(background);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public static Builder newSysMLPackageNodeStyle() {
return new Builder();
}

public static Builder newSysMLPackageNodeStyle(SysMLPackageNodeStyle nodeStyle) {
return new Builder(nodeStyle);
}

public String getBackground() {
return this.background;
}
Expand Down Expand Up @@ -96,6 +100,14 @@ private Builder() {
// Prevent instantiation
}

private Builder(SysMLPackageNodeStyle nodeStyle) {
this.background = nodeStyle.getBackground();
this.borderColor = nodeStyle.getBorderColor();
this.borderSize = nodeStyle.getBorderSize();
this.borderStyle = nodeStyle.getBorderStyle();
this.childrenLayoutStrategy = nodeStyle.getChildrenLayoutStrategy();
}

public Builder background(String background) {
this.background = Objects.requireNonNull(background);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public static Builder newSysMLViewFrameNodeStyle() {
return new Builder();
}

public static Builder newSysMLViewFrameNodeStyle(SysMLViewFrameNodeStyle nodeStyle) {
return new Builder(nodeStyle);
}

public String getBackground() {
return this.background;
}
Expand Down Expand Up @@ -103,6 +107,15 @@ private Builder() {
// Prevent instantiation
}

private Builder(SysMLViewFrameNodeStyle nodeStyle) {
this.background = nodeStyle.getBackground();
this.borderColor = nodeStyle.getBorderColor();
this.borderSize = nodeStyle.getBorderSize();
this.borderStyle = nodeStyle.getBorderStyle();
this.borderRadius = nodeStyle.getBorderRadius();
this.childrenLayoutStrategy = nodeStyle.getChildrenLayoutStrategy();
}

public Builder background(String background) {
this.background = Objects.requireNonNull(background);
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2025 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.syson.application.nodes.dto;

import java.util.UUID;

import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramInput;

/**
* Input for the edition of a SysMLImportedPackage node's appearance.
*
* @author arichard
*/
public record EditSysMLImportedPackageNodeAppearanceInput(UUID id, String editingContextId, String representationId, String nodeId, SysMLImportedPackageNodeAppearanceInput appearance)
implements IDiagramInput {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2025 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.syson.application.nodes.dto;

import java.util.UUID;

import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramInput;

/**
* Input for the edition of a SysMLPackage node's appearance.
*
* @author arichard
*/
public record EditSysMLNoteNodeAppearanceInput(UUID id, String editingContextId, String representationId, String nodeId, SysMLNoteNodeAppearanceInput appearance) implements IDiagramInput {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2025 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.syson.application.nodes.dto;

import java.util.UUID;

import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramInput;

/**
* Input for the edition of a SysMLPackage node's appearance.
*
* @author arichard
*/
public record EditSysMLPackageNodeAppearanceInput(UUID id, String editingContextId, String representationId, String nodeId, SysMLPackageNodeAppearanceInput appearance) implements IDiagramInput {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2025 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.syson.application.nodes.dto;

import java.util.UUID;

import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramInput;

/**
* Input for the edition of a SysMLViewFrame node's appearance.
*
* @author arichard
*/
public record EditSysMLViewFrameNodeAppearanceInput(UUID id, String editingContextId, String representationId, String nodeId, SysMLViewFrameNodeAppearanceInput appearance) implements IDiagramInput {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright (c) 2025 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.syson.application.nodes.dto;

import org.eclipse.sirius.components.diagrams.LineStyle;

/**
* Input for the edition of a SysMLImportedPackage node's appearance.
*
* @author arichard
*/
public record SysMLImportedPackageNodeAppearanceInput(String background, String borderColor, Integer borderSize, LineStyle borderStyle) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright (c) 2025 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.syson.application.nodes.dto;

import org.eclipse.sirius.components.diagrams.LineStyle;

/**
* Input for the edition of a SysMLNote node's appearance.
*
* @author arichard
*/
public record SysMLNoteNodeAppearanceInput(String background, String borderColor, Integer borderSize, LineStyle borderStyle) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright (c) 2025 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.syson.application.nodes.dto;

import org.eclipse.sirius.components.diagrams.LineStyle;

/**
* Input for the edition of a SysMLPackage node's appearance.
*
* @author arichard
*/
public record SysMLPackageNodeAppearanceInput(String background, String borderColor, Integer borderSize, LineStyle borderStyle) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright (c) 2025 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.syson.application.nodes.dto;

import org.eclipse.sirius.components.diagrams.LineStyle;

/**
* Input for the edition of a SysMLViewFrame node's appearance.
*
* @author arichard
*/
public record SysMLViewFrameNodeAppearanceInput(String background, String borderColor, Integer borderSize, LineStyle borderStyle, int borderRadius) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*******************************************************************************
* Copyright (c) 2025 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.syson.application.nodes.graphql;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.Objects;
import java.util.concurrent.CompletableFuture;

import org.eclipse.sirius.components.annotations.spring.graphql.MutationDataFetcher;
import org.eclipse.sirius.components.core.api.IPayload;
import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates;
import org.eclipse.sirius.components.graphql.api.IEditingContextDispatcher;
import org.eclipse.sirius.components.graphql.api.IExceptionWrapper;
import org.eclipse.syson.application.nodes.dto.EditSysMLImportedPackageNodeAppearanceInput;

import graphql.schema.DataFetchingEnvironment;

/**
* The data fetcher used to edit the appearance of a SysMLImportedPackage node.
*
* @author arichard
*/
@MutationDataFetcher(type = "Mutation", field = "editSysMLImportedPackageNodeAppearance")
public class MutationEditSysMLImportedPackageNodeAppearanceDataFetcher implements IDataFetcherWithFieldCoordinates<CompletableFuture<IPayload>> {

private static final String INPUT_ARGUMENT = "input";

private final ObjectMapper objectMapper;

private final IExceptionWrapper exceptionWrapper;

private final IEditingContextDispatcher editingContextDispatcher;

public MutationEditSysMLImportedPackageNodeAppearanceDataFetcher(ObjectMapper objectMapper, IExceptionWrapper exceptionWrapper, IEditingContextDispatcher editingContextDispatcher) {
this.objectMapper = Objects.requireNonNull(objectMapper);
this.exceptionWrapper = Objects.requireNonNull(exceptionWrapper);
this.editingContextDispatcher = Objects.requireNonNull(editingContextDispatcher);
}

@Override
public CompletableFuture<IPayload> get(DataFetchingEnvironment environment) throws Exception {
Object argument = environment.getArgument(INPUT_ARGUMENT);
var input = this.objectMapper.convertValue(argument, EditSysMLImportedPackageNodeAppearanceInput.class);

return this.exceptionWrapper.wrapMono(() -> this.editingContextDispatcher.dispatchMutation(input.editingContextId(), input), input).toFuture();
}
}
Loading
Loading