## Resource modification hooks

So far, we've assumed that resource API is being used to modify resources that are located in the user's file system. This is indeed the fundamental structure of the workspace, but it's also possible that a plug-in adds capabilities for manipulation of resources that are managed somewhere else. For example, the platform Team support plug-ins add the ability to work with resources that are under the management of a versioning repository.

The resource API includes capabilities that have been added specifically to enable the team support plug-ins and plug-ins that implement repository providers using the team support. The following discussion covers the generic mechanism for registering resource hooks. See Implementing a repository provider for a discussion of how team uses these hooks.

### Resource move/delete hooks

This hook allows the team plug-in and its providers to control how resource moves and deletes are implemented. The hook includes the ability to prevent these operations from happening. Implementors can provide alternate implementations for moving or deleting files, folders, and projects.

The team plug-in uses the org.eclipse.core.resources.moveDeleteHook extension point to register its hook:

    <extension point="org.eclipse.core.resources.moveDeleteHook" id="MoveDeleteHook">
    	<moveDeleteHook class="org.eclipse.team.internal.core.MoveDeleteManager"/>
    </extension>

The supplied class must implement IMoveDeleteHook, which is called by the platform whenever a resource is moved or deleted. The team plug-in installs a move delete hook manager that can determine which team provider is managing a resource and invoke its specific hook.

> Note: The move delete hook was designed specifically for use by the team core plug-in and other team repository provider clients. It is not intended for general use. Team providers should not install the hook using the extension point, but instead implement their hook in their RepositoryProvider class. See Team resource modification hooks for more information about using these hooks.

### File modification validators

It's also possible that team repository providers will need to prevent or intervene in the editing or saving of a file. The team plug-in accomplishes this by using the extension point org.eclipse.core.resources.fileModificationValidator to register a validator that is called whenever a resource is to be modified.

    <extension point="org.eclipse.core.resources.fileModificationValidator" id="FileValidator">
    	<fileModificationValidator class="org.eclipse.team.internal.core.FileModificationValidatorManager"/>
    </extension>

The supplied class must implement IFileModificationValidator, which is called by the platform whenever a resource is saved or opened. The team plug-in installs a file modification manager that can determine which team provider is managing a resource and invoke its specific validator.

> Note: The file modification validator hook was designed specifically for use by the team core plug-in. It is not intended for general use. Team providers should not install the hook using the extension point, but instead implement their hook in their Repository Provider class. See Team resource modification hooks for more information about using these hooks.