Skip to content

[2467] Add connected elements tool to the General View - #2496

Open
AxelRICHARD wants to merge 3 commits into
cooldownfrom
cbr/enh/addreferenced
Open

[2467] Add connected elements tool to the General View#2496
AxelRICHARD wants to merge 3 commits into
cooldownfrom
cbr/enh/addreferenced

Conversation

@AxelRICHARD

@AxelRICHARD AxelRICHARD commented Aug 31, 2026

Copy link
Copy Markdown
Member

Expose existing elements connected to the selected element through both inbound and outbound General View relationships.

Add the tool icon and integration coverage.

Bug: #2467

PLEASE READ ALL ITEMS AND CHECK ONLY RELEVANT CHECKBOXES BELOW

Auto review

  • Have you reviewed this PR? Please do a first quick review, It is very useful to detect typos and missing copyrights, check comments, check your code... The reviewer will thank you for that :)

Project management

  • Has the pull request been added to the relevant milestone?
  • Have the priority: and pr: labels been added to the pull request? (In case of doubt, start with the labels priority: low and pr: to review later)
  • Have the relevant issues been added to the pull request?
  • Have the relevant labels been added to the issues? (area:, type:)
  • Have the relevant issues been added to the same project milestone as the pull request?

Changelog and release notes

  • Has the CHANGELOG.adoc + doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc been updated to reference the relevant issues?
  • Have the relevant API breaks been described in the CHANGELOG.adoc?
  • Are the new / upgraded dependencies mentioned in the relevant section of the CHANGELOG.adoc?
  • In case of a change with a visual impact, are there any screenshots in the doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?
  • In case of a key change, has the change been added to Key highlights section in doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?

Documentation

  • Have you included an update of the documentation in your pull request? Please ask yourself if an update (installation manual, user manual, developer manual...) is needed and add one accordingly.

Tests

  • Is the code properly tested? Any pull request (fix, enhancement or new feature) should come with a test (or several). It could be unit tests, integration tests or cypress tests depending on the context. Only doc and releng pull request do not need for tests.

Expose existing elements connected to the selected element through both
inbound and outbound General View relationships.

Add the tool icon and integration coverage.

Bug: #2467
Signed-off-by: Cedric Brun <cedric.brun@obeo.fr>
@cbrun
cbrun force-pushed the cbr/enh/addreferenced branch from 51dcaf9 to f4d7a9c Compare September 1, 2026 13:18
/**
* Tests for {@link DiagramMutationExposeService}.
*
* @author arichard

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@author cbrun

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: changed the author to cbrun.

return element;
}

/** Adds every project element connected to the given element to the current view. */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add full javadoc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added full Javadoc, including the parameters and return value, and updated it to reflect the selection-based filtering.

return element;
}

private Set<Element> getConnectedElements(Element element, ResourceSet resourceSet) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add full javadoc here and on every new method you introduced

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Javadoc to the helper methods introduced here, documenting connected-element discovery, project-resource filtering, parameters and return values.

return resource != null && resourceSet.getResources().contains(resource) && !ElementUtil.isStandardLibraryResource(resource);
}

private EdgeEndpoints getGeneralViewEdgeEndpoints(Element candidate) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an EMF Switch in a dedicated class would be more suitable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I extracted the endpoint resolution into GeneralViewEdgeEndpointsSwitch, extending SysmlSwitch, with dedicated tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update the javadoc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the Javadoc to include the connected-elements tool, for both the single-selection and multi-selection sections.

.build();
var builder = this.diagramBuilderHelper.newNodeToolSection().name("Related Elements");
if (nested) {
builder.nodeTools(this.addExistingElementsTool(false, true), this.addExistingElementsTool(true, true), this.addExistingConnectedElementsTool());

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you add your tool only if nested is true?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, that restriction was unnecessary. The tool is now included for both values of nested, making it available from compartments as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add it here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it to the multi-selection section too. The operation collects connected candidates for the whole selection and filters them before exposing anything, so the result does not depend on selection order.

@cbrun cbrun self-assigned this Sep 7, 2026
Extract edge endpoint resolution into an EMF switch and document the
new methods. Enable the tool for compartments and multiple selections.

Bug: #2467
Signed-off-by: Cedric Brun <cedric.brun@obeo.fr>
@cbrun
cbrun force-pushed the cbr/enh/addreferenced branch from 172ea3d to b9b655a Compare September 8, 2026 15:19
@cbrun

cbrun commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Following our discussion, the tool now excludes connected elements that can be represented as ports or inside a compartment/container of any selected node, even when the compartment is hidden. This uses the node descriptions rather than a blacklist of semantic types. Independent connected elements are still exposed, and existing representations are preserved.

Added unit and integration coverage, including single and multiple selections. The local build passes, and all coverage thresholds are met.

Filter candidates against all selected nodes before exposure,
including hidden compartments and border node representations.

Bug: #2467
Signed-off-by: Cedric Brun <cedric.brun@obeo.fr>
@cbrun
cbrun force-pushed the cbr/enh/addreferenced branch from b9b655a to 82e117e Compare September 8, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add existing connected elements to a General View

2 participants