[2469] Add a selection dialog to New Reference tools - #2504
Conversation
| owner.getOwnedRelationship().add(membership); | ||
| new ElementInitializerSwitch().doSwitch(newReferenceUsage); | ||
| if (referencedUsage != null) { | ||
| var refSubsetting = SysmlFactory.eINSTANCE.createReferenceSubsetting(); |
There was a problem hiding this comment.
Are you sure that ReferenceSubsetting is the appropriate type to create here? Why not a Redefinition for example, or a Subsetting? Please explain.
There was a problem hiding this comment.
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() { |
| .isSelectableExpression(AQLConstants.AQL_SELF + ".oclIsKindOf(" + domainType + ")") | ||
| .build(); | ||
|
|
||
| return this.diagramBuilderHelper.newSelectionDialogDescription() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
| @@ -0,0 +1,118 @@ | |||
| /******************************************************************************* | |||
There was a problem hiding this comment.
Would it possible to merge this ToolProvider with ReferenceUsageCompartmentNodeToolProvider.java?
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Why did you remove SysmlPackage.eINSTANCE.getReferenceUsage() here? Why did you not modified SDVNodeDescriptionProviderSwitch instead?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
No, I did not try because the default UsageNodeDescriptionProvider works fine for ReferenceUsage nodes.
There was a problem hiding this comment.
Ok I see now, indeed, my interrogation was wrong
|
|
||
| == New features | ||
|
|
||
| ** `New Reference` tools have a selection dialog. |
There was a problem hiding this comment.
Please add section if you are the first, in your case it should be:
* In diagrams:
** `New Reference` tools have a selection dialog.
...
| == New features | ||
|
|
||
| ** `New Reference` tools have a selection dialog. | ||
| This allows to select a `Usage` that the new `ReferenceUsage` references. |
There was a problem hiding this comment.
Update with Usage or Definition
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>
4824c8f to
51b8456
Compare
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
Project management
priority:andpr:labels been added to the pull request? (In case of doubt, start with the labelspriority: lowandpr: to review later)area:,type:)Changelog and release notes
CHANGELOG.adoc+doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adocbeen updated to reference the relevant issues?CHANGELOG.adoc?CHANGELOG.adoc?doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?Key highlightssection indoc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?Documentation
Tests