Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » [Solved] Apply a default profile ?
[Solved] Apply a default profile ? [message #872560] Wed, 16 May 2012 10:42 Go to next message
LE HALPER Nicolas is currently offline LE HALPER NicolasFriend
Messages: 13
Registered: April 2012
Junior Member
Hi everyone,

Is it possible to apply programmatically a default profile after the creation of a new uml model ? Indeed, overwhise, I had to apply the profile manually thanks to Papyrus interface ( Proprieties -> Profile -> Apply registered profile ).

Thanks for answers.

[Updated on: Fri, 18 May 2012 20:58]

Report message to a moderator

Re: Apply a default profile ? [message #872581 is a reply to message #872560] Wed, 16 May 2012 11:51 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hello Nicolas,

You should have a look at oep.sysml.diagram.ui, which provides the wizards to create SysML models. It is really similar to what you're willing to do.

You can also use the Model Template extension point, which is probably even simpler. This extension point is used to create a new UML Model with UML Primitive types. You can do a similar implementation, which will apply a profile instead of importing a library. See oep.uml.diagram.wizards and oep.uml.templaterepository for the Primitive Types example.


Camille


Camille Letavernier
Re: Apply a default profile ? [message #872659 is a reply to message #872581] Wed, 16 May 2012 14:51 Go to previous messageGo to next message
LE HALPER Nicolas is currently offline LE HALPER NicolasFriend
Messages: 13
Registered: April 2012
Junior Member
Thanks Camille. The first solution seems to be the good one. I didn't found the specific class for the UML Model with UML Primitive types Sad ( I found CreateUMLModelCommand ). However, in order to apply a profile with Package.applyProfile, I have to find the specific package. I really don't know how to find it...
For instance, Andres had the same problem here h ttp://www.eclipse.org/forums/index.php/t/198189/.

Thank you for your help Wink
Re: Apply a default profile ? [message #872664 is a reply to message #872659] Wed, 16 May 2012 15:06 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Nicolas,


The second solution doesn't involve any Java-code : you simply register a predefined UML Model, on which your profile is already applied. Then, this model becomes available in the "template" page of the wizard. It is simply an extension point + a UML Model, packaged into a plug-in.

For the first option, the SysML Profile application example is located in oep.sysml.diagram.common.commands.CreateSysMLModelCommand, which is called by the Wizard.

So, basically, for the first option, you have 4 main steps :

- Create a ModelCreationCommandBase (See oep.sysml.diagram.common.commands.CreateSysMLModelCommand for an example)
- Register the command through the org.eclipse.papyrus.infra.core.papyrusDiagram extension point

- Create a CreateModelWizard (See org.eclipse.papyrus.sysml.diagram.ui.NewSysMLModelWizard for an example)
- Register the wizard through the org.eclipse.ui.newWizards extension point


Camille


Camille Letavernier
Re: Apply a default profile ? [message #873685 is a reply to message #872664] Fri, 18 May 2012 20:57 Go to previous message
LE HALPER Nicolas is currently offline LE HALPER NicolasFriend
Messages: 13
Registered: April 2012
Junior Member
Thx you, I really didn't understand when you told me the first time about creating a model. I used an extension point like you said and it works perfectly. Wink It is the extension point named org.eclipse.papyrus.wizards.template.

Thank you again for your help Wink

Nicolas.
Previous Topic:Eclipse freezing when changing to the Papyrus perspective
Next Topic:Unable to read the stereotypes from Papyrus SysML model in standalone mode
Goto Forum:
  


Current Time: Tue Apr 23 15:50:23 GMT 2024

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

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

Back to the top