|
Eclipse Platform Release 3.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.core.runtime.PlatformObject
org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant
public abstract class AbstractSynchronizeParticipant
This class is the abstract base class for all synchronize view participants. Clients must subclass
this class instead of directly implementing ISynchronizeParticipant.
This class provides lifecycle support and hooks for configuration of synchronize view pages.
ISynchronizeParticipant| Field Summary | |
|---|---|
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. |
| Constructor Summary | |
|---|---|
AbstractSynchronizeParticipant()
Default constructor is a no-op. |
|
| Method Summary | |
|---|---|
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()
|
boolean |
equals(Object obj)
|
void |
firePropertyChange(Object source,
String property,
Object oldValue,
Object newValue)
Notify all listeners that the given property has changed. |
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. |
| Methods inherited from class org.eclipse.core.runtime.PlatformObject |
|---|
getAdapter |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.team.ui.synchronize.ISynchronizeParticipant |
|---|
createPage, dispose, run |
| Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
|---|
getAdapter |
| Field Detail |
|---|
public static final String P_PINNED
public static final String P_SCHEDULED
protected IConfigurationElement configElement
| Constructor Detail |
|---|
public AbstractSynchronizeParticipant()
| Method Detail |
|---|
public String getName()
ISynchronizeParticipant
getName in interface ISynchronizeParticipantpublic ImageDescriptor getImageDescriptor()
ISynchronizeParticipantnull
if none.
getImageDescriptor in interface ISynchronizeParticipantnull
if nonepublic String getId()
ISynchronizeParticipant
getId in interface ISynchronizeParticipantpublic String getSecondaryId()
ISynchronizeParticipant
getSecondaryId in interface ISynchronizeParticipantnull if this participant doesn't support
multiple instances.public final void setPinned(boolean pinned)
ISynchronizeParticipant
setPinned in interface ISynchronizeParticipantpinned - sets if the participant is pinned.public final boolean isPinned()
ISynchronizeParticipant
isPinned in interface ISynchronizeParticipanttrue if this participant is pinned and false
otherwise.protected void pinned(boolean pinned)
pinned - whether the participant is pinned.public boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean doesSupportSynchronize()
public void addPropertyChangeListener(IPropertyChangeListener listener)
ISynchronizeParticipantThe 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 ISynchronizeParticipantlistener - a property change listenerpublic void removePropertyChangeListener(IPropertyChangeListener listener)
ISynchronizeParticipant
removePropertyChangeListener in interface ISynchronizeParticipantlistener - a property listener
public 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 nullnewValue - the new value of the property, or null
public void setInitializationData(IConfigurationElement config,
String propertyName,
Object data)
throws CoreException
IExecutableExtensionIConfigurationElement.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 suppliedStringHashtable containing the actual
parameter names and values (both Strings)
setInitializationData in interface IExecutableExtensionconfig - 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
CoreExceptionprotected 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 particant as defined in the plugin manifest.
init in interface ISynchronizeParticipantsecondaryId - 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 state
PartInitException - if this participant was not initialized
successfullyISynchronizeParticipant.init(String, org.eclipse.ui.IMemento)public void saveState(IMemento memento)
ISynchronizeParticipantinit.
This method can be called multiple times during the lifetime of the participant object.
saveState in interface ISynchronizeParticipantmemento - a memento to receive the object statepublic final ISynchronizePageConfiguration createPageConfiguration()
ISynchronizeParticipantISynchronizeParticipant.createPage(ISynchronizePageConfiguration) is called and as such
can be used to pre-configure visual properties of the displayed page.
createPageConfiguration in interface ISynchronizeParticipantprotected 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 configuration
public 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 ISynchronizeParticipantelement - 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 configuration
TeamException - if an error occurred that shoudl rpevent 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 ISynchronizeParticipantprotected 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
|
Eclipse Platform Release 3.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.