Class ResourceRuleFactory
- java.lang.Object
-
- org.eclipse.core.resources.team.ResourceRuleFactory
-
- All Implemented Interfaces:
IResourceRuleFactory
public class ResourceRuleFactory extends Object implements IResourceRuleFactory
Default implementation of IResourceRuleFactory. The teamHook extension may subclass to provide more specialized scheduling rules for workspace operations that they participate in.- Since:
- 3.0
- See Also:
IResourceRuleFactory
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ResourceRuleFactory()
Deprecated.this constructor relies on the workspace already initialized and accessible via static access, instead theResourceRuleFactory(IWorkspace)
constructor should be used.protected
ResourceRuleFactory(IWorkspace workspace)
Creates a new resource rule factory for the given workspace.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ISchedulingRule
buildRule()
Default implementation ofIResourceRuleFactory#buildRule
.ISchedulingRule
charsetRule(IResource resource)
Default implementation ofIResourceRuleFactory#charsetRule
.ISchedulingRule
copyRule(IResource source, IResource destination)
Default implementation ofIResourceRuleFactory#copyRule
.ISchedulingRule
createRule(IResource resource)
Default implementation ofIResourceRuleFactory#createRule
.ISchedulingRule
deleteRule(IResource resource)
Default implementation ofIResourceRuleFactory#deleteRule
.ISchedulingRule
derivedRule(IResource resource)
Default implementation ofIResourceRuleFactory#derivedRule
.ISchedulingRule
markerRule(IResource resource)
Default implementation ofIResourceRuleFactory#markerRule
.ISchedulingRule
modifyRule(IResource resource)
Default implementation ofIResourceRuleFactory#modifyRule
.ISchedulingRule
moveRule(IResource source, IResource destination)
Default implementation ofIResourceRuleFactory#moveRule
.protected ISchedulingRule
parent(IResource resource)
Convenience method to return the parent of the given resource, or the resource itself for projects and the workspace root.ISchedulingRule
refreshRule(IResource resource)
Default implementation ofIResourceRuleFactory#refreshRule
.ISchedulingRule
validateEditRule(IResource[] resources)
Default implementation ofIResourceRuleFactory#validateEditRule
.
-
-
-
Constructor Detail
-
ResourceRuleFactory
@Deprecated protected ResourceRuleFactory()
Deprecated.this constructor relies on the workspace already initialized and accessible via static access, instead theResourceRuleFactory(IWorkspace)
constructor should be used.Creates a new default resource rule factory. This constructor must only be called by subclasses.
-
ResourceRuleFactory
protected ResourceRuleFactory(IWorkspace workspace)
Creates a new resource rule factory for the given workspace. This constructor must only be called by subclasses.- Since:
- 3.17
-
-
Method Detail
-
buildRule
public final ISchedulingRule buildRule()
Default implementation ofIResourceRuleFactory#buildRule
. This default implementation always returns the workspace root.Subclasses may not currently override this method.
- Specified by:
buildRule
in interfaceIResourceRuleFactory
- Returns:
- a scheduling rule, or
null
- See Also:
IResourceRuleFactory.buildRule()
-
charsetRule
public ISchedulingRule charsetRule(IResource resource)
Default implementation ofIResourceRuleFactory#charsetRule
. This default implementation always returns the project of the resource whose charset setting is being changed, ornull
if the resource is the workspace root.Subclasses may override this method. The rule provided by an overriding method must at least contain the rule from this default implementation.
- Specified by:
charsetRule
in interfaceIResourceRuleFactory
- Parameters:
resource
- the resource for which the charset will be changed- Returns:
- a scheduling rule, or
null
- Since:
- 3.1
- See Also:
ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
,IResourceRuleFactory.charsetRule(IResource)
-
derivedRule
public final ISchedulingRule derivedRule(IResource resource)
Default implementation ofIResourceRuleFactory#derivedRule
. This default implementation always returnsnull
.Subclasses may not currently override this method.
- Specified by:
derivedRule
in interfaceIResourceRuleFactory
- Parameters:
resource
- the resource for which the derived flag will be changed- Returns:
- a scheduling rule, or
null
- Since:
- 3.6
- See Also:
ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
,IResourceRuleFactory.derivedRule(IResource)
-
copyRule
public ISchedulingRule copyRule(IResource source, IResource destination)
Default implementation ofIResourceRuleFactory#copyRule
. This default implementation always returns the parent of the destination resource.Subclasses may override this method. The rule provided by an overriding method must at least contain the rule from this default implementation.
- Specified by:
copyRule
in interfaceIResourceRuleFactory
- Parameters:
source
- the source of the copydestination
- the destination of the copy- Returns:
- a scheduling rule, or
null
- See Also:
ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
,IResourceRuleFactory.copyRule(IResource, IResource)
-
createRule
public ISchedulingRule createRule(IResource resource)
Default implementation ofIResourceRuleFactory#createRule
. This default implementation always returns the parent of the resource being created.Subclasses may override this method. The rule provided by an overriding method must at least contain the rule from this default implementation.
- Specified by:
createRule
in interfaceIResourceRuleFactory
- Parameters:
resource
- the resource being created- Returns:
- a scheduling rule, or
null
- See Also:
ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
,IResourceRuleFactory.createRule(IResource)
-
deleteRule
public ISchedulingRule deleteRule(IResource resource)
Default implementation ofIResourceRuleFactory#deleteRule
. This default implementation always returns the parent of the resource being deleted.Subclasses may override this method. The rule provided by an overriding method must at least contain the rule from this default implementation.
- Specified by:
deleteRule
in interfaceIResourceRuleFactory
- Parameters:
resource
- the resource to be deleted- Returns:
- a scheduling rule, or
null
- See Also:
ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
,IResourceRuleFactory.deleteRule(IResource)
-
markerRule
public final ISchedulingRule markerRule(IResource resource)
Default implementation ofIResourceRuleFactory#markerRule
. This default implementation always returnsnull
.Subclasses may not currently override this method.
- Specified by:
markerRule
in interfaceIResourceRuleFactory
- Parameters:
resource
- the resource owning the marker to be modified- Returns:
- a scheduling rule, or
null
- See Also:
IResourceRuleFactory.markerRule(IResource)
-
modifyRule
public ISchedulingRule modifyRule(IResource resource)
Default implementation ofIResourceRuleFactory#modifyRule
. This default implementation returns the resource being modified, or the parent resource if modifying a project description file. Note that this must encompass any rule required by thevalidateSave
hook.Subclasses may override this method. The rule provided by an overriding method must at least contain the rule from this default implementation.
- Specified by:
modifyRule
in interfaceIResourceRuleFactory
- Parameters:
resource
- the resource being modified- Returns:
- a scheduling rule, or
null
- See Also:
ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
,IResourceRuleFactory.modifyRule(IResource)
,FileModificationValidator.validateSave(IFile)
,IProjectDescription.DESCRIPTION_FILE_NAME
-
moveRule
public ISchedulingRule moveRule(IResource source, IResource destination)
Default implementation ofIResourceRuleFactory#moveRule
. This default implementation returns a rule that combines the parent of the source resource and the parent of the destination resource.Subclasses may override this method. The rule provided by an overriding method must at least contain the rule from this default implementation.
- Specified by:
moveRule
in interfaceIResourceRuleFactory
- Parameters:
source
- the source of the movedestination
- the destination of the move- Returns:
- a scheduling rule, or
null
- See Also:
ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
,IResourceRuleFactory.moveRule(IResource, IResource)
-
parent
protected final ISchedulingRule parent(IResource resource)
Convenience method to return the parent of the given resource, or the resource itself for projects and the workspace root.- Parameters:
resource
- the resource to compute the parent of- Returns:
- the parent resource for folders and files, and the resource itself for projects and the workspace root.
-
refreshRule
public ISchedulingRule refreshRule(IResource resource)
Default implementation ofIResourceRuleFactory#refreshRule
. This default implementation always returns the parent of the resource being refreshed.Subclasses may override this method. The rule provided by an overriding method must at least contain the rule from this default implementation.
- Specified by:
refreshRule
in interfaceIResourceRuleFactory
- Parameters:
resource
- the resource to refresh- Returns:
- a scheduling rule, or
null
- See Also:
ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
,IResourceRuleFactory.refreshRule(IResource)
-
validateEditRule
public ISchedulingRule validateEditRule(IResource[] resources)
Default implementation ofIResourceRuleFactory#validateEditRule
. This default implementation returns a rule that combines the parents of all read-only resources, ornull
if there are no read-only resources.Subclasses may override this method. The rule provided by an overriding method must at least contain the rule from this default implementation.
- Specified by:
validateEditRule
in interfaceIResourceRuleFactory
- Parameters:
resources
- the resources to be validated- Returns:
- a scheduling rule, or
null
- See Also:
ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
,IResourceRuleFactory.validateEditRule(IResource[])
-
-