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
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Stakeholders are by default represented with a dedicated graphical node connecte
- https://github.com/eclipse-syson/syson/issues/2111[#2111] [diagrams] Leverage the latest change of the selection dialog to allow creating a `Stakeholder` graphical node without specialization.
- https://github.com/eclipse-syson/syson/issues/2122[#2122] [diagrams] Leverage the latest change of the selection dialog to allow creating a `Subject` graphical node without specialization.
- https://github.com/eclipse-syson/syson/issues/2129[#2129] [diagrams] Leverage the latest change of the selection dialog to allow creating a `FlowUsage` from a `ConnectionUsage` without selection a `PayloadFeature`
- https://github.com/eclipse-syson/syson/issues/2105[#2105] [explorer] In the _Explorer_ view, `Expression` elements now display their full textual representation.

=== New features

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* Copyright (c) 2025, 2026 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
Expand Down Expand Up @@ -42,6 +42,8 @@ public static final class GraphicalIds {
*/
public static final class SemanticIds {

public static final String DOCUMENT_ID = "26a78eef-bfa1-4de0-9d0a-c1f86a1b97d5";

public static final String PACKAGE_1_ID = "2264f62c-b223-4b9b-ae41-96dc2ba0070e";

public static final String A0_ID = "82a2fa10-e736-4c3e-b27a-e94f76d7456d";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ public static <T extends EObject> List<T> getAncestors(Class<T> type, EObject ob
*/
public static <T extends EObject> Optional<T> getFirstAncestor(Class<T> type, EObject object, Predicate<EObject> ancestorPredicate) {
var current = object;
List<T> results = new ArrayList<>();
while (current != null) {
if (type.isInstance(current) && (ancestorPredicate == null || ancestorPredicate.test(current))) {
return Optional.of((T) current);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.eclipse.syson.sysml.ReferenceUsage;
import org.eclipse.syson.sysml.StakeholderMembership;
import org.eclipse.syson.sysml.SubjectMembership;
import org.eclipse.syson.sysml.Usage;

/**
* Element-related services doing queries. This class should not depend on sirius-web services or other spring services.
Expand Down Expand Up @@ -78,6 +79,19 @@ public boolean isStakeholder(Element element) {
return element instanceof PartUsage && element.getOwningMembership() instanceof StakeholderMembership;
}

/**
* Check if a given {@code element} is an {@link Expression} definition. We can not simply rely on whether the
* element is an instance of {@link Expression} as many types in SysMLv2 inherit from this type without being
* themselves an actual expressions.
*
* @param element
* the element to test.
* @return true if the element is an actual expression definition.
*/
public boolean isExpressionDefinition(Element element) {
return element instanceof Expression && !(element instanceof Usage);
}

/**
* Get the source of a {@link Connector}.
*
Expand Down Expand Up @@ -144,7 +158,7 @@ public <T extends Element> Optional<T> getCommonOwnerAncestor(Element e1, Elemen
* Gets the value expression of a feature (Value of the FeatureValue owned by this feature).
*
* @param feature
* a non null feature
* a non null feature
* @return an optional expression
*/
public Optional<Expression> getValueExpression(Feature feature) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@
import org.eclipse.sirius.web.domain.boundedcontexts.representationdata.RepresentationMetadata;
import org.eclipse.sirius.web.domain.boundedcontexts.representationdata.services.api.IRepresentationMetadataSearchService;
import org.eclipse.syson.sysml.Element;
import org.eclipse.syson.sysml.Expression;
import org.eclipse.syson.sysml.Type;
import org.eclipse.syson.sysml.ViewUsage;
import org.eclipse.syson.sysml.metamodel.services.MetamodelQueryElementService;
import org.eclipse.syson.sysml.textual.SysMLElementSerializer;
import org.eclipse.syson.sysml.textual.SysMLSerializingOptions;
import org.eclipse.syson.sysml.textual.utils.FileNameDeresolver;
import org.eclipse.syson.sysml.util.ElementUtil;
import org.eclipse.syson.tree.explorer.fragments.KerMLStandardLibraryDirectory;
import org.eclipse.syson.tree.explorer.fragments.LibrariesDirectory;
Expand Down Expand Up @@ -74,6 +79,8 @@ public class SysONDefaultExplorerServices implements ISysONDefaultExplorerServic

private final IReadOnlyObjectPredicate readOnlyObjectPredicate;

private final MetamodelQueryElementService metamodelQueryElementService;

public SysONDefaultExplorerServices(IIdentityService identityService, IContentService contentService, IRepresentationMetadataSearchService representationMetadataSearchService,
IExplorerServices explorerServices, ILabelService labelService, ISysONExplorerFilterService filterService, final IReadOnlyObjectPredicate readOnlyObjectPredicate) {
this.identityService = Objects.requireNonNull(identityService);
Expand All @@ -83,6 +90,7 @@ public SysONDefaultExplorerServices(IIdentityService identityService, IContentSe
this.labelService = Objects.requireNonNull(labelService);
this.filterService = Objects.requireNonNull(filterService);
this.readOnlyObjectPredicate = Objects.requireNonNull(readOnlyObjectPredicate);
this.metamodelQueryElementService = new MetamodelQueryElementService();
}

@Override
Expand Down Expand Up @@ -148,6 +156,8 @@ public String getLabel(Object self) {
String label = "";
if (self instanceof ISysONExplorerFragment fragment) {
label = fragment.getLabel();
} else if (self instanceof Expression expression && this.metamodelQueryElementService.isExpressionDefinition(expression)) {
label = this.getValueExpressionTextualRepresentation(expression);
} else if (self instanceof Type type) {
String name = type.getName();
if (name != null) {
Expand All @@ -159,6 +169,25 @@ public String getLabel(Object self) {
return label;
}

private String getValueExpressionTextualRepresentation(Expression value) {
String result = "";
if (value != null) {
SysMLSerializingOptions options = new SysMLSerializingOptions.Builder()
.lineSeparator("\n")
.nameDeresolver(new FileNameDeresolver())
.indentation("\t")
.needEscapeCharacter(false)
.build();
String textualFormat = new SysMLElementSerializer(options, s -> {
// Do nothing for now
}).doSwitch(value);
if (textualFormat != null) {
result = textualFormat;
}
}
return result;
}

private String getFallbackLabel(Object self) {
StyledString styledLabel = this.labelService.getStyledLabel(self);
if (styledLabel != null) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ image::release-notes-stakeholder-node.png[Default representation of Stakeholder
** Improve the tool to create a `Subject` graphical node by making specialization selection optional.
** Improve the tool to create a `FlowUsage` from a `ConnectionUsage` by making the payload selection optional.

* In the _Explorer_ view:

** `Expression` elements now display their full textual representation:
+
image::explorer-expression-text.png[Expression textual representation]

== Technical details

* For technical details on this {product} release (including breaking changes), please refer to https://github.com/eclipse-syson/syson/blob/main/CHANGELOG.adoc[changelog].
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { Theme } from '@mui/material/styles';
import TextField from '@mui/material/TextField';
import { useEffect, useState } from 'react';
import { makeStyles } from 'tss-react/mui';

import { InsertTextualSysMLv2ModalProps, InsertTextualSysMLv2ModalState } from './InsertTextualSysMLv2Modal.types';
import { NewObjectAsTextReport } from './NewObjectAsTextDocumentReport';
import { useInsertTextualSysMLv2 } from './useInsertTextualSysMLv2';
Expand Down Expand Up @@ -106,7 +105,7 @@ export const InsertTextualSysMLv2Modal = ({ editingContextId, item, onClose }: I
onClick={(event) => onInsertTextualSysMLv2(event)}
startIcon={
state.insertInProgress ? (
<CircularProgress size="20px" data-testid="arrange-all-circular-loading" />
<CircularProgress size="20px" data-testid="create-objects-circular-loading" />
) : (
<PublishIcon />
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* Copyright (c) 2025, 2026 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
Expand All @@ -19,7 +19,7 @@ import {
GQLInsertTextualSysMLv2MutationData,
GQLInsertTextualSysMLv2Payload,
UseInsertTextualSysMLv2Value,
} from './useInsertTextualSysML.v2types';
} from './useInsertTextualSysMLv2.types';

const insertTextualSysMLv2Mutation = gql`
mutation insertTextualSysMLv2($input: InsertTextualSysMLv2Input!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2024, 2025 Obeo.
* Copyright (c) 2024, 2026 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
Expand Down
6 changes: 3 additions & 3 deletions scripts/check-coverage.jsh
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ var moduleCoverageData = List.of(
new ModuleCoverage("syson-form-services", 100.0),
new ModuleCoverage("syson-model-services", 94.0),
new ModuleCoverage("syson-representation-services", 100.0),
new ModuleCoverage("syson-services", 64.0),
new ModuleCoverage("syson-services", 65.0),
new ModuleCoverage("syson-siriusweb-customnodes-metamodel", 41.0),
new ModuleCoverage("syson-siriusweb-customnodes-metamodel-edit", 0.0),
new ModuleCoverage("syson-standard-diagrams-view", 97.0),
new ModuleCoverage("syson-sysml-export", 71.0),
new ModuleCoverage("syson-sysml-import", 85.0),
new ModuleCoverage("syson-sysml-metamodel", 76.0),
new ModuleCoverage("syson-sysml-metamodel", 77.0),
new ModuleCoverage("syson-sysml-metamodel-edit", 17.0),
new ModuleCoverage("syson-sysml-metamodel-services", 92.0),
new ModuleCoverage("syson-sysml-rest-api-services", 93.0),
new ModuleCoverage("syson-sysml-validation", 97.0),
new ModuleCoverage("syson-table-requirements-view", 72.0),
new ModuleCoverage("syson-table-requirements-view", 73.0),
new ModuleCoverage("syson-table-services", 100.0),
new ModuleCoverage("syson-tree-explorer-view", 88.0),
new ModuleCoverage("syson-tree-services", 80.0)
Expand Down
Loading