1. 編寫自己的nature:
package com.byc.natures;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.runtime.CoreException;


/**
*
* @author Bai Yucheng 2008-4-28
*
*/
public class MyProjectNature implements IProjectNature {
private IProject project;

public void configure() throws CoreException {
//do nothing
}

public void deconfigure() throws CoreException {
//do nothing
}

public IProject getProject() {
return project;
}

public void setProject(IProject iproject) {
project = iproject;
}

}

<extension
id="com.byc.MyProjectNature"
name="Project Nature"
point="org.eclipse.core.resources.natures">
<runtime>
<run
class="com.byc.natures.MyProjectNature">
</run>
</runtime>
</extension>
private void addProjectNature(IProject project) throws CoreException {
if (!project.hasNature(PROJECT_NATURE)) {
try {
IProjectDescription description = project.getDescription();
String[] natures = description.getNatureIds();
String[] newNatures = new String[natures.length + 1];
System.arraycopy(natures, 0, newNatures, 0, natures.length);
newNatures[natures.length] = PROJECT_NATURE;
description.setNatureIds(newNatures);
project.setDescription(description, null);
} catch (CoreException e) {
e.printStackTrace();
}
}
}


































2. 添加擴(kuò)展點:org.eclipse.core.resources.natures,設(shè)置class屬性為我們的nature











3. 在新建工程的向?qū)е刑砑游覀兊膎ature,添加方法為:














