Add Nature, No Builder? [message #272891] |
Tue, 28 September 2004 14:35  |
Eclipse User |
|
|
|
Originally posted by: barlock.usx.ibmx.com
If I programmatically add a Java nature to a project, I note that the
project properties does not include the Java Builder. I thought I got the
builder "for free" by adding the nature -- but apparently not. Do I also
have to programmatically update the buildspec in the project description to
include the Java Builder?
Chris
|
|
|
|
Re: Add Nature, No Builder? [message #272970 is a reply to message #272931] |
Wed, 29 September 2004 11:22  |
Eclipse User |
|
|
|
Originally posted by: barlock.usx.ibmx.com
> Yes it should be added for free. How do you add the Java nature ? Do you
> prereq org.eclipse.jdt.core in your plugin.xml ?
>
> Jerome
Found it! I was missing the project.setDescription method call:
description = project.getDescription();
String[] prevNatures = description.getNatureIds();
String[] newNatures = new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0,
prevNatures.length);
newNatures[prevNatures.length] = JavaCore.NATURE_ID;
description.setNatureIds(newNatures);
project.setDescription(description, null); // Missed this
call.
Thanks,
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.03410 seconds