| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> |
| <HEAD> |
| <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> |
| <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> |
| |
| <LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css"> |
| <TITLE> |
| Resource modification hooks |
| </TITLE> |
| |
| <link rel="stylesheet" type="text/css" HREF="../book.css"> |
| </HEAD> |
| <BODY BGCOLOR="#ffffff"> |
| <H2> |
| Resource modification hooks</H2> |
| <P >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 <a href="team.htm">Team support</a> |
| plug-ins add the ability to work with resources that are under the management of |
| a versioning repository.</P> |
| |
| <P > |
| 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 <a href="team_provider_hooks.htm">Team |
| resource modification hooks </a>for a discussion of how team uses these |
| hooks. </P> |
| |
| <h3 > |
| Resource move/delete hooks</h3> |
| |
| <P > |
| 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. </P> |
| |
| <P > |
| The team plug-in uses the <a href="../reference/extension-points/org_eclipse_core_resources_moveDeleteHook.html"><b>org.eclipse.core.resources.moveDeleteHook</b></a> |
| extension point to register its hook:</P> |
| |
| <pre ><font color="#4444CC"><extension point="org.eclipse.core.resources.moveDeleteHook" id="MoveDeleteHook"> |
| <moveDeleteHook class="org.eclipse.team.internal.core.MoveDeleteManager"/> |
| </extension></font> |
| </pre> |
| |
| <P > |
| The supplied class must implement <a href="../reference/api/org/eclipse/core/resources/team/IMoveDeleteHook.html"><b>IMoveDeleteHook</b></a>, |
| 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.</P> |
| |
| <blockquote> |
| |
| <P ><i>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 <a href="team_provider_hooks.htm">Team |
| resource modification hooks</a> for more information about using these hooks.</i></P> |
| |
| </blockquote> |
| |
| <h3 > |
| File modification validators</h3> |
| |
| <p>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 <a href="../reference/extension-points/org_eclipse_core_resources_moveDeleteHook.html"><b>org.eclipse.core.resources.fileModificationValidator</b></a> |
| to register a validator that is called whenever a resource is to be modified.</p> |
| |
| <pre ><font color="#4444CC"><extension point="org.eclipse.core.resources.fileModificationValidator" id="FileValidator"> |
| <fileModificationValidator class="org.eclipse.team.internal.core.FileModificationValidatorManager"/> |
| </extension></font></pre> |
| |
| <P >The supplied class must implement <a href="../reference/api/org/eclipse/core/resources/IFileModificationValidator.html"><b>IFileModificationValidator</b></a>, |
| 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.</P> |
| |
| <blockquote> |
| |
| <P ><i>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 <a href="team_provider_hooks.htm">Team resource |
| modification hooks</a> for more information about using these hooks.</i></P> |
| |
| </blockquote> |
| |
| <P > |
| <a href="../hglegal.htm"><img border="0" src="../ngibmcpy.gif" alt="Copyright IBM Corporation and others 2000, 2003." border="0" width="324" height="14"></a></P> |
| |
| </BODY> |
| </HTML> |