Eclipse Platform
2.0

org.eclipse.team.core
Class RepositoryProvider

java.lang.Object
  |
  +--org.eclipse.team.core.RepositoryProvider
All Implemented Interfaces:
IProjectNature

public abstract class RepositoryProvider
extends Object
implements IProjectNature

A concrete subclass of RepositoryProvider is created for each project that is associated with a repository provider. The lifecycle of these instances is is similar to that of the platform's 'nature' mechanism.

To create a repository provider and have it registered with the platform, a client must minimally:

  1. extend RepositoryProvider
  2. define a repository extension in plugin.xml. Here is an example extension point definition:
    <extension point="org.eclipse.team.core.repository">
     <repository
      class="org.eclipse.myprovider.MyRepositoryProvider"
      id="org.eclipse.myprovider.myProviderID">
     </repository>
    </extension>

Once a repository provider is registered with Team, then you can associate a repository provider with a project by invoking RepositoryProvider.map().

Since:
2.0
See Also:
RepositoryProvider.map(IProject, String)

Constructor Summary
RepositoryProvider()
          Default constructor required for the resources plugin to instantiate this class from the nature extension definition.
 
Method Summary
 void configure()
          Configures the nature for the given project.
abstract  void configureProject()
          Configures the provider for the given project.
static void convertNatureToProperty(IProject project, boolean removeNature)
           
static String[] getAllProviderTypeIds()
          Returns all known (registered) RepositoryProvider ids.
 IFileModificationValidator getFileModificationValidator()
          Returns an IFileModificationValidator for pre-checking operations that modify the contents of files.
abstract  String getID()
          Answer the id of this provider instance.
 IMoveDeleteHook getMoveDeleteHook()
          Returns an IMoveDeleteHook for handling moves and deletes that occur withing projects managed by the provider.
 IProject getProject()
          Returns the project to which this project nature applies.
static RepositoryProvider getProvider(IProject project)
          Returns the provider for a given IProject or null if a provider is not associated with the project or if the project is closed or does not exist.
static RepositoryProvider getProvider(IProject project, String id)
          Returns a provider of type with the given id if associated with the given project or null if the project is not associated with a provider of that type or the nature id is that of a non-team repository provider nature.
 org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations getSimpleAccess()
          Provisional non-API method.
static void map(IProject project, String id)
          Instantiate a new RepositoryProvider with concrete class by given providerID and associate it with project.
 void setProject(IProject project)
          Sets the project to which this nature applies.
 String toString()
          Returns a brief description of this provider.
static void unmap(IProject project)
          Disassoociates project with the repository provider its currently mapped to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.resources.IProjectNature
deconfigure
 

Constructor Detail

RepositoryProvider

public RepositoryProvider()
Default constructor required for the resources plugin to instantiate this class from the nature extension definition.

Method Detail

map

public static void map(IProject project,
                       String id)
                throws TeamException
Instantiate a new RepositoryProvider with concrete class by given providerID and associate it with project.

Parameters:
project - the project to be mapped
id - the ID of the provider to be mapped to the project
Throws:
TeamException - if
  • There is no provider by that ID.
  • The project is already associated with a repository provider and that provider prevented its unmapping.
See Also:
unmap(IProject)

unmap

public static void unmap(IProject project)
                  throws TeamException
Disassoociates project with the repository provider its currently mapped to.

Parameters:
project -
Throws:
TeamException - The project isn't associated with any repository provider.

configureProject

public abstract void configureProject()
                               throws CoreException
Configures the provider for the given project. This method is called after setProject. If an exception is generated during configuration of the project, the provider will not be assigned to the project.

Throws:
CoreException - if the configuration fails.

configure

public final void configure()
                     throws CoreException
Configures the nature for the given project. This is called by RepositoryProvider.map() the first time a provider is mapped to a project. It is not intended to be called by clients.

Specified by:
configure in interface IProjectNature
Throws:
CoreException - if this method fails. If the configuration fails the provider will not be associated with the project.
See Also:
configureProject()

getID

public abstract String getID()
Answer the id of this provider instance. The id should be the repository provider's id as defined in the provider plugin's plugin.xml.

Returns:
the nature id of this provider

getFileModificationValidator

public IFileModificationValidator getFileModificationValidator()
Returns an IFileModificationValidator for pre-checking operations that modify the contents of files. Returns null if the provider does not wish to participate in file modification validation.

See Also:
IFileModificationValidator

getMoveDeleteHook

public IMoveDeleteHook getMoveDeleteHook()
Returns an IMoveDeleteHook for handling moves and deletes that occur withing projects managed by the provider. This allows providers to control how moves and deletes occur and includes the ability to prevent them.

Returning null signals that the default move and delete behavior is desired.

See Also:
org.eclipse.core.resources.IMoveDeleteHook

toString

public String toString()
Returns a brief description of this provider. The exact details of the representation are unspecified and subject to change, but the following may be regarded as typical: "SampleProject:org.eclipse.team.cvs.provider"

Overrides:
toString in class Object
Returns:
a string description of this provider

getAllProviderTypeIds

public static final String[] getAllProviderTypeIds()
Returns all known (registered) RepositoryProvider ids.

Returns:
an array of registered repository provider ids.

getProvider

public static final RepositoryProvider getProvider(IProject project)
Returns the provider for a given IProject or null if a provider is not associated with the project or if the project is closed or does not exist. This method should be called if the caller is looking for any repository provider. Otherwise call getProvider(project, id) to look for a specific repository provider type.

Parameters:
project - the project to query for a provider
Returns:
the repository provider associated with the project

getProvider

public static final RepositoryProvider getProvider(IProject project,
                                                   String id)
Returns a provider of type with the given id if associated with the given project or null if the project is not associated with a provider of that type or the nature id is that of a non-team repository provider nature.

Parameters:
project - the project to query for a provider
id - the repository provider id
Returns:
the repository provider

getSimpleAccess

public org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations getSimpleAccess()
Provisional non-API method. This method is here to allow experimentation with 3rd party tools calling providers in a repository neutral manner. Returns an object which implements a set of provider neutral operations for this provider. Answers null if the provider does not wish to support these operations.

Returns:
the repository operations or null if the provider does not support provider neutral operations.
See Also:
SimpleAccessOperations

getProject

public IProject getProject()
Description copied from interface: IProjectNature
Returns the project to which this project nature applies.

Specified by:
getProject in interface IProjectNature
Returns:
the project handle

setProject

public void setProject(IProject project)
Description copied from interface: IProjectNature
Sets the project to which this nature applies. Used when instantiating this project nature runtime. This is called by IProject.create() or IProject.setDescription() and should not be called directly by clients.

Specified by:
setProject in interface IProjectNature
Parameters:
project - the project to which this nature applies

convertNatureToProperty

public static void convertNatureToProperty(IProject project,
                                           boolean removeNature)
                                    throws TeamException
TeamException

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.