Skip to content
Open
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 @@ -44,6 +44,7 @@ This fix ensure that imported models containing, for example, a top-level `Libra
A new compartment named _satisfy requirements_ has also been added to `PartDefinition` and `PartUsage` graphical nodes in diagrams.
- https://github.com/eclipse-syson/syson/issues/1762[#1762] [diagrams] Increase the default size of nodes.
- https://github.com/eclipse-syson/syson/issues/1752[#1752] [diagrams] In diagrams, hide the node displayed on the top of the diagram if the candidate compartment is not hidden.
- https://github.com/eclipse-syson/syson/issues/1790[#1790] [explorer] Add a condition to apply filters only to the SysON explorer.

=== New features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@

import org.eclipse.emf.ecore.EObject;
import org.eclipse.sirius.components.collaborative.trees.api.TreeFilter;
import org.eclipse.sirius.components.core.api.IEditingContextSearchService;
import org.eclipse.sirius.components.core.api.IIdentityService;
import org.eclipse.sirius.components.core.api.IObjectSearchService;
import org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService;
import org.eclipse.sirius.components.graphql.tests.ExecuteEditingContextFunctionInput;
import org.eclipse.sirius.components.graphql.tests.ExecuteEditingContextFunctionSuccessPayload;
import org.eclipse.sirius.components.graphql.tests.api.IExecuteEditingContextFunctionRunner;
import org.eclipse.sirius.components.trees.TreeItem;
import org.eclipse.sirius.components.trees.description.TreeDescription;
import org.eclipse.sirius.web.application.views.explorer.ExplorerEventInput;
import org.eclipse.sirius.web.application.views.explorer.services.ExplorerDescriptionProvider;
import org.eclipse.sirius.web.application.views.explorer.services.ExplorerTreeItemContextMenuEntryProvider;
Expand All @@ -56,7 +59,8 @@
import org.eclipse.syson.sysml.Namespace;
import org.eclipse.syson.sysml.OwningMembership;
import org.eclipse.syson.sysml.Package;
import org.eclipse.syson.tree.explorer.filters.SysONTreeFilterProvider;
import org.eclipse.syson.tree.explorer.filters.SysONTreeFilterConstants;
import org.eclipse.syson.tree.explorer.view.SysONTreeFilterProvider;
import org.eclipse.syson.tree.explorer.view.SysONTreeViewDescriptionProvider;
import org.eclipse.syson.tree.explorer.view.menu.context.SysONExplorerTreeItemContextMenuEntryProvider;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -119,6 +123,12 @@ public class SysONExplorerTests extends AbstractIntegrationTests {
@Autowired
private SysONTreeFilterProvider sysonTreeFilterProvider;

@Autowired
private IRepresentationDescriptionSearchService representationDescriptionSearchService;

@Autowired
private IEditingContextSearchService editingContextSearchService;

private List<String> defaultFilters;

private String sysONExplorerTreeDescriptionId;
Expand All @@ -127,7 +137,13 @@ public class SysONExplorerTests extends AbstractIntegrationTests {
public void beforeEach() {
this.sysONExplorerTreeDescriptionId = this.sysonTreeViewDescriptionProvider.getDescriptionId();
this.givenInitialServerState.initialize();
this.defaultFilters = this.sysonTreeFilterProvider.get(null, null).stream()
var optionalEditingContext = this.editingContextSearchService.findById(GeneralViewEmptyTestProjectData.EDITING_CONTEXT);
TreeDescription treeDescription = optionalEditingContext
.flatMap(editingContext -> this.representationDescriptionSearchService.findById(editingContext, this.sysONExplorerTreeDescriptionId))
.filter(TreeDescription.class::isInstance)
.map(TreeDescription.class::cast)
.orElse(null);
this.defaultFilters = this.sysonTreeFilterProvider.get(null, treeDescription).stream()
.filter(TreeFilter::defaultState)
.map(TreeFilter::id)
.toList();
Expand Down Expand Up @@ -298,7 +314,7 @@ public void getExplorerContentWithKerMLAndSysMLExpanded() {
@Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@Test
public void getRootContentWithHideMembershipsAndHideKerMLStandardLibraries() {
List<String> filters = List.of(SysONTreeFilterProvider.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID, SysONTreeFilterProvider.HIDE_KERML_STANDARD_LIBRARIES_TREE_FILTER_ID);
List<String> filters = List.of(SysONTreeFilterConstants.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID, SysONTreeFilterConstants.HIDE_KERML_STANDARD_LIBRARIES_TREE_FILTER_ID);
var explorerRepresentationId = this.representationIdBuilder.buildExplorerRepresentationId(this.sysONExplorerTreeDescriptionId, List.of(GeneralViewEmptyTestProjectData.SemanticIds.MODEL_ID), filters);
var input = new ExplorerEventInput(UUID.randomUUID(), GeneralViewEmptyTestProjectData.EDITING_CONTEXT, explorerRepresentationId);
var flux = this.explorerEventSubscriptionRunner.run(input);
Expand Down Expand Up @@ -389,7 +405,7 @@ public void getContextMenuOfModelAndLibraryDirectories() {
@Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@Test
public void treePathQueryApplyExplorerFilters() {
List<String> filters = List.of(SysONTreeFilterProvider.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID, SysONTreeFilterProvider.HIDE_ROOT_NAMESPACES_ID);
List<String> filters = List.of(SysONTreeFilterConstants.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID, SysONTreeFilterConstants.HIDE_ROOT_NAMESPACES_ID);
var explorerRepresentationId = this.representationIdBuilder.buildExplorerRepresentationId(this.sysONExplorerTreeDescriptionId,
List.of(GeneralViewEmptyTestProjectData.SemanticIds.MODEL_ID, GeneralViewEmptyTestProjectData.SemanticIds.PACKAGE_1_ID), filters);
var input = new ExplorerEventInput(UUID.randomUUID(), GeneralViewEmptyTestProjectData.EDITING_CONTEXT, explorerRepresentationId);
Expand Down Expand Up @@ -438,7 +454,7 @@ public void treePathQueryApplyExplorerFilters() {
@Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@Test
public void treePathQueryInSiriusWebDefaultExplorerDoesNotApplyExplorerFilters() {
List<String> filters = List.of(SysONTreeFilterProvider.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID, SysONTreeFilterProvider.HIDE_ROOT_NAMESPACES_ID);
List<String> filters = List.of(SysONTreeFilterConstants.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID, SysONTreeFilterConstants.HIDE_ROOT_NAMESPACES_ID);
var explorerRepresentationId = this.representationIdBuilder.buildExplorerRepresentationId(ExplorerDescriptionProvider.DESCRIPTION_ID, List.of(GeneralViewEmptyTestProjectData.SemanticIds.MODEL_ID, GeneralViewEmptyTestProjectData.SemanticIds.PACKAGE_1_ID), filters);

var input = new ExplorerEventInput(UUID.randomUUID(), GeneralViewEmptyTestProjectData.EDITING_CONTEXT, explorerRepresentationId);
Expand Down Expand Up @@ -509,7 +525,7 @@ public void treePathQueryInSiriusWebDefaultExplorerDoesNotApplyExplorerFilters()
@Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@Test
public void getExplorerContentWithImportedLibraryContainingOnePackage() {
List<String> filters = List.of(SysONTreeFilterProvider.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
List<String> filters = List.of(SysONTreeFilterConstants.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
var explorerRepresentationId = this.representationIdBuilder.buildExplorerRepresentationId(this.sysONExplorerTreeDescriptionId, List.of(), filters);
var input = new ExplorerEventInput(UUID.randomUUID(), ProjectWithUsedBatmobileLibraryDependencyTestProjectData.EDITING_CONTEXT, explorerRepresentationId);
var flux = this.explorerEventSubscriptionRunner.run(input);
Expand Down Expand Up @@ -538,7 +554,7 @@ public void getExplorerContentWithImportedLibraryContainingOnePackage() {
@Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@Test
public void getExplorerContentWithImportedLibraryContainingPackageAndLibraryPackage() {
List<String> filters = List.of(SysONTreeFilterProvider.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
List<String> filters = List.of(SysONTreeFilterConstants.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
var explorerRepresentationId = this.representationIdBuilder.buildExplorerRepresentationId(this.sysONExplorerTreeDescriptionId, List.of(), filters);
var input = new ExplorerEventInput(UUID.randomUUID(), ProjectWithLibraryDependencyContainingPackageAndLibraryPackageTestProjectData.EDITING_CONTEXT, explorerRepresentationId);
var flux = this.explorerEventSubscriptionRunner.run(input);
Expand Down Expand Up @@ -567,7 +583,7 @@ public void getExplorerContentWithImportedLibraryContainingPackageAndLibraryPack
@Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@Test
public void getExplorerContentWithImportedLibraryContainingLibraryPackage() {
List<String> filters = List.of(SysONTreeFilterProvider.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
List<String> filters = List.of(SysONTreeFilterConstants.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
var explorerRepresentationId = this.representationIdBuilder.buildExplorerRepresentationId(this.sysONExplorerTreeDescriptionId,
List.of(UUID.nameUUIDFromBytes("SysON_Libraries_Directory".getBytes()).toString(), UUID.nameUUIDFromBytes("SysON_User_Libraries_Directory".getBytes()).toString()), filters);
var input = new ExplorerEventInput(UUID.randomUUID(), ProjectWithLibraryDependencyContainingLibraryPackageTestProjectData.EDITING_CONTEXT, explorerRepresentationId);
Expand Down Expand Up @@ -621,7 +637,7 @@ public void getExplorerContentWithImportedLibraryContainingLibraryPackage() {
@Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@Test
public void getExplorerContentWithImportedLibraryContainingCommentAndLibraryPackage() {
List<String> filters = List.of(SysONTreeFilterProvider.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
List<String> filters = List.of(SysONTreeFilterConstants.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
var explorerRepresentationId = this.representationIdBuilder.buildExplorerRepresentationId(this.sysONExplorerTreeDescriptionId,
List.of(UUID.nameUUIDFromBytes("SysON_Libraries_Directory".getBytes()).toString(), UUID.nameUUIDFromBytes("SysON_User_Libraries_Directory".getBytes()).toString()), filters);
var input = new ExplorerEventInput(UUID.randomUUID(), ProjectWithLibraryDependencyContainingCommentAndLibraryPackageTestProjectData.EDITING_CONTEXT, explorerRepresentationId);
Expand Down Expand Up @@ -675,7 +691,7 @@ public void getExplorerContentWithImportedLibraryContainingCommentAndLibraryPack
@Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@Test
public void getExplorerContentOnLibrarySemanticDataWithLibraryPackage() {
List<String> filters = List.of(SysONTreeFilterProvider.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
List<String> filters = List.of(SysONTreeFilterConstants.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
var explorerRepresentationId = this.representationIdBuilder.buildExplorerRepresentationId(this.sysONExplorerTreeDescriptionId,
List.of(), filters);
var input = new ExplorerEventInput(UUID.randomUUID(), ProjectWithLibraryDependencyContainingLibraryPackageTestProjectData.LIBRARY_EDITING_CONTEXT, explorerRepresentationId);
Expand Down Expand Up @@ -703,7 +719,7 @@ public void getExplorerContentOnLibrarySemanticDataWithLibraryPackage() {
@Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@Test
public void getExplorerContentOnLibrarySemanticDataWithPackage() {
List<String> filters = List.of(SysONTreeFilterProvider.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
List<String> filters = List.of(SysONTreeFilterConstants.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
var explorerRepresentationId = this.representationIdBuilder.buildExplorerRepresentationId(this.sysONExplorerTreeDescriptionId,
List.of(), filters);
var input = new ExplorerEventInput(UUID.randomUUID(), ProjectWithLibraryDependencyContainingPackageAndLibraryPackageTestProjectData.LIBRARY_EDITING_CONTEXT, explorerRepresentationId);
Expand Down Expand Up @@ -736,7 +752,7 @@ public void sysONExplorerTreeItemContextMenuEntriesTest() {
GeneralViewEmptyTestProjectData.SemanticIds.PACKAGE_1_ID,
GeneralViewEmptyTestProjectData.SemanticIds.VIEW_USAGE_ID);

List<String> filters = List.of(SysONTreeFilterProvider.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);
List<String> filters = List.of(SysONTreeFilterConstants.HIDE_MEMBERSHIPS_TREE_ITEM_FILTER_ID);

var explorerRepresentationId = this.representationIdBuilder.buildExplorerRepresentationId(this.sysONExplorerTreeDescriptionId, expandedItemIds, filters);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
import org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramEventInput;
import org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramRefreshedEventPayload;
import org.eclipse.sirius.components.collaborative.trees.api.TreeFilter;
import org.eclipse.sirius.components.core.api.IEditingContextSearchService;
import org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService;
import org.eclipse.sirius.components.diagrams.tests.navigation.DiagramNavigator;
import org.eclipse.sirius.components.trees.TreeItem;
import org.eclipse.sirius.components.trees.description.TreeDescription;
import org.eclipse.sirius.components.view.emf.diagram.IDiagramIdProvider;
import org.eclipse.sirius.web.application.views.explorer.ExplorerEventInput;
import org.eclipse.sirius.web.tests.services.api.IGivenCommittedTransaction;
Expand All @@ -43,7 +46,7 @@
import org.eclipse.syson.standard.diagrams.view.SDVDescriptionNameGenerator;
import org.eclipse.syson.sysml.SysmlPackage;
import org.eclipse.syson.sysml.helper.LabelConstants;
import org.eclipse.syson.tree.explorer.filters.SysONTreeFilterProvider;
import org.eclipse.syson.tree.explorer.view.SysONTreeFilterProvider;
import org.eclipse.syson.tree.explorer.view.SysONTreeViewDescriptionProvider;
import org.eclipse.syson.util.IDescriptionNameGenerator;
import org.eclipse.syson.util.SysONRepresentationDescriptionIdentifiers;
Expand Down Expand Up @@ -98,6 +101,12 @@ public class GVViewAsOnNodeTests extends AbstractIntegrationTests {
@Autowired
private SysONTreeFilterProvider sysonTreeFilterProvider;

@Autowired
private IRepresentationDescriptionSearchService representationDescriptionSearchService;

@Autowired
private IEditingContextSearchService editingContextSearchService;

private final IDescriptionNameGenerator descriptionNameGenerator = new SDVDescriptionNameGenerator();

private Flux<DiagramRefreshedEventPayload> givenSubscriptionToDiagram() {
Expand Down Expand Up @@ -178,7 +187,13 @@ public void testViewAsIVOnPartUsage() {

// the explorer view has a new ViewUsage with a diagram
var sysONExplorerTreeDescriptionId = this.sysonTreeViewDescriptionProvider.getDescriptionId();
var defaultFilters = this.sysonTreeFilterProvider.get(null, null).stream()
var optionalEditingContext = this.editingContextSearchService.findById(ViewAsOnNodeTestProjectData.EDITING_CONTEXT_ID);
TreeDescription treeDescription = optionalEditingContext
.flatMap(editingContext -> this.representationDescriptionSearchService.findById(editingContext, sysONExplorerTreeDescriptionId))
.filter(TreeDescription.class::isInstance)
.map(TreeDescription.class::cast)
.orElse(null);
var defaultFilters = this.sysonTreeFilterProvider.get(null, treeDescription).stream()
.filter(TreeFilter::defaultState)
.map(TreeFilter::id)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
import org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramEventInput;
import org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramRefreshedEventPayload;
import org.eclipse.sirius.components.collaborative.trees.api.TreeFilter;
import org.eclipse.sirius.components.core.api.IEditingContextSearchService;
import org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService;
import org.eclipse.sirius.components.diagrams.Diagram;
import org.eclipse.sirius.components.diagrams.tests.navigation.DiagramNavigator;
import org.eclipse.sirius.components.trees.TreeItem;
import org.eclipse.sirius.components.trees.description.TreeDescription;
import org.eclipse.sirius.components.view.diagram.DiagramDescription;
import org.eclipse.sirius.components.view.emf.diagram.IDiagramIdProvider;
import org.eclipse.sirius.web.application.views.explorer.ExplorerEventInput;
Expand All @@ -53,7 +56,7 @@
import org.eclipse.syson.standard.diagrams.view.SDVDescriptionNameGenerator;
import org.eclipse.syson.sysml.SysmlPackage;
import org.eclipse.syson.sysml.helper.LabelConstants;
import org.eclipse.syson.tree.explorer.filters.SysONTreeFilterProvider;
import org.eclipse.syson.tree.explorer.view.SysONTreeFilterProvider;
import org.eclipse.syson.tree.explorer.view.SysONTreeViewDescriptionProvider;
import org.eclipse.syson.util.IDescriptionNameGenerator;
import org.eclipse.syson.util.SysONRepresentationDescriptionIdentifiers;
Expand Down Expand Up @@ -131,6 +134,12 @@ public class GVViewUsageTests extends AbstractIntegrationTests {
@Autowired
private ExpandAllTreeItemTester expandAllTreeItemTester;

@Autowired
private IRepresentationDescriptionSearchService representationDescriptionSearchService;

@Autowired
private IEditingContextSearchService editingContextSearchService;

private DiagramDescriptionIdProvider diagramDescriptionIdProvider;

private StepVerifier.Step<DiagramRefreshedEventPayload> verifier;
Expand Down Expand Up @@ -197,7 +206,13 @@ public void setUp() {
this.diagramDescriptionIdProvider = new DiagramDescriptionIdProvider(this.diagramDescription, this.diagramIdProvider);

this.sysONExplorerTreeDescriptionId = this.sysonTreeViewDescriptionProvider.getDescriptionId();
this.defaultFilters = this.sysonTreeFilterProvider.get(null, null).stream()
var optionalEditingContext = this.editingContextSearchService.findById(GeneralViewViewTestProjectData.EDITING_CONTEXT_ID);
TreeDescription treeDescription = optionalEditingContext
.flatMap(editingContext -> this.representationDescriptionSearchService.findById(editingContext, this.sysONExplorerTreeDescriptionId))
.filter(TreeDescription.class::isInstance)
.map(TreeDescription.class::cast)
.orElse(null);
this.defaultFilters = this.sysonTreeFilterProvider.get(null, treeDescription).stream()
.filter(TreeFilter::defaultState)
.map(TreeFilter::id)
.toList();
Expand Down
Loading
Loading