public abstract class AbstractSynchronizeParticipant extends PlatformObject implements ISynchronizeParticipant
ISynchronizeParticipant
.
This class provides lifecycle support and hooks for configuration of synchronize view pages.
ISynchronizeParticipant
Modifier and Type | Field and Description |
---|---|
protected IConfigurationElement |
configElement |
static String |
P_PINNED
Property key used in the property change event fired when the pinned
state of a participant changes.
|
static String |
P_SCHEDULED
Property key used in the property change event fired when the
participants refresh schedule changes.
|
P_CONTENT
Constructor and Description |
---|
AbstractSynchronizeParticipant()
Default constructor is a no-op.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(IPropertyChangeListener listener)
Adds a listener for changes to properties of this synchronize
participant.
|
ISynchronizePageConfiguration |
createPageConfiguration()
Creates the configuration for the participant page.
|
boolean |
doesSupportSynchronize()
Return whether this participant can be refreshed.
|
boolean |
equals(Object obj) |
void |
firePropertyChange(Object source,
String property,
Object oldValue,
Object newValue)
Notify all listeners that the given property has changed.
|
String |
getHelpContextId()
Returns the help context id of this participant or value of
IHelpContextIds.SYNC_VIEW when no specific id has been
provided. |
String |
getId()
Returns the unique id that identified the type of this
synchronize participant.
|
ImageDescriptor |
getImageDescriptor()
Returns an image descriptor for this synchronize participant, or
null
if none. |
String |
getName()
Returns the name of this synchronize participant.
|
PreferencePage[] |
getPreferencePages()
Return the list of preference pages that are associated with this participant
|
String |
getSecondaryId()
Returns the instance id that identified the unique instance of this
participant.
|
int |
hashCode() |
void |
init(String secondaryId,
IMemento memento)
Classes that are persisted must override this method and perform
the following initialization.
|
protected abstract void |
initializeConfiguration(ISynchronizePageConfiguration configuration)
This method is invoked after a page configuration is created but before it is returned by the
createPageConfiguration method. |
boolean |
isPinned()
Returns if this participant is pinned.
|
protected boolean |
isViewerContributionsSupported()
Return whether this participant supports the contribution of actions to
the context menu by contributing a
viewerContribution
to the org.eclipse.ui.popupMenus extension point. |
protected void |
pinned(boolean pinned)
Called when the pinned state is changed.
|
void |
prepareCompareInput(ISynchronizeModelElement element,
CompareConfiguration config,
IProgressMonitor monitor)
Default implementation will update the labels in the given configuration using
information from the provided element if it adapts to
SyncInfo . |
void |
removePropertyChangeListener(IPropertyChangeListener listener)
Removes the given property listener from this synchronize participant.
|
void |
saveState(IMemento memento)
Saves the participants object state within the memento.
|
protected void |
setImageDescriptor(ImageDescriptor imageDescriptor)
Sets the image descriptor for this participant to the specified value and
notifies property listeners of the change.
|
void |
setInitializationData(IConfigurationElement config,
String propertyName,
Object data)
This method is called by the implementation of the method
IConfigurationElement.createExecutableExtension
on a newly constructed extension, passing it its relevant configuration
information. |
protected void |
setInitializationData(ISynchronizeParticipantDescriptor descriptor) |
protected void |
setName(String name)
Sets the name of this participant to the specified value and notifies
property listeners of the change.
|
void |
setPinned(boolean pinned)
Sets whether this participant is pinned.
|
protected void |
setSecondaryId(String secondaryId)
Sets the secondary id for this participant.
|
getAdapter
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
createPage, dispose, run
getAdapter
public static final String P_PINNED
public static final String P_SCHEDULED
protected IConfigurationElement configElement
public AbstractSynchronizeParticipant()
public String getName()
ISynchronizeParticipant
getName
in interface ISynchronizeParticipant
public ImageDescriptor getImageDescriptor()
ISynchronizeParticipant
null
if none.getImageDescriptor
in interface ISynchronizeParticipant
null
if nonepublic String getId()
ISynchronizeParticipant
getId
in interface ISynchronizeParticipant
public String getSecondaryId()
ISynchronizeParticipant
getSecondaryId
in interface ISynchronizeParticipant
null
if this participant doesn't support
multiple instances.public String getHelpContextId()
IHelpContextIds.SYNC_VIEW
when no specific id has been
provided.getHelpContextId
in interface ISynchronizeParticipant
ISynchronizeParticipant.getHelpContextId()
,
IHelpContextIds.SYNC_VIEW
public final void setPinned(boolean pinned)
ISynchronizeParticipant
setPinned
in interface ISynchronizeParticipant
pinned
- sets if the participant is pinned.public final boolean isPinned()
ISynchronizeParticipant
isPinned
in interface ISynchronizeParticipant
true
if this participant is pinned and false
otherwise.protected void pinned(boolean pinned)
pinned
- whether the participant is pinned.public boolean doesSupportSynchronize()
ISynchronizeParticipant.run(org.eclipse.ui.IWorkbenchPart)
method is called.public void addPropertyChangeListener(IPropertyChangeListener listener)
ISynchronizeParticipant
The changes supported by the synchronize view are as follows:
IBasicPropertyConstants.P_TEXT
- indicates the name
of a synchronize participant has changedIBasicPropertyConstants.P_IMAGE
- indicates the
image of a synchronize participant has changedClients may define additional properties as required.
addPropertyChangeListener
in interface ISynchronizeParticipant
listener
- a property change listenerpublic void removePropertyChangeListener(IPropertyChangeListener listener)
ISynchronizeParticipant
removePropertyChangeListener
in interface ISynchronizeParticipant
listener
- a property listenerpublic void firePropertyChange(Object source, String property, Object oldValue, Object newValue)
source
- the object on which a property has changedproperty
- identifier of the property that has changedoldValue
- the old value of the property, or null
newValue
- the new value of the property, or null
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException
IExecutableExtension
IConfigurationElement.createExecutableExtension
on a newly constructed extension, passing it its relevant configuration
information. Most executable extensions only make use of the first
two call arguments.
Regular executable extensions specify their Java implementation class name as an attribute of the configuration element for the extension. For example
<action run="com.example.BaseAction"/>In the above example, this method would be called with a reference to the
<action>
element (first argument), and
"run"
as the name of the attribute that defined
this executable extension (second argument).
The last parameter is for the specific use of extension adapters and is typically not used by regular executable extensions.
There are two supported ways of associating additional adapter-specific data with the configuration in a way that is transparent to the extension point implementor:
(1) by specifying adapter data as part of the implementation
class attribute value. The Java class name can be followed
by a ":" separator, followed by any adapter data in string
form. For example, if the extension point specifies an attribute
"run"
to contain the name of the extension implementation,
an adapter can be configured as
<action run="com.example.ExternalAdapter:./cmds/util.exe -opt 3"/>
(2) by converting the attribute used to specify the executable extension to a child element of the original configuration element, and specifying the adapter data in the form of xml markup. Using this form, the example above would become
<action> <run class="com.xyz.ExternalAdapter"> <parameter name="exec" value="./cmds/util.exe"/> <parameter name="opt" value="3"/> </run > </action>
Form (2) will typically only be used for extension points that anticipate the majority of extensions configured into it will in fact be in the form of adapters.
In either case, the specified adapter class is instantiated using its 0-argument public constructor. The adapter data is passed as the last argument of this method. The data argument is defined as Object. It can have the following values:
null
, if no adapter data was suppliedString
Hashtable
containing the actual
parameter names and values (both String
s)setInitializationData
in interface IExecutableExtension
config
- the configuration element used to trigger this execution.
It can be queried by the executable extension for specific
configuration propertiespropertyName
- the name of an attribute of the configuration element
used on the createExecutableExtension(String)
call. This
argument can be used in the cases where a single configuration element
is used to define multiple executable extensions.data
- adapter data in the form of a String
,
a Hashtable
, or null
.CoreException
- if error(s) detected during initialization processingIConfigurationElement.createExecutableExtension(String)
protected void setInitializationData(ISynchronizeParticipantDescriptor descriptor) throws CoreException
CoreException
protected void setName(String name)
name
- the new nameprotected void setImageDescriptor(ImageDescriptor imageDescriptor)
imageDescriptor
- the new image descriptorprotected void setSecondaryId(String secondaryId)
secondaryId
- the secondary id for this participant.public void init(String secondaryId, IMemento memento) throws PartInitException
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
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
memento
- a memento to receive the object statepublic final ISynchronizePageConfiguration createPageConfiguration()
ISynchronizeParticipant
ISynchronizeParticipant.createPage(ISynchronizePageConfiguration)
is called and as such
can be used to pre-configure visual properties of the displayed page.createPageConfiguration
in interface ISynchronizeParticipant
protected abstract void initializeConfiguration(ISynchronizePageConfiguration configuration)
createPageConfiguration
method. Subclasses can implement this method to
tailor the configuration in ways appropriate to the participant.configuration
- the newly create page configurationpublic void prepareCompareInput(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) throws TeamException
SyncInfo
.
It will also cache the contents for the remote and base if the element is
sync info based.prepareCompareInput
in interface ISynchronizeParticipant
element
- the sync model element whose contents are about to be displayed to the user
in a compare editor or compare dialogconfig
- the compare configuration that will be used to configure the compare editor or dialogmonitor
- a progress monitor that can be used if contacting a server to prepare the element and configurationTeamException
- if an error occurred that should prevent the display of the compare editor containing
the elementISynchronizeParticipant.prepareCompareInput(org.eclipse.team.ui.synchronize.ISynchronizeModelElement, org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor)
public PreferencePage[] getPreferencePages()
ISynchronizeParticipant
getPreferencePages
in interface ISynchronizeParticipant
protected boolean isViewerContributionsSupported()
viewerContribution
to the org.eclipse.ui.popupMenus
extension point. By default,
false
is returned. If a subclasses overrides to return true
,
the id
of the participant is used as the targetId
. Here is
an extension that could be added to the plugin manifest to contribute an action to
the context menu for a participant
<extension point="org.eclipse.ui.popupMenus"> <viewerContribution id="org.eclipse.team.cvs.ui.viewContributionId" targetID="org.eclipse.team.cvs.ui.cvsworkspace-participant"> <action label="Add" menubarPath="additions" tooltip="Add a file to CVS version control" class="org.eclipse.team.internal.ccvs.ui.actions.AddAction" helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_add" id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.add"> </action> </viewerContribution> </extension>
org.eclipse.ui.popupMenus
extension point
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.