Skip to main content



      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 12:36 Go to next message
Eclipse UserFriend
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 14:17] by Moderator

Re: Get updated resource set from Java service [message #1799971 is a reply to message #1799942] Tue, 18 December 2018 04:06 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Get updated resource set from Java service [message #1800444 is a reply to message #1799971] Fri, 28 December 2018 09:42 Go to previous message
Eclipse UserFriend
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 Jul 23 13:58:55 EDT 2025

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

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

Back to the top