public class ModelSynchronizeParticipant extends AbstractSynchronizeParticipant
ISynchronizationContext
.
This class may be subclassed by clients.
Modifier and Type | Field and Description |
---|---|
static String |
ALL_MODEL_PROVIDERS_VISIBLE
Constant used with the
P_ACTIVE_MODEL_PROVIDER property to indicate
that all enabled model providers are active. |
static String |
P_VISIBLE_MODEL_PROVIDER
Property constant used to store and retrieve the id of the active
ModelProvider from an ISynchronizePageConfiguration . |
static String |
PROP_ACTIVE_SAVEABLE
Property constant used during property change notification to indicate
that the active model of this participant has changed.
|
static String |
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.
|
static String |
PROP_ENABLED_MODEL_PROVIDERS
Property constant used during property change notification to indicate
that the enabled model providers for this participant have changed.
|
configElement, P_PINNED, P_SCHEDULED
P_CONTENT
Constructor and Description |
---|
ModelSynchronizeParticipant()
Create a participant in order to restore it from saved state.
|
ModelSynchronizeParticipant(SynchronizationContext context)
Create a participant for the given context
|
Modifier and Type | Method and Description |
---|---|
ICompareInput |
asCompareInput(Object object)
Return a compare input for the given model object or
null
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 |
createMergeActionGroup()
Create the merge action group for this participant.
|
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 name
|
protected 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.
|
SaveableComparison |
getActiveSaveable()
Return the active saveable for this participant.
|
Object |
getAdapter(Class adapter)
Returns an object which is an instance of the given class
associated with this object.
|
ISynchronizationContext |
getContext()
Return the synchronization context for this participant.
|
ModelProvider[] |
getEnabledModelProviders()
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.
|
String |
getName()
Returns the name of this synchronize participant.
|
PreferencePage[] |
getPreferencePages()
Return the list of preference pages that are associated with 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.
|
boolean |
hasCompareInputFor(Object object)
Return whether their is a compare input associated with the given object.
|
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. |
protected void |
initializeContext(SynchronizationContext context)
Set the context of this participant.
|
boolean |
isMergingEnabled()
Return whether merge capabilities are enabled for this participant.
|
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 |
restoreContext(ISynchronizationScopeManager manager)
Recreate the context for this participant.
|
void |
run(IWorkbenchPart part)
Runs the participants action.
|
void |
saveState(IMemento memento)
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.
|
addPropertyChangeListener, createPageConfiguration, doesSupportSynchronize, equals, firePropertyChange, getHelpContextId, getId, getImageDescriptor, getSecondaryId, hashCode, isPinned, isViewerContributionsSupported, pinned, prepareCompareInput, removePropertyChangeListener, setImageDescriptor, setInitializationData, setInitializationData, setName, setPinned, setSecondaryId
public static final String P_VISIBLE_MODEL_PROVIDER
ModelProvider
from an ISynchronizePageConfiguration
. The
active model provider will be the only one visible in the page. If
null
or ALL_MODEL_PROVIDERS_ACTIVE
is
returned, all model providers are considered active and are visible.public static final String ALL_MODEL_PROVIDERS_VISIBLE
P_ACTIVE_MODEL_PROVIDER
property to indicate
that all enabled model providers are active.public static final String PROP_ENABLED_MODEL_PROVIDERS
public static final String PROP_ACTIVE_SAVEABLE
public static final String PROP_DIRTY
public ModelSynchronizeParticipant(SynchronizationContext context)
context
- the synchronization contextpublic ModelSynchronizeParticipant()
public static ModelSynchronizeParticipant createParticipant(SynchronizationContext context, String name)
context
- the synchronization contextname
- the name of the participantpublic String getName()
ISynchronizeParticipant
getName
in interface ISynchronizeParticipant
getName
in class AbstractSynchronizeParticipant
protected final String getShortName()
getName()
method defined in this class.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 configurationprotected ModelSynchronizeParticipantActionGroup createMergeActionGroup()
public final IPageBookViewPage createPage(ISynchronizePageConfiguration configuration)
ISynchronizeParticipant
ISynchronizePageSite
.configuration
- used to initialize the pagepublic void run(IWorkbenchPart part)
ISynchronizeParticipant
part
- the part in which the action is run or null
if the action
is not being run in a workbench part.public final void refresh(IWorkbenchSite site, ResourceMapping[] mappings)
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 refreshedpublic 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).
protected void initializeContext(SynchronizationContext context)
context
- the context for this participantpublic ISynchronizationContext getContext()
public ICompareInput asCompareInput(Object object)
null
if the object is not eligible for comparison.object
- the model objectnull
public boolean hasCompareInputFor(Object object)
true
if asCompareInput(Object)
would return a value and false
if it would return null
.object
- the object.public boolean isMergingEnabled()
public void setMergingEnabled(boolean mergingEnabled)
mergingEnabled
- whether merge capabilities should be enabled for this participantprotected String getShortTaskName()
protected String getLongTaskName(ResourceMapping[] mappings)
mappings
- the mappings being refreshedpublic 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)
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 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)
protected MergeContext restoreContext(ISynchronizationScopeManager manager) throws CoreException
manager
- the restored scopeCoreException
protected ISynchronizationScopeManager createScopeManager(ResourceMapping[] mappings)
mappings
- the restored mappingspublic SaveableComparison getActiveSaveable()
null
public void setActiveSaveable(SaveableComparison activeSaveable)
activeSaveable
- the active saveable (may be null
)public boolean checkForBufferChange(Shell shell, ISynchronizationCompareInput input, boolean cancelAllowed, IProgressMonitor monitor) throws CoreException
shell
- a shellinput
- the compare input about to be displayedcancelAllowed
- whether the display of the compare input can be canceledmonitor
- a progress monitor or null
if progress reporting is not requiredCoreException
public ModelProvider[] getEnabledModelProviders()
public PreferencePage[] getPreferencePages()
ISynchronizeParticipant
getPreferencePages
in interface ISynchronizeParticipant
getPreferencePages
in class AbstractSynchronizeParticipant
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.