Package org.eclipse.core.resources.team
Class FileModificationValidator
java.lang.Object
org.eclipse.core.resources.team.FileModificationValidator
- All Implemented Interfaces:
IFileModificationValidator
public abstract class FileModificationValidator
extends Object
implements IFileModificationValidator
The file modification validator is a Team-related hook for pre-checking operations
that modify the contents of files.
This class is used only in conjunction with the "org.eclipse.core.resources.fileModificationValidator" extension point. It is intended to be implemented only by the Eclipse Platform Team plug-in or by repository providers whose validator get invoked by Team.
- Since:
- 3.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal IStatusvalidateEdit(IFile[] files, Object context) Deprecated.abstract IStatusvalidateEdit(IFile[] files, FileModificationValidationContext context) Validates that the given files can be modified.validateSave(IFile file) Validates that the given file can be saved.
-
Constructor Details
-
FileModificationValidator
public FileModificationValidator()
-
-
Method Details
-
validateEdit
Deprecated.this method is part of the deprecatedIFileModificationValidatorinterface. Clients should callvalidateEdit(IFile[], FileModificationValidationContext)instead.Validates that the given files can be modified. The files must all exist in the workspace. The optional context object may be supplied if UI-based validation is required. If the context isnull, the validator must attempt to perform the validation in a headless manner. The returned status isIStatus.OKif this validator believes the given file can be modified. Other return statuses indicate the reason why the individual files cannot be modified.- Specified by:
validateEditin interfaceIFileModificationValidator- Parameters:
files- the files that are to be modified; these files must all exist in the workspacecontext- theorg.eclipse.swt.widgets.Shellthat is to be used to parent any dialogs with the user, ornullif there is no UI context (declared as anObjectto avoid any direct references on the SWT component)- Returns:
- a status object that is OK if things are fine, otherwise a status describing reasons why modifying the given files is not reasonable
- See Also:
-
validateSave
Validates that the given file can be saved. This method is called fromIFile#setContentsandIFile#appendContentsbefore any attempt to write data to disk. The returned status isIStatus.OKif this validator believes the given file can be successfully saved. In all other cases the return value is a non-OK status. Note that a return value ofIStatus.OKdoes not guarantee that the save will succeed.- Specified by:
validateSavein interfaceIFileModificationValidator- Parameters:
file- the file that is to be modified; this file must exist in the workspace- Returns:
- a status indicating whether or not it is reasonable to try writing to the given file;
IStatus.OKindicates a save should be attempted. - See Also:
-
validateEdit
Validates that the given files can be modified. The files must all exist in the workspace. The optional context may be supplied if UI-based validation is required. If the context isnull, the validator must attempt to perform the validation in a headless manner. The returned status isIStatus.OKif this validator believes the given file can be modified. Other return statuses indicate the reason why the individual files cannot be modified.- Parameters:
files- the files that are to be modified; these files must all exist in the workspacecontext- the context to aid in UI-based validation ornullif the validation must be headless- Returns:
- a status object that is OK if things are fine, otherwise a status describing reasons why modifying the given files is not reasonable
- See Also:
-
IFileModificationValidatorinterface.