org.eclipse.core.internal.resources
Class ProjectDescription

java.lang.Object
  extended by org.eclipse.core.internal.resources.ModelObject
      extended by org.eclipse.core.internal.resources.ProjectDescription
All Implemented Interfaces:
java.lang.Cloneable, IProjectDescription

public class ProjectDescription
extends ModelObject
implements IProjectDescription


Field Summary
 
Fields inherited from interface org.eclipse.core.resources.IProjectDescription
DESCRIPTION_FILE_NAME
 
Constructor Summary
ProjectDescription()
           
 
Method Summary
 java.lang.Object clone()
           
 IProject[] getAllReferences(boolean makeCopy)
          Returns the union of the description's static and dynamic project references, with duplicates omitted.
 ICommand[] getBuildSpec()
          Returns the list of build commands to run when building the described project.
 ICommand[] getBuildSpec(boolean makeCopy)
           
 java.lang.String getComment()
          Returns the descriptive comment for the described project.
 IProject[] getDynamicReferences()
          Returns the dynamic project references for the described project.
 IProject[] getDynamicReferences(boolean makeCopy)
           
 java.net.URI getLinkLocationURI(org.eclipse.core.runtime.IPath aPath)
          Returns the link location for the given resource name.
 java.util.HashMap getLinks()
          Returns the map of link descriptions (IPath (project relative path) -> LinkDescription).
 org.eclipse.core.runtime.IPath getLocation()
          Deprecated.  
 java.net.URI getLocationURI()
          Returns the location URI for the described project.
 java.lang.String[] getNatureIds()
          Returns the list of natures associated with the described project.
 java.lang.String[] getNatureIds(boolean makeCopy)
           
 IProject[] getReferencedProjects()
          Returns the projects referenced by the described project.
 IProject[] getReferencedProjects(boolean makeCopy)
           
 boolean hasNature(java.lang.String natureID)
          Returns whether the project nature specified by the given nature extension id has been added to the described project.
 boolean hasPrivateChanges(ProjectDescription description)
          Returns true if any private attributes of the description have changed.
 boolean hasPublicChanges(ProjectDescription description)
          Returns true if any public attributes of the description have changed.
 ICommand newCommand()
          Returns a new build command.
 void setBuildSpec(ICommand[] value)
          Sets the list of build command to run when building the described project.
 void setComment(java.lang.String value)
          Sets the comment for the described project.
 void setDynamicReferences(IProject[] value)
          Sets the dynamic project references for the described project.
 void setLinkDescriptions(java.util.HashMap linkDescriptions)
          Sets the map of link descriptions (String name -> LinkDescription).
 boolean setLinkLocation(org.eclipse.core.runtime.IPath path, LinkDescription description)
          Sets the description of a link.
 void setLocation(org.eclipse.core.runtime.IPath path)
          Sets the local file system location for the described project.
 void setLocationURI(java.net.URI location)
          Sets the location for the described project.
 void setName(java.lang.String value)
          Sets the name of the described project.
 void setNatureIds(java.lang.String[] value)
          Sets the list of natures associated with the described project.
 void setReferencedProjects(IProject[] value)
          Sets the referenced projects, ignoring any duplicates.
 
Methods inherited from class org.eclipse.core.internal.resources.ModelObject
getName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.resources.IProjectDescription
getName
 

Constructor Detail

ProjectDescription

public ProjectDescription()
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class ModelObject

getAllReferences

public IProject[] getAllReferences(boolean makeCopy)
Returns the union of the description's static and dynamic project references, with duplicates omitted. The calculation is optimized by caching the result


getBuildSpec

public ICommand[] getBuildSpec()
Description copied from interface: IProjectDescription
Returns the list of build commands to run when building the described project. The commands are listed in the order in which they are to be run.

Specified by:
getBuildSpec in interface IProjectDescription
Returns:
the list of build commands for the described project

getBuildSpec

public ICommand[] getBuildSpec(boolean makeCopy)

getComment

public java.lang.String getComment()
Description copied from interface: IProjectDescription
Returns the descriptive comment for the described project.

Specified by:
getComment in interface IProjectDescription
Returns:
the comment for the described project

getDynamicReferences

public IProject[] getDynamicReferences()
Description copied from interface: IProjectDescription
Returns the dynamic project references for the described project. Dynamic project references can be used instead of simple project references in cases where the reference information is computed dynamically be a third party. These references are persisted by the workspace in a private location outside the project description file, and as such will not be shared when a project is exported or persisted in a repository. A client using project references is always responsible for setting these references when a project is created or recreated.

