org.eclipse.core.internal.resources
Class Project

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.core.internal.resources.Resource
          extended by org.eclipse.core.internal.resources.Container
              extended by org.eclipse.core.internal.resources.Project
All Implemented Interfaces:
java.lang.Cloneable, ICoreConstants, IPathRequestor, IContainer, IProject, IResource, org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.jobs.ISchedulingRule

public class Project
extends Container
implements IProject


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
 
Fields inherited from interface org.eclipse.core.internal.resources.ICoreConstants
CRASH_DETECTED, EMPTY_FILE_STATES, EMPTY_PROJECT_ARRAY, EMPTY_RESOURCE_ARRAY, I_NULL_SYNC_INFO, K_BUILD_LIST, M_CHILDREN_UNKNOWN, M_CONTENT_CACHE, M_DEFAULT_CONTENT_DESCRIPTION, M_DERIVED, M_HIDDEN, M_LINK, M_LOCAL_EXISTS, M_MARKERS_SNAP_DIRTY, M_NO_CONTENT_DESCRIPTION, M_OPEN, M_PHANTOM, M_SYNCINFO_SNAP_DIRTY, M_TEAM_PRIVATE_MEMBER, M_TYPE, M_TYPE_START, M_USED, MINIMUM_FILE_SEGMENT_LENGTH, MINIMUM_FOLDER_SEGMENT_LENGTH, NULL_FLAG, PREF_VERSION, PREF_VERSION_KEY, PROJECT_SEGMENT_LENGTH, REFRESH_ON_STARTUP, WORKSPACE_TREE_VERSION_1, WORKSPACE_TREE_VERSION_2
 
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.internal.resources.Resource
accept, accept, accept, accept, checkCopyRequirements, checkDoesNotExist, checkExists, checkLocal, checkValidPath, clearHistory, contains, copy, copy, countResources, createLink, createLink, createMarker, createProxy, delete, deleteMarkers, equals, exists, exists, findExistingResourceVariant, findMarker, findMarkers, findMaxProblemSeverity, getFileExtension, getFlags, getFullPath, getLocalManager, getLocalTimeStamp, getLocation, getLocationURI, getMarker, getModificationStamp, getName, getPersistentProperties, getPersistentProperty, getPropertyManager, getResourceAttributes, getResourceInfo, getSessionProperties, getSessionProperty, getStore, getTypeString, getWorkspace, hashCode, isConflicting, isDerived, isHidden, isHidden, isLinked, isPhantom, isPhantom, isReadOnly, isSynchronized, isTeamPrivateMember, isUnderLink, move, move, move, move, refreshLocal, requestName, requestPath, revertModificationStamp, setDerived, setHidden, setLocal, setLocalTimeStamp, setPersistentProperty, setReadOnly, setResourceAttributes, setSessionProperty, setTeamPrivateMember, synchronizing, toString
 
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

build

public void build(int trigger,
                  org.eclipse.core.runtime.IProgressMonitor monitor)
           throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Builds this project. Does nothing if the project is closed.

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.

Specified by:
build in interface IProject
Parameters:
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
Throws:
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.
See Also:
IProjectDescription, IncrementalProjectBuilder.FULL_BUILD, IncrementalProjectBuilder.INCREMENTAL_BUILD, IResourceRuleFactory.buildRule()

build

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
Description copied from interface: IProject
Invokes the 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.

Specified by:
build in interface IProject
Parameters:
trigger - the kind of build being requested. Valid values are:
builderName - the name of the builder
args - a table of builder-specific arguments keyed by argument name (key type: String, value type: String); null is equivalent to an empty map
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
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.
See Also:
IProjectDescription, IncrementalProjectBuilder.build(int, Map, IProgressMonitor), IncrementalProjectBuilder.FULL_BUILD, IncrementalProjectBuilder.INCREMENTAL_BUILD, IncrementalProjectBuilder.CLEAN_BUILD, IResourceRuleFactory.buildRule()

