public abstract class SubscriberParticipant extends AbstractSynchronizeParticipant implements IPropertyChangeListener
Subscriber
. It maintains a dynamic collection of all out-of-sync resources
by listening to workspace resource changes and remote changes thus creating a live view of
changes in the workspace.
The subscriber can be configured to be synchronized in the background based on a schedule. This effectively refreshes the subscriber and updates the dynamic sync set.
Subclasses will typically want to override the following methods:
configElement, P_PINNED, P_SCHEDULED
P_CONTENT
Constructor and Description |
---|
SubscriberParticipant()
Constructor initializes the schedule.
|
SubscriberParticipant(ISynchronizeScope scope)
Constructor which should be called when creating a participant whose resources
are to be scoped.
|
Modifier and Type | Method and Description |
---|---|
IPageBookViewPage |
createPage(ISynchronizePageConfiguration configuration)
Creates and returns a new page for this synchronize participant.
|
void |
dispose()
Disposes of this synchronize participant and is called to free the
resources associated with a participant.
|
Object |
getAdapter(Class adapter)
Returns an object which is an instance of the given class
associated with this object.
|
protected String |
getLongTaskName()
Deprecated.
use
getLongTaskName(IResource[]) instead |
protected String |
getLongTaskName(IResource[] resources)
Returns the long task name to describe the behavior of the
refresh operation to the user.
|
static SubscriberParticipant |
getMatchingParticipant(String ID,
IResource[] resources)
Returns a participant that matches the given resource scoping
|
String |
getName()
Returns the name of this synchronize participant.
|
org.eclipse.team.internal.ui.synchronize.SubscriberRefreshSchedule |
getRefreshSchedule() |
IResource[] |
getResources()
Returns the resources supervised by this participant.
|
ISynchronizeScope |
getScope()
Return the scope that defines the resources displayed by this participant.
|
protected String |
getShortName()
Return the name of the participant as specified in the plugin manifest file.
|
protected String |
getShortTaskName()
Returns the short task name (e.g. no more than 25 characters) to describe the behavior of the
refresh operation to the user.
|
Subscriber |
getSubscriber()
Return the
Subscriber associated with this this participant. |
org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector |
getSubscriberSyncInfoCollector()
Return the
SubscriberSyncInfoCollector for the participant. |
SyncInfoTree |
getSyncInfoSet()
Returns the
SyncInfoTree for this participant. |
void |
init(String secondaryId,
IMemento memento)
Classes that are persisted must override this method and perform
the following initialization.
|
protected void |
initializeConfiguration(ISynchronizePageConfiguration configuration)
This method is invoked after a page configuration is created but before it is returned by the
createPageConfiguration method. |
void |
propertyChange(PropertyChangeEvent event)
Notification that a property has changed.
|
void |
refresh(IResource[] resources,
String shortTaskName,
String longTaskName,
IWorkbenchSite site)
Refresh a participant in the background the result of the refresh are shown in the progress view.
|
void |
refreshInDialog(Shell shell,
IResource[] resources,
String jobName,
String taskName,
ISynchronizePageConfiguration configuration,
IWorkbenchSite site)
Refresh this participants synchronization state and displays the result in a model dialog.
|
IStatus |
refreshNow(IResource[] resources,
String taskName,
IProgressMonitor monitor)
Refresh a participant.
|
void |
reset()
Reset the sync set of the participant by repopulating it from scratch.
|
void |
run(IWorkbenchPart part)
Runs the participants action.
|
void |
saveState(IMemento memento)
Saves the participants object state within the memento.
|
void |
setRefreshSchedule(org.eclipse.team.internal.ui.synchronize.SubscriberRefreshSchedule schedule) |
protected void |
setSubscriber(Subscriber subscriber)
Subclasses must call this method to initialize the participant.
|
protected void |
setSyncInfoFilter(SyncInfoFilter filter)
Provide a filter that is used to filter the contents of the sync info set for the participant.
|
protected void |
validateConfiguration(ISynchronizePageConfiguration configuration)
This method is invoked before the given configuration is used to
create the page (see
createPage(ISynchronizePageConfiguration) ). |
addPropertyChangeListener, createPageConfiguration, doesSupportSynchronize, equals, firePropertyChange, getHelpContextId, getId, getImageDescriptor, getPreferencePages, getSecondaryId, hashCode, isPinned, isViewerContributionsSupported, pinned, prepareCompareInput, removePropertyChangeListener, setImageDescriptor, setInitializationData, setInitializationData, setName, setPinned, setSecondaryId
public SubscriberParticipant()
public SubscriberParticipant(ISynchronizeScope scope)
scope
- a synchronize scopepublic final IPageBookViewPage createPage(ISynchronizePageConfiguration configuration)
ISynchronizeParticipant
ISynchronizePageSite
.createPage
in interface ISynchronizeParticipant
configuration
- used to initialize the pagepublic IResource[] getResources()
public final void refreshInDialog(Shell shell, IResource[] resources, String jobName, String taskName, ISynchronizePageConfiguration configuration, IWorkbenchSite site)
shell
- resources
- jobName
- taskName
- configuration
- site
- public final void refresh(IResource[] resources, String shortTaskName, String longTaskName, IWorkbenchSite site)
shortTaskName
and longTaskName
can be null
in which case, the default values for these are returned by the methods getShortTaskName()
and
getLongTaskName(IResource[])
will be used.resources
- the resources to be refreshed.shortTaskName
- the taskName of the background job that will run the synchronize or null
if the default job name is desired.longTaskName
- the taskName of the progress monitor running the synchronize or null
if the default job name is desired.site
- the workbench site the synchronize is running from. This can be used to notify the site
that a job is running.public final IStatus refreshNow(IResource[] resources, String taskName, IProgressMonitor monitor)
resources
- taskName
- monitor
- public void dispose()
ISynchronizeParticipant
ISynchronizeManager
this method is called when the
manager is shutdown or the participant is removed from the manager.
Within this method a participant may release any resources, fonts, images, etc. held by this part. It is also very important to remove all listeners.
Clients should not call this method (the synchronize manager calls this method at appropriate times).
dispose
in interface ISynchronizeParticipant
public String getName()
ISynchronizeParticipant
getName
in interface ISynchronizeParticipant
getName
in class AbstractSynchronizeParticipant
protected final String getShortName()
getName()
method defined in this class.public SyncInfoTree getSyncInfoSet()
SyncInfoTree
for this participant. This set
contains the out-of-sync resources supervised by this participant.public Subscriber getSubscriber()
Subscriber
associated with this this participant. This
method will only return null
if the participant has not been initialized
yet.Subscriber
associated with this this participant.public static SubscriberParticipant getMatchingParticipant(String ID, IResource[] resources)
ID
- the type id of participants to matchresources
- the resources to match in the scopepublic void propertyChange(PropertyChangeEvent event)
IPropertyChangeListener
This method gets called when the observed object fires a property change event.
propertyChange
in interface IPropertyChangeListener
event
- the property change event object describing which property
changed and howpublic void init(String secondaryId, IMemento memento) throws PartInitException
AbstractSynchronizeParticipant
super.init(secondaryId, memento); try { ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(PARTICIPANT_ID); setInitializationData(descriptor); } catch (CoreException e) { TeamUIPlugin.log(e); }where
PARTICIPANT_ID
is the id of the participant as defined in the plugin manifest.
init
in interface ISynchronizeParticipant
init
in class AbstractSynchronizeParticipant
secondaryId
- the secondayId of this participant instance or null
if this participant doesn't support multiple instances.memento
- the participant state or null
if there
is no previous saved statePartInitException
- if this participant was not initialized
successfullyISynchronizeParticipant.init(String, org.eclipse.ui.IMemento)
public void saveState(IMemento memento)
ISynchronizeParticipant
init
.
This method can be called multiple times during the lifetime of the participant object.
saveState
in interface ISynchronizeParticipant
saveState
in class AbstractSynchronizeParticipant
memento
- a memento to receive the object statepublic void reset()
public org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector getSubscriberSyncInfoCollector()
SubscriberSyncInfoCollector
for the participant.
This collector maintains the set of all out-of-sync resources for the
subscriber.SubscriberSyncInfoCollector
for this participantpublic void setRefreshSchedule(org.eclipse.team.internal.ui.synchronize.SubscriberRefreshSchedule schedule)
public org.eclipse.team.internal.ui.synchronize.SubscriberRefreshSchedule getRefreshSchedule()
protected void initializeConfiguration(ISynchronizePageConfiguration configuration)
AbstractSynchronizeParticipant
createPageConfiguration
method. Subclasses can implement this method to
tailor the configuration in ways appropriate to the participant.initializeConfiguration
in class AbstractSynchronizeParticipant
configuration
- the newly create page configurationpublic void run(IWorkbenchPart part)
ISynchronizeParticipant
run
in interface ISynchronizeParticipant
part
- the part in which the action is run or null
if the action
is not being run in a workbench part.protected String getShortTaskName()
protected String getLongTaskName()
getLongTaskName(IResource[]) instead
protected String getLongTaskName(IResource[] resources)
resources
- protected void validateConfiguration(ISynchronizePageConfiguration configuration)
createPage(ISynchronizePageConfiguration)
).
The configuration would have been initialized by
initializeConfiguration(ISynchronizePageConfiguration)
but may have also been tailored further. This method gives the participant
a chance to validate those changes before the page is created.configuration
- the page configuration that is about to be used to create a page.protected void setSubscriber(Subscriber subscriber)
init(String, IMemento)
. This method will initialize
the sync info collector.subscriber
- the subscriber to associate with this participant.protected void setSyncInfoFilter(SyncInfoFilter filter)
Subclasses can invoke this method any time after setSubscriber
has been invoked.
filter
- a sync info filterpublic ISynchronizeScope getScope()
public Object getAdapter(Class adapter)
PlatformObject
null
if
no such object can be found.
This implementation of the method declared by IAdaptable
passes the request along to the platform's adapter manager; roughly
Platform.getAdapterManager().getAdapter(this, adapter)
.
Subclasses may override this method (however, if they do so, they
should invoke the method on their superclass to ensure that the
Platform's adapter manager is consulted).
getAdapter
in interface IAdaptable
getAdapter
in class PlatformObject
adapter
- the class to adapt tonull
IAdaptable.getAdapter(Class)
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.