Multiple models in one diagram representation [message #1829986] |
Wed, 15 July 2020 05:54  |
Eclipse User |
|
|
|
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 #1830155 is a reply to message #1830095] |
Sat, 18 July 2020 06:59  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.05631 seconds