Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Add Nature, No Builder?
Add Nature, No Builder? [message #272891] Tue, 28 September 2004 14:35 Go to next message
Eclipse UserFriend
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 #272931 is a reply to message #272891] Wed, 29 September 2004 06:07 Go to previous messageGo to next message
Eclipse UserFriend
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

"Chris Barlock" <barlock@usx.ibmx.com> wrote in message
news:cjcakg$dff$1@eclipse.org...
> 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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Eclipse look-and-feel editor on linux red-hat
Next Topic:Eclipse Update
Goto Forum:
  


Current Time: Wed May 14 12:30:59 EDT 2025

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

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

Back to the top