public static void addNature()

in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyNatureHelper.java [44:75]


    public static void addNature(final IProject project) {
        if (hasNature(project)) {
            return;
        }

        final IProjectDescription description;
        try {
            description = project.getDescription();
        } catch (CoreException e) {
            IvyPlugin.logError("Failed to add Ivy dependency management on " + project.getName(), e);
            return;
        }
        final String[] ids = description.getNatureIds();

        final String[] newIds = new String[ids == null ? 1 : ids.length + 1];
        if (ids != null) {
            System.arraycopy(ids, 0, newIds, 0, ids.length);
        }
        newIds[ids == null ? 0 : ids.length] = IVY_NATURE_ID;

        description.setNatureIds(newIds);
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                try {
                    project.setDescription(description, null);
                } catch (CoreException e) {
                    IvyPlugin.logError(
                        "Failed to add Ivy dependency management on " + project.getName(), e);
                }
            }
        });
    }