Adding a Semantic Resource to the Session (SOLVED) [message #1818519] |
Wed, 18 December 2019 06:48  |
Eclipse User |
|
|
|
Hi All,
I use the following code to add a semantic-resource to the Session instance.
final AddSemanticResourceCommand command = new AddSemanticResourceCommand(session, resource.getURI(), monitor);
session.getTransactionalEditingDomain().getCommandStack().execute(command);
The constructor takes the resource URI as an input parameter. After the command is executed, the semantic-resource "instance" loaded in the session is not the same as the one used to get the URI (resource.getURI()). As a side-effect, I see the following error when I try to perform the save operation - Impossible to find an interpreter - Could not find a session for the model element...
As a workaround, I get hold of the semantic-resource from the session using the resource URI and replace the model element in the resource with the one passed as the parameter to the service method. The hack works.
Is there a better way to deal with the above?
Out of curiosity, why is it that the `AddSemanticResourceCommand` constructor takes a resource URI and not a resource as a parameter?
Please comment.
Thanks in advance.
[Updated on: Wed, 18 December 2019 10:02] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04675 seconds