I've tried to set my project with an absolute url that is located inside the workspace but then my project is referenced with an absolute path.
I've tried to put a relative url to my project description but it's not working.
Here is my code.
IProgressMonitor monitor = new NullProgressMonitor();
if(!project.exists()) {
project.create(monitor);
}
project.open(monitor);
IProjectDescription description = project.getDescription();
IPath path = workspace.getRoot().getLocation().append(workspaceName).append(project.getName());
URI newLocation = URIUtil.toURI(path.toOSString());
if(!newLocation.equals(description.getLocationURI())){
if (path.toFile().exists()) {
path.toFile().delete();
}
//use relative path, not working
description.setLocationURI(workspace.getRoot().getLocationURI().relativize(newLocation));
project.move(description, IResource.FORCE | IResource.SHALLOW, monitor);
}
Anyway thank you for your reply