-
Notifications
You must be signed in to change notification settings - Fork 92
[2250] Leverage the selection dialog to improve the assume and require constraints #2253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
156 changes: 148 additions & 8 deletions
156
...yson/application/controllers/diagrams/general/view/GVSubNodeRequirementCreationTests.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...lipse/syson/diagram/common/view/nodes/AssumeConstraintCompartmentItemNodeDescription.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 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 | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Obeo - initial API and implementation | ||
| *******************************************************************************/ | ||
| package org.eclipse.syson.diagram.common.view.nodes; | ||
|
|
||
| import org.eclipse.emf.ecore.EClass; | ||
| import org.eclipse.emf.ecore.EReference; | ||
| import org.eclipse.sirius.components.view.builder.providers.IColorProvider; | ||
| import org.eclipse.syson.sysml.SysmlPackage; | ||
| import org.eclipse.syson.util.IDescriptionNameGenerator; | ||
| import org.eclipse.syson.util.SysMLMetamodelHelper; | ||
|
|
||
| /** | ||
| * Used to create a {@link org.eclipse.syson.sysml.ConstraintUsage} compartment item node description. | ||
| * <p> | ||
| * {@link org.eclipse.syson.sysml.ConstraintUsage} compartment items have to be contained in a {@link org.eclipse.syson.sysml.RequirementConstraintMembership} with {@link org.eclipse.syson.sysml.RequirementConstraintKind#ASSUMPTION}. | ||
| * </p> | ||
| * @author gcoutable | ||
| */ | ||
| public class AssumeConstraintCompartmentItemNodeDescription extends CompartmentItemNodeDescriptionProvider { | ||
| public static final String COMPARTMENT_ITEM_NAME = " assume constraint"; | ||
|
|
||
| public AssumeConstraintCompartmentItemNodeDescription(EClass eClass, EReference eReference, IColorProvider colorProvider, IDescriptionNameGenerator descriptionNameGenerator) { | ||
| super(eClass, eReference, colorProvider, descriptionNameGenerator); | ||
| } | ||
|
|
||
| @Override | ||
| protected String getDomainType() { | ||
| return SysMLMetamodelHelper.buildQualifiedName(SysmlPackage.eINSTANCE.getElement()); | ||
| } | ||
|
|
||
| @Override | ||
| protected String getName() { | ||
| return super.getName() + COMPARTMENT_ITEM_NAME; | ||
| } | ||
| } |
68 changes: 68 additions & 0 deletions
68
...g/eclipse/syson/diagram/common/view/nodes/AssumeConstraintCompartmentNodeDescription.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 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 | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Obeo - initial API and implementation | ||
| *******************************************************************************/ | ||
| package org.eclipse.syson.diagram.common.view.nodes; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import org.eclipse.emf.ecore.EClass; | ||
| import org.eclipse.emf.ecore.EReference; | ||
| import org.eclipse.sirius.components.view.builder.IViewDiagramElementFinder; | ||
| import org.eclipse.sirius.components.view.builder.providers.IColorProvider; | ||
| import org.eclipse.sirius.components.view.builder.providers.INodeToolProvider; | ||
| import org.eclipse.sirius.components.view.diagram.DiagramDescription; | ||
| import org.eclipse.sirius.components.view.diagram.NodeDescription; | ||
| import org.eclipse.syson.diagram.common.view.tools.AssumeConstraintNodeToolProvider; | ||
| import org.eclipse.syson.util.IDescriptionNameGenerator; | ||
|
|
||
| /** | ||
| * Compartment node allowing to display {@link org.eclipse.syson.sysml.ConstraintUsage} owned by a {@link org.eclipse.syson.sysml.RequirementConstraintMembership} with {@link org.eclipse.syson.sysml.RequirementConstraintKind#ASSUMPTION}. | ||
| * | ||
| * @author gcoutable | ||
| */ | ||
| public class AssumeConstraintCompartmentNodeDescription extends AbstractCompartmentNodeDescriptionProvider { | ||
|
|
||
| public static final String COMPARTMENT_NAME = " assume"; | ||
|
|
||
| public AssumeConstraintCompartmentNodeDescription(EClass eClass, EReference eReference, IColorProvider colorProvider, IDescriptionNameGenerator descriptionNameGenerator) { | ||
| super(eClass, eReference, colorProvider, descriptionNameGenerator); | ||
| } | ||
|
|
||
| @Override | ||
| protected String getCompartmentName() { | ||
| return this.getDescriptionNameGenerator().getCompartmentName(this.eClass, this.eReference) + COMPARTMENT_NAME; | ||
| } | ||
|
|
||
| @Override | ||
| protected String getCustomCompartmentLabel() { | ||
| return "assume constraints"; | ||
| } | ||
|
|
||
| @Override | ||
| public void link(DiagramDescription diagramDescription, IViewDiagramElementFinder cache) { | ||
| cache.getNodeDescription(this.getCompartmentName()).ifPresent(nodeDescription -> { | ||
| cache.getNodeDescription(this.getDescriptionNameGenerator().getCompartmentItemName(this.eClass, this.eReference) + AssumeConstraintCompartmentItemNodeDescription.COMPARTMENT_ITEM_NAME) | ||
| .ifPresent(itemNodeDescription -> nodeDescription.getChildrenDescriptions().add(itemNodeDescription)); | ||
| nodeDescription.setPalette(this.createCompartmentPalette(cache)); | ||
| }); | ||
| } | ||
|
|
||
| @Override | ||
| protected List<INodeToolProvider> getItemCreationToolProviders() { | ||
| return List.of(new AssumeConstraintNodeToolProvider()); | ||
| } | ||
|
|
||
| @Override | ||
| protected List<NodeDescription> getDroppableNodes(IViewDiagramElementFinder cache) { | ||
| return List.of(); | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
...ipse/syson/diagram/common/view/nodes/RequireConstraintCompartmentItemNodeDescription.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 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 | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Obeo - initial API and implementation | ||
| *******************************************************************************/ | ||
| package org.eclipse.syson.diagram.common.view.nodes; | ||
|
|
||
| import org.eclipse.emf.ecore.EClass; | ||
| import org.eclipse.emf.ecore.EReference; | ||
| import org.eclipse.sirius.components.view.builder.providers.IColorProvider; | ||
| import org.eclipse.syson.sysml.SysmlPackage; | ||
| import org.eclipse.syson.util.IDescriptionNameGenerator; | ||
| import org.eclipse.syson.util.SysMLMetamodelHelper; | ||
|
|
||
| /** | ||
| * Used to create a {@link org.eclipse.syson.sysml.ConstraintUsage} compartment item node description. | ||
| * <p> | ||
| * {@link org.eclipse.syson.sysml.ConstraintUsage} compartment items have to be contained in a {@link org.eclipse.syson.sysml.RequirementConstraintMembership} with {@link org.eclipse.syson.sysml.RequirementConstraintKind#REQUIREMENT}. | ||
| * </p> | ||
| * @author gcoutable | ||
| */ | ||
| public class RequireConstraintCompartmentItemNodeDescription extends CompartmentItemNodeDescriptionProvider { | ||
| public static final String COMPARTMENT_ITEM_NAME = " require constraint"; | ||
|
|
||
| public RequireConstraintCompartmentItemNodeDescription(EClass eClass, EReference eReference, IColorProvider colorProvider, IDescriptionNameGenerator descriptionNameGenerator) { | ||
| super(eClass, eReference, colorProvider, descriptionNameGenerator); | ||
| } | ||
|
|
||
| @Override | ||
| protected String getDomainType() { | ||
| return SysMLMetamodelHelper.buildQualifiedName(SysmlPackage.eINSTANCE.getElement()); | ||
| } | ||
|
|
||
| @Override | ||
| protected String getName() { | ||
| return super.getName() + COMPARTMENT_ITEM_NAME; | ||
| } | ||
| } |
68 changes: 68 additions & 0 deletions
68
.../eclipse/syson/diagram/common/view/nodes/RequireConstraintCompartmentNodeDescription.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 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 | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Obeo - initial API and implementation | ||
| *******************************************************************************/ | ||
| package org.eclipse.syson.diagram.common.view.nodes; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import org.eclipse.emf.ecore.EClass; | ||
| import org.eclipse.emf.ecore.EReference; | ||
| import org.eclipse.sirius.components.view.builder.IViewDiagramElementFinder; | ||
| import org.eclipse.sirius.components.view.builder.providers.IColorProvider; | ||
| import org.eclipse.sirius.components.view.builder.providers.INodeToolProvider; | ||
| import org.eclipse.sirius.components.view.diagram.DiagramDescription; | ||
| import org.eclipse.sirius.components.view.diagram.NodeDescription; | ||
| import org.eclipse.syson.diagram.common.view.tools.RequireConstraintNodeToolProvider; | ||
| import org.eclipse.syson.util.IDescriptionNameGenerator; | ||
|
|
||
| /** | ||
| * Compartment node allowing to display {@link org.eclipse.syson.sysml.ConstraintUsage} owned by a {@link org.eclipse.syson.sysml.RequirementConstraintMembership} with {@link org.eclipse.syson.sysml.RequirementConstraintKind#REQUIREMENT}. | ||
| * | ||
| * @author gcoutable | ||
| */ | ||
| public class RequireConstraintCompartmentNodeDescription extends AbstractCompartmentNodeDescriptionProvider { | ||
|
|
||
| public static final String COMPARTMENT_NAME = " require"; | ||
|
|
||
| public RequireConstraintCompartmentNodeDescription(EClass eClass, EReference eReference, IColorProvider colorProvider, IDescriptionNameGenerator descriptionNameGenerator) { | ||
| super(eClass, eReference, colorProvider, descriptionNameGenerator); | ||
| } | ||
|
|
||
| @Override | ||
| protected String getCompartmentName() { | ||
| return this.getDescriptionNameGenerator().getCompartmentName(this.eClass, this.eReference) + COMPARTMENT_NAME; | ||
| } | ||
|
|
||
| @Override | ||
| protected String getCustomCompartmentLabel() { | ||
| return "require constraints"; | ||
| } | ||
|
|
||
| @Override | ||
| public void link(DiagramDescription diagramDescription, IViewDiagramElementFinder cache) { | ||
| cache.getNodeDescription(this.getCompartmentName()).ifPresent(nodeDescription -> { | ||
| cache.getNodeDescription(this.getDescriptionNameGenerator().getCompartmentItemName(this.eClass, this.eReference) + RequireConstraintCompartmentItemNodeDescription.COMPARTMENT_ITEM_NAME) | ||
| .ifPresent(itemNodeDescription -> nodeDescription.getChildrenDescriptions().add(itemNodeDescription)); | ||
| nodeDescription.setPalette(this.createCompartmentPalette(cache)); | ||
| }); | ||
| } | ||
|
|
||
| @Override | ||
| protected List<INodeToolProvider> getItemCreationToolProviders() { | ||
| return List.of(new RequireConstraintNodeToolProvider()); | ||
| } | ||
|
|
||
| @Override | ||
| protected List<NodeDescription> getDroppableNodes(IViewDiagramElementFinder cache) { | ||
| return List.of(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.