org.eclipse.core.resources
Interface IProjectDescription

All Known Implementing Classes:
ProjectDescription

public interface IProjectDescription

A project description contains the meta-data required to define a project. In effect, a project description is a project's "content".


Field Summary
static java.lang.String DESCRIPTION_FILE_NAME
          Constant that denotes the name of the project description file (value ".project").
 
Method Summary
 ICommand[] getBuildSpec()
          Returns the list of build commands to run when building the described project.
 java.lang.String getComment()
          Returns the descriptive comment for the described project.
 IProject[] getDynamicReferences()
          Returns the dynamic project references for the described project.
 org.eclipse.core.runtime.IPath getLocation()
          Deprecated. Since 3.2, project locations are not necessarily in the local file system. The more general getLocationURI() method should be used instead.
 java.net.URI getLocationURI()
          Returns the location URI for the described project.
 java.lang.String getName()
          Returns the name of the described project.
 java.lang.String[] getNatureIds()
          Returns the list of natures associated with the described project.
 IProject[] getReferencedProjects()
          Returns the projects referenced by the described project.
 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.
 ICommand newCommand()
          Returns a new build command.
 void setBuildSpec(ICommand[] buildSpec)
          Sets the list of build command to run when building the described project.
 void setComment(java.lang.String comment)
          Sets the comment for the described project.
 void setDynamicReferences(IProject[] projects)
          Sets the dynamic project references for the described project.
 void setLocation(org.eclipse.core.runtime.IPath location)
          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 projectName)
          Sets the name of the described project.
 void setNatureIds(java.lang.String[] natures)
          Sets the list of natures associated with the described project.
 void setReferencedProjects(IProject[] projects)
          Sets the referenced projects, ignoring any duplicates.
 

Field Detail

DESCRIPTION_FILE_NAME

static final java.lang.String DESCRIPTION_FILE_NAME
Constant that denotes the name of the project description file (value ".project"). The handle of a project's description file is project.getFile(DESCRIPTION_FILE_NAME). The project description file is located in the root of the project's content area.

Since:
2.0
See Also:
Constant Field Values
Method Detail

getBuildSpec

ICommand[] getBuildSpec()
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.

Returns:
the list of build commands for the described project

getComment

java.lang.String getComment()
Returns the descriptive comment for the described project.

Returns:
the comment for the described project

getDynamicReferences

IProject[] getDynamicReferences()
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.

Returns:
a list of projects
Since:
3.0
See Also:
getReferencedProjects(), setDynamicReferences(IProject[])

getLocation

org.eclipse.core.runtime.IPath getLocation()
Deprecated. Since 3.2, project locations are not necessarily in the local file system. The more general getLocationURI() method should be used instead.

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.

Returns:
the location for the described project or null

getLocationURI

java.net.URI getLocationURI()
Returns the location URI for the described project. null is returned if the default location should be used.

Returns:
the location for the described project or null
Since:
3.2
See Also:
setLocationURI(URI)

getName

java.lang.String getName()
Returns the name of the described project.

Returns:
the name of the described project

getNatureIds

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

Returns:
the list of natures for the described project
See Also:
setNatureIds(String[])

getReferencedProjects

IProject[] getReferencedProjects()
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.

Returns:
a list of projects
See Also:
getDynamicReferences()

hasNature

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.

Parameters:
natureId - the nature extension identifier
Returns:
true if the described project has the given nature

newCommand

ICommand newCommand()
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.

Returns:
a new command
See Also:
setBuildSpec(ICommand[])

setBuildSpec

void setBuildSpec(ICommand[] buildSpec)
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.

Parameters:
buildSpec - the array of build commands to run
See Also:
IProject.setDescription(IProjectDescription, int, IProgressMonitor), getBuildSpec(), newCommand()

setComment

void setComment(java.lang.String comment)
Sets the comment for the described project.

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

Parameters:
comment - the comment for the described project
See Also:
IProject.setDescription(IProjectDescription, int, IProgressMonitor), getComment()

setDynamicReferences

void setDynamicReferences(IProject[] projects)
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.

Parameters:
projects - list of projects
Since:
3.0
See Also:
getDynamicReferences(), IProject.setDescription(IProjectDescription, int, IProgressMonitor)

setLocation

void setLocation(org.eclipse.core.runtime.IPath location)
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.

Parameters:
location - the location for the described project or null
See Also:
getLocation()

setLocationURI

void setLocationURI(java.net.URI location)
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.

Parameters:
location - the location for the described project or null
Since:
3.2
See Also:
getLocationURI(), IWorkspace.validateProjectLocationURI(IProject, URI)

setName

void setName(java.lang.String projectName)
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.

Parameters:
projectName - the name of the described project
See Also:
IProject.setDescription(IProjectDescription, int, IProgressMonitor), getName()

setNatureIds

void setNatureIds(java.lang.String[] natures)
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.

Parameters:
natures - the list of natures
See Also:
IProject.setDescription(IProjectDescription, int, IProgressMonitor), getNatureIds()

setReferencedProjects

void setReferencedProjects(IProject[] projects)
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.

Parameters:
projects - a list of projects
See Also:
IProject.setDescription(IProjectDescription, int, IProgressMonitor), getReferencedProjects()