Interface IMoveDeleteHook
IResource.move and IResource.delete.
This interface is intended to be implemented by the team component in
conjunction with the org.eclipse.core.resources.moveDeleteHook
standard extension point. Individual team providers may also implement this
interface. It is not intended to be implemented by other clients. The methods
defined on this interface are called from within the implementations of
IResource.move and IResource.delete. They are not
intended to be called from anywhere else.
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleandeleteFile(IResourceTree tree, IFile file, int updateFlags, IProgressMonitor monitor) ImplementsIResource.delete(int,IProgressMonitor)where the receiver is a file.booleandeleteFolder(IResourceTree tree, IFolder folder, int updateFlags, IProgressMonitor monitor) ImplementsIResource.delete(int,IProgressMonitor)where the receiver is a folder.booleandeleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) ImplementsIResource.delete(int,IProgressMonitor)where the receiver is a project.booleanmoveFile(IResourceTree tree, IFile source, IFile destination, int updateFlags, IProgressMonitor monitor) ImplementsIResource.move(IPath,int,IProgressMonitor)where the receiver is a file.booleanmoveFolder(IResourceTree tree, IFolder source, IFolder destination, int updateFlags, IProgressMonitor monitor) ImplementsIResource.move(IPath,int,IProgressMonitor)where the receiver is a project.booleanmoveProject(IResourceTree tree, IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor) ImplementsIResource.move(IPath,int,IProgressMonitor)andIResource.move(IProjectDescription,int,IProgressMonitor)where the receiver is a project.
-
Method Details
-
deleteFile
ImplementsIResource.delete(int,IProgressMonitor)where the receiver is a file. Returnstrueto accept responsibility for implementing this operation as per the API contract.In broad terms, a full re-implementation should delete the file in the local file system and then call
tree.deletedFileto complete the updating of the workspace resource tree to reflect this fact. If unsuccessful in deleting the file from the local file system, it should instead calltree.failedto report the reason for the failure. In either case, it should returntrueto indicate that the operation was attempted. TheFORCEupdate flag needs to be honored: unlessFORCEis specified, the implementation must usetree.isSynchronizedto determine whether the file is in sync before attempting to delete it. TheKEEP_HISTORYupdate flag needs to be honored as well; usetree.addToLocalHistoryto capture the contents of the file before deleting it from the local file system.An extending implementation should perform whatever pre-processing it needs to do and then call
tree.standardDeleteFileto explicitly invoke the standard file deletion behavior, which deletes both the file from the local file system and updates the workspace resource tree. It should returntrueto indicate that the operation was attempted.Returning
falseis the easy way for the implementation to say "pass". It is equivalent to callingtree.standardDeleteFileand returningtrue.The implementation of this method runs "below" the resources API and is therefore very restricted in what resource API method it can call. The list of useable methods includes most resource operations that read but do not update the resource tree; resource operations that modify resources and trigger deltas must not be called from within the dynamic scope of the invocation of this method.
- Parameters:
tree- the workspace resource tree; this object is only valid for the duration of the invocation of this method, and must not be used after this method has completedfile- the handle of the file to delete; the receiver ofIResource.delete(int,IProgressMonitor)updateFlags- bit-wise or of update flag constants as perIResource.delete(int,IProgressMonitor)monitor- the progress monitor, ornullas perIResource.delete(int,IProgressMonitor)- Returns:
falseif this method declined to assume responsibility for this operation, andtrueif this method attempted to carry out the operation- Throws:
OperationCanceledException- if the operation is canceled. Cancelation can occur even if no progress monitor is provided.- See Also:
-
deleteFolder
ImplementsIResource.delete(int,IProgressMonitor)where the receiver is a folder. Returnstrueto accept responsibility for implementing this operation as per the API contract.In broad terms, a full re-implementation should delete the directory tree in the local file system and then call
tree.deletedFolderto complete the updating of the workspace resource tree to reflect this fact. If unsuccessful in deleting the directory or any of its descendents from the local file system, it should instead calltree.failedto report each reason for failure. In either case it should returntrueto indicate that the operation was attempted. TheFORCEupdate flag needs to be honored: unlessFORCEis specified, the implementation must usetree.isSynchronizedto determine whether the folder subtree is in sync before attempting to delete it. TheKEEP_HISTORYupdate flag needs to be honored as well; usetree.addToLocalHistoryto capture the contents of any files being deleted.A partial re-implementation should perform whatever pre-processing it needs to do and then call
tree.standardDeleteFolderto explicitly invoke the standard folder deletion behavior, which deletes both the folder and its descendents from the local file system and updates the workspace resource tree. It should returntrueto indicate that the operation was attempted.Returning
falseis the easy way for the implementation to say "pass". It is equivalent to callingtree.standardDeleteFolderand returningtrue.The implementation of this method runs "below" the resources API and is therefore very restricted in what resource API method it can call. The list of useable methods includes most resource operations that read but do not update the resource tree; resource operations that modify resources and trigger deltas must not be called from within the dynamic scope of the invocation of this method.
- Parameters:
tree- the workspace resource tree; this object is only valid for the duration of the invocation of this method, and must not be used after this method has completedfolder- the handle of the folder to delete; the receiver ofIResource.delete(int,IProgressMonitor)updateFlags- bit-wise or of update flag constants as perIResource.delete(int,IProgressMonitor)monitor- the progress monitor, ornullas perIResource.delete(int,IProgressMonitor)- Returns:
falseif this method declined to assume responsibility for this operation, andtrueif this method attempted to carry out the operation- Throws:
OperationCanceledException- if the operation is canceled. Cancelation can occur even if no progress monitor is provided.- See Also:
-
deleteProject
boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) ImplementsIResource.delete(int,IProgressMonitor)where the receiver is a project. Returnstrueto accept responsibility for implementing this operation as per the API contract.In broad terms, a full re-implementation should delete the project content area in the local file system if required (the files of a closed project should be deleted only if the
IResource.ALWAYS_DELETE_PROJECT_CONTENTSupdate flag is specified; the files of an open project should be deleted unless the theIResource.NEVER_DELETE_PROJECT_CONTENTSupdate flag is specified). It should then calltree.deletedProjectto complete the updating of the workspace resource tree to reflect this fact. If unsuccessful in deleting the project's files from the local file system, it should instead calltree.failedto report the reason for the failure. In either case, it should returntrueto indicate that the operation was attempted. TheFORCEupdate flag may need to be honored if the project is open: unlessFORCEis specified, the implementation must usetree.isSynchronizedto determine whether the project subtree is in sync before attempting to delete it. Note that local history is not maintained when a project is deleted, regardless of the setting of theKEEP_HISTORYupdate flag.A partial re-implementation should perform whatever pre-processing it needs to do and then call
tree.standardDeleteProjectto explicitly invoke the standard project deletion behavior. It should returntrueto indicate that the operation was attempted.Returning
falseis the easy way for the implementation to say "pass". It is equivalent to callingtree.standardDeleteProjectand returningtrue.The implementation of this method runs "below" the resources API and is therefore very restricted in what resource API method it can call. The list of useable methods includes most resource operations that read but do not update the resource tree; resource operations that modify resources and trigger deltas must not be called from within the dynamic scope of the invocation of this method.
- Parameters:
tree- the workspace resource tree; this object is only valid for the duration of the invocation of this method, and must not be used after this method has completedproject- the handle of the project to delete; the receiver ofIResource.delete(int,IProgressMonitor)updateFlags- bit-wise or of update flag constants as perIResource.delete(int,IProgressMonitor)monitor- the progress monitor, ornullas perIResource.delete(int,IProgressMonitor)- Returns:
falseif this method declined to assume responsibility for this operation, andtrueif this method attempted to carry out the operation- Throws:
OperationCanceledException- if the operation is canceled. Cancelation can occur even if no progress monitor is provided.- See Also:
-
moveFile
boolean moveFile(IResourceTree tree, IFile source, IFile destination, int updateFlags, IProgressMonitor monitor) ImplementsIResource.move(IPath,int,IProgressMonitor)where the receiver is a file. Returnstrueto accept responsibility for implementing this operation as per the API contract.On entry to this hook method, the following is guaranteed about the workspace resource tree: the source file exists; the destination file does not exist; the container of the destination file exists and is accessible. In broad terms, a full re-implementation should move the file in the local file system and then call
tree.moveFileto complete the updating of the workspace resource tree to reflect this fact. If unsuccessful in moving the file in the local file system, it should instead calltree.failedto report the reason for the failure. In either case, it should returntrueto indicate that the operation was attempted. TheFORCEupdate flag needs to be honored: unlessFORCEis specified, the implementation must usetree.isSynchronizedto determine whether the file is in sync before attempting to move it. TheKEEP_HISTORYupdate flag needs to be honored as well; usetree.addToLocalHistoryto capture the contents of the file (naturally, this must be before moving the file from the local file system).An extending implementation should perform whatever pre-processing it needs to do and then call
tree.standardMoveFileto explicitly invoke the standard file moving behavior, which moves both the file in the local file system and updates the workspace resource tree. It should returntrueto indicate that the operation was attempted.Returning
falseis the easy way for the implementation to say "pass". It is equivalent to callingtree.standardMoveFileand returningtrue.The implementation of this method runs "below" the resources API and is therefore very restricted in what resource API method it can call. The list of useable methods includes most resource operations that read but do not update the resource tree; resource operations that modify resources and trigger deltas must not be called from within the dynamic scope of the invocation of this method.
- Parameters:
tree- the workspace resource tree; this object is only valid for the duration of the invocation of this method, and must not be used after this method has completedsource- the handle of the file to move; the receiver ofIResource.move(IPath,int,IProgressMonitor)destination- the handle of where the file will move to; the handle equivalent of the first parameter toIResource.move(IPath,int,IProgressMonitor)updateFlags- bit-wise or of update flag constants as perIResource.move(IPath,int,IProgressMonitor)monitor- the progress monitor, ornullas perIResource.move(IPath,int,IProgressMonitor)- Returns:
falseif this method declined to assume responsibility for this operation, andtrueif this method attempted to carry out the operation- Throws:
OperationCanceledException- if the operation is canceled. Cancelation can occur even if no progress monitor is provided.- See Also:
-
moveFolder
boolean moveFolder(IResourceTree tree, IFolder source, IFolder destination, int updateFlags, IProgressMonitor monitor) ImplementsIResource.move(IPath,int,IProgressMonitor)where the receiver is a project. Returnstrueto accept responsibility for implementing this operation as per the API contract.On entry to this hook method, the following is guaranteed about the workspace resource tree: the source folder exists; the destination folder does not exist; the container of the destination folder exists and is accessible. In broad terms, a full re-implementation should move the directory tree in the local file system and then call
tree.movedFolderto complete the updating of the workspace resource tree to reflect this fact. If unsuccessful in moving the directory or any of its descendents in the local file system, calltree.failedto report each reason for failure. In either case, returntrueto indicate that the operation was attempted. TheFORCEupdate flag needs to be honored: unlessFORCEis specified, the implementation must usetree.isSynchronizedto determine whether the folder subtree is in sync before attempting to move it. TheKEEP_HISTORYupdate flag needs to be honored as well; usetree.addToLocalHistoryto capture the contents of any files being moved.A partial re-implementation should perform whatever pre-processing it needs to do and then call
tree.standardMoveFolderto explicitly invoke the standard folder move behavior, which move both the folder and its descendents in the local file system and updates the workspace resource tree. Returntrueto indicate that the operation was attempted.Returning
falseis the easy way for the implementation to say "pass". It is equivalent to callingtree.standardDeleteFolderand returningtrue.The implementation of this method runs "below" the resources API and is therefore very restricted in what resource API method it can call. The list of useable methods includes most resource operations that read but do not update the resource tree; resource operations that modify resources and trigger deltas must not be called from within the dynamic scope of the invocation of this method.
- Parameters:
tree- the workspace resource tree; this object is only valid for the duration of the invocation of this method, and must not be used after this method has completedsource- the handle of the folder to move; the receiver ofIResource.move(IPath,int,IProgressMonitor)destination- the handle of where the folder will move to; the handle equivalent of the first parameter toIResource.move(IPath,int,IProgressMonitor)updateFlags- bit-wise or of update flag constants as perIResource.move(IPath,int,IProgressMonitor)monitor- the progress monitor, ornullas perIResource.move(IPath,int,IProgressMonitor)- Returns:
falseif this method declined to assume responsibility for this operation, andtrueif this method attempted to carry out the operation- Throws:
OperationCanceledException- if the operation is canceled. Cancelation can occur even if no progress monitor is provided.- See Also:
-
moveProject
boolean moveProject(IResourceTree tree, IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor) ImplementsIResource.move(IPath,int,IProgressMonitor)andIResource.move(IProjectDescription,int,IProgressMonitor)where the receiver is a project. Returnstrueto accept responsibility for implementing this operation as per the API contracts.On entry to this hook method, the source project is guaranteed to exist and be open in the workspace resource tree. If the given description contains a different name from that of the given project, then the project is being renamed (and its content possibly relocated). If the given description contains the same name as the given project, then the project is being relocated but not renamed. When the project is being renamed, the destination project is guaranteed not to exist in the workspace resource tree.
Returning
falseis the easy way for the implementation to say "pass". It is equivalent to callingtree.standardMoveProjectand returningtrue.The implementation of this method runs "below" the resources API and is therefore very restricted in what resource API method it can call. The list of useable methods includes most resource operations that read but do not update the resource tree; resource operations that modify resources and trigger deltas must not be called from within the dynamic scope of the invocation of this method.
- Parameters:
tree- the workspace resource tree; this object is only valid for the duration of the invocation of this method, and must not be used after this method has completedsource- the handle of the open project to move; the receiver ofIResource.move(IProjectDescription,int,IProgressMonitor)orIResource.move(IPath,int,IProgressMonitor)description- the new description of the project; the first parameter toIResource.move(IProjectDescription,int,IProgressMonitor), or a copy of the project's description with the location changed to the path given in the first parameter toIResource.move(IPath,int,IProgressMonitor)updateFlags- bit-wise or of update flag constants as perIResource.move(IProjectDescription,int,IProgressMonitor)orIResource.move(IPath,int,IProgressMonitor)monitor- the progress monitor, ornullas perIResource.move(IProjectDescription,int,IProgressMonitor)orIResource.move(IPath,int,IProgressMonitor)- Returns:
falseif this method declined to assume responsibility for this operation, andtrueif this method attempted to carry out the operation- Throws:
OperationCanceledException- if the operation is canceled. Cancelation can occur even if no progress monitor is provided.- See Also:
-