org.netbeans.modules.projectapi/1 1.9.22

org.netbeans.api.project
Class ProjectUtils

java.lang.Object
  extended by org.netbeans.api.project.ProjectUtils

public class ProjectUtils
extends Object

Utility methods to get information about Projects.


Method Summary
static ProjectInformation getInformation(Project p)
          Get basic information about a project.
static Sources getSources(Project p)
          Get a list of sources for a project.
static boolean hasSubprojectCycles(Project master, Project candidate)
          Check whether a project has, or might have, cycles in its subproject graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInformation

public static ProjectInformation getInformation(Project p)
Get basic information about a project. If the project has a ProjectInformation instance in its lookup, that is used. Otherwise, a basic dummy implementation is returned.

Parameters:
p - a project
Returns:
some information about it
See Also:
Project.getLookup()

getSources

public static Sources getSources(Project p)
Get a list of sources for a project. If the project has a Sources instance in its lookup, that is used. Otherwise, a basic implementation is returned using GenericSources.genericOnly(org.netbeans.api.project.Project).

Parameters:
p - a project
Returns:
a list of sources for it
See Also:
Project.getLookup()

hasSubprojectCycles

public static boolean hasSubprojectCycles(Project master,
                                          Project candidate)
Check whether a project has, or might have, cycles in its subproject graph.

If the candidate parameter is null, this simply checks whether the master project's current directed graph of (transitive) subprojects contains any cycles. If the candidate is also passed, this checks whether the master project's subproject graph would contain cycles if the candidate were added as a (direct) subproject of the master project.

All cycles are reported even if they do not contain the master project.

If the master project already contains the candidate as a (direct) subproject, the effect is as if the candidate were null.

Projects with no SubprojectProvider are considered to have no subprojects, just as if the provider returned an empty set.

Acquires read access.

Project types which let the user somehow configure subprojects in the GUI (perhaps indirectly, e.g. via a classpath) should use this call to check for possible cycles before adding new subprojects.

Parameters:
master - a project to root the subproject graph from
candidate - a potential direct subproject of the master project, or null
Returns:
true if the master project currently has a cycle somewhere in its subproject graph, regardless of the candidate parameter, or if the candidate is not null and the master project does not currently have a cycle but would have one if the candidate were added as a subproject
See Also:
Issue #43845

org.netbeans.modules.projectapi/1 1.9.22

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.