public static void addNature(IProject project,String natureId) throws CoreException {
  if (!project.isOpen() || project.hasNature(natureId)) {
    return;
  }
  addNatures(project,Collections.singletonList(natureId));
}

public static void addNature ( IProject project , String natureId ) throws CoreException { if ( ! project . isOpen ( ) || project . hasNature ( natureId ) ) { return ; } addNatures ( project , Collections . singletonList ( natureId ) ) ; }
add the nature id to the project unless it is already specified or the project is not opened .
