Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Load resources from a Sirius modeling environment
Load resources from a Sirius modeling environment [message #1733914] Thu, 02 June 2016 08:09 Go to next message
Mouna Lab is currently offline Mouna LabFriend
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 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 705
Registered: July 2009
Senior Member
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
Re: Load resources from a Sirius modeling environment [message #1733966 is a reply to message #1733947] Thu, 02 June 2016 13:54 Go to previous message
Mouna Lab is currently offline Mouna LabFriend
Messages: 4
Registered: May 2016
Junior Member
Hi, Pierre-Charles,

Thank you so much for your answer. The dialog box that i am going to use is the EMF LoadResourceAction.LoadResourceDialog but ididn't know what to do with the URI once submitted.

I will try what you have suggested. Thanks again.

Kind regards,
Mouna
Previous Topic:Converting the Ifile to modeling file
Next Topic:External Java action call
Goto Forum:
  


Current Time: Wed Nov 13 12:21:07 GMT 2024

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

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

Back to the top