Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » EObjectQuery on external ressource
EObjectQuery on external ressource [message #1810995] Fri, 23 August 2019 08:23 Go to next message
Michael C is currently offline Michael CFriend
Messages: 53
Registered: April 2019
Member
Hello, I'm loading an xmi file as a new Ressource. I can't use EObjectQuery on the eobjects of the ressource.
So, I tried to link the eobjects to the Sirius session like this :
// Get the resource
		Resource resource = resSet.getResource(URI.createFileURI(path), true);
		World myWorld = (World) resource.getContents().get(0);
		myWorld.eAllContents().forEachRemaining(o -> o.eAdapters().add(new SessionTransientAttachment(SessionManager.INSTANCE.getSession(self))));

self is an eobject of the current session.

Now I can use EObjectQuery but it does not work everytime, or sometimes it does not return all the expected results.
Is it the correct way to use EObjectQuery in this case ?

Thanks
Re: EObjectQuery on external ressource [message #1811005 is a reply to message #1810995] Fri, 23 August 2019 13:32 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 270
Registered: August 2010
Senior Member
Hello,

Which method from EObjectQuery do you need? Since this helper is supposed to be used on EObject loaded in the context of the Sirius session, it is not surprising to meet some issues.
If you need to link a new semantic resource to the Sirius session, you should use org.eclipse.sirius.business.api.session.Session.addSemanticResource(URI, IProgressMonitor) instead.

Regards,

Florian
Re: EObjectQuery on external ressource [message #1811009 is a reply to message #1811005] Fri, 23 August 2019 14:02 Go to previous message
Michael C is currently offline Michael CFriend
Messages: 53
Registered: April 2019
Member
Hello,

Thanks you, my code is working using addSemanticResource and then removeSemanticResource when I'm done.

Regards,

Michael
Previous Topic:Set focus when open new dialog or wizard
Next Topic:edge creation automatically
Goto Forum:
  


Current Time: Tue Apr 16 19:58:44 GMT 2024

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

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

Back to the top