The returned projects need not exist in the workspace. The result will not contain duplicates. Returns an empty array if there are no dynamic project references on this description.

Specified by:
getDynamicReferences in interface IProjectDescription
Returns:
a list of projects
See Also:
IProjectDescription.getReferencedProjects(), IProjectDescription.setDynamicReferences(IProject[])

getDynamicReferences

public IProject[] getDynamicReferences(boolean makeCopy)

getLinkLocationURI

public java.net.URI getLinkLocationURI(org.eclipse.core.runtime.IPath aPath)
Returns the link location for the given resource name. Returns null if no such link exists.


getLinks

public java.util.HashMap getLinks()
Returns the map of link descriptions (IPath (project relative path) -> LinkDescription). Since this method is only used internally, it never creates a copy. Returns null if the project does not have any linked resources.


getLocation

public org.eclipse.core.runtime.IPath getLocation()
Deprecated. 

Description copied from interface: IProjectDescription
Returns the local file system location for the described project. The path will be either an absolute file system path, or a relative path whose first segment is the name of a workspace path variable. null is returned if the default location should be used. This method will return null if this project is not located in the local file system.

Specified by:
getLocation in interface IProjectDescription
Returns:
the location for the described project or null
See Also:
IProjectDescription.getLocation()

getLocationURI

public java.net.URI getLocationURI()
Description copied from interface: IProjectDescription
Returns the location URI for the described project. null is returned if the default location should be used.

Specified by:
getLocationURI in interface IProjectDescription
Returns:
the location for the described project or null
See Also:
IProjectDescription.setLocationURI(URI)

getNatureIds

public java.lang.String[] getNatureIds()
Description copied from interface: IProjectDescription
Returns the list of natures associated with the described project. Returns an empty array if there are no natures on this description.

Specified by:
getNatureIds in interface IProjectDescription
Returns:
the list of natures for the described project
See Also:
IProjectDescription.setNatureIds(String[])

getNatureIds

public java.lang.String[] getNatureIds(boolean makeCopy)

getReferencedProjects

public IProject[] getReferencedProjects()
Description copied from interface: IProjectDescription
Returns the projects referenced by the described project. These references are persisted in the project description file (".project") and as such will be shared whenever the project is exported to another workspace. For references that are likely to change from one workspace to another, dynamic references should be used instead.

The projects need not exist in the workspace. The result will not contain duplicates. Returns an empty array if there are no referenced projects on this description.

Specified by:
getReferencedProjects in interface IProjectDescription
Returns:
a list of projects
See Also:
IProjectDescription.getDynamicReferences()

getReferencedProjects

public IProject[] getReferencedProjects(boolean makeCopy)

hasNature

public boolean hasNature(java.lang.String natureID)
Description copied from interface: IProjectDescription
Returns whether the project nature specified by the given nature extension id has been added to the described project.

Specified by:
hasNature in interface IProjectDescription
Parameters:
natureID - the nature extension identifier
Returns:
true if the described project has the given nature

hasPrivateChanges

public boolean hasPrivateChanges(ProjectDescription description)
Returns true if any private attributes of the description have changed. Private attributes are those that are not stored in the project description file (.project).


hasPublicChanges

public boolean hasPublicChanges(ProjectDescription description)
Returns true if any public attributes of the description have changed. Public attributes are those that are stored in the project description file (.project).


newCommand

public ICommand newCommand()
Description copied from interface: IProjectDescription
Returns a new build command.

Note that the new command does not become part of this project description's build spec until it is installed via the setBuildSpec method.

Specified by:
newCommand in interface IProjectDescription
Returns:
a new command
See Also:
IProjectDescription.setBuildSpec(ICommand[])

setBuildSpec

public void setBuildSpec(ICommand[] value)
Description copied from interface: IProjectDescription
Sets the list of build command to run when building the described project.

Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor) before changes made to this description take effect.

Specified by:
setBuildSpec in interface IProjectDescription
Parameters:
value - the array of build commands to run
See Also:
IProject.setDescription(IProjectDescription, int, IProgressMonitor), IProjectDescription.getBuildSpec(), IProjectDescription.newCommand()

setComment

public void setComment(java.lang.String value)
Description copied from interface: IProjectDescription
Sets the comment for the described project.

Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor) before changes made to this description take effect.

