Loading and accessing resources [message #1850203] |
Mon, 21 February 2022 14:40  |
Akira Tanaka Messages: 98 Registered: March 2010 |
Member |
|
|
Dear Sirius experts,
I'd like to achieve the following with Sirius or ObeoDesigner. Any comment would be appreciated.
Setup:
I have a metamodel mmx.ecore, and three EMF XMI models, A.mmx, B.mmx, and C.mmx.
Based on mmx.ecore, I created mmx.odesign file, and created a modeling project mmx.test for testing.
I imported A.mmx, and made the model representation graphical.
Now I'd like to import B.mmx and C.mmx into the mmx.test project and allow A.mmx to cross reference model elements
in B.mmx and C.mmx. The goal is to have drop-down menu (or checkbox) in the dialog box when adding model element(s)
in A.mmx from its palette (i.e. tool section).
Questions:
1) What would be the suggested way for tool users to load external resources like the two models above?
Is use of context menu to Project Dependencies to add resources the one?
2) Once resources are added/loaded, how can I access to the model elements from AQL statements, e.g. from select widget?
Is there any explanation in the documentation or example like this case?
Thank you very much in advance.
|
|
|
Re: Loading and accessing resources [message #1850230 is a reply to message #1850203] |
Tue, 22 February 2022 10:47   |
Simon Tulia Messages: 14 Registered: January 2022 |
Junior Member |
|
|
Hello Akira,
I am also newbie in Sirius, but I need some things similar nowadays. So, I am trying to answer your question as far as I know. More precisely, this is what I do for the similar case:
1. First, I define the other models in another modeling project whose name is MyToolbox. Therefore, I can keep their representations separately, too.
2. I add these .mmx files (B and C) to the project dependencies of my main project.
After that, I am able to access the contents of B.mmx and C.mmx models in a select widget. Note that, MyToolbox project should not be closed. So, I can add some items from B.mmx to A.mmx, for example. However, I could not figure out all of my problems [1].
I can also access the items in B.mmx and C.mmx programmatically. As far as I understood from the documentation, each modeling project refers to a Session object. So, I can get the external session object
URI u = URI.createPlatformResourceURI("/MyToolbox/MyToolbox.aird", true);
Session externalSession = SessionManager.INSTANCE.getSession(u, new NullProgressMonitor());
I hope it is useful for you, too.
|
|
|
|
Powered by
FUDForum. Page generated in 0.01590 seconds