|
Re: Creating a representation file externally [message #1791596 is a reply to message #1791287] |
Mon, 02 July 2018 16:53 |
|
Hello,
I have not created a Session from scratch lately but off the top of my head this is how I would proceed:
- First you will need to create a session programmatically using SessionFactory.INSTANCE.createSession and then open it (using the open method).
- Next you can add your semantic resources to your new session using org.eclipse.sirius.business.api.session.Session.addSemanticResource(URI, IProgressMonitor).
- Now, that you have the needed resources in your session, you will want to activate the Viewpoint you designed on your session. You can wrap your session in UserSession and use the selectViewpoints method or directly execute the command ChangeViewpointSelectionCommand.
- Finally, you can create a representation using the API DialectManager.INSTANCE.createRepresentation.
Regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
Re: Creating a representation file externally [message #1792864 is a reply to message #1792827] |
Wed, 25 July 2018 08:51 |
|
Hello Urban,
The second argument is the semantic root that will be used to create the new representation. For example, when you create a new representation manually, it is the element of the model you right-click on to create the new representation.
The third argument is the representation description specified in your VSM (.odesign), that will be used to create the new representation concerning the semantic root you choose. You can access to the RepresentationDescription element from the Viewpoint reference "getOwnedRepresentations()". You should already have the Viewpoint thanks to step 3, but you can also access the active viewpoints from the session using the reference getSelectedViewpoints(boolean).
For example, you can take a look to the JUnit and SWTBot tests we have, many of them uses this API.
Regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05220 seconds