Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 445469

Summary: The model and the target ref have no path
Product: [Modeling] Sirius Reporter: Verena Käfer <verena.kaefer>
Component: DiagramAssignee: Project Inbox <sirius.diagram-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cedric.brun, maxime.porhel, pierre-charles.david
Version: 1.0.1Keywords: triaged
Target Milestone: 2.0.0   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Verena Käfer CLA 2014-09-30 05:46:04 EDT
Situation:
With a AddSemanticResourceCommand a resource in a subfolder is added to a representation file in the same subfolder

Project/folder/resource
Project/folder/resource.aird

Result: In the aird file the resource and the target are listed with the path absolute to the project. 

Problem: After a restart the resources can't be found any more because Sirius looks for the resource starting on the level of ther aird file.
Comment 1 Maxime Porhel CLA 2014-09-30 09:41:15 EDT
Hi Verena,

In your case, how do you use the AddSemanticResourceCommand ? With which kind of URI ?
Comment 2 Verena Käfer CLA 2014-09-30 10:12:39 EDT
Hi Maxime,

I use
URI newFileUri = (URI.createURI(newFile.getLocationURI().toString()));

AddSemanticResourceCommand addResourceToSession = new AddSemanticResourceCommand(session, newFileUri, new NullProgressMonitor());
Comment 3 Verena Käfer CLA 2014-09-30 10:13:22 EDT
session.getTransactionalEditingDomain().getCommandStack()	.execute(addResourceToSession);
Comment 4 Cedric Brun CLA 2014-09-30 10:35:38 EDT
It looks like you would be bettter of creating a platform resource uri instead of a file URI 

URI.createPlatformResourceURI(newFile.getFullPath().toString(), true)

That being said, we should check that fileURIs are kept and serialized correctly.
Comment 5 Maxime Porhel CLA 2014-09-30 11:16:27 EDT
I agree with Cedric, I was about to propose the same snippet.
Comment 6 Verena Käfer CLA 2014-10-03 09:43:28 EDT
Ah thanks. I didn't think of a platform resource uri
Comment 7 Pierre-Charles David CLA 2014-10-13 05:09:36 EDT
(In reply to Verena Käfer from comment #6)
> Ah thanks. I didn't think of a platform resource uri

Hi. Did the suggestions fix your issue, and if so can we close this ticket?
Comment 8 Verena Käfer CLA 2014-10-13 05:51:23 EDT
Yes, it works with createPlatformResourceURI
Comment 9 Pierre-Charles David CLA 2014-10-13 07:05:09 EDT
(In reply to Verena Käfer from comment #8)
> Yes, it works with createPlatformResourceURI

Thanks for the confirmation; closing.
Comment 10 Pierre-Charles David CLA 2014-10-27 06:51:36 EDT
Available in Sirius 2.0.0.