Eclipse Platform Release 3.7

## org.eclipse.core.resources.team
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
`protected` `ResourceRuleFactory()` Creates a new default resource rule factory.

Method Summary
`ISchedulingRule` `buildRule()` Default implementation of `IResourceRuleFactory#buildRule`.
`ISchedulingRule` `charsetRule(IResource resource)` Default implementation of `IResourceRuleFactory#charsetRule`.
`ISchedulingRule` `copyRule(IResource source, IResource destination)` Default implementation of `IResourceRuleFactory#copyRule`.
`ISchedulingRule` `createRule(IResource resource)` Default implementation of `IResourceRuleFactory#createRule`.
`ISchedulingRule` `deleteRule(IResource resource)` Default implementation of `IResourceRuleFactory#deleteRule`.
`ISchedulingRule` `derivedRule(IResource resource)` Default implementation of `IResourceRuleFactory#derivedRule`.
`ISchedulingRule` `markerRule(IResource resource)` Default implementation of `IResourceRuleFactory#markerRule`.
`ISchedulingRule` `modifyRule(IResource resource)` Default implementation of `IResourceRuleFactory#modifyRule`.
`ISchedulingRule` `moveRule(IResource source, IResource destination)` Default implementation of `IResourceRuleFactory#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 of `IResourceRuleFactory#refreshRule`.
`ISchedulingRule` `validateEditRule(IResource[] resources)` Default implementation of `IResourceRuleFactory#validateEditRule`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ResourceRuleFactory

    protected ResourceRuleFactory()

  Creates a new default resource rule factory. This constructor must only be called by subclasses.

Method Detail

### buildRule

    public final ISchedulingRule buildRule()

  Default implementation of `IResourceRuleFactory#buildRule`. This default implementation always returns the workspace root.

  Subclasses may not currently override this method.

  Specified by:
    `buildRule` in interface `IResourceRuleFactory`
  Returns:
    a scheduling rule, or `null`
  See Also:
    `IResourceRuleFactory.buildRule()`

### charsetRule

    public ISchedulingRule charsetRule(IResource resource)

  Default implementation of `IResourceRuleFactory#charsetRule`. This default implementation always returns the project of the resource whose charset setting is being changed, or `null` 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 interface `IResourceRuleFactory`
  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 of `IResourceRuleFactory#derivedRule`. This default implementation always returns `null`.

  Subclasses may not currently override this method.

  Specified by:
    `derivedRule` in interface `IResourceRuleFactory`
  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 of `IResourceRuleFactory#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 interface `IResourceRuleFactory`
  Parameters:
    `source` - the source of the copy
    `destination` - 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 of `IResourceRuleFactory#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 interface `IResourceRuleFactory`
  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 of `IResourceRuleFactory#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 interface `IResourceRuleFactory`
  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 of `IResourceRuleFactory#markerRule`. This default implementation always returns `null`.

  Subclasses may not currently override this method.

  Specified by:
    `markerRule` in interface `IResourceRuleFactory`
  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 of `IResourceRuleFactory#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 the `validateSave` 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 interface `IResourceRuleFactory`
  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 of `IResourceRuleFactory#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 interface `IResourceRuleFactory`
  Parameters:
    `source` - the source of the move
    `destination` - 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 of `IResourceRuleFactory#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 interface `IResourceRuleFactory`
  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 of `IResourceRuleFactory#validateEditRule`. This default implementation returns a rule that combines the parents of all read-only resources, or `null` 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 interface `IResourceRuleFactory`
  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[])`

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.