|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IProject
A project is a type of resource which groups resources into buildable, reusable units.
Features of projects include:
Projects implement the IAdaptable
interface;
extensions are managed by the platform's adapter manager.
Platform.getAdapterManager()
Field Summary |
---|
Fields inherited from interface org.eclipse.core.resources.IContainer |
---|
EXCLUDE_DERIVED, INCLUDE_HIDDEN, INCLUDE_PHANTOMS, INCLUDE_TEAM_PRIVATE_MEMBERS |
Fields inherited from interface org.eclipse.core.resources.IResource |
---|
ALLOW_MISSING_LOCAL, ALWAYS_DELETE_PROJECT_CONTENT, AVOID_NATURE_CONFIG, BACKGROUND_REFRESH, CHECK_ANCESTORS, DEPTH_INFINITE, DEPTH_ONE, DEPTH_ZERO, DERIVED, FILE, FOLDER, FORCE, HIDDEN, KEEP_HISTORY, NEVER_DELETE_PROJECT_CONTENT, NONE, NULL_STAMP, PROJECT, REPLACE, ROOT, SHALLOW, TEAM_PRIVATE |
Method Summary | |
---|---|
void |
build(int kind,
org.eclipse.core.runtime.IProgressMonitor monitor)
Builds this project. |
void |
build(int kind,
java.lang.String builderName,
java.util.Map args,
org.eclipse.core.runtime.IProgressMonitor monitor)
Invokes the build method of the specified builder
for this project. |
void |
close(org.eclipse.core.runtime.IProgressMonitor monitor)
Closes this project. |
void |
create(org.eclipse.core.runtime.IProgressMonitor monitor)
Creates a new project resource in the workspace with files in the default location in the local file system. |
void |
create(IProjectDescription description,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Creates a new project resource in the workspace using the given project description. |
void |
create(IProjectDescription description,
org.eclipse.core.runtime.IProgressMonitor monitor)
Creates a new project resource in the workspace using the given project description. |
void |
delete(boolean deleteContent,
boolean force,
org.eclipse.core.runtime.IProgressMonitor monitor)
Deletes this project from the workspace. |
org.eclipse.core.runtime.content.IContentTypeMatcher |
getContentTypeMatcher()
Returns this project's content type matcher. |
IProjectDescription |
getDescription()
Returns the description for this project. |
IFile |
getFile(java.lang.String name)
Returns a handle to the file with the given name in this project. |
IFolder |
getFolder(java.lang.String name)
Returns a handle to the folder with the given name in this project. |
IProjectNature |
getNature(java.lang.String natureId)
Returns the specified project nature for this project or null if
the project nature has not been added to this project. |
org.eclipse.core.runtime.IPath |
getPluginWorkingLocation(org.eclipse.core.runtime.IPluginDescriptor plugin)
Deprecated. Use IProject.getWorkingLocation(plugin.getUniqueIdentifier()) . |
IProject[] |
getReferencedProjects()
Returns the projects referenced by this project. |
IProject[] |
getReferencingProjects()
Returns the list of all open projects which reference this project. |
org.eclipse.core.runtime.IPath |
getWorkingLocation(java.lang.String id)
Returns the location in the local file system of the project-specific working data area for use by the bundle/plug-in with the given identifier, or null if the project does not exist. |
boolean |
hasNature(java.lang.String natureId)
Returns whether the project nature specified by the given nature extension id has been added to this project. |
boolean |
isNatureEnabled(java.lang.String natureId)
Returns true if the project nature specified by the given nature extension id is enabled for this project, and false otherwise. |
boolean |
isOpen()
Returns whether this project is open. |
void |
move(IProjectDescription description,
boolean force,
org.eclipse.core.runtime.IProgressMonitor monitor)
Renames this project so that it is located at the name in the given description. |
void |
open(int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Opens this project. |
void |
open(org.eclipse.core.runtime.IProgressMonitor monitor)
Opens this project. |
void |
setDescription(IProjectDescription description,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Changes this project resource to match the given project description. |
void |
setDescription(IProjectDescription description,
org.eclipse.core.runtime.IProgressMonitor monitor)
Changes this project resource to match the given project description. |
Methods inherited from interface org.eclipse.core.resources.IContainer |
---|
exists, findDeletedMembersWithHistory, findMember, findMember, findMember, findMember, getDefaultCharset, getDefaultCharset, getFile, getFolder, members, members, members, setDefaultCharset, setDefaultCharset |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
---|
getAdapter |
Methods inherited from interface org.eclipse.core.runtime.jobs.ISchedulingRule |
---|
contains, isConflicting |
Method Detail |
---|
void build(int kind, java.lang.String builderName, java.util.Map args, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
build
method of the specified builder
for this project. Does nothing if this project is closed. If this project
has multiple builders on its build spec matching the given name, only
the first matching builder will be run.
The builder name is declared in the extension that plugs in
to the standard org.eclipse.core.resources.builders
extension point. The arguments are builder specific.
This method may change resources; these changes will be reported in a subsequent resource change event.
This method is long-running; progress and cancellation are provided by the given progress monitor.
kind
- the kind of build being requested. Valid values are:
IncrementalProjectBuilder.FULL_BUILD
- indicates a full build.IncrementalProjectBuilder.INCREMENTAL_BUILD
- indicates a incremental build.IncrementalProjectBuilder.CLEAN_BUILD
- indicates a clean request. Clean does
not actually build anything, but rather discards all problems and build states.builderName
- the name of the builderargs
- a table of builder-specific arguments keyed by argument name
(key type: String
, value type: String
);
null
is equivalent to an empty mapmonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if the build fails.
The status contained in the exception may be a generic IResourceStatus.BUILD_FAILED
code, but it could also be any other status code; it might
also be a MultiStatus
.
org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IProjectDescription
,
IncrementalProjectBuilder.build(int, Map, IProgressMonitor)
,
IncrementalProjectBuilder.FULL_BUILD
,
IncrementalProjectBuilder.INCREMENTAL_BUILD
,
IncrementalProjectBuilder.CLEAN_BUILD
,
IResourceRuleFactory.buildRule()
void build(int kind, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
Building a project involves executing the commands found in this project's build spec.
This method may change resources; these changes will be reported in a subsequent resource change event.
This method is long-running; progress and cancellation are provided by the given progress monitor.
kind
- the kind of build being requested. Valid values are:
IncrementalProjectBuilder.FULL_BUILD
- indicates a full build.IncrementalProjectBuilder.INCREMENTAL_BUILD
- indicates an incremental build.CLEAN_BUILD
- indicates a clean request. Clean does
not actually build anything, but rather discards all problems and build states.
monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if the build fails.
The status contained in the exception may be a generic BUILD_FAILED
code, but it could also be any other status code; it might
also be a multi-status.
org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IProjectDescription
,
IncrementalProjectBuilder.FULL_BUILD
,
IncrementalProjectBuilder.INCREMENTAL_BUILD
,
IResourceRuleFactory.buildRule()
void close(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
Closing a project involves ensuring that all important project-related state is safely stored on disk, and then discarding the in-memory representation of its resources and other volatile state, including session properties. After this method, the project continues to exist in the workspace but its member resources (and their members, etc.) do not. A closed project can later be re-opened.
This method changes resources; these changes will be reported in a subsequent resource change event that includes an indication that this project has been closed and its members have been removed.
This method is long-running; progress and cancellation are provided by the given progress monitor.
monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.open(IProgressMonitor)
,
isOpen()
,
IResourceRuleFactory.modifyRule(IResource)
void create(IProjectDescription description, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
Newly created projects have no session or persistent properties.
If the project content area given in the project description does not contain a project description file, a project description file is written in the project content area with the natures, build spec, comment, and referenced projects as specified in the given project description. If there is an existing project description file, it is not overwritten. In either case, this method does not cause natures to be configured.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the project has been added to the workspace.
This method is long-running; progress and cancellation are provided by the given progress monitor.
description
- the project descriptionmonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IWorkspace.validateName
).IWorkspace.validateProjectLocation
).IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IWorkspace.validateProjectLocation(IProject, IPath)
,
IResourceRuleFactory.createRule(IResource)
void create(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
Newly created projects have no session or persistent properties.
If the project content area does not contain a project description file, an initial project description file is written in the project content area with the following information:
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this project has been added to the workspace.
This method is long-running; progress and cancellation are provided by the given progress monitor.
monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IWorkspace.validateName
).IWorkspace.validateProjectLocation
).IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IWorkspace.validateProjectLocation(IProject, IPath)
,
IResourceRuleFactory.createRule(IResource)
void create(IProjectDescription description, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
Newly created projects have no session or persistent properties.
If the project content area given in the project description does not contain a project description file, a project description file is written in the project content area with the natures, build spec, comment, and referenced projects as specified in the given project description. If there is an existing project description file, it is not overwritten. In either case, this method does not cause natures to be configured.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the project has been added to the workspace.
This method is long-running; progress and cancellation are provided by the given progress monitor.
The IResource.HIDDEN
update flag indicates that this resource
should immediately be set as a hidden resource. Specifying this flag
is equivalent to atomically calling IResource.setHidden(boolean)
with a value of true
immediately after creating the resource.
Update flags other than those listed above are ignored.
description
- the project descriptionmonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IWorkspace.validateName
).IWorkspace.validateProjectLocation
).IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IWorkspace.validateProjectLocation(IProject, IPath)
,
IResourceRuleFactory.createRule(IResource)
void delete(boolean deleteContent, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This is a convenience method, fully equivalent to:
delete( (deleteContent ? IResource.ALWAYS_DELETE_PROJECT_CONTENT : IResource.NEVER_DELETE_PROJECT_CONTENT ) | (force ? FORCE : IResource.NONE), monitor);
This method is long-running; progress and cancellation are provided by the given progress monitor.
deleteContent
- a flag controlling how whether content is
aggressively deletedforce
- a flag controlling whether resources that are not
in sync with the local file system will be toleratedmonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IResource.delete(int, IProgressMonitor)
,
open(IProgressMonitor)
,
close(IProgressMonitor)
,
IResource.delete(int,IProgressMonitor)
,
IResourceRuleFactory.deleteRule(IResource)
org.eclipse.core.runtime.content.IContentTypeMatcher getContentTypeMatcher() throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IContentTypeMatcher
IProjectDescription getDescription() throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
create(IProgressMonitor)
,
create(IProjectDescription, IProgressMonitor)
,
IResource.copy(IProjectDescription, int, IProgressMonitor)
,
move(IProjectDescription, boolean, IProgressMonitor)
IFile getFile(java.lang.String name)
This is a resource handle operation; neither the resource nor the result need exist in the workspace. The validation check on the resource name/path is not done when the resource handle is constructed; rather, it is done automatically as the resource is created.
name
- the string name of the member file
getFolder(String)
IFolder getFolder(java.lang.String name)
This is a resource handle operation; neither the container nor the result need exist in the workspace. The validation check on the resource name/path is not done when the resource handle is constructed; rather, it is done automatically as the resource is created.
name
- the string name of the member folder
getFile(String)
IProjectNature getNature(java.lang.String natureId) throws org.eclipse.core.runtime.CoreException
null
if
the project nature has not been added to this project.
Clients may downcast to a more concrete type for more nature-specific methods.
The documentation for a project nature specifies any such additional protocol.
This may cause the plug-in that provides the given nature to be activated.
natureId
- the fully qualified nature extension identifier, formed
by combining the nature extension id with the id of the declaring plug-in.
(e.g. "com.example.acmeplugin.coolnature"
)
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
org.eclipse.core.runtime.IPath getPluginWorkingLocation(org.eclipse.core.runtime.IPluginDescriptor plugin)
IProject.getWorkingLocation(plugin.getUniqueIdentifier())
.
null
if the project does not exist.
The content, structure, and management of this area is the responsibility of the plug-in. This area is deleted when the project is deleted.
This project needs to exist but does not need to be open.
plugin
- the plug-in
org.eclipse.core.runtime.IPath getWorkingLocation(java.lang.String id)
null
if the project does not exist.
The content, structure, and management of this area is the responsibility of the bundle/plug-in. This area is deleted when the project is deleted.
This project needs to exist but does not need to be open.
id
- the bundle or plug-in's identifier
IProject[] getReferencedProjects() throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IProjectDescription.getReferencedProjects()
,
IProjectDescription.getDynamicReferences()
IProject[] getReferencingProjects()
boolean hasNature(java.lang.String natureId) throws org.eclipse.core.runtime.CoreException
natureId
- the nature extension identifier
true
if the project has the given nature
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
boolean isNatureEnabled(java.lang.String natureId) throws org.eclipse.core.runtime.CoreException
natureId
- the nature extension identifier
true
if the given nature is enabled for this project
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IWorkspace.validateNatureSet(String[])
boolean isOpen()
A project must be opened before it can be manipulated. A closed project is passive and has a minimal memory footprint; a closed project has no members.
true
if this project is open, false
if
this project is closed or does not existopen(IProgressMonitor)
,
close(IProgressMonitor)
void move(IProjectDescription description, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This is a convenience method, fully equivalent to:
move(description, (force ? FORCE : IResource.NONE), monitor);
This method changes resources; these changes will be reported in a subsequent resource change event that will include an indication that the resource has been removed from its parent and that a corresponding resource has been added to its new parent. Additional information provided with resource delta shows that these additions and removals are related.
This method is long-running; progress and cancellation are provided by the given progress monitor.
description
- the description for the destination projectforce
- a flag controlling whether resources that are not
in sync with the local file system will be toleratedmonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this resource could not be moved. Reasons include:
force
is false
.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IResourceDelta.getFlags()
,
IResource.move(IProjectDescription,int,IProgressMonitor)
,
IResourceRuleFactory.moveRule(IResource, IResource)
void open(int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
Opening a project constructs an in-memory representation of its resources from information stored on disk.
The BACKGROUND_REFRESH
update flag controls how
this method behaves when a project is opened for the first time on a location
that has existing resources on disk. If this flag is specified, resources on disk
will be added to the project in the background after this method returns.
Child resources of the project may not be available until this background
refresh completes. If this flag is not specified, resources on disk are added
to the project in the foreground before this method returns.
BACKGROUND_REFRESH
update flag is specified, multiple resource change events may occur as
resources on disk are discovered and added to the tree.
This method is long-running; progress and cancellation are provided by the given progress monitor.
monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.close(IProgressMonitor)
,
IResource.BACKGROUND_REFRESH
,
IResourceRuleFactory.modifyRule(IResource)
void open(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This is a convenience method, fully equivalent to
open(IResource.NONE, monitor)
.
This method changes resources; these changes will be reported in a subsequent resource change event that includes an indication that the project has been opened and its resources have been added to the tree.
This method is long-running; progress and cancellation are provided by the given progress monitor.
monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.close(IProgressMonitor)
,
IResourceRuleFactory.modifyRule(IResource)
void setDescription(IProjectDescription description, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This is a convenience method, fully equivalent to:
setDescription(description, KEEP_HISTORY, monitor);
This method requires the IWorkspaceRoot
scheduling rule.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the project's content has changed.
This method is long-running; progress and cancellation are provided by the given progress monitor.
description
- the project descriptionmonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.getDescription()
,
IProjectNature.configure()
,
IProjectNature.deconfigure()
,
setDescription(IProjectDescription,int,IProgressMonitor)
void setDescription(IProjectDescription description, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
The given project description is used to change the project's
natures, build spec, comment, and referenced projects.
The name and location of a project cannot be changed using this method;
these settings in the project description are ignored. To change a project's
name or location, use IResource.move(IProjectDescription, int, IProgressMonitor)
.
The project's session and persistent properties are not affected.
If the new description includes nature ids of natures that the project
did not have before, these natures will be configured in automatically,
which involves instantiating the project nature and calling
IProjectNature.configure()
on it. An internal reference to the
nature object is retained, and will be returned on subsequent calls to
getNature
for the specified nature id. Similarly, any natures
the project had which are no longer required will be automatically
de-configured by calling IProjectNature.deconfigure()
on the nature object and letting go of the internal reference to it.
The FORCE
update flag controls how this method deals with
cases where the workspace is not completely in sync with the local file
system. If FORCE
is not specified, the method will only attempt
to overwrite the project's description file in the local file system
provided it is in sync with the workspace. This option ensures there is no
unintended data loss; it is the recommended setting.
However, if FORCE
is specified, an attempt will be made
to write the project description file in the local file system, overwriting
any existing one if need be.
The KEEP_HISTORY
update flag controls whether or not a copy of
current contents of the project description file should be captured in the
workspace's local history. The local history mechanism serves as a safety net
to help the user recover from mistakes that might otherwise result in data
loss. Specifying KEEP_HISTORY
is recommended. Note that local
history is maintained with each individual project, and gets discarded when
a project is deleted from the workspace.
The AVOID_NATURE_CONFIG
update flag controls whether or
not added and removed natures should be configured or de-configured. If this
flag is not specified, then added natures will be configured and removed natures
will be de-configured. If this flag is specified, natures can still be added or
removed, but they will not be configured or de-configured.
The scheduling rule required for this operation depends on the
AVOID_NATURE_CONFIG
flag. If the flag is specified the
IResourceRuleFactory.modifyRule(org.eclipse.core.resources.IResource)
is required; If the flag is not specified,
the IWorkspaceRoot
scheduling rule is required.
Update flags other than FORCE
, KEEP_HISTORY
,
and AVOID_NATURE_CONFIG
are ignored.
Prior to modifying the project description file, the file modification
validator (if provided by the Team plug-in), will be given a chance to
perform any last minute preparations. Validation is performed by calling
IFileModificationValidator.validateSave
on the project
description file. If the validation fails, then this operation will fail.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the project's content has changed.
This method is long-running; progress and cancellation are provided by the given progress monitor.
description
- the project descriptionupdateFlags
- bit-wise or of update flag constants
(FORCE
, KEEP_HISTORY
and
AVOID_NATURE_CONFIG
)monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
FORCE
is not
specified.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.getDescription()
,
IProjectNature.configure()
,
IProjectNature.deconfigure()
,
IResource.FORCE
,
IResource.KEEP_HISTORY
,
IResource.AVOID_NATURE_CONFIG
,
IResourceRuleFactory.modifyRule(IResource)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |