Package org.eclipse.team.ui.synchronize
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
-
Field Summary
Fields inherited from interface org.eclipse.team.ui.mapping.ITeamStateProvider
USE_DECORATED_STATE_MASK -
Constructor Summary
ConstructorsConstructorDescriptionSubscriberTeamStateProvider(Subscriber subscriber) Create a provider that determines the synchronization state from the subscriber. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Called when the provider is no longer needed.String[]getDecoratedProperties(Object element) Return the set of property identifiers that represent the set of properties that the team decorator would decorate for the given model element.getResourceMappingContext(Object element) Return a resource mapping context that gives access to the remote state of the resources associated with the provider.getStateDescription(Object element, int stateMask, String[] properties, IProgressMonitor monitor) Return the state description for the given element.protected final SubscriberReturn the subscriber associated with this tester.protected final intgetSynchronizationState(Object element, int stateMask, IProgressMonitor monitor) Obtain the synchronization state of the element.booleanhasDecoratedState(Object element) Return whether the given element has any decorated state.voidNotifies this listener that some resources' subscriber properties have changed.Methods inherited from class org.eclipse.team.ui.synchronize.TeamStateProvider
addDecoratedStateChangeListener, fireStateChangeEvent, getDecoratedStateMask, isDecorationEnabled, removeDecoratedStateChangeListener
-
Constructor Details
-
SubscriberTeamStateProvider
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
Description copied from interface:ITeamStateProviderReturn whether the given element has any decorated state.- Specified by:
hasDecoratedStatein interfaceITeamStateProvider- 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 usingSubscriber.getState(ResourceMapping, int, IProgressMonitor)- Parameters:
element- the elementstateMask- the state mask that indicates which state flags are desiredmonitor- 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:ITeamStateProviderReturn the state description for the given element. Anullis return if the element is not decorated or if decoration is disabled. Only the portion of the synchronization state covered bystateMaskis returned. ThestateMaskshould beITeamStateProvider.USE_DECORATED_STATE_MASKor the mask returned fromITeamStateProvider.getDecoratedStateMask(Object)and the requested properties should benullor the value returned fromITeamStateProvider.getDecoratedProperties(Object)if the client wishes to obtain the current decorated state.- Specified by:
getStateDescriptionin interfaceITeamStateProvider- Parameters:
element- the model elementstateMask- the mask that identifies which synchronization state flags are desired if presentproperties- the set of properties that should be included in the result ornullif the decorated properties are desiredmonitor- a progress monitor- Returns:
- the state for the given element or
null - Throws:
CoreException- if an error occurs
-
getResourceMappingContext
Description copied from interface:ITeamStateProviderReturn a resource mapping context that gives access to the remote state of the resources associated with the provider. If aRemoteResourceMappingContextis returned, then the client may access the remote state.- Specified by:
getResourceMappingContextin interfaceITeamStateProvider- 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
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
Description copied from interface:ISubscriberChangeListenerNotifies 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:
subscriberResourceChangedin interfaceISubscriberChangeListener- Parameters:
deltas- detailing the kinds of changes
-
getDecoratedProperties
Description copied from interface:ITeamStateProviderReturn the set of property identifiers that represent the set of properties that the team decorator would decorate for the given model element.- Specified by:
getDecoratedPropertiesin interfaceITeamStateProvider- Parameters:
element- the model element to be decorated- Returns:
- the set of decorated properties
-