Specified by:
setComment in interface IProjectDescription
Parameters:
value - the comment for the described project
See Also:
IProject.setDescription(IProjectDescription, int, IProgressMonitor), IProjectDescription.getComment()

setDynamicReferences

public void setDynamicReferences(IProject[] value)
Description copied from interface: IProjectDescription
Sets the dynamic project references for the described project. The projects need not exist in the workspace. Duplicates will be removed.

Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor) before changes made to this description take effect.

Specified by:
setDynamicReferences in interface IProjectDescription
Parameters:
value - list of projects
See Also:
IProjectDescription.getDynamicReferences(), IProject.setDescription(IProjectDescription, int, IProgressMonitor)

setLinkDescriptions

public void setLinkDescriptions(java.util.HashMap linkDescriptions)
Sets the map of link descriptions (String name -> LinkDescription). Since this method is only used internally, it never creates a copy. May pass null if this project does not have any linked resources


setLinkLocation

public boolean setLinkLocation(org.eclipse.core.runtime.IPath path,
                               LinkDescription description)
Sets the description of a link. Setting to a description of null will remove the link from the project description.

Returns:
true if the description was actually changed, false otherwise.
Since:
3.5 returns boolean (was void before)

setLocation

public void setLocation(org.eclipse.core.runtime.IPath path)
Description copied from interface: IProjectDescription
Sets the local file system location for the described project. The path must be either an absolute file system path, or a relative path whose first segment is the name of a defined workspace path variable. If null is specified, the default location is used.

Setting the location on a description for a project which already exists has no effect; the new project location is ignored when the description is set on the already existing project. This method is intended for use on descriptions for new projects or for destination projects for copy and move.

This operation maps the root folder of the project to the exact location provided. For example, if the location for project named "P" is set to the path c:\my_plugins\Project1, the file resource at workspace path /P/index.html would be stored in the local file system at c:\my_plugins\Project1\index.html.

Specified by:
setLocation in interface IProjectDescription
Parameters:
path - the location for the described project or null
See Also:
IProjectDescription.getLocation()

setLocationURI

public void setLocationURI(java.net.URI location)
Description copied from interface: IProjectDescription
Sets the location for the described project. If null is specified, the default location is used.

Setting the location on a description for a project which already exists has no effect; the new project location is ignored when the description is set on the already existing project. This method is intended for use on descriptions for new projects or for destination projects for copy and move.

This operation maps the root folder of the project to the exact location provided. For example, if the location for project named "P" is set to the URI file://c:/my_plugins/Project1, the file resource at workspace path /P/index.html would be stored in the local file system at file://c:/my_plugins/Project1/index.html.

Specified by:
setLocationURI in interface IProjectDescription
Parameters:
location - the location for the described project or null
See Also:
IProjectDescription.getLocationURI(), IWorkspace.validateProjectLocationURI(IProject, URI)

setName

public void setName(java.lang.String value)
Description copied from interface: IProjectDescription
Sets the name of the described project.

Setting the name on a description and then setting the description on the project has no effect; the new name is ignored.

Creating a new project with a description name which doesn't match the project handle name results in the description name being ignored; the project will be created using the name in the handle.

Specified by:
setName in interface IProjectDescription
Overrides:
setName in class ModelObject
Parameters:
value - the name of the described project
See Also:
IProject.setDescription(IProjectDescription, int, IProgressMonitor), IProjectDescription.getName()

setNatureIds

public void setNatureIds(java.lang.String[] value)
Description copied from interface: IProjectDescription
Sets the list of natures associated with the described project. A project created with this description will have these natures added to it in the given order.

Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor) before changes made to this description take effect.

Specified by:
setNatureIds in interface IProjectDescription
Parameters:
value - the list of natures
See Also:
IProject.setDescription(IProjectDescription, int, IProgressMonitor), IProjectDescription.getNatureIds()

setReferencedProjects

public void setReferencedProjects(IProject[] value)
Description copied from interface: IProjectDescription
Sets the referenced projects, ignoring any duplicates. The order of projects is preserved. The projects need not exist in the workspace.

Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor) before changes made to this description take effect.

Specified by:
setReferencedProjects in interface IProjectDescription
Parameters:
value - a list of projects
See Also:
IProject.setDescription(IProjectDescription, int, IProgressMonitor), IProjectDescription.getReferencedProjects()