//new way
if (currentJavaProject == null)
{
// if the java nature is not present
// it must be added, along with the Derby nature
IProjectDescription description = currentProject
.getDescription();
String[] natureIds = description.getNatureIds();
String[] newNatures = new String[natureIds.length + 2];
System.arraycopy(natureIds, 0, newNatures, 0, natureIds.length);
newNatures[newNatures.length - 2] = JavaCore.NATURE_ID;
newNatures[newNatures.length - 1] = CommonNames.DERBY_NATURE;
description.setNatureIds(newNatures);
currentProject.setDescription(description, null);
currentJavaProject = (IJavaProject) JavaCore
.create((IProject) currentProject);
}
else
{
//add the derby nature, the java nature is already present
IProjectDescription description = currentJavaProject
.getProject().getDescription();
String[] natures = description.getNatureIds();
String[] newNatures = new String[natures.length + 1];
System.arraycopy(natures, 0, newNatures, 0, natures.length);
// must prefix with plugin id
newNatures[natures.length] = CommonNames.DERBY_NATURE;
description.setNatureIds(newNatures);
currentJavaProject.getProject().setDescription(description,
null);
}
IClasspathEntry[] rawClasspath = currentJavaProject