Class TeamHook
This class is intended to be subclassed by the team component in
conjunction with the org.eclipse.core.resources.teamHook
standard extension point. Individual team providers may also subclass this
class. It is not intended to be subclassed by other clients. The methods
defined on this class are called from within the implementations of
workspace API methods and must not be invoked directly by clients.
- Since:
- 2.1
-
Field Summary
Modifier and TypeFieldDescriptionprotected final IResourceRuleFactory
The default resource scheduling rule factory. -
Constructor Summary
ModifierConstructorDescriptionprotected
TeamHook()
Deprecated.protected
TeamHook
(IWorkspace workspace) Creates a new team hook for the given workspace. -
Method Summary
Modifier and TypeMethodDescriptiongetRuleFactory
(IProject project) Returns the resource scheduling rule factory that should be used when workspace operations are invoked on resources in that project.protected final void
setRuleFactory
(IProject project, IResourceRuleFactory factory) Sets the resource scheduling rule factory to use for resource modifications in the given project.validateCreateLink
(IFile file, int updateFlags, URI location) Validates whether a particular attempt at link creation is allowed.validateCreateLink
(IFile file, int updateFlags, IPath location) Validates whether a particular attempt at link creation is allowed.validateCreateLink
(IFolder folder, int updateFlags, URI location) Validates whether a particular attempt at link creation is allowed.validateCreateLink
(IFolder folder, int updateFlags, IPath location) Validates whether a particular attempt at link creation is allowed.
-
Field Details
-
defaultFactory
The default resource scheduling rule factory. This factory can be used for projects that the team hook methods do not participate in.- Since:
- 3.0
- See Also:
-
-
Constructor Details
-
TeamHook
Deprecated.this constructor relies on the workspace already initialized and accessible via static access, instead theTeamHook(IWorkspace)
constructor should be used.Creates a new team hook. Default constructor for use by subclasses and the resources plug-in only. -
TeamHook
Creates a new team hook for the given workspace.- Since:
- 3.17
-
-
Method Details
-
getRuleFactory
Returns the resource scheduling rule factory that should be used when workspace operations are invoked on resources in that project. The workspace will ask the team hook this question only once per project, per session. The workspace will assume the returned result is valid for the rest of that session, unless the rule is changed by callingsetRuleFactory
.This method must not return
null
. If no special rules are required by the team hook for the given project, the value of thedefaultFactory
field should be returned.This default implementation always returns the value of the
defaultFactory
field. Subclasses may override and provide a subclass ofResourceRuleFactory
.- Parameters:
project
- the project to return scheduling rules for- Returns:
- the resource scheduling rules for a project
- Since:
- 3.0
- See Also:
-
setRuleFactory
Sets the resource scheduling rule factory to use for resource modifications in the given project. This method only needs to be called if the factory has changed since the initial call togetRuleFactory
for the given projectThe supplied factory must not be
null
. If no special rules are required by the team hook for the given project, the value of thedefaultFactory
field should be used.Note that the new rule factory will only take effect for resource changing operations that begin after this method completes. Care should be taken to avoid calling this method during the invocation of any resource changing operation (in any thread). The best time to change rule factories is during resource change notification when the workspace is locked for modification.
- Overrides:
setRuleFactory
in classorg.eclipse.core.internal.resources.InternalTeamHook
- Parameters:
project
- the project to change the resource rule factory forfactory
- the new resource rule factory- Since:
- 3.0
- See Also:
-
validateCreateLink
Validates whether a particular attempt at link creation is allowed. This gives team providers an opportunity to hook into the beginning of the implementation ofIFile.createLink
.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.
This method should be overridden by subclasses that want to control what links are created. The default implementation of this method allows all links to be created.
- Parameters:
file
- the file to be linkedupdateFlags
- bit-wise or of update flag constants (only ALLOW_MISSING_LOCAL is relevant here)location
- a file system path where the file should be linked- Returns:
- a status object with code
IStatus.OK
if linking is allowed, otherwise a status object with severityIStatus.ERROR
indicating why the creation is not allowed. - See Also:
-
validateCreateLink
Validates whether a particular attempt at link creation is allowed. This gives team providers an opportunity to hook into the beginning of the implementation ofIFile.createLink(URI, int, IProgressMonitor)
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.
This method should be overridden by subclasses that want to control what links are created. The default implementation of this method allows all links to be created.
- Parameters:
file
- the file to be linkedupdateFlags
- bit-wise or of update flag constants (only ALLOW_MISSING_LOCAL is relevant here)location
- a file system URI where the file should be linked- Returns:
- a status object with code
IStatus.OK
if linking is allowed, otherwise a status object with severityIStatus.ERROR
indicating why the creation is not allowed. - Since:
- 3.2
- See Also:
-
validateCreateLink
Validates whether a particular attempt at link creation is allowed. This gives team providers an opportunity to hook into the beginning of the implementation ofIFolder.createLink
.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.
This method should be overridden by subclasses that want to control what links are created. The default implementation of this method allows all links to be created.
- Parameters:
folder
- the file to be linkedupdateFlags
- bit-wise or of update flag constants (only ALLOW_MISSING_LOCAL is relevant here)location
- a file system path where the folder should be linked- Returns:
- a status object with code
IStatus.OK
if linking is allowed, otherwise a status object with severityIStatus.ERROR
indicating why the creation is not allowed. - See Also:
-
validateCreateLink
Validates whether a particular attempt at link creation is allowed. This gives team providers an opportunity to hook into the beginning of the implementation ofIFolder.createLink(URI, int, IProgressMonitor)
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.
This method should be overridden by subclasses that want to control what links are created. The default implementation of this method allows all links to be created.
- Parameters:
folder
- the file to be linkedupdateFlags
- bit-wise or of update flag constants (only ALLOW_MISSING_LOCAL is relevant here)location
- a file system path where the folder should be linked- Returns:
- a status object with code
IStatus.OK
if linking is allowed, otherwise a status object with severityIStatus.ERROR
indicating why the creation is not allowed. - Since:
- 3.2
- See Also:
-
TeamHook(IWorkspace)
constructor should be used.