Class SubscriberTeamStateProvider

java.lang.Object
org.eclipse.team.ui.synchronize.TeamStateProvider
org.eclipse.team.ui.synchronize.SubscriberTeamStateProvider
All Implemented Interfaces:
EventListener, ISubscriberChangeListener, ITeamStateProvider

public class SubscriberTeamStateProvider extends TeamStateProvider implements ISubscriberChangeListener
A team state provider that makes use of a Subscriber to determine the synchronization state. Repository provider types that have a subscriber will get one of these free through the adaptable mechanism. If a repository provider type does not have a subscriber, or it a repository provider type wishes to se a custom provider, they must adapt their RepositoryProviderType class to an appropriate ITeamStateProvider.

Clients may subclass this class.

Since:
3.2
  • Constructor Details

    • SubscriberTeamStateProvider

      public SubscriberTeamStateProvider(Subscriber subscriber)
      Create a provider that determines the synchronization state from the subscriber. This method registers this provider as a listener on the subscriber in order to know when to fire state change events.
      Parameters:
      subscriber - the subscriber for this provider
  • Method Details

    • hasDecoratedState

      public boolean hasDecoratedState(Object element) throws CoreException
      Description copied from interface: ITeamStateProvider
      Return whether the given element has any decorated state.
      Specified by:
      hasDecoratedState in interface ITeamStateProvider
      Parameters:
      element - the element being decorated
      Returns:
      whether the given element has any decorated state
      Throws:
      CoreException - if an error occurs
    • getSynchronizationState

      protected final int getSynchronizationState(Object element, int stateMask, IProgressMonitor monitor) throws CoreException
      Obtain the synchronization state of the element. If the model provider for the element adapts to an ISynchronizationCompareAdapter, then the adapter is used to determine the synchronization state. Others, the state is obtained from the subscriber using Subscriber.getState(ResourceMapping, int, IProgressMonitor)
      Parameters:
      element - the element
      stateMask - the state mask that indicates which state flags are desired
      monitor - a progress monitor
      Returns:
      the synchronization state of the element
      Throws:
      CoreException - if operation failed
    • getStateDescription

      public ITeamStateDescription getStateDescription(Object element, int stateMask, String[] properties, IProgressMonitor monitor) throws CoreException
      Description copied from interface: ITeamStateProvider
      Return the state description for the given element. A null is return if the element is not decorated or if decoration is disabled. Only the portion of the synchronization state covered by stateMask is returned. The stateMask should be ITeamStateProvider.USE_DECORATED_STATE_MASK or the mask returned from ITeamStateProvider.getDecoratedStateMask(Object) and the requested properties should be null or the value returned from ITeamStateProvider.getDecoratedProperties(Object) if the client wishes to obtain the current decorated state.
      Specified by:
      getStateDescription in interface ITeamStateProvider
      Parameters:
      element - the model element
      stateMask - the mask that identifies which synchronization state flags are desired if present
      properties - the set of properties that should be included in the result or null if the decorated properties are desired
      monitor - a progress monitor
      Returns:
      the state for the given element or null
      Throws:
      CoreException - if an error occurs
    • getResourceMappingContext

      public ResourceMappingContext getResourceMappingContext(Object element)
      Description copied from interface: ITeamStateProvider
      Return a resource mapping context that gives access to the remote state of the resources associated with the provider. If a RemoteResourceMappingContext is returned, then the client may access the remote state.
      Specified by:
      getResourceMappingContext in interface ITeamStateProvider
      Parameters:
      element - the element for which remote contents are desired
      Returns:
      a resource mapping context that gives access to the remote state of the resources associated with the provider
    • getSubscriber

      protected final Subscriber getSubscriber()
      Return the subscriber associated with this tester.
      Returns:
      the subscriber associated with this tester.
    • dispose

      public void dispose()
      Called when the provider is no longer needed. This method stops listening to the subscriber. Subclasses may extend this method but must call this method if they do.
    • subscriberResourceChanged

      public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas)
      Description copied from interface: ISubscriberChangeListener
      Notifies this listener that some resources' subscriber properties have changed. The changes have already happened. For example, a resource's base revision may have changed. The resource tree may or may not be open for modification when this method is invoked.
      Specified by:
      subscriberResourceChanged in interface ISubscriberChangeListener
      Parameters:
      deltas - detailing the kinds of changes
    • getDecoratedProperties

      public String[] getDecoratedProperties(Object element)
      Description copied from interface: ITeamStateProvider
      Return the set of property identifiers that represent the set of properties that the team decorator would decorate for the given model element.
      Specified by:
      getDecoratedProperties in interface ITeamStateProvider
      Parameters:
      element - the model element to be decorated
      Returns:
      the set of decorated properties