Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Multiple models in one diagram representation
Multiple models in one diagram representation [message #1829986] Wed, 15 July 2020 09:54 Go to next message
Bastian Haverkamp is currently offline Bastian HaverkampFriend
Messages: 2
Registered: July 2020
Junior Member
Hi,

I am trying to build an application where I have two models that are connected in some way.
The first model contains a component model, similar to an UML model representation. It is pretty fleshed out and contains some additional information and fields for elements.

In a second step, I now want to add a "MappingModel", which is basically just a model that maps components to strings (will be Java Classes at some point) and specific elements of the components to other strings.

I now want to be able to edit these mappings inside my diagram representation on a new Properties Page.

How can I add multiple models to a representation?
I tried to load the model in a service call, which worked, but I can not edit any information then. I think it has to do with Sirius not being able to "find" the EObject after the initial loading of the resource, but this is just guessing;
I had a properties view for mappingModel::ComponentMapping, with sementic candidates coming from service which I called on a component, i.e. component.getMapping().

Any ideas would be greatly appreciated.
Re: Multiple models in one diagram representation [message #1830095 is a reply to message #1829986] Fri, 17 July 2020 08:54 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 270
Registered: August 2010
Senior Member
Hi,

There is no restriction is Sirius to display elements from multiple models (and meta-models) in the same representation. If your model resource is properly added to the Sirius session, Sirius will also load all resource dependencies (by resolving all EMF references) at the session opening.

See in https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#diagram_description how to reference multiple meta-models.
See also https://www.eclipse.org/sirius/doc/user/general/Modeling%20Project.html#ProjectDependencies.

Regards,

Florian
Re: Multiple models in one diagram representation [message #1830155 is a reply to message #1830095] Sat, 18 July 2020 10:59 Go to previous message
Bastian Haverkamp is currently offline Bastian HaverkampFriend
Messages: 2
Registered: July 2020
Junior Member
Hi Florian,

thanks! That was actually much easier than expected. The hint with "Sirius session" really helped, for anyone coming across this post, I can also recommend this thread: https://www.eclipse.org/forums/index.php/t/1078013/

For completeness, some quick notes that helped me:
When both models are in the same modeling project, they are automatically added to the same session.
You can retrieve all semantic resources of the current session in a service like this:
SessionManager.INSTANCE.getSession(obj).getSemanticResources();

Where obj is the EObject parameter of the service call.

I then iterate over all semantic resources and compare the URI of the resources to the URI of the model that I am searching for.
This way, I can return the Resource and use my program logic to return semantic candidates for diagram elements using yet another service, which uses the mentioned resource.

Regards,

Bastian
Previous Topic:Programmatically set the positon of diagram element and set the diagram layout
Next Topic:Provide option for layout
Goto Forum:
  


Current Time: Tue Apr 23 09:50:53 GMT 2024

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

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

Back to the top