Interface IResourceTree
IMoveDeleteHook
call these methods.- Since:
- 2.0
- Restriction:
- This interface is not intended to be implemented by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
Constant indicating that no file timestamp was supplied. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToLocalHistory
(IFile file) Adds the current state of the given file to the local history.long
computeTimestamp
(IFile file) Computes the timestamp for the given file in the local file system.void
deletedFile
(IFile file) Declares that the given file has been successfully deleted from the local file system, and requests that the corresponding deletion should now be made to the workspace resource tree.void
deletedFolder
(IFolder folder) Declares that the given folder and all its descendents have been successfully deleted from the local file system, and requests that the corresponding deletion should now be made to the workspace resource tree.void
deletedProject
(IProject project) Declares that the given project's content area in the local file system has been successfully dealt with in an appropriate manner, and requests that the corresponding deletion should now be made to the workspace resource tree.void
Declares that the operation has failed for the specified reason.long
getTimestamp
(IFile file) Returns the timestamp for the given file as recorded in the workspace resource tree.boolean
isSynchronized
(IResource resource, int depth) Returns whether the given resource and its descendents to the given depth are considered to be in sync with the local file system.void
Declares that the given source file has been successfully moved to the given destination in the local file system, and requests that the corresponding changes should now be made to the workspace resource tree.void
movedFolderSubtree
(IFolder source, IFolder destination) Declares that the given source folder and its descendents have been successfully moved to the given destination in the local file system, and requests that the corresponding changes should now be made to the workspace resource tree for the folder and all its descendents.boolean
movedProjectSubtree
(IProject source, IProjectDescription description) Declares that the given source project and its files and folders have been successfully relocated in the local file system if required, and requests that the rename and/or relocation should now be made to the workspace resource tree for the project and all its descendents.void
standardDeleteFile
(IFile file, int updateFlags, IProgressMonitor monitor) Deletes the given file in the standard manner from both the local file system and from the workspace resource tree.void
standardDeleteFolder
(IFolder folder, int updateFlags, IProgressMonitor monitor) Deletes the given folder and its descendents in the standard manner from both the local file system and from the workspace resource tree.void
standardDeleteProject
(IProject project, int updateFlags, IProgressMonitor monitor) Deletes the given project and its descendents in the standard manner from both the local file system and from the workspace resource tree.void
standardMoveFile
(IFile source, IFile destination, int updateFlags, IProgressMonitor monitor) Moves the given file in the standard manner from both the local file system and from the workspace resource tree.void
standardMoveFolder
(IFolder source, IFolder destination, int updateFlags, IProgressMonitor monitor) Moves the given folder and its descendents in the standard manner from both the local file system and from the workspace resource tree.void
standardMoveProject
(IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor) Renames and/or relocates the given project in the standard manner.void
updateMovedFileTimestamp
(IFile file, long timestamp) Updates the timestamp for the given file in the workspace resource tree.
-
Field Details
-
NULL_TIMESTAMP
static final long NULL_TIMESTAMPConstant indicating that no file timestamp was supplied.- See Also:
-
-
Method Details
-
addToLocalHistory
Adds the current state of the given file to the local history. Does nothing if the file does not exist in the workspace resource tree, or if it exists in the workspace resource tree but not in the local file system.This method is used to capture the state of a file in the workspace local history before it is overwritten or deleted.
- Parameters:
file
- the file to be captured
-
isSynchronized
Returns whether the given resource and its descendents to the given depth are considered to be in sync with the local file system. Returnsfalse
if the given resource does not exist in the workspace resource tree, but exists in the local file system; and conversely.- Parameters:
resource
- the resource of interestdepth
- the depth (one ofIResource.DEPTH_ZERO
,DEPTH_ONE
, orDEPTH_INFINITE
)- Returns:
true
if the resource is synchronized, andfalse
in all other cases
-
computeTimestamp
Computes the timestamp for the given file in the local file system. ReturnsNULL_TIMESTAMP
if the timestamp of the file in the local file system cannot be determined. The file need not exist in the workspace resource tree; however, if the file's project does not exist in the workspace resource tree, this method returnsNULL_TIMESTAMP
because the project's local content area is indeterminate.Note that the timestamps used for workspace resource tree file synchronization are not necessarily interchangeable with
java.io.File
last modification time.The ones computed bycomputeTimestamp
may have a higher resolution in some operating environments.- Parameters:
file
- the file of interest- Returns:
- the local file system timestamp for the file, or
NULL_TIMESTAMP
if it could not be computed
-
getTimestamp
Returns the timestamp for the given file as recorded in the workspace resource tree. ReturnsNULL_TIMESTAMP
if the given file does not exist in the workspace resource tree, or if the timestamp is not known.Note that the timestamps used for workspace resource tree file synchronization are not necessarily interchangeable with
java.io.File
last modification time.The ones computed bycomputeTimestamp
may have a higher resolution in some operating environments.- Parameters:
file
- the file of interest- Returns:
- the workspace resource tree timestamp for the file, or
NULL_TIMESTAMP
if the file does not exist in the workspace resource tree, or if the timestamp is not known
-
updateMovedFileTimestamp
Updates the timestamp for the given file in the workspace resource tree. The file is the local file system is not affected. Does nothing if the given file does not exist in the workspace resource tree.The given timestamp should be that of the corresponding file in the local file system (as computed by
computeTimestamp
). A discrepancy between the timestamp of the file in the local file system and the timestamp recorded in the workspace resource tree means that the file is out of sync (isSynchronized
returnsfalse
).This operation should be used after
movedFile/Folder/Project
to correct the workspace resource tree record when file timestamps change in the course of a move operation.Note that the timestamps used for workspace resource tree file synchronization are not necessarily interchangeable with
java.io.File
last modification time.The ones computed bycomputeTimestamp
may have a higher resolution in some operating environments.- Parameters:
file
- the file of interesttimestamp
- the local file system timestamp for the file, orNULL_TIMESTAMP
if unknown- See Also:
-
failed
Declares that the operation has failed for the specified reason. This method may be called multiple times to report multiple failures. All reasons will be accumulated and taken into consideration when deciding the outcome of the hooked operation as a whole.- Parameters:
reason
- the reason the operation (or sub-operation) failed
-
deletedFile
Declares that the given file has been successfully deleted from the local file system, and requests that the corresponding deletion should now be made to the workspace resource tree. No action is taken if the given file does not exist in the workspace resource tree.This method clears out any markers, session properties, and persistent properties associated with the given file.
- Parameters:
file
- the file that was just deleted from the local file system
-
deletedFolder
Declares that the given folder and all its descendents have been successfully deleted from the local file system, and requests that the corresponding deletion should now be made to the workspace resource tree. No action is taken if the given folder does not exist in the workspace resource tree.This method clears out any markers, session properties, and persistent properties associated with the given folder or its descendents.
- Parameters:
folder
- the folder that was just deleted from the local file system
-
deletedProject
Declares that the given project's content area in the local file system has been successfully dealt with in an appropriate manner, and requests that the corresponding deletion should now be made to the workspace resource tree. No action is taken if the given project does not exist in the workspace resource tree.This method clears out everything associated with this project and any of its descendent resources, including: markers; session properties; persistent properties; local history; and project-specific plug-ins working data areas. The project's content area is not affected.
- Parameters:
project
- the project being deleted
-
movedFile
Declares that the given source file has been successfully moved to the given destination in the local file system, and requests that the corresponding changes should now be made to the workspace resource tree. No action is taken if the given source file does not exist in the workspace resource tree.The destination file must not already exist in the workspace resource tree.
This operation carries over the file timestamp unchanged. Use
updateMovedFileTimestamp
to update the timestamp of the file if its timestamp changed as a direct consequence of the move.- Parameters:
source
- the handle of the source file that was moveddestination
- the handle of where the file moved to- See Also:
-
movedFolderSubtree
Declares that the given source folder and its descendents have been successfully moved to the given destination in the local file system, and requests that the corresponding changes should now be made to the workspace resource tree for the folder and all its descendents. No action is taken if the given source folder does not exist in the workspace resource tree.This operation carries over file timestamps unchanged. Use
updateMovedFileTimestamp
to update the timestamp of files whose timestamps changed as a direct consequence of the move.The destination folder must not already exist in the workspace resource tree.
- Parameters:
source
- the handle of the source folder that was moveddestination
- the handle of where the folder moved to
-
movedProjectSubtree
Declares that the given source project and its files and folders have been successfully relocated in the local file system if required, and requests that the rename and/or relocation should now be made to the workspace resource tree for the project and all its descendents. No action is taken if the given project does not exist in the workspace resource tree.This operation carries over file timestamps unchanged. Use
updateMovedFileTimestamp
to update the timestamp of files whose timestamps changed as a direct consequence of the move.If the project is being renamed, the destination project must not already exist in the workspace resource tree.
Local history is not preserved if the project is renamed. It is preserved when the project's content area is relocated without renaming the project.
- Parameters:
source
- the handle of the source project that was moveddescription
- the new project description- Returns:
true
if the move succeeded, andfalse
otherwise
-
standardDeleteFile
Deletes the given file in the standard manner from both the local file system and from the workspace resource tree.Implementations of
IMoveDeleteHook
must invoke this method in lieu offile.delete(updateFlags, monitor)
because all regular API operations that modify resources are off limits.If the operation fails, the reason for the failure is automatically collected by an internal call to
failed
.- Parameters:
file
- the file to deleteupdateFlags
- bit-wise or of update flag constants as perIResource.delete(int,IProgressMonitor)
monitor
- the progress monitor, ornull
as perIResource.delete(int,IProgressMonitor)
-
standardDeleteFolder
Deletes the given folder and its descendents in the standard manner from both the local file system and from the workspace resource tree.Implementations of
IMoveDeleteHook
must invoke this method in lieu offolder.delete(updateFlags, monitor)
because all regular API operations that modify resources are off limits.If the operation fails, the reason for the failure is automatically collected by an internal call to
failed
.- Parameters:
folder
- the folder to deleteupdateFlags
- bit-wise or of update flag constants as perIResource.delete(int,IProgressMonitor)
monitor
- the progress monitor, ornull
as perIResource.delete(int,IProgressMonitor)
-
standardDeleteProject
Deletes the given project and its descendents in the standard manner from both the local file system and from the workspace resource tree.Implementations of
IMoveDeleteHook
must invoke this method in lieu ofproject.delete(updateFlags, monitor)
because all regular API operations that modify resources are off limits.If the operation fails, the reason for the failure is automatically collected by an internal call to
failed
.- Parameters:
project
- the project to deleteupdateFlags
- bit-wise or of update flag constants as perIResource.delete(int,IProgressMonitor)
monitor
- the progress monitor, ornull
as perIResource.delete(int,IProgressMonitor)
-
standardMoveFile
Moves the given file in the standard manner from both the local file system and from the workspace resource tree.Implementations of
IMoveDeleteHook
must invoke this method in lieu ofsource.move(destination.getProjectRelativePath(), updateFlags, monitor)
because all regular API operations that modify resources are off limits.If the operation fails, the reason for the failure is automatically collected by an internal call to
failed
.- Parameters:
source
- the handle of the source file to movedestination
- the handle of where the file will move toupdateFlags
- bit-wise or of update flag constants as perIResource.move(IPath,int,IProgressMonitor)
monitor
- the progress monitor, ornull
as perIResource.move(IPath,int,IProgressMonitor)
-
standardMoveFolder
void standardMoveFolder(IFolder source, IFolder destination, int updateFlags, IProgressMonitor monitor) Moves the given folder and its descendents in the standard manner from both the local file system and from the workspace resource tree.Implementations of
IMoveDeleteHook
must invoke this method in lieu ofsource.move(destination.getProjectRelativePath(), updateFlags, monitor)
because all regular API operations that modify resources are off limits.If the operation fails, the reason for the failure is automatically collected by an internal call to
failed
.- Parameters:
source
- the handle of the source folder to movedestination
- the handle of where the folder will move toupdateFlags
- bit-wise or of update flag constants as perIResource.move(IPath,int,IProgressMonitor)
monitor
- the progress monitor, ornull
as perIResource.move(IPath,int,IProgressMonitor)
-
standardMoveProject
void standardMoveProject(IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor) Renames and/or relocates the given project in the standard manner.Implementations of
IMoveDeleteHook
must invoke this method in lieu ofsource.move(description, updateFlags, monitor)
because all regular API operations that modify resources are off limits.If the operation fails, the reason for the failure is automatically collected by an internal call to
failed
.- Parameters:
source
- the handle of the source folder to movedescription
- the new project descriptionupdateFlags
- bit-wise or of update flag constants as perIResource.move(IPath,int,IProgressMonitor)
monitor
- the progress monitor, ornull
as perIResource.move(IPath,int,IProgressMonitor)
-