Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Get updated resource set from Java service
Get updated resource set from Java service [message #1799942] Mon, 17 December 2018 17:36 Go to next message
Edmundo López Bóbeda is currently offline Edmundo López BóbedaFriend
Messages: 26
Registered: October 2012
Junior Member
Hello,

I'm using a Sirius service to get possible models for an import, the code looks more or less like this:

	public EObject addImport(MappingInstance instance) {
		EList<Resource> resources = instance.eResource().getResourceSet().getResources();
		List<String> validExtensions = new ArrayList<>();
		validExtensions.add("common");
		validExtensions.add("model");
		validExtensions.add("map");
		List<Resource> models = resources.stream().filter(p -> validExtensions.contains(p.getURI().fileExtension()))
				.collect(Collectors.toList());
// do my stuff to find the models I wan to import...


The problem I find is that if I add or remove a file, the resource set is not updated and I'm not able to find the resources (or on deletion, the resources are shown but are actually not there).

How can I make sure that the resource sets are updated?

Thanks in advance,

Best regards,

Edmundo López

PS: If I close and reopen the diagram, the resource set updates automagically.

[Updated on: Mon, 17 December 2018 19:17]

Report message to a moderator

Re: Get updated resource set from Java service [message #1799971 is a reply to message #1799942] Tue, 18 December 2018 09:06 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 432
Registered: May 2011
Senior Member
Hello,

I think that if you add the resource to the resourceSet but not the Sirius session, that would explain the need to close and reopen. Have you tried executing the command org.eclipse.sirius.tools.api.command.semantic.AddSemanticResourceCommand.AddSemanticResourceCommand(Session, URI, IProgressMonitor)? It should properly update the resourceSet and your session.

Regards,
Steve


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Get updated resource set from Java service [message #1800444 is a reply to message #1799971] Fri, 28 December 2018 14:42 Go to previous message
Edmundo López Bóbeda is currently offline Edmundo López BóbedaFriend
Messages: 26
Registered: October 2012
Junior Member
Thanks a lot for your answer, I'll try that.

Best regards,

Edmundo López
Previous Topic:weird links
Next Topic:Sirius Community Survey 2019
Goto Forum:
  


Current Time: Wed Oct 23 00:32:58 GMT 2019

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

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

Back to the top