Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » [DSML/Diagram kind]: Forcing stereotype creation on model creation
[DSML/Diagram kind]: Forcing stereotype creation on model creation [message #1749989] Wed, 14 December 2016 19:01 Go to next message
nicolas metayer is currently offline nicolas metayerFriend
Messages: 4
Registered: December 2016
Location: Montréal, Canada
Junior Member
Hello,

I'm currently working on the implementation of a new profile within papyrus.

So far, using the SysML 1.4 plugins as example , I have managed to register my profile, create new viewpoint to have my new profile along with its diagram type showing up when using the using the menu "File -> new > Papyrus Model".

I have researched if my question has been already answered however I did not find answer to my question which is:

-Is there a way to force an user to create an instance of a stereotype when the user creates a new papyrus model with a specific diagram kind?

For example, using the attached plugins examples, when creating a new papyrus model for the "Test" profile selecting "test diagram", is it possible to force the user to create an instance of the "test" stereotype?
The idea would be to display an interface that ask the user to fill-in the stereotype attributes.

I'm expecting that this would require to add some code to the initializeModel() function that applies the profile to the model which is located in the class called by the "org.papyrus.infra.ui.papyrusDiagram" extension.

Could you please point me to some resources on how to implement such behavior (if it's possible) ?

Kind regards,

Nicolas
  • Attachment: test.zip
    (Size: 46.83KB, Downloaded 108 times)
Re: [DSML/Diagram kind]: Forcing stereotype creation on model creation [message #1750024 is a reply to message #1749989] Thu, 15 December 2016 08:57 Go to previous messageGo to next message
Benoit Maggi is currently offline Benoit MaggiFriend
Messages: 129
Registered: March 2013
Location: Bordeaux, France
Senior Member
Hi Nicolas,

Not sure I understood what you expect to do.
Nerveless, please find attached a modified version of your code where the model is created with a test class with the test stereotype applied.

Basically,
- you were using different URI in your model and in your plugin.xml
- org.eclipse.uml2.uml.generated_package extension point needs to refer to the element (see after the #)
- add some code in initializeModel to create element + apply stereotype

Some comments, the usual way to init a model in the wizard is using the following extension point org.eclipse.papyrus.uml.diagram.wizards.template to add templates in the the second part of the wizard.

You may find some examples there
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/tree/examples/library/org.eclipse.papyrus.training.library.wizard?h=streams/2.0-maintenance

Regards,
Benoit
Re: [DSML/Diagram kind]: Forcing stereotype creation on model creation [message #1750164 is a reply to message #1750024] Fri, 16 December 2016 15:47 Go to previous message
nicolas metayer is currently offline nicolas metayerFriend
Messages: 4
Registered: December 2016
Location: Montréal, Canada
Junior Member
Hello benoit,

Thank you for the quick answer.

Quote:
Not sure I understood what you expect to do.
Nerveless, please find attached a modified version of your code where the model is created with a test class with the test stereotype applied.


Sorry, If my description was not easy to understand. I myself do not know yet exactly how I want things to be done, It is still a work in progress...

Anyway, I have been looking the two solutions that you have provided and both of them achieve the expected result.

As you mentioned the "org.eclipse.papyrus.uml.diagram.wizards.template" extension point is the way to go.
This will allow me to provide the user with a multitude of templates for each of the initialization scenario that my DSML faces and with much less effort than if I had to implement this in Java.



Quote:
You may find some examples there
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/tree/examples/library/org.eclipse.papyrus.training.library.wizard?h=streams/2.0-maintenance

Thanks for sharing this example I was not aware of it existence.

Regards,
Nicolas
Previous Topic:Custom LabelProvider for table column?
Next Topic: I can't sort UML elements by type in model explorer or tables!
Goto Forum:
  


Current Time: Wed Jan 15 11:36:05 GMT 2025

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

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

Back to the top