|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.runtime.PlatformObject
org.eclipse.core.internal.resources.Resource
org.eclipse.core.internal.resources.Container
org.eclipse.core.internal.resources.Project
public class Project
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 trigger,
org.eclipse.core.runtime.IProgressMonitor monitor)
Builds this project. |
void |
build(int trigger,
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 |
checkAccessible(int flags)
Checks that this resource is accessible. |
void |
close(org.eclipse.core.runtime.IProgressMonitor monitor)
Closes this project. |
void |
copy(org.eclipse.core.runtime.IPath destination,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Makes a copy of this resource at the given path. |
void |
copy(IProjectDescription destination,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Makes a copy of this project using the given project description. |
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. |
void |
delete(boolean force,
org.eclipse.core.runtime.IProgressMonitor monitor)
Deletes this resource from the workspace. |
void |
deleteResource(boolean convertToPhantom,
org.eclipse.core.runtime.MultiStatus status)
This method should be called to delete a resource from the tree because it will also delete its properties and markers. |
org.eclipse.core.runtime.content.IContentTypeMatcher |
getContentTypeMatcher()
Returns this project's content type matcher. |
java.lang.String |
getDefaultCharset(boolean checkImplicit)
Returns the default charset for resources in this container. |
IProjectDescription |
getDescription()
Returns the description for 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. |
IContainer |
getParent()
Returns the resource which is the parent of this resource, or null if it has no parent (that is, this
resource is the workspace root). |
org.eclipse.core.runtime.IPath |
getPluginWorkingLocation(org.eclipse.core.runtime.IPluginDescriptor plugin)
Deprecated. |
IProject |
getProject()
Returns the project which contains this resource. |
org.eclipse.core.runtime.IPath |
getProjectRelativePath()
Returns a relative path of this resource with respect to its project. |
org.eclipse.core.runtime.IPath |
getRawLocation()
Returns the file system location of this resource, or null if no
path can be determined. |
java.net.URI |
getRawLocationURI()
Returns the file system location of this resource, or null if no
path can be determined. |
IProject[] |
getReferencedProjects()
Returns the projects referenced by this project. |
IProject[] |
getReferencingProjects()
Returns the list of all open projects which reference this project. |
int |
getType()
Returns the type of this resource. |
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. |
ProjectDescription |
internalGetDescription()
This is an internal helper method. |
void |
internalSetLocal(boolean flag,
int depth)
Sets the M_LOCAL_EXISTS flag. |
boolean |
isAccessible()
Returns whether this resource is accessible. |
boolean |
isDerived(int options)
Returns whether this resource subtree is marked as derived. |
boolean |
isLinked(int options)
Returns true if this resource has been linked to
a location other than the default location calculated by the platform. |
boolean |
isLocal(int depth)
Deprecated. |
boolean |
isLocal(int flags,
int depth)
Deprecated. |
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. |
boolean |
isOpen(int flags)
|
boolean |
isTeamPrivateMember(int options)
Returns whether this resource is a team private member of its parent container. |
void |
move(IProjectDescription destination,
boolean force,
org.eclipse.core.runtime.IProgressMonitor monitor)
Renames this project so that it is located at the name in the given description. |
void |
move(IProjectDescription description,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Renames or relocates this project so that it is the project specified by the given project 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. |
org.eclipse.core.runtime.IStatus |
reconcileLinks(ProjectDescription newDescription)
The project description file has changed on disk, resulting in a changed set of linked resources. |
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. |
void |
touch(org.eclipse.core.runtime.IProgressMonitor monitor)
Marks this resource as having changed even though its content may not have changed. |
void |
writeDescription(int updateFlags)
Writes the project's current description file to disk. |
void |
writeDescription(IProjectDescription description,
int updateFlags,
boolean hasPublicChanges,
boolean hasPrivateChanges)
Writes the project description file to disk. |
Methods inherited from class org.eclipse.core.internal.resources.Container |
---|
convertToPhantom, exists, findDeletedMembersWithHistory, findMember, findMember, findMember, findMember, getDefaultCharset, getFile, getFile, getFolder, getFolder, members, members, members, setDefaultCharset, setDefaultCharset |
Methods inherited from class org.eclipse.core.runtime.PlatformObject |
---|
getAdapter |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.core.resources.IProject |
---|
getFile, getFolder |
Methods inherited from interface org.eclipse.core.resources.IContainer |
---|
exists, findDeletedMembersWithHistory, findMember, findMember, findMember, findMember, getDefaultCharset, getFile, getFolder, members, members, members, setDefaultCharset, setDefaultCharset |
Methods inherited from interface org.eclipse.core.resources.IResource |
---|
accept, accept, accept, accept, clearHistory, copy, copy, createMarker, createProxy, delete, deleteMarkers, equals, exists, findMarker, findMarkers, findMaxProblemSeverity, getFileExtension, getFullPath, getLocalTimeStamp, getLocation, getLocationURI, getMarker, getModificationStamp, getName, getPersistentProperties, getPersistentProperty, getResourceAttributes, getSessionProperties, getSessionProperty, getWorkspace, isDerived, isHidden, isHidden, isLinked, isPhantom, isReadOnly, isSynchronized, isTeamPrivateMember, move, move, move, refreshLocal, revertModificationStamp, setDerived, setHidden, setLocal, setLocalTimeStamp, setPersistentProperty, setReadOnly, setResourceAttributes, setSessionProperty, setTeamPrivateMember |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
---|
getAdapter |
Methods inherited from interface org.eclipse.core.runtime.jobs.ISchedulingRule |
---|
contains, isConflicting |
Method Detail |
---|
public void build(int trigger, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
build
in interface IProject
trigger
- 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.IProjectDescription
,
IncrementalProjectBuilder.FULL_BUILD
,
IncrementalProjectBuilder.INCREMENTAL_BUILD
,
IResourceRuleFactory.buildRule()
public void build(int trigger, java.lang.String builderName, java.util.Map args, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
build
in interface IProject
trigger
- 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
.IProjectDescription
,
IncrementalProjectBuilder.build(int, Map, IProgressMonitor)
,
IncrementalProjectBuilder.FULL_BUILD
,
IncrementalProjectBuilder.INCREMENTAL_BUILD
,
IncrementalProjectBuilder.CLEAN_BUILD
,
IResourceRuleFactory.buildRule()
public void checkAccessible(int flags) throws org.eclipse.core.runtime.CoreException
checkAccessible
in class Resource
org.eclipse.core.runtime.CoreException
- if this resource is not accessiblepublic void close(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
close
in interface IProject
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.IProject.open(IProgressMonitor)
,
IProject.isOpen()
,
IResourceRuleFactory.modifyRule(IResource)
public void copy(org.eclipse.core.runtime.IPath destination, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IResource
The supplied path may be absolute or relative. Absolute paths fully specify the new location for the resource, including its project. Relative paths are considered to be relative to the container of the resource being copied. A trailing separator is ignored.
Calling this method with a one segment absolute destination path is equivalent to calling:
copy(workspace.newProjectDescription(folder.getName()),updateFlags,monitor);
When a resource is copied, its persistent properties are copied with it. Session properties and markers are not copied.
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 copy
resources that are in sync with the corresponding files and directories in
the local file system; it will fail if it encounters a resource that is out
of sync with the file system. However, if FORCE
is specified,
the method copies all corresponding files and directories from the local file
system, including ones that have been recently updated or created. Note that
in both settings of the FORCE
flag, the operation fails if the
newly created resources in the workspace would be out of sync with the local
file system; this ensures files in the file system cannot be accidentally
overwritten.
The SHALLOW
update flag controls how this method deals with linked
resources. If SHALLOW
is not specified, then the underlying
contents of the linked resource will always be copied in the file system. In
this case, the destination of the copy will never be a linked resource or
contain any linked resources. If SHALLOW
is specified when a
linked resource is copied into another project, a new linked resource is
created in the destination project that points to the same file system
location. When a project containing linked resources is copied, the new
project will contain the same linked resources pointing to the same file
system locations. For both of these shallow cases, no files on disk under
the linked resource are actually copied. With the SHALLOW
flag,
copying of linked resources into anything other than a project is not
permitted. The SHALLOW
update flag is ignored when copying non-
linked resources.
The IResource.DERIVED
update flag indicates that the new resource
should immediately be set as a derived resource. Specifying this flag
is equivalent to atomically calling IResource.setDerived(boolean)
with a value of true
immediately after creating the resource.
The IResource.TEAM_PRIVATE
update flag indicates that the new resource
should immediately be set as a team private resource. Specifying this flag
is equivalent to atomically calling IResource.setTeamPrivateMember(boolean)
with a value of true
immediately after creating the resource.
The IResource.HIDDEN
update flag indicates that the new 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.
This operation changes resources; these changes will be reported in a subsequent resource change event that will include an indication that the resource copy has been added to its new parent.
An attempt will be made to copy the local history for this resource and its children, to the destination. Since local history existence is a safety-net mechanism, failure of this action will not result in automatic failure of the copy operation.
This operation is long-running; progress and cancellation are provided by the given progress monitor.
copy
in interface IResource
copy
in class Resource
destination
- the destination pathupdateFlags
- bit-wise or of update flag constants
(IResource.FORCE
, IResource.SHALLOW
, IResource.DERIVED
, IResource.TEAM_PRIVATE
, IResource.HIDDEN
)monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this resource could not be copied. Reasons include:
SHALLOW
is specified.FORCE
is not specified.IResourceChangeEvent
for more details.IResource.FORCE
,
IResource.SHALLOW
,
IResource.DERIVED
,
IResource.TEAM_PRIVATE
,
IResourceRuleFactory.copyRule(IResource, IResource)
public void copy(IProjectDescription destination, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IResource
When a resource is copied, its persistent properties are copied with it. Session properties and markers are not copied.
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 copy resources that are in sync with the corresponding files and
directories in the local file system; it will fail if it encounters a
resource that is out of sync with the file system. However, if
FORCE
is specified, the method copies all corresponding files
and directories from the local file system, including ones that have been
recently updated or created. Note that in both settings of the
FORCE
flag, the operation fails if the newly created resources
in the workspace would be out of sync with the local file system; this
ensures files in the file system cannot be accidentally overwritten.
The SHALLOW
update flag controls how this method deals with
linked resources. If SHALLOW
is not specified, then the
underlying contents of any linked resources in the project will always be
copied in the file system. In this case, the destination of the copy will
never contain any linked resources. If SHALLOW
is specified
when a project containing linked resources is copied, new linked resources
are created in the destination project that point to the same file system
locations. In this case, no files on disk under linked resources are
actually copied. The SHALLOW
update flag is ignored when copying
non- linked resources.
Update flags other than FORCE
or SHALLOW
are ignored.
An attempt will be made to copy the local history for this resource and its children, to the destination. Since local history existence is a safety-net mechanism, failure of this action will not result in automatic failure of the copy operation.
This operation changes resources; these changes will be reported in a subsequent resource change event that will include an indication that the resource copy has been added to its new parent.
This operation is long-running; progress and cancellation are provided by the given progress monitor.
copy
in interface IResource
copy
in class Resource
destination
- the destination project descriptionupdateFlags
- bit-wise or of update flag constants
(FORCE
and SHALLOW
)monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this resource could not be copied. Reasons include:
FORCE
is not specified.IResourceChangeEvent
for more details.IResource.FORCE
,
IResource.SHALLOW
,
IResourceRuleFactory.copyRule(IResource, IResource)
public void create(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
create
in interface IProject
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.IWorkspace.validateProjectLocation(IProject, IPath)
,
IResourceRuleFactory.createRule(IResource)
public void create(IProjectDescription description, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
create
in interface IProject
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.IWorkspace.validateProjectLocation(IProject, IPath)
,
IResourceRuleFactory.createRule(IResource)
public void create(IProjectDescription description, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
create
in interface IProject
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.IWorkspace.validateProjectLocation(IProject, IPath)
,
IResourceRuleFactory.createRule(IResource)
public void delete(boolean deleteContent, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
delete
in interface IProject
delete
in class Resource
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.IResource.delete(int, IProgressMonitor)
,
IProject.open(IProgressMonitor)
,
IProject.close(IProgressMonitor)
,
IResource.delete(int,IProgressMonitor)
,
IResourceRuleFactory.deleteRule(IResource)
public void delete(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IResource
This is a convenience method, fully equivalent to:
delete(force ? FORCE : IResource.NONE, monitor);
This method changes 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.
delete
in interface IResource
delete
in class Resource
force
- 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:
force
is false
.IResourceChangeEvent
for more details.IResource.delete(int,IProgressMonitor)
public void deleteResource(boolean convertToPhantom, org.eclipse.core.runtime.MultiStatus status) throws org.eclipse.core.runtime.CoreException
Resource
deleteResource
in class Resource
org.eclipse.core.runtime.CoreException
public org.eclipse.core.runtime.content.IContentTypeMatcher getContentTypeMatcher() throws org.eclipse.core.runtime.CoreException
IProject
getContentTypeMatcher
in interface IProject
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IContentTypeMatcher
public java.lang.String getDefaultCharset(boolean checkImplicit)
IContainer
If checkImplicit is false
, this method
will return the charset defined by calling #setDefaultCharset, provided this
container exists, or null
otherwise.
If checkImplicit is true
, this method uses the following
algorithm to determine the charset to be returned:
Note that this method does not check whether the result is a supported
charset name. Callers should be prepared to handle
UnsupportedEncodingException
where this charset is used.
getDefaultCharset
in interface IContainer
null
IFile.getCharset()
public IProjectDescription getDescription() throws org.eclipse.core.runtime.CoreException
IProject
getDescription
in interface IProject
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IProject.create(IProgressMonitor)
,
IProject.create(IProjectDescription, IProgressMonitor)
,
IResource.copy(IProjectDescription, int, IProgressMonitor)
,
IProject.move(IProjectDescription, boolean, IProgressMonitor)
public IProjectNature getNature(java.lang.String natureID) throws org.eclipse.core.runtime.CoreException
IProject
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.
getNature
in interface IProject
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:
public IContainer getParent()
IResource
null
if it has no parent (that is, this
resource is the workspace root).
The full path of the parent resource is the same as this resource's full path with the last segment removed.
This is a resource handle operation; neither the resource nor the resulting resource need exist.
getParent
in interface IResource
getParent
in class Resource
null
if it has no parentpublic org.eclipse.core.runtime.IPath getPluginWorkingLocation(org.eclipse.core.runtime.IPluginDescriptor plugin)
getPluginWorkingLocation
in interface IProject
plugin
- the plug-in
IProject.getPluginWorkingLocation(IPluginDescriptor)
public IProject getProject()
IResource
null
for the workspace root.
A resource's project is the one named by the first segment of its full path.
This is a resource handle operation; neither the resource nor the resulting project need exist.
getProject
in interface IResource
getProject
in class Resource
public org.eclipse.core.runtime.IPath getProjectRelativePath()
IResource
This is a resource handle operation; the resource need not exist. If this resource does exist, its path can be safely assumed to be valid.
A resource's project-relative path indicates the route from the project to the resource. Within a project, there is exactly one such path for any given resource. The returned path never has a trailing slash.
Project-relative paths are recommended over absolute paths, since the former are not affected if the project is renamed.
getProjectRelativePath
in interface IResource
getProjectRelativePath
in class Resource
IResource.getFullPath()
,
IResource.getProject()
,
Path.EMPTY
public org.eclipse.core.runtime.IPath getRawLocation()
IResource
null
if no
path can be determined. The returned path will either be an absolute file
system path, or a relative path whose first segment is the name of a
workspace path variable.
If this resource is an existing project, the returned path will be equal to
the location path in the project description. If this resource is a linked
resource in an open project, the returned path will be equal to the location
path supplied when the linked resource was created. In all other cases, this
method returns the same value as IResource.getLocation()
.
getRawLocation
in interface IResource
getRawLocation
in class Resource
null
if no path can be determinedIResource.getLocation()
,
IFile.createLink(IPath, int, IProgressMonitor)
,
IFolder.createLink(IPath, int, IProgressMonitor)
,
IPathVariableManager
,
IProjectDescription.getLocation()
public java.net.URI getRawLocationURI()
IResource
null
if no
path can be determined. The returned path will either be an absolute URI,
or a relative URI whose first path segment is the name of a workspace path variable.
If this resource is an existing project, the returned path will be equal to
the location path in the project description. If this resource is a linked
resource in an open project, the returned path will be equal to the location
path supplied when the linked resource was created. In all other cases, this
method returns the same value as IResource.getLocationURI()
.
getRawLocationURI
in interface IResource
getRawLocationURI
in class Resource
null
if no path can be determinedIResource.getLocationURI()
,
IFile.createLink(URI, int, IProgressMonitor)
,
IFolder.createLink(URI, int, IProgressMonitor)
,
IPathVariableManager
,
IProjectDescription.getLocationURI()
public IProject[] getReferencedProjects() throws org.eclipse.core.runtime.CoreException
IProject
getReferencedProjects
in interface IProject
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IProjectDescription.getReferencedProjects()
,
IProjectDescription.getDynamicReferences()
public IProject[] getReferencingProjects()
IProject
getReferencingProjects
in interface IProject
public int getType()
IResource
FILE
,
FOLDER
, PROJECT
, ROOT
.
FILE
implement IFile
.FOLDER
implement IFolder
.PROJECT
implement IProject
.ROOT
implement IWorkspaceRoot
.This is a resource handle operation; the resource need not exist in the workspace.
getType
in interface IResource
getType
in class Resource
IResource.FILE
,
IResource.FOLDER
,
IResource.PROJECT
,
IResource.ROOT
public org.eclipse.core.runtime.IPath getWorkingLocation(java.lang.String id)
IProject
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.
getWorkingLocation
in interface IProject
id
- the bundle or plug-in's identifier
public boolean hasNature(java.lang.String natureID) throws org.eclipse.core.runtime.CoreException
IProject
hasNature
in interface IProject
natureID
- the nature extension identifier
true
if the project has the given nature
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
public ProjectDescription internalGetDescription()
public void internalSetLocal(boolean flag, int depth) throws org.eclipse.core.runtime.CoreException
Resource
org.eclipse.core.runtime.CoreException
public boolean isAccessible()
IResource
isAccessible
in interface IResource
isAccessible
in class Resource
true
if this resource is accessible, and
false
otherwiseIResource.exists()
,
IProject.isOpen()
public boolean isDerived(int options)
IResource
false
if this resource does not exist.
The IResource.CHECK_ANCESTORS
option flag indicates whether this method
should consider ancestor resources in its calculation. If the
IResource.CHECK_ANCESTORS
flag is present, this method will return
true
, if this resource, or any parent resource, is marked
as derived. If the IResource.CHECK_ANCESTORS
option flag is not specified,
this method returns false for children of derived resources.
isDerived
in interface IResource
isDerived
in class Resource
options
- bit-wise or of option flag constants
(only IResource.CHECK_ANCESTORS
is applicable)
true
if this resource subtree is derived, and
false
otherwiseIResource.setDerived(boolean)
public boolean isLinked(int options)
IResource
true
if this resource has been linked to
a location other than the default location calculated by the platform. This
location can be outside the project's content area or another location
within the project. Returns false
in all other cases, including
the case where this resource does not exist. The workspace root and
projects are never linked.
This method returns true only for a resource that has been linked using
the createLink
method.
The IResource.CHECK_ANCESTORS
option flag indicates whether this method
should consider ancestor resources in its calculation. If the
IResource.CHECK_ANCESTORS
flag is present, this method will return
true
if this resource, or any parent resource, is a linked
resource. If the IResource.CHECK_ANCESTORS
option flag is not specified,
this method returns false for children of linked resources.
isLinked
in interface IResource
isLinked
in class Resource
options
- bit-wise or of option flag constants
(only IResource.CHECK_ANCESTORS
is applicable)
true
if this resource is linked, and
false
otherwiseIFile.createLink(IPath, int, IProgressMonitor)
,
IFolder.createLink(IPath, int, IProgressMonitor)
public boolean isTeamPrivateMember(int options)
IResource
false
if this resource does not exist.
The IResource.CHECK_ANCESTORS
option flag indicates whether this method
should consider ancestor resources in its calculation. If the
IResource.CHECK_ANCESTORS
flag is present, this method will return
true
if this resource, or any parent resource, is a team
private member. If the IResource.CHECK_ANCESTORS
option flag is not
specified, this method returns false for children of team private
members.
isTeamPrivateMember
in interface IResource
isTeamPrivateMember
in class Resource
options
- bit-wise or of option flag constants (only
IResource.CHECK_ANCESTORS
is applicable)
true
if this resource is a team private member, and
false
otherwiseIResource.setTeamPrivateMember(boolean)
public boolean isLocal(int depth)
IResource
false
in all other cases,
including the case where this resource does not exist. The workspace
root and projects are always local.
When a resource is not local, its content and properties are unavailable for both reading and writing.
isLocal
in interface IResource
isLocal
in class Resource
depth
- valid values are DEPTH_ZERO
,
DEPTH_ONE
, or DEPTH_INFINITE
true
if this resource is local, and
false
otherwiseIResource.isLocal(int)
public boolean isLocal(int flags, int depth)
Resource
isLocal
in class Container
IResource.isLocal(int)
public boolean isNatureEnabled(java.lang.String natureId) throws org.eclipse.core.runtime.CoreException
IProject
isNatureEnabled
in interface IProject
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[])
public boolean isOpen()
IProject
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.
isOpen
in interface IProject
true
if this project is open, false
if
this project is closed or does not existIProject.open(IProgressMonitor)
,
IProject.close(IProgressMonitor)
public boolean isOpen(int flags)
public void move(IProjectDescription destination, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
move
in interface IProject
destination
- 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.IResourceDelta.getFlags()
,
IResource.move(IProjectDescription,int,IProgressMonitor)
,
IResourceRuleFactory.moveRule(IResource, IResource)
public void move(IProjectDescription description, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IResource
When a resource moves, its session and persistent properties move with it. Likewise for all the other attributes of the resource including markers.
When this project's location is the default location, then the directories and files on disk are moved to be in the location specified by the given description. If the given description specifies the default location for the project, the directories and files are moved to the default location. If the name in the given description is the same as this project's name and the location is different, then the project contents will be moved to the new location. In all other cases the directories and files on disk are left untouched. Parts of the supplied description other than the name and location are ignored.
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 move
resources that are in sync with the corresponding files and directories in
the local file system; it will fail if it encounters a resource that is out
of sync with the file system. However, if FORCE
is specified,
the method moves all corresponding files and directories from the local file
system, including ones that have been recently updated or created. Note that
in both settings of the FORCE
flag, the operation fails if the
newly created resources in the workspace would be out of sync with the local
file system; this ensures files in the file system cannot be accidentally
overwritten.
The KEEP_HISTORY
update flag controls whether or not file that
are about to be deleted from the local file system have their current
contents saved 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 except in circumstances where past states of the files are of no
conceivable interest to the user. Note that local history is maintained
with each individual project, and gets discarded when a project is deleted
from the workspace. Hence KEEP_HISTORY
is only really applicable
when moving files and folders, but not whole projects.
Local history information for this project and its children will not be moved to the destination.
The SHALLOW
update flag controls how this method deals with linked
resources. If SHALLOW
is not specified, then the underlying
contents of any linked resource will always be moved in the file system. In
this case, the destination of the move will not contain any linked resources.
If SHALLOW
is specified when a project containing linked
resources is moved, new linked resources are created in the destination
project pointing to the same file system locations. In this case, no files
on disk under any linked resource are actually moved. The
SHALLOW
update flag is ignored when moving non- linked
resources.
The IResource.REPLACE
update flag controls how this method deals
with a change of location. If the location changes and the IResource.REPLACE
flag is not specified, then the projects contents on disk are moved to the new
location. If the location changes and the IResource.REPLACE
flag is specified, then the project is reoriented to correspond to the new
location, but no contents are moved on disk. The contents already on
disk at the new location become the project contents. If the new project
location does not exist, it will be created.
Update flags other than those listed above are ignored.
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.
move
in interface IResource
move
in class Resource
description
- the destination project descriptionupdateFlags
- bit-wise or of update flag constants
(IResource.FORCE
, IResource.KEEP_HISTORY
, IResource.SHALLOW
and IResource.REPLACE
).monitor
- 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 not specified.IResourceChangeEvent
for more details.IResourceDelta.getFlags()
,
IResource.FORCE
,
IResource.KEEP_HISTORY
,
IResource.SHALLOW
,
IResource.REPLACE
,
IResourceRuleFactory.moveRule(IResource, IResource)
public void open(int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
open
in interface IProject
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.IProject.close(IProgressMonitor)
,
IResource.BACKGROUND_REFRESH
,
IResourceRuleFactory.modifyRule(IResource)
public void open(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
open
in interface IProject
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.IProject.close(IProgressMonitor)
,
IResourceRuleFactory.modifyRule(IResource)
public org.eclipse.core.runtime.IStatus reconcileLinks(ProjectDescription newDescription)
newDescription
- the new project description that may have
changed link descriptions.
public void setDescription(IProjectDescription description, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
setDescription
in interface IProject
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.IProject.getDescription()
,
IProjectNature.configure()
,
IProjectNature.deconfigure()
,
IResource.FORCE
,
IResource.KEEP_HISTORY
,
IResource.AVOID_NATURE_CONFIG
,
IResourceRuleFactory.modifyRule(IResource)
public void setDescription(IProjectDescription description, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IProject
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.
setDescription
in interface IProject
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.IProject.getDescription()
,
IProjectNature.configure()
,
IProjectNature.deconfigure()
,
IProject.setDescription(IProjectDescription,int,IProgressMonitor)
public void touch(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IResource
This method changes resources; these changes will be reported in a subsequent resource change event. If the resource is a project, the change event will indicate a description change.
This method is long-running; progress and cancellation are provided by the given progress monitor.
touch
in interface IResource
touch
in class Resource
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.IResourceRuleFactory.modifyRule(IResource)
,
IResourceDelta.CONTENT
,
IResourceDelta.DESCRIPTION
public void writeDescription(int updateFlags) throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
public void writeDescription(IProjectDescription description, int updateFlags, boolean hasPublicChanges, boolean hasPrivateChanges) throws org.eclipse.core.runtime.CoreException
description
- The description to writeupdateFlags
- The write operation update flagshasPublicChanges
- Whether the public sections of the description have changedhasPrivateChanges
- Whether the private sections of the description have changed
org.eclipse.core.runtime.CoreException
- On failure to write the description
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |