Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Reconnect tool Precondition : I can't access to otherEnd and edgeView variables
Reconnect tool Precondition : I can't access to otherEnd and edgeView variables [message #1853006] Tue, 14 June 2022 14:45 Go to next message
vincent lorenzo is currently offline vincent lorenzoFriend
Messages: 205
Registered: June 2010
Location: Paris Saclay, France
Senior Member
Hello everybody,
I'm developing a Reconnect tool for the UML ContainmentLink in a Sirius based UML ClassDiagram for Papyrus). I would like to write a precondition to be able to check the enablement of the tool.

index.php/fa/42190/0/

On the previous image, the link means that Package_TARGET is owned by Package_SOURCE.

I want to create a precondition to forbid the reconnection on the source side from Package_SOURCE to Class_SOURCE, because a such containment is forbidden (Class_SOURCE can't contain Package_TARGET).

Firstly, in the precondition field I declared a service like that:
Quote:
service:reconnectContainmentLinkPrecondition(target)
//target is the new source!


and in my java class, I declared a method like that:
Quote:
public boolean reconnectContainmentLinkPrecondition(Element context, Element target)
//context is the old source
//target is the new source


-> it works fine, the method is called.

Now I want to add a validation of the target (Package_TARGET side), so I need to access to the other end (the target) of the link. I tried "otherEnd" like proposed in the documentation (and I also tried "edgeView" to try to access to the other end, like proposed here :, but without success, I never enter in my java method with this new argument.

Debugging, I saw that these variables are not registered in the IInterpreter (org.eclipse.sirius.diagram.ui.graphical.edit.policies.SiriusGraphicalNodeEditPolicy.getBestTool(EdgeMapping, boolean, EdgeTarget, EdgeTarget, DEdge, boolean).

I also found this bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=476523 and its associated draft : https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/55181.

Please could you indicate me if there is another way to access to the otherEnd ?
Regards,
Vincent LORENZO

Re: Reconnect tool Precondition : I can't access to otherEnd and edgeView variables [message #1853265 is a reply to message #1853006] Fri, 24 June 2022 13:31 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 296
Registered: July 2009
Senior Member
Hello Vincent,

Firstly, as explained in the bug you noticed, https://bugs.eclipse.org/bugs/show_bug.cgi?id=476523, the variable otherEnd is not available during precondition evaluation. It is only available in execution of the reconnect tool. So currently, there is no way to use this variable in precondition. Except if the enhancement 476523 is implemented in a future version of Sirius.

A workaround is to call the method "reconnectContainmentLinkPrecondition" during the reconnection execution.
The only problem with this solution is that the end user will feel like they can do the reconnect (no forbidden sign). However, the tool will actually do nothing.
It is possible to throw an OperationCanceledException instead of returning false. Therby, a message will be display in the error log to explain why the tool does nothing.
throw new OperationCanceledException("This message explains why nothing is happening..."); 


For information, we will try to investigate the bugzilla to integrate it in a future version.

Regards,


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Reconnect tool Precondition : I can't access to otherEnd and edgeView variables [message #1853562 is a reply to message #1853265] Thu, 07 July 2022 16:35 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 296
Registered: July 2009
Senior Member
Good news, this enhancement will be available in the next release of Sirius (7.0.2).

Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Reconnect tool Precondition : I can't access to otherEnd and edgeView variables [message #1854140 is a reply to message #1853562] Wed, 03 August 2022 08:17 Go to previous messageGo to next message
vincent lorenzo is currently offline vincent lorenzoFriend
Messages: 205
Registered: June 2010
Location: Paris Saclay, France
Senior Member
Hello Laurent, thank you for your answer, I will test the 7.0.2 asap.
Re: Reconnect tool Precondition : I can't access to otherEnd and edgeView variables [message #1854186 is a reply to message #1854140] Fri, 05 August 2022 07:30 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 638
Registered: July 2009
Senior Member
It is now available at https://download.eclipse.org/sirius/updates/releases/7.0.2/2021-06/

Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:[ANN] Sirius 7.0.2
Next Topic:Sirius Web add a java service
Goto Forum:
  


Current Time: Tue Aug 16 22:41:01 GMT 2022

Powered by FUDForum. Page generated in 0.02505 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top