Problems Setting the ProjectDescription [message #248459] |
Wed, 02 June 2004 14:26  |
Eclipse User |
|
|
|
Originally posted by: bodin.cs.umn.edu
Hi, I am trying to set the Description of a project but I always get the
error "Problems encountered while setting project description." The
error comes from the line:
String message = Policy.bind("resources.projectDesc");
In class Project.
Here is the code I am trying to execute.
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(projectName);
IProjectDescription newDesc =
root.getWorkspace().newProjectDescription(projectName);
newDesc.setNatureIds(new String[]{"newNature"});
newDesc.setLocation(project.getDescription().getLocation());
project.setDescription(newDesc, monitor);
Does anybody know what is going wrong?
Thanks,
Derek
|
|
|
Re: Problems Setting the ProjectDescription [message #248556 is a reply to message #248459] |
Wed, 02 June 2004 17:35  |
Eclipse User |
|
|
|
Originally posted by: richkulp.NO.SPAM.us.ibm.com
This is what you should use for setting a description into an existing
project. Using newProjectDescription will wipe out the existing settings.
Use this instead:
IProjectDescription description = proj.getDescription();
String[] prevNatures = description.getNatureIds();
String[] newNatures = new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
newNatures[prevNatures.length] = natureId;
description.setNatureIds(newNatures);
proj.setDescription(description, null);
--
Thanks, Rich Kulp
|
|
|
Powered by
FUDForum. Page generated in 0.04022 seconds