Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Constraints on diagrams creation.(How to implement them?)
Constraints on diagrams creation. [message #1832037] Mon, 07 September 2020 07:53 Go to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
I'm trying to implement the following constraint:
"Only Block Definition Diagrams are allowed. If the user creates a different diagram, an error should appear."

First, I tried with the extension point "org.eclipse.emf.validation.constraintProviders" specifying as package "http://www.eclipse.org/emf/2002/Ecore" and as Target "EObject".

For unknown reasons, with this approach, the defined constraint explores all the elements of the model (blocks, ports, connetions, ...) but not the diagrams.

Then, I tried with the extension point "org.polarsys.chess.resourceListener" implementing the method "transactionAboutToCommit(ResourceSetChangeEvent event)".

With this approach, the creation diagram event is detected and the error is displayed, but a new diagram icon still appears in Model Explorer.

Do you have any suggestions?
Many thanks,
Alberto

Re: Constraints on diagrams creation. [message #1832162 is a reply to message #1832037] Thu, 10 September 2020 13:14 Go to previous messageGo to next message
Vincent Lorenzo is currently offline Vincent LorenzoFriend
Messages: 247
Registered: June 2010
Location: Paris Saclay, France
Senior Member
Hello Alberto,
yes the EMF validation is only used to check the semantic part of the model, so UML and the applied profile.

I'm not really surprised you get a such result with a ResourceSetListener, but I have no idea how to fix this trouble.

To my mind, the best way to implement this behavior is to duplicate the SysML architecture file (for SysmL 1.4, the file is https://git.eclipse.org/c/papyrus/org.eclipse.papyrus-sysml.git/tree/gui/org.eclipse.papyrus.sysml14.architecture/resources/sysml14.architecture.


So one you create your own sysml architecture plugin and file. You need to change the creation command registered for the diagram creation in order to be able to refuse the diagram creation.

To be honest, I didn't test this solution, but I think it will work.
Warning, with this solution, you are creating a new DSML specializing SysML, you might to change the Architecture Language of your existing model (in ModelExplorer view -> Right click -> Switch Architecture Context)
Re: Constraints on diagrams creation. [message #1832164 is a reply to message #1832162] Thu, 10 September 2020 13:53 Go to previous message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
Thanks vincent for the suggestion.

Instead of create my own sysml architecture plugin, shouldn't be possible to register somehow a custom creation command to replace the current one?

Previous Topic:Guard and Priorities visible in the Diagram Editor
Next Topic:Existing InstanceSpecification as value
Goto Forum:
  


Current Time: Thu Mar 28 19:42:03 GMT 2024

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

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

Back to the top