/**
   * Crate a plug-in project with the given name
   *
   * @param projectName
   * @param additionalNatures
   * @return a new plug-in project
   * @throws CoreException
   */
  public static IJavaProject createPluginProject(String projectName, String[] additionalNatures)
      throws CoreException {
    String[] resolvednatures = additionalNatures;
    if (additionalNatures != null) {
      ArrayList<String> natures = new ArrayList<String>(Arrays.asList(additionalNatures));
      if (!natures.contains(IBundleProjectDescription.PLUGIN_NATURE)) {
        // need to always set this one first, in case others depend on it, like API Tools does
        natures.add(0, IBundleProjectDescription.PLUGIN_NATURE);
      }
      if (!natures.contains(JavaCore.NATURE_ID)) {
        natures.add(0, JavaCore.NATURE_ID);
      }
      resolvednatures = (String[]) natures.toArray(new String[natures.size()]);
    }

    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    IBundleProjectService service = getBundleProjectService();
    IBundleProjectDescription description = service.getDescription(project);
    IBundleClasspathEntry entry =
        service.newBundleClasspathEntry(new Path(SRC_FOLDER), new Path(BIN_FOLDER), null);
    description.setSymbolicName(projectName);
    description.setBundleClasspath(new IBundleClasspathEntry[] {entry});
    description.setNatureIds(resolvednatures);
    description.setBundleVendor("ibm");
    description.setTargetVersion(IBundleProjectDescription.VERSION_3_4);
    description.setExtensionRegistry(true);
    description.setEquinox(true);
    description.setBundleVersion(new Version("1.0.0"));
    description.setExecutionEnvironments(new String[] {"J2SE-1.5"});
    description.apply(null);
    AbstractApiTest.waitForAutoBuild();
    return JavaCore.create(project);
  }