Class ModelSynchronizeParticipant
- All Implemented Interfaces:
IAdaptable,IExecutableExtension,ISynchronizeParticipant
ISynchronizationContext.
This class may be subclassed by clients.
- Since:
- 3.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant used with theP_ACTIVE_MODEL_PROVIDERproperty to indicate that all enabled model providers are active.static final StringProperty constant used to store and retrieve the id of the activeModelProviderfrom anISynchronizePageConfiguration.static final StringProperty constant used during property change notification to indicate that the active model of this participant has changed.static final StringProperty constant used during property change notification to indicate that the dirty state for the active saveable model of this participant has changed.static final StringProperty constant used during property change notification to indicate that the enabled model providers for this participant have changed.Fields inherited from class org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant
configElement, P_PINNED, P_SCHEDULEDFields inherited from interface org.eclipse.team.ui.synchronize.ISynchronizeParticipant
P_CONTENT -
Constructor Summary
ConstructorsConstructorDescriptionCreate a participant in order to restore it from saved state.Create a participant for the given context -
Method Summary
Modifier and TypeMethodDescriptionasCompareInput(Object object) Return a compare input for the given model object ornullif the object is not eligible for comparison.booleancheckForBufferChange(Shell shell, ISynchronizationCompareInput input, boolean cancelAllowed, IProgressMonitor monitor) Convenience method for switching the active saveable of this participant to the saveable of the given input.protected ModelSynchronizeParticipantActionGroupCreate the merge action group for this participant.final IPageBookViewPagecreatePage(ISynchronizePageConfiguration configuration) Creates and returns a new page for this synchronize participant.static ModelSynchronizeParticipantcreateParticipant(SynchronizationContext context, String name) Create a participant for the given context and nameprotected ISynchronizationScopeManagercreateScopeManager(ResourceMapping[] mappings) Create and return a scope manager that can be used to build the scope of this participant when it is restored after a restart.voiddispose()Disposes of this synchronize participant and is called to free the resources associated with a participant.Return the active saveable for this participant.<T> TgetAdapter(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.Return the synchronization context for this participant.Return the list of model providers that are enabled for the participant.protected StringgetLongTaskName(ResourceMapping[] mappings) Returns the long task name to describe the behavior of the refresh operation to the user.getName()Returns the name of this synchronize participant.Return the list of preference pages that are associated with this participantprotected final StringReturn the name of the participant as specified in the plugin manifest file.protected StringReturns the short task name (e.g. no more than 25 characters) to describe the behavior of the refresh operation to the user.booleanhasCompareInputFor(Object object) Return whether their is a compare input associated with the given object.voidClasses that are persisted must override this method and perform the following initialization.protected voidinitializeConfiguration(ISynchronizePageConfiguration configuration) This method is invoked after a page configuration is created but before it is returned by thecreatePageConfigurationmethod.protected voidinitializeContext(SynchronizationContext context) Set the context of this participant.booleanReturn whether merge capabilities are enabled for this participant.final voidrefresh(IWorkbenchSite site, ResourceMapping[] mappings) Refresh a participant in the background the result of the refresh are shown in the progress view.protected MergeContextRecreate the context for this participant.voidrun(IWorkbenchPart part) Runs the participants action.voidSaves the participants object state within the memento.voidsetActiveSaveable(SaveableComparison activeSaveable) Set the active saveable of this participant.voidsetMergingEnabled(boolean mergingEnabled) Set whether merge capabilities should be enabled for this participant.Methods inherited from class org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant
addPropertyChangeListener, createPageConfiguration, doesSupportSynchronize, equals, firePropertyChange, getHelpContextId, getId, getImageDescriptor, getSecondaryId, hashCode, isPinned, isViewerContributionsSupported, pinned, prepareCompareInput, removePropertyChangeListener, setImageDescriptor, setInitializationData, setInitializationData, setName, setPinned, setSecondaryId
-
Field Details
-
P_VISIBLE_MODEL_PROVIDER
Property constant used to store and retrieve the id of the activeModelProviderfrom anISynchronizePageConfiguration. The active model provider will be the only one visible in the page. IfnullorALL_MODEL_PROVIDERS_ACTIVEis returned, all model providers are considered active and are visible.- See Also:
-
ALL_MODEL_PROVIDERS_VISIBLE
Constant used with theP_ACTIVE_MODEL_PROVIDERproperty to indicate that all enabled model providers are active.- See Also:
-
PROP_ENABLED_MODEL_PROVIDERS
Property constant used during property change notification to indicate that the enabled model providers for this participant have changed.- See Also:
-
PROP_ACTIVE_SAVEABLE
Property constant used during property change notification to indicate that the active model of this participant has changed.- See Also:
-
PROP_DIRTY
Property constant used during property change notification to indicate that the dirty state for the active saveable model of this participant has changed.- See Also:
-
-
Constructor Details
-
ModelSynchronizeParticipant
Create a participant for the given context- Parameters:
context- the synchronization context
-
ModelSynchronizeParticipant
public ModelSynchronizeParticipant()Create a participant in order to restore it from saved state.
-
-
Method Details
-
createParticipant
public static ModelSynchronizeParticipant createParticipant(SynchronizationContext context, String name) Create a participant for the given context and name- Parameters:
context- the synchronization contextname- the name of the participant- Returns:
- a participant for the given context
-
getName
Description copied from interface:ISynchronizeParticipantReturns the name of this synchronize participant. This name is displayed to the user.- Specified by:
getNamein interfaceISynchronizeParticipant- Overrides:
getNamein classAbstractSynchronizeParticipant- Returns:
- the name of this synchronize participant
-
getShortName
Return the name of the participant as specified in the plugin manifest file. This method is provided to give access to this name since it is masked by thegetName()method defined in this class.- Returns:
- the name of the participant as specified in the plugin manifest file
- Since:
- 3.1
-
initializeConfiguration
Description copied from class:AbstractSynchronizeParticipantThis method is invoked after a page configuration is created but before it is returned by thecreatePageConfigurationmethod. Subclasses can implement this method to tailor the configuration in ways appropriate to the participant.- Specified by:
initializeConfigurationin classAbstractSynchronizeParticipant- Parameters:
configuration- the newly create page configuration
-
createMergeActionGroup
Create the merge action group for this participant. Subclasses can override in order to provide a merge action group that configures certain aspects of the merge actions.- Returns:
- the merge action group for this participant
-
createPage
Description copied from interface:ISynchronizeParticipantCreates and returns a new page for this synchronize participant. The page is displayed using the parameters from the configuration. For example, the configuration defines the context in which the page is shown, via theISynchronizePageSite.- Parameters:
configuration- used to initialize the page- Returns:
- a page book view page representation of this synchronize participant
-
run
Description copied from interface:ISynchronizeParticipantRuns the participants action. Typically this would be some action to refresh the synchronization state of the participant. This action is run from the global synchronize drop-down.- Parameters:
part- the part in which the action is run ornullif the action is not being run in a workbench part.
-
refresh
Refresh a participant in the background the result of the refresh are shown in the progress view. Refreshing can also be considered synchronizing, or refreshing the synchronization state. Basically this is a long running operation that will update the participant's context with new changes detected on the server.- Parameters:
site- the workbench site the synchronize is running from. This can be used to notify the site that a job is running.mappings- the resource mappings to be refreshed
-
dispose
public void dispose()Description copied from interface:ISynchronizeParticipantDisposes of this synchronize participant and is called to free the resources associated with a participant. When a participant is added to theISynchronizeManagerthis 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).
-
initializeContext
Set the context of this participant. This method must be invoked before a page is obtained from the participant.- Parameters:
context- the context for this participant
-
getContext
Return the synchronization context for this participant.- Returns:
- the synchronization context for this participant
-
asCompareInput
Return a compare input for the given model object ornullif the object is not eligible for comparison.- Parameters:
object- the model object- Returns:
- a compare input for the model object or
null
-
hasCompareInputFor
Return whether their is a compare input associated with the given object. In other words, returntrueifasCompareInput(Object)would return a value andfalseif it would returnnull.- Parameters:
object- the object.- Returns:
- whether their is a compare input associated with the given object
-
isMergingEnabled
public boolean isMergingEnabled()Return whether merge capabilities are enabled for this participant. If merging is enabled, merge actions can be shown. If merging is disabled, no merge actions should be surfaced.- Returns:
- whether merge capabilities should be enabled for this participant
-
setMergingEnabled
public void setMergingEnabled(boolean mergingEnabled) Set whether merge capabilities should be enabled for this participant.- Parameters:
mergingEnabled- whether merge capabilities should be enabled for this participant
-
getShortTaskName
Returns the short task name (e.g. no more than 25 characters) to describe the behavior of the refresh operation to the user. This is typically shown in the status line when this participant is refreshed in the background. When refreshed in the foreground, only the long task name is shown.- Returns:
- the short task name to show in the status line.
-
getLongTaskName
Returns the long task name to describe the behavior of the refresh operation to the user. This is typically shown in the status line when this subscriber is refreshed in the background.- Parameters:
mappings- the mappings being refreshed- Returns:
- the long task name
- Since:
- 3.1
-
getAdapter
Description copied from class:PlatformObjectReturns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.This implementation of the method declared by
IAdaptablepasses the request along to the platform's adapter manager; roughlyPlatform.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).- Specified by:
getAdapterin interfaceIAdaptable- Overrides:
getAdapterin classPlatformObject- Type Parameters:
T- the class type- Parameters:
adapter- the class to adapt to- Returns:
- the adapted object or
null - See Also:
-
saveState
Description copied from interface:ISynchronizeParticipantSaves the participants object state within the memento. This state will be available when the participant is restored viainit.This method can be called multiple times during the lifetime of the participant object.
- Specified by:
saveStatein interfaceISynchronizeParticipant- Overrides:
saveStatein classAbstractSynchronizeParticipant- Parameters:
memento- a memento to receive the object state
-
init
Description copied from class:AbstractSynchronizeParticipantClasses that are persisted must override this method and perform the following initialization.super.init(secondaryId, memento); try { ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(PARTICIPANT_ID); setInitializationData(descriptor); } catch (CoreException e) { TeamUIPlugin.log(e); }wherePARTICIPANT_IDis the id of the participant as defined in the plugin manifest.- Specified by:
initin interfaceISynchronizeParticipant- Overrides:
initin classAbstractSynchronizeParticipant- Parameters:
secondaryId- the secondayId of this participant instance ornullif this participant doesn't support multiple instances.memento- the participant state ornullif there is no previous saved state- Throws:
PartInitException- if this participant was not initialized successfully- See Also:
-
restoreContext
Recreate the context for this participant. This method is invoked when the participant is restored after a restart. Although it is provided with a progress monitor, long running operations should be avoided.- Parameters:
manager- the restored scope- Returns:
- the context for this participant
- Throws:
CoreException- if restoring context failed
-
createScopeManager
Create and return a scope manager that can be used to build the scope of this participant when it is restored after a restart. By default, this method returns a scope manager that uses the local content. This method can be overridden by subclasses.- Parameters:
mappings- the restored mappings- Returns:
- a scope manager that can be used to build the scope of this participant when it is restored after a restart
-
getActiveSaveable
Return the active saveable for this participant. There is at most one saveable active at any time.- Returns:
- the active saveable for this participant
or
null
-
setActiveSaveable
Set the active saveable of this participant.- Parameters:
activeSaveable- the active saveable (may benull)
-
checkForBufferChange
public boolean checkForBufferChange(Shell shell, ISynchronizationCompareInput input, boolean cancelAllowed, IProgressMonitor monitor) throws CoreException Convenience method for switching the active saveable of this participant to the saveable of the given input.- Parameters:
shell- a shellinput- the compare input about to be displayedcancelAllowed- whether the display of the compare input can be canceledmonitor- a progress monitor ornullif progress reporting is not required- Returns:
- whether the user choose to continue with the display of the given compare input
- Throws:
CoreException- if an error occurs
-
getEnabledModelProviders
Return the list of model providers that are enabled for the participant. By default, the list is those model providers that contain mappings in the scope. Subclasses may override to add additional model providers.- Returns:
- the list of model providers that are active for the participant
-
getPreferencePages
Description copied from interface:ISynchronizeParticipantReturn the list of preference pages that are associated with this participant- Specified by:
getPreferencePagesin interfaceISynchronizeParticipant- Overrides:
getPreferencePagesin classAbstractSynchronizeParticipant- Returns:
- the list of preference pages that are associated with this participant
-