public interface IProjectDescription
Modifier and Type | Field and Description |
---|---|
static String |
DESCRIPTION_FILE_NAME
Constant that denotes the name of the project description file (value
".project" ). |
Modifier and Type | Method and Description |
---|---|
IBuildConfiguration[] |
getBuildConfigReferences(String configName)
Returns the build configurations referenced by the specified configuration for the
described project.
|
ICommand[] |
getBuildSpec()
Returns the list of build commands to run when building the described project.
|
String |
getComment()
Returns the descriptive comment for the described project.
|
IProject[] |
getDynamicReferences()
Returns the dynamic project references for the described project.
|
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. |
URI |
getLocationURI()
Returns the location URI for the described project.
|
String |
getName()
Returns the name of the described project.
|
String[] |
getNatureIds()
Returns the list of natures associated with the described project.
|
IProject[] |
getReferencedProjects()
Returns the projects referenced by the described project.
|
boolean |
hasNature(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 |
setActiveBuildConfig(String configName)
Sets the active configuration for the described project.
|
void |
setBuildConfigReferences(String configName,
IBuildConfiguration[] references)
Sets the build configurations referenced by the specified configuration.
|
void |
setBuildConfigs(String[] configNames)
Sets the build configurations for the described project.
|
void |
setBuildSpec(ICommand[] buildSpec)
Sets the list of build command to run when building the described project.
|
void |
setComment(String comment)
Sets the comment for the described project.
|
void |
setDynamicReferences(IProject[] projects)
Sets the dynamic project references for the described project.
|
void |
setLocation(IPath location)
Sets the local file system location for the described project.
|
void |
setLocationURI(URI location)
Sets the location for the described project.
|
void |
setName(String projectName)
Sets the name of the described project.
|
void |
setNatureIds(String[] natures)
Sets the list of natures associated with the described project.
|
void |
setReferencedProjects(IProject[] projects)
Sets the referenced projects, ignoring any duplicates.
|
static final String DESCRIPTION_FILE_NAME
".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.IBuildConfiguration[] getBuildConfigReferences(String configName)
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. As such clients are always responsible for setting these references when a project is created or recreated.
The referenced build configurations need not exist in the workspace.
The result will not contain duplicates. The order of the references is preserved
from the call to setBuildConfigReferences(String, IBuildConfiguration[])
.
Returns an empty array if the provided config doesn't dynamically reference
any other build configurations, or the given config does not exist in this description.
configName
- the configuration in the described project to get the references forsetBuildConfigReferences(String, IBuildConfiguration[])
ICommand[] getBuildSpec()
String getComment()
IProject[] getDynamicReferences()
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.
getBuildConfigReferences(String)
,
getReferencedProjects()
,
setDynamicReferences(IProject[])
IPath getLocation()
getLocationURI()
method should be used instead.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.null
URI getLocationURI()
null
is
returned if the default location should be used.null
setLocationURI(URI)
String getName()
String[] getNatureIds()
setNatureIds(String[])
IProject[] getReferencedProjects()
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.
getDynamicReferences()
,
getBuildConfigReferences(String)
boolean hasNature(String natureId)
natureId
- the nature extension identifiertrue
if the described project has the given natureICommand newCommand()
Note that the new command does not become part of this project
description's build spec until it is installed via the setBuildSpec
method.
setBuildSpec(ICommand[])
void setActiveBuildConfig(String configName)
If a configuration with the specified name does not exist in the project then the first configuration in the project is treated as the active configuration.
configName
- the configuration to set as the active or defaultvoid setBuildConfigs(String[] configNames)
The passed in names must all be non-null. Before they are set, duplicates are removed.
All projects have one default build configuration, and it is impossible to configure the project to have no build configurations. If the input is null or an empty list, the current configurations are removed, and a default build configuration is (re-)added.
Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor)
before changes made to this description take effect.
configNames
- the configurations to set for the described projectIProject.getActiveBuildConfig()
,
IProject.getBuildConfigs()
,
setActiveBuildConfig(String)
void setBuildConfigReferences(String configName, IBuildConfiguration[] references)
The configuration to which references are being added needs to exist in this
description, but the referenced projects and build configurations need not exist.
A reference with null
configuration name is resolved to the active build configuration
on use.
Duplicates will be removed. The order of the referenced build configurations is preserved.
If the given configuration does not exist in this description then this has no effect.
References at the build configuration level take precedence over references at the project level.
Like dynamic references, these build configuration references are persisted as part of workspace metadata.
Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor)
before changes made to this description take effect.
configName
- the configuration in the described project to set the references forreferences
- list of build configuration referencesgetBuildConfigReferences(String)
,
IProject.setDescription(IProjectDescription, int, IProgressMonitor)
void setBuildSpec(ICommand[] buildSpec)
Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor)
before changes made to this description take effect.
buildSpec
- the array of build commands to runIProject.setDescription(IProjectDescription, int, IProgressMonitor)
,
getBuildSpec()
,
newCommand()
void setComment(String comment)
Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor)
before changes made to this description take effect.
comment
- the comment for the described projectIProject.setDescription(IProjectDescription, int, IProgressMonitor)
,
getComment()
void setDynamicReferences(IProject[] projects)
Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor)
before changes made to this description take effect.
projects
- list of projectsgetDynamicReferences()
,
setBuildConfigReferences(String, IBuildConfiguration[])
,
IProject.setDescription(IProjectDescription, int, IProgressMonitor)
void setLocation(IPath location)
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.
location
- the location for the described project or null
getLocation()
void setLocationURI(URI location)
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.
location
- the location for the described project or null
getLocationURI()
,
IWorkspace.validateProjectLocationURI(IProject, URI)
void setName(String projectName)
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.
projectName
- the name of the described projectIProject.setDescription(IProjectDescription, int, IProgressMonitor)
,
getName()
void setNatureIds(String[] natures)
Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor)
before changes made to this description take effect.
natures
- the list of naturesIProject.setDescription(IProjectDescription, int, IProgressMonitor)
,
getNatureIds()
void setReferencedProjects(IProject[] projects)
Users must call IProject.setDescription(IProjectDescription, int, IProgressMonitor)
before changes made to this description take effect.
projects
- a list of projectsIProject.setDescription(IProjectDescription, int, IProgressMonitor)
,
setBuildConfigReferences(String, IBuildConfiguration[])
,
getReferencedProjects()
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.