Load resources from a Sirius modeling environment [message #1733914] |
Thu, 02 June 2016 08:09 |
Mouna Lab Messages: 4 Registered: May 2016 |
Junior Member |
|
|
Hi,
I am having two ecore metamodels A.ecore and B.ecore where the A metamodel reference the B one.
In my sirius modeling tool, i want to offer the possibility to load Resources (file.B) without passing by the A Model Editor (file.A), meaning, i want to create some kind of a button to imitate the same work that: right click on A model editor >> Load Resource ... does (Please find attached a screen capture).
So i thought of creating a Java service which invoke the EMF LoadResourceAction.
**https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html
I have also come across the Sirius Session API with which i can get the current TransactioanlEditingDoman and its Resource Set from the Session. So i can add different resources (files.B) in my Resource Set (file.A).
** https://www.eclipse.org/sirius/doc/developer/Architecture.html
So my questions are:
- is this envisaged by the EMF and Sirius API ? and whether there is a link to the Sirius SessionAPI documentation?
- does the Session should be retrieved from the Modeling Project where i have my model A ?
Thank you in advance!
[Updated on: Thu, 02 June 2016 09:37] Report message to a moderator
|
|
|
Re: Load resources from a Sirius modeling environment [message #1733947 is a reply to message #1733914] |
Thu, 02 June 2016 11:38 |
|
Le 02/06/2016 10:09, Mouna LAB a écrit :
> Hi,
Hi.
> I am having two ecore metamodels A.ecore and B.ecore where the A metamodel reference the B one.
>
> In my sirius modeling tool, i want to offer the possibility to load Resources (file.B) without passing by the A Model Editor (file.A), meaning, i want to create some kind of a button to imitate the same work that: right click on A model editor >> Load Resource ... does (Please find attached a screen capture).
>
> So i thought of creating a Java service which invoke the EMF LoadResourceAction.
> **https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html
>
> I have also come across the Sirius Session API with which i can get the current TransactioanlEditingDoman and its Resource Set from the Session. So i can add different resources (files.B) in my Resource Set (file.A).
> ** https://www.eclipse.org/sirius/doc/developer/Architecture.html
>
> So my questions are:
> - is this envisaged by the EMF and Sirius API ? and whether there is a link to an up-to-date Sirius documentation?
It should be possible with a Java service which:
- Asks the user which resource to load (how to do this depends on your
context, but you can open a dialog box if needed).
- Once you have the URI of the EMF resource to load, invoke the
org.eclipse.sirius.business.api.session.Session.addSemanticResource(URI,
IProgressMonitor) method which will load it and register it inside the
session.
> - does the Session should be retrieved from the Modeling Project where i have my model A ?
If you have access to a semantic element from inside your session (e.g.
the target element on which your tool was invoked), you can obtain the
session using:
new
org.eclipse.sirius.business.api.query.EObjectQuery(mySemanticElement).getSession().
Regards,
Pierre-Charles
--
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Powered by
FUDForum. Page generated in 0.03103 seconds