Skip to content

[2469] Add a selection dialog to New Reference tools - #2504

Open
jerome-obeo wants to merge 1 commit into
eclipse-syson:cooldownfrom
jerome-obeo:jgo/enh/add_selection_dialog_in_new_reference
Open

[2469] Add a selection dialog to New Reference tools#2504
jerome-obeo wants to merge 1 commit into
eclipse-syson:cooldownfrom
jerome-obeo:jgo/enh/add_selection_dialog_in_new_reference

Conversation

@jerome-obeo

Copy link
Copy Markdown
Contributor

New Reference tools have a selection dialog.
This allows to select a Usage that the new ReferenceUsage references. The tools are also able to create an empty ReferenceUsage.

Bug: #2469

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.

owner.getOwnedRelationship().add(membership);
new ElementInitializerSwitch().doSwitch(newReferenceUsage);
if (referencedUsage != null) {
var refSubsetting = SysmlFactory.eINSTANCE.createReferenceSubsetting();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you sure that ReferenceSubsetting is the appropriate type to create here? Why not a Redefinition for example, or a Subsetting? Please explain.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The fact that we want to create a reference to another element is brought by the RerferenceSubsetting relationship.
It is equivalent to :

part def MyPart;
part p : MyPart;
ref myPart ::> p;

::> is the operator for references.

ReferenceSubsetting defines a referencedFeature which seems appropriate to get the referenced element.

I found this in : 8.3.3.3.9 ReferenceSubsetting of the KerML specification.

return "/icons/full/obj16/ReferenceUsage.svg";
}

protected SelectionDialogDescription getSelectionDialogDescription() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why there is no @OverRide annotation?

.isSelectableExpression(AQLConstants.AQL_SELF + ".oclIsKindOf(" + domainType + ")")
.build();

return this.diagramBuilderHelper.newSelectionDialogDescription()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This dialog should also allow Definition candidates, like ActorCompartmentNodeToolProvider for example.
When Usage is selected, then a ReferenceSubsetting/Definition/Subsetting (I don't know which one, see my other comment) is created, when Definition is selected, then a FeatureTyping is created.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought allowing to reference a type in a ReferenceUsage creation tool may be confusing for user.
If we allow user to select a Classifier instead of a Feature, and use this selected element to set the FeatureTyping relation of the new ReferenceUsage as it is done for Actor.

This will be equivalent to:

ref newRefUsage : theSelectedDefinition;

But we are not really doing a reference.

This is the reason, I strictly narrowed the selection dialog to Usage.

Do you prefer I allow Definition to be selected in the ReferenceUsage creation tool to type the new element with the given Definition?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,118 @@
/*******************************************************************************

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it possible to merge this ToolProvider with ReferenceUsageCompartmentNodeToolProvider.java?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I merged the dialog, but I keep two tools due to difference between both operations.

SysmlPackage.eINSTANCE.getPortUsage(),
SysmlPackage.eINSTANCE.getPortDefinition(),
SysmlPackage.eINSTANCE.getReferenceUsage()
SysmlPackage.eINSTANCE.getPortDefinition()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did you remove SysmlPackage.eINSTANCE.getReferenceUsage() here? Why did you not modified SDVNodeDescriptionProviderSwitch instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is not a matter of getting the correct node description provider, it is about controlling the diagram ReferenceUsage creation tool.
In SDVDiagramDescriptionProvider#createToolSections we go through all sections and for each element of those sections, we create a generic creation tool (via SDVDiagramDescriptionProvider#getCreationToolsForElement)
This is not the tool we want, we want a dedicated one with a selection dialog.
The only way I've found to avoid this generic tool to be used was to remove the ReferenceUsage eClass from the Structure tools section.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As I said, did you try to modify SDVNodeDescriptionProviderSwitch? It seems strange that in that file the caseReferenceUsage has not been modified by your PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, I did not try because the default UsageNodeDescriptionProvider works fine for ReferenceUsage nodes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok I see now, indeed, my interrogation was wrong


== New features

** `New Reference` tools have a selection dialog.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add section if you are the first, in your case it should be:

* In diagrams:

** `New Reference` tools have a selection dialog.
...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

== New features

** `New Reference` tools have a selection dialog.
This allows to select a `Usage` that the new `ReferenceUsage` references.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Update with Usage or Definition

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

New Reference tools have a selection dialog.
This allows to select an Element that the new ReferenceUsage uses.
If the selected element is a Classifier (e.g PartDefinition), it is used
to type the new ReferenceUsage.
It it is a Feature then the new ReferenceUsage references this given
feature.
The tools are also able to create an empty ReferenceUsage.

Bug: eclipse-syson#2469
Signed-off-by: Jerome Gout <jerome.gout@obeosoft.com>
@jerome-obeo
jerome-obeo force-pushed the jgo/enh/add_selection_dialog_in_new_reference branch from 4824c8f to 51b8456 Compare September 8, 2026 08:27
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.

Reference tool should have a selection dialog

2 participants