checkAccessible

public void checkAccessible(int flags)
                     throws org.eclipse.core.runtime.CoreException
Checks that this resource is accessible. Typically this means that it exists. In the case of projects, they must also be open. If phantom is true, phantom resources are considered.

Overrides:
checkAccessible in class Resource
Throws:
org.eclipse.core.runtime.CoreException - if this resource is not accessible

close

public void close(org.eclipse.core.runtime.IProgressMonitor monitor)
           throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Closes this project. The project need not be open. Closing a closed project does nothing.

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.

Specified by:
close in interface IProject
Parameters:
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This resource does not exist.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IProject.open(IProgressMonitor), IProject.isOpen(), IResourceRuleFactory.modifyRule(IResource)

copy

public void copy(org.eclipse.core.runtime.IPath destination,
                 int updateFlags,
                 org.eclipse.core.runtime.IProgressMonitor monitor)
          throws org.eclipse.core.runtime.CoreException
Description copied from interface: IResource
Makes a copy of this resource at the given path. The resource's descendents are copied as well. The path of this resource must not be a prefix of the destination path. The workspace root may not be the source or destination location of a copy operation, and a project can only be copied to another project. After successful completion, corresponding new resources will exist at the given path; their contents and properties will be copies of the originals. The original resources are not affected.

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.

Specified by:
copy in interface IResource
Overrides:
copy in class Resource
Parameters:
destination - the destination path
updateFlags - 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
Throws:
org.eclipse.core.runtime.CoreException - if this resource could not be copied. Reasons include:
  • This resource does not exist.
  • This resource or one of its descendents is not local.
  • The source or destination is the workspace root.
  • The source is a project but the destination is not.
  • The destination is a project but the source is not.
  • The resource corresponding to the parent destination path does not exist.
  • The resource corresponding to the parent destination path is a closed project.
  • The source is a linked resource, but the destination is not a project, and SHALLOW is specified.
  • A resource at destination path does exist.
  • This resource or one of its descendants is out of sync with the local file system and FORCE is not specified.
  • The workspace and the local file system are out of sync at the destination resource or one of its descendants.
  • The source resource is a file and the destination path specifies a project.
  • The source is a linked resource, and the destination path does not specify a project.
  • The location of the source resource on disk is the same or a prefix of the location of the destination resource on disk.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IResource.FORCE, IResource.SHALLOW, IResource.DERIVED, IResource.TEAM_PRIVATE, IResourceRuleFactory.copyRule(IResource, IResource)

copy

public void copy(IProjectDescription destination,
                 int updateFlags,
                 org.eclipse.core.runtime.IProgressMonitor monitor)
          throws org.eclipse.core.runtime.CoreException
Description copied from interface: IResource
Makes a copy of this project using the given project description. The project's descendents are copied as well. The description specifies the name, location and attributes of the new project. After successful completion, corresponding new resources will exist at the given path; their contents and properties will be copies of the originals. The original resources are not affected.

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.

Specified by:
copy in interface IResource
Overrides:
copy in class Resource
Parameters:
destination - the destination project description
updateFlags - bit-wise or of update flag constants (FORCE and SHALLOW)
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this resource could not be copied. Reasons include:
  • This resource does not exist.
  • This resource or one of its descendents is not local.
  • This resource is not a project.
  • The project described by the given description already exists.
  • This resource or one of its descendents is out of sync with the local file system and FORCE is not specified.
  • The workspace and the local file system are out of sync at the destination resource or one of its descendents.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IResource.FORCE, IResource.SHALLOW, IResourceRuleFactory.copyRule(IResource, IResource)

create

public void create(org.eclipse.core.runtime.IProgressMonitor monitor)
            throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Creates a new project resource in the workspace with files in the default location in the local file system. Upon successful completion, the project will exist but be closed.

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:

If there is an existing project description file, it is not overwritten.

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.

Specified by:
create in interface IProject
Parameters:
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project already exists in the workspace.
  • The name of this resource is not valid (according to IWorkspace.validateName).
  • The project location is not valid (according to IWorkspace.validateProjectLocation).
  • The project description file could not be created in the project content area.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IWorkspace.validateProjectLocation(IProject, IPath), IResourceRuleFactory.createRule(IResource)

create

public void create(IProjectDescription description,
                   org.eclipse.core.runtime.IProgressMonitor monitor)
            throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Creates a new project resource in the workspace using the given project description. Upon successful completion, the project will exist but be closed.

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.

Specified by:
create in interface IProject
Parameters:
description - the project description
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project already exists in the workspace.
  • The name of this resource is not valid (according to IWorkspace.validateName).
  • The project location is not valid (according to IWorkspace.validateProjectLocation).
  • The project description file could not be created in the project content area.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IWorkspace.validateProjectLocation(IProject, IPath), IResourceRuleFactory.createRule(IResource)

create

public void create(IProjectDescription description,
                   int updateFlags,
                   org.eclipse.core.runtime.IProgressMonitor monitor)
            throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Creates a new project resource in the workspace using the given project description. Upon successful completion, the project will exist but be closed.

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.

Specified by:
create in interface IProject
Parameters:
description - the project description
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project already exists in the workspace.
  • The name of this resource is not valid (according to IWorkspace.validateName).
  • The project location is not valid (according to IWorkspace.validateProjectLocation).
  • The project description file could not be created in the project content area.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IWorkspace.validateProjectLocation(IProject, IPath), IResourceRuleFactory.createRule(IResource)

delete

public void delete(boolean deleteContent,
                   boolean force,
                   org.eclipse.core.runtime.IProgressMonitor monitor)
            throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Deletes this project from the workspace. No action is taken if this project does not exist.

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.

Specified by:
delete in interface IProject
Overrides:
delete in class Resource
Parameters:
deleteContent - a flag controlling how whether content is aggressively deleted
force - a flag controlling whether resources that are not in sync with the local file system will be tolerated
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project could not be deleted.
  • This project's contents could not be deleted.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IResource.delete(int, IProgressMonitor), IProject.open(IProgressMonitor), IProject.close(IProgressMonitor), IResource.delete(int,IProgressMonitor), IResourceRuleFactory.deleteRule(IResource)

delete

public void delete(boolean force,
                   org.eclipse.core.runtime.IProgressMonitor monitor)
            throws org.eclipse.core.runtime.CoreException
Description copied from interface: IResource
Deletes this resource from the workspace.

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.

Specified by:
delete in interface IResource
Overrides:
delete in class Resource
Parameters:
force - a flag controlling whether resources that are not in sync with the local file system will be tolerated
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This resource could not be deleted for some reason.
  • This resource or one of its descendents is out of sync with the local file system and force is false.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IResource.delete(int,IProgressMonitor)

deleteResource

public void deleteResource(boolean convertToPhantom,
                           org.eclipse.core.runtime.MultiStatus status)
                    throws org.eclipse.core.runtime.CoreException
Description copied from class: Resource
This method should be called to delete a resource from the tree because it will also delete its properties and markers. If a status object is provided, minor exceptions are added, otherwise they are thrown. If major exceptions occur, they are always thrown.

Overrides:
deleteResource in class Resource
Throws:
org.eclipse.core.runtime.CoreException

getContentTypeMatcher

public org.eclipse.core.runtime.content.IContentTypeMatcher getContentTypeMatcher()
                                                                           throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Returns this project's content type matcher. This content type matcher takes project specific preferences and nature-content type associations into account.

Specified by:
getContentTypeMatcher in interface IProject
Returns:
the content type matcher for this project
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project does not exist.
  • This project is not open.
See Also:
IContentTypeMatcher

getDefaultCharset

public java.lang.String getDefaultCharset(boolean checkImplicit)
Description copied from interface: IContainer
Returns the default charset for resources in this container.

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:

  1. the one explicitly set by calling #setDefaultCharset (with a non-null argument) on this container, if any, and this container exists, or
  2. the parent's default charset, if this container has a parent (is not the workspace root), or
  3. the charset returned by ResourcesPlugin#getEncoding.

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.

Specified by:
getDefaultCharset in interface IContainer
Returns:
the name of the default charset encoding for this container, or null
See Also:
IFile.getCharset()

getDescription

public IProjectDescription getDescription()
                                   throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Returns the description for this project. The returned value is a copy and cannot be used to modify this project. The returned value is suitable for use in creating, copying and moving other projects.

Specified by:
getDescription in interface IProject
Returns:
the description for this project
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project does not exist.
  • This project is not open.
See Also:
IProject.create(IProgressMonitor), IProject.create(IProjectDescription, IProgressMonitor), IResource.copy(IProjectDescription, int, IProgressMonitor), IProject.move(IProjectDescription, boolean, IProgressMonitor)

getNature

public IProjectNature getNature(java.lang.String natureID)
                         throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Returns the specified project nature for this project or 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.

Specified by:
getNature in interface IProject
Parameters:
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")
Returns:
the project nature object
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project does not exist.
  • This project is not open.
  • The project nature extension could not be found.

getParent

public IContainer getParent()
Description copied from interface: IResource
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).

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.

Specified by:
getParent in interface IResource
Overrides:
getParent in class Resource
Returns:
the parent resource of this resource, or null if it has no parent

getPluginWorkingLocation

public org.eclipse.core.runtime.IPath getPluginWorkingLocation(org.eclipse.core.runtime.IPluginDescriptor plugin)
Deprecated. 

(non-Javadoc)

Specified by:
getPluginWorkingLocation in interface IProject
Parameters:
plugin - the plug-in
Returns:
a local file system path
See Also:
IProject.getPluginWorkingLocation(IPluginDescriptor)

getProject

public IProject getProject()
Description copied from interface: IResource
Returns the project which contains this resource. Returns itself for projects and 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.

Specified by:
getProject in interface IResource
Overrides:
getProject in class Resource
Returns:
the project handle

getProjectRelativePath

public org.eclipse.core.runtime.IPath getProjectRelativePath()
Description copied from interface: IResource
Returns a relative path of this resource with respect to its project. Returns the empty path for projects and the workspace root.

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.

Specified by:
getProjectRelativePath in interface IResource
Overrides:
getProjectRelativePath in class Resource
Returns:
the relative path of this resource with respect to its project
See Also:
IResource.getFullPath(), IResource.getProject(), Path.EMPTY

getRawLocation

public org.eclipse.core.runtime.IPath getRawLocation()
Description copied from interface: IResource
Returns the file system location of this resource, or 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().

Specified by:
getRawLocation in interface IResource
Overrides:
getRawLocation in class Resource
Returns:
the raw path of this resource in the local file system, or null if no path can be determined
See Also:
IResource.getLocation(), IFile.createLink(IPath, int, IProgressMonitor), IFolder.createLink(IPath, int, IProgressMonitor), IPathVariableManager, IProjectDescription.getLocation()

getRawLocationURI

public java.net.URI getRawLocationURI()
Description copied from interface: IResource
Returns the file system location of this resource, or 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().

Specified by:
getRawLocationURI in interface IResource
Overrides:
getRawLocationURI in class Resource
Returns:
the raw path of this resource in the file system, or null if no path can be determined
See Also:
IResource.getLocationURI(), IFile.createLink(URI, int, IProgressMonitor), IFolder.createLink(URI, int, IProgressMonitor), IPathVariableManager, IProjectDescription.getLocationURI()

getReferencedProjects

public IProject[] getReferencedProjects()
                                 throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Returns the projects referenced by this project. This includes both the static and dynamic references of this project. The returned projects need not exist in the workspace. The result will not contain duplicates. Returns an empty array if there are no referenced projects.

Specified by:
getReferencedProjects in interface IProject
Returns:
a list of projects
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project does not exist.
  • This project is not open.
See Also:
IProjectDescription.getReferencedProjects(), IProjectDescription.getDynamicReferences()

getReferencingProjects

public IProject[] getReferencingProjects()
Description copied from interface: IProject
Returns the list of all open projects which reference this project. This project may or may not exist. Returns an empty array if there are no referencing projects.

Specified by:
getReferencingProjects in interface IProject
Returns:
a list of open projects referencing this project

getType

public int getType()
Description copied from interface: IResource
Returns the type of this resource. The returned value will be one of FILE, FOLDER, PROJECT, ROOT.

This is a resource handle operation; the resource need not exist in the workspace.

Specified by:
getType in interface IResource
Specified by:
getType in class Resource
Returns:
the type of this resource
See Also:
IResource.FILE, IResource.FOLDER, IResource.PROJECT, IResource.ROOT

getWorkingLocation

public org.eclipse.core.runtime.IPath getWorkingLocation(java.lang.String id)
Description copied from interface: IProject
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.

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.

Specified by:
getWorkingLocation in interface IProject
Parameters:
id - the bundle or plug-in's identifier
Returns:
a local file system path

hasNature

public boolean hasNature(java.lang.String natureID)
                  throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Returns whether the project nature specified by the given nature extension id has been added to this project.

Specified by:
hasNature in interface IProject
Parameters:
natureID - the nature extension identifier
Returns:
true if the project has the given nature
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project does not exist.
  • This project is not open.

internalGetDescription

public ProjectDescription internalGetDescription()
This is an internal helper method. This implementation is different from the API method getDescription(). This one does not check the project accessibility. It exists in order to prevent "chicken and egg" problems in places like the project creation. It may return null.


internalSetLocal

public void internalSetLocal(boolean flag,
                             int depth)
                      throws org.eclipse.core.runtime.CoreException
Description copied from class: Resource
Sets the M_LOCAL_EXISTS flag. Is internal so we don't have to begin an operation.

Throws:
org.eclipse.core.runtime.CoreException

isAccessible

public boolean isAccessible()
Description copied from interface: IResource
Returns whether this resource is accessible. For files and folders, this is equivalent to existing; for projects, this is equivalent to existing and being open. The workspace root is always accessible.

Specified by:
isAccessible in interface IResource
Overrides:
isAccessible in class Resource
Returns:
true if this resource is accessible, and false otherwise
See Also:
IResource.exists(), IProject.isOpen()

isDerived

public boolean isDerived(int options)
Description copied from interface: IResource
Returns whether this resource subtree is marked as derived. Returns 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.

Specified by:
isDerived in interface IResource
Overrides:
isDerived in class Resource
Parameters:
options - bit-wise or of option flag constants (only IResource.CHECK_ANCESTORS is applicable)
Returns:
true if this resource subtree is derived, and false otherwise
See Also:
IResource.setDerived(boolean)

isLinked

public boolean isLinked(int options)
Description copied from interface: IResource
Returns 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.

Specified by:
isLinked in interface IResource
Overrides:
isLinked in class Resource
Parameters:
options - bit-wise or of option flag constants (only IResource.CHECK_ANCESTORS is applicable)
Returns:
true if this resource is linked, and false otherwise
See Also:
IFile.createLink(IPath, int, IProgressMonitor), IFolder.createLink(IPath, int, IProgressMonitor)

isTeamPrivateMember

public boolean isTeamPrivateMember(int options)
Description copied from interface: IResource
Returns whether this resource is a team private member of its parent container. Returns 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.

Specified by:
isTeamPrivateMember in interface IResource
Overrides:
isTeamPrivateMember in class Resource
Parameters:
options - bit-wise or of option flag constants (only IResource.CHECK_ANCESTORS is applicable)
Returns:
true if this resource is a team private member, and false otherwise
See Also:
IResource.setTeamPrivateMember(boolean)

isLocal

public boolean isLocal(int depth)
Deprecated. 

Description copied from interface: IResource
Returns whether this resource and its members (to the specified depth) are expected to have their contents (and properties) available locally. Returns 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.

Specified by:
isLocal in interface IResource
Overrides:
isLocal in class Resource
Parameters:
depth - valid values are DEPTH_ZERO, DEPTH_ONE, or DEPTH_INFINITE
Returns:
true if this resource is local, and false otherwise
See Also:
IResource.isLocal(int)

isLocal

public boolean isLocal(int flags,
                       int depth)
Deprecated. 

Description copied from class: Resource
Note the depth parameter is intentionally ignored because this method is over-ridden by Container.isLocal().

Overrides:
isLocal in class Container
See Also:
IResource.isLocal(int)

isNatureEnabled

public boolean isNatureEnabled(java.lang.String natureId)
                        throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Returns true if the project nature specified by the given nature extension id is enabled for this project, and false otherwise.

Specified by:
isNatureEnabled in interface IProject
Parameters:
natureId - the nature extension identifier
Returns:
true if the given nature is enabled for this project
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project does not exist.
  • This project is not open.
See Also:
IWorkspace.validateNatureSet(String[])

isOpen

public boolean isOpen()
Description copied from interface: IProject
Returns whether this project is open.

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.

Specified by:
isOpen in interface IProject
Returns:
true if this project is open, false if this project is closed or does not exist
See Also:
IProject.open(IProgressMonitor), IProject.close(IProgressMonitor)

isOpen

public boolean isOpen(int flags)

move

public void move(IProjectDescription destination,
                 boolean force,
                 org.eclipse.core.runtime.IProgressMonitor monitor)
          throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Renames this project so that it is located at the name in the given description.

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.

Specified by:
move in interface IProject
Parameters:
destination - the description for the destination project
force - a flag controlling whether resources that are not in sync with the local file system will be tolerated
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this resource could not be moved. Reasons include:
  • This resource is not accessible.
  • This resource or one of its descendents is not local.
  • This resource or one of its descendents is out of sync with the local file system and force is false.
  • The workspace and the local file system are out of sync at the destination resource or one of its descendents.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IResourceDelta.getFlags(), IResource.move(IProjectDescription,int,IProgressMonitor), IResourceRuleFactory.moveRule(IResource, IResource)

move

public void move(IProjectDescription description,
                 int updateFlags,
                 org.eclipse.core.runtime.IProgressMonitor monitor)
          throws org.eclipse.core.runtime.CoreException
Description copied from interface: IResource
Renames or relocates this project so that it is the project specified by the given project description. The description specifies the name and location of the new project. After successful completion, the old project and any direct or indirect members will no longer exist; but corresponding new resources will now exist in the new project.

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.

Specified by:
move in interface IResource
Overrides:
move in class Resource
Parameters:
description - the destination project description
updateFlags - 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
Throws:
org.eclipse.core.runtime.CoreException - if this resource could not be moved. Reasons include:
  • This resource does not exist.
  • This resource or one of its descendents is not local.
  • This resource is not a project.
  • The project at the destination already exists.
  • This resource or one of its descendents is out of sync with the local file system and FORCE is not specified.
  • The workspace and the local file system are out of sync at the destination resource or one of its descendents.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
  • The destination file system location is occupied. When moving a project in the file system, the destination directory must either not exist or be empty.
See Also:
IResourceDelta.getFlags(), IResource.FORCE, IResource.KEEP_HISTORY, IResource.SHALLOW, IResource.REPLACE, IResourceRuleFactory.moveRule(IResource, IResource)

open

public void open(int updateFlags,
                 org.eclipse.core.runtime.IProgressMonitor monitor)
          throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Opens this project. No action is taken if the project is already open.

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.

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. If the 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.

Specified by:
open in interface IProject
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IProject.close(IProgressMonitor), IResource.BACKGROUND_REFRESH, IResourceRuleFactory.modifyRule(IResource)

open

public void open(org.eclipse.core.runtime.IProgressMonitor monitor)
          throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Opens this project. No action is taken if the project is already open.

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.

Specified by:
open in interface IProject
Parameters:
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IProject.close(IProgressMonitor), IResourceRuleFactory.modifyRule(IResource)

reconcileLinks

public org.eclipse.core.runtime.IStatus reconcileLinks(ProjectDescription newDescription)
The project description file has changed on disk, resulting in a changed set of linked resources. Perform the necessary creations and deletions of links to bring the links in sync with those described in the project description.

Parameters:
newDescription - the new project description that may have changed link descriptions.
Returns:
status ok if everything went well, otherwise an ERROR multi-status describing the problems encountered.

setDescription

public void setDescription(IProjectDescription description,
                           int updateFlags,
                           org.eclipse.core.runtime.IProgressMonitor monitor)
                    throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Changes this project resource to match the given project description. This project should exist and be open.

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.

Specified by:
setDescription in interface IProject
Parameters:
description - the project description
updateFlags - 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
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project does not exist in the workspace.
  • This project is not open.
  • The location in the local file system corresponding to the project description file is occupied by a directory.
  • The workspace is not in sync with the project description file in the local file system and FORCE is not specified.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
  • The file modification validator disallowed the change.
See Also:
IProject.getDescription(), IProjectNature.configure(), IProjectNature.deconfigure(), IResource.FORCE, IResource.KEEP_HISTORY, IResource.AVOID_NATURE_CONFIG, IResourceRuleFactory.modifyRule(IResource)

setDescription

public void setDescription(IProjectDescription description,
                           org.eclipse.core.runtime.IProgressMonitor monitor)
                    throws org.eclipse.core.runtime.CoreException
Description copied from interface: IProject
Changes this project resource to match the given project description. This project should exist and be open.

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.

Specified by:
setDescription in interface IProject
Parameters:
description - the project description
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This project does not exist in the workspace.
  • This project is not open.
  • The location in the local file system corresponding to the project description file is occupied by a directory.
  • The workspace is out of sync with the project description file in the local file system .
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
  • The file modification validator disallowed the change.
See Also:
IProject.getDescription(), IProjectNature.configure(), IProjectNature.deconfigure(), IProject.setDescription(IProjectDescription,int,IProgressMonitor)

touch

public void touch(org.eclipse.core.runtime.IProgressMonitor monitor)
           throws org.eclipse.core.runtime.CoreException
Description copied from interface: IResource
Marks this resource as having changed even though its content may not have changed. This method can be used to trigger the rebuilding of resources/structures derived from this resource. Touching the workspace root has no effect.

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.

Specified by:
touch in interface IResource
Overrides:
touch in class Resource
Parameters:
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
org.eclipse.core.runtime.CoreException - if this method fails. Reasons include:
  • This resource does not exist.
  • This resource is not local.
  • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
See Also:
IResourceRuleFactory.modifyRule(IResource), IResourceDelta.CONTENT, IResourceDelta.DESCRIPTION

writeDescription

public void writeDescription(int updateFlags)
                      throws org.eclipse.core.runtime.CoreException
Writes the project's current description file to disk.

Throws:
org.eclipse.core.runtime.CoreException

writeDescription

public void writeDescription(IProjectDescription description,
                             int updateFlags,
                             boolean hasPublicChanges,
                             boolean hasPrivateChanges)
                      throws org.eclipse.core.runtime.CoreException
Writes the project description file to disk. This is the only method that should ever be writing the description, because it ensures that the description isn't then immediately discovered as an incoming change and read back from disk.

Parameters:
description - The description to write
updateFlags - The write operation update flags
hasPublicChanges - Whether the public sections of the description have changed
hasPrivateChanges - Whether the private sections of the description have changed
Throws:
org.eclipse.core.runtime.CoreException - On failure to write the description