Community
Participate
Working Groups
Created attachment 269908 [details] Screenshot of the diagram having the defect In MelodyCCM, there is a link connection tool about connecting a BorderNode to another Node. When I use this tool, preconditions are not called : It's a "provides" tool between a component and an interface (see screenshot). As a source, I can clic on the port or the component (extramapping), and as target, on the interface. But I Can also clic on the interface as a source. This check is done in preconditions, and those preconditions are not called by sirius during runtime. I checked SiriusGraphicalNodeEditPolicy.getConnectionCreateCommand, and the behavior seems correct, it returns null as a Command at the end. The canCreate varialbe is set to false from the beginning, it's correct after mapping checking, so he doesn't call the precondition : it's logical. But at the end, it doesn't invalidate the link creation tool. I try to isolate this issue in a smaller sample, but I wasn't able : in all reproduction cases, the problem doesn't occurs. It might be an combinaison of many things for reproduction.
Created attachment 269909 [details] The tool declaration all other declarations are not specific
Created attachment 269910 [details] The declaration of the link mapping
I can't reproduce the problem with Sirius. I try to reproduce the problem with ecore example that contains extra mapping as explain in ticket. I try too, with a not synchronized diagram. In all cases the précondition is evaluated and the result correspond as expected.
Julien, did you try with a 4.1.x version of Sirius ? Could you attach you sample on ecore ? It seems you forgot the precondition/sourceFinderPrecondition/targetFinderPrecondition in your VSM to mimic Jérôme use case. Jérôme, as currently implemented, there is not checks of the mapping preconditions during mappings/extra mappings analysis for an EdgeCreationTool, see org.eclipse.sirius.diagram.business.api.query.EdgeCreationDescriptionQuery.isValidAsSourceElement(DMappingBased) (+ target variant), the check is done on the mapping, extra mapping their domain class. You should update your tool to complete the "Connection Complete Precondition"/"Connection Start Precondition" attributes of your tool. (you might also extract the common part of mapping/tool preconditions in java service to ease the maintenance) IMO (to confirm with Pierre-Charles), the evaluation of all mappings preconditions is not done at command building step of the tool, as it would be evaluated on each source/target changes while hoovering the diagram and this might cause performance drawbacks.