Class ModelSynchronizeParticipant
- All Implemented Interfaces:
IAdaptable
,IExecutableExtension
,ISynchronizeParticipant
ISynchronizationContext
.
This class may be subclassed by clients.
- Since:
- 3.2
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Constant used with theP_ACTIVE_MODEL_PROVIDER
property to indicate that all enabled model providers are active.static final String
Property constant used to store and retrieve the id of the activeModelProvider
from anISynchronizePageConfiguration
.static final String
Property constant used during property change notification to indicate that the active model of this participant has changed.static final String
Property constant used during property change notification to indicate that the dirty state for the active saveable model of this participant has changed.static final String
Property 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_SCHEDULED
Fields inherited from interface org.eclipse.team.ui.synchronize.ISynchronizeParticipant
P_CONTENT
-
Constructor Summary
ConstructorDescriptionCreate 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 ornull
if the object is not eligible for comparison.boolean
checkForBufferChange
(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 ModelSynchronizeParticipantActionGroup
Create the merge action group for this participant.final IPageBookViewPage
createPage
(ISynchronizePageConfiguration configuration) Creates and returns a new page for this synchronize participant.static ModelSynchronizeParticipant
createParticipant
(SynchronizationContext context, String name) Create a participant for the given context and nameprotected ISynchronizationScopeManager
createScopeManager
(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.void
dispose()
Disposes of this synchronize participant and is called to free the resources associated with a participant.Return the active saveable for this participant.<T> T
getAdapter
(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 String
getLongTaskName
(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 String
Return the name of the participant as specified in the plugin manifest file.protected String
Returns the short task name (e.g. no more than 25 characters) to describe the behavior of the refresh operation to the user.boolean
hasCompareInputFor
(Object object) Return whether their is a compare input associated with the given object.void
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 thecreatePageConfiguration
method.protected void
initializeContext
(SynchronizationContext context) Set the context of this participant.boolean
Return whether merge capabilities are enabled for this participant.final void
refresh
(IWorkbenchSite site, ResourceMapping[] mappings) Refresh a participant in the background the result of the refresh are shown in the progress view.protected MergeContext
Recreate the context for this participant.void
run
(IWorkbenchPart part) Runs the participants action.void
Saves the participants object state within the memento.void
setActiveSaveable
(SaveableComparison activeSaveable) Set the active saveable of this participant.void
setMergingEnabled
(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 activeModelProvider
from anISynchronizePageConfiguration
. The active model provider will be the only one visible in the page. Ifnull
orALL_MODEL_PROVIDERS_ACTIVE
is returned, all model providers are considered active and are visible.- See Also:
-
ALL_MODEL_PROVIDERS_VISIBLE
Constant used with theP_ACTIVE_MODEL_PROVIDER
property 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:ISynchronizeParticipant
Returns the name of this synchronize participant. This name is displayed to the user.- Specified by:
getName
in interfaceISynchronizeParticipant
- Overrides:
getName
in 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:AbstractSynchronizeParticipant
This method is invoked after a page configuration is created but before it is returned by thecreatePageConfiguration
method. Subclasses can implement this method to tailor the configuration in ways appropriate to the participant.- Specified by:
initializeConfiguration
in 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:ISynchronizeParticipant
Creates 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:ISynchronizeParticipant
Runs 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 ornull
if 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:ISynchronizeParticipant
Disposes of this synchronize participant and is called to free the resources associated with a participant. When a participant is added to theISynchronizeManager
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).
-
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 ornull
if 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, returntrue
ifasCompareInput(Object)
would return a value andfalse
if 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:PlatformObject
Returns an object which is an instance of the given class associated with this object. Returnsnull
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; 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:
getAdapter
in interfaceIAdaptable
- Overrides:
getAdapter
in 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:ISynchronizeParticipant
Saves 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:
saveState
in interfaceISynchronizeParticipant
- Overrides:
saveState
in classAbstractSynchronizeParticipant
- Parameters:
memento
- a memento to receive the object state
-
init
Description copied from class:AbstractSynchronizeParticipant
Classes 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_ID
is the id of the participant as defined in the plugin manifest.- Specified by:
init
in interfaceISynchronizeParticipant
- Overrides:
init
in classAbstractSynchronizeParticipant
- Parameters:
secondaryId
- the secondayId of this participant instance ornull
if this participant doesn't support multiple instances.memento
- the participant state ornull
if 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 ornull
if 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:ISynchronizeParticipant
Return the list of preference pages that are associated with this participant- Specified by:
getPreferencePages
in interfaceISynchronizeParticipant
- Overrides:
getPreferencePages
in classAbstractSynchronizeParticipant
- Returns:
- the list of preference pages that are associated with this participant
-