Eclipse Platform
Release 3.0

org.eclipse.team.ui.synchronize
Interface ISynchronizeParticipant

All Superinterfaces:
IExecutableExtension
All Known Implementing Classes:
AbstractSynchronizeParticipant

public interface ISynchronizeParticipant
extends IExecutableExtension

A synchronize participant is a visual compoment that can be displayed within any control (e.g. view, editor, dialog). Typically a participant is used to show changes between local resources and variant states of those resources and allows the user to perform actions to manipulate the changes.

This class does not mandate how the synchronization state is displayed, but instead provides the accessors that clients would use to create a visual instance of the this participant.

A participant can display multiple instances of its synchronization state to the user via the creation of a page createPage(ISynchronizePageConfiguration) and clients can decide where to display the page. For example, the synchronize view is an example of a client that displays a participant in a view. However, you can imagine that a client may also want to display this state in a wizard or dialog instead. That is possible by

When a participant is registered with the ISynchronizeManager it will automatically display in the Synchronize View and if the participant extension point enabled synchronizeWizards it will also appear in the global synchronize action toolbar.

A participant is added to the workbench as follows:

Once a participant is added to the synchronize manager its lifecycle will be managed. On shutdown if the participant is persistable, the participant will be asked to persist state via the saveState() method. At startup the init() method is called with a handle to the state that was saved. The dispose method is called when the participant is removed from the manager and at shutdown.

Clients are not intended to implement this interface. Instead, sublcass AbstractSynchronizeParticpant.

Since:
3.0
See Also:
ISynchronizeView, ISynchronizeManager, AbstractSynchronizeParticpant

Method Summary
 void addPropertyChangeListener(IPropertyChangeListener listener)
          Adds a listener for changes to properties of this synchronize participant.
 IPageBookViewPage createPage(ISynchronizePageConfiguration configuration)
          Creates and returns a new page for this synchronize participant.
 ISynchronizePageConfiguration createPageConfiguration()
          Creates the configuration for the participant page.
 void dispose()
          Disposes of this synchronize participant and is called to free the resources associated with a participant.
 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.
 String getSecondaryId()
          Returns the instance id that identified the unique instance of this participant.
 void init(String secondaryId, IMemento memento)
          Initializes this participant with the given participant state.
 boolean isPinned()
          Returns if this participant is pinned.
 void removePropertyChangeListener(IPropertyChangeListener listener)
          Removes the given property listener from this synchronize participant.
 void run(IWorkbenchPart part)
          Runs the participants action.
 void saveState(IMemento memento)
          Saves the participants object state within the memento.
 void setPinned(boolean pinned)
          Sets whether this participant is pinned.
 
Methods inherited from interface org.eclipse.core.runtime.IExecutableExtension
setInitializationData
 

Method Detail

getId

public String getId()
Returns the unique id that identified the type of this synchronize participant. The synchronize manager supports registering several instances of the same participant type.

Returns:
the unique id that identified the type of this synchronize participant.

getSecondaryId

public String getSecondaryId()
Returns the instance id that identified the unique instance of this participant. The synchronize manager supports registering several instances of the same participant type and this id is used to differentiate between them.

Returns:
the instance id that identified the unique instance of this participant or null if this participant doesn't support multiple instances.

getName

public String getName()
Returns the name of this synchronize participant. This name is displayed to the user.

Returns:
the name of this synchronize participant

getImageDescriptor

public ImageDescriptor getImageDescriptor()
Returns an image descriptor for this synchronize participant, or null if none.

Returns:
an image descriptor for this synchronize participant, or null if none

isPinned

public boolean isPinned()
Returns if this participant is pinned. Pinned participants will only be removed from the synchronize manager until they are un-pinned.

Returns:
true if this participant is pinned and false otherwise.

setPinned

public void setPinned(boolean pinned)
Sets whether this participant is pinned.

Parameters:
pinned - sets if the participant is pinned.

createPageConfiguration

public ISynchronizePageConfiguration createPageConfiguration()
Creates the configuration for the participant page. The configuration controls the options for displaying the participant. The configuration used to initialize the page when createPage(ISynchronizePageConfiguration) is called and as such can be used to pre-configure visual properties of the displayed page.

Returns:
the configuration for the participant page.

createPage

public IPageBookViewPage createPage(ISynchronizePageConfiguration configuration)
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 the ISynchronizePageSite.

Parameters:
configuration - used to initialize the page
Returns:
a page book view page representation of this synchronize participant

run

public void run(IWorkbenchPart part)
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 or null if the action is not being run in a workbench part.

init

public void init(String secondaryId,
                 IMemento memento)
          throws PartInitException
Initializes this participant with the given participant state. A memento is passed to the participant which contains a snapshot of the participants state from a previous session.

This method is automatically called by the team plugin shortly after participant construction. It marks the start of the views lifecycle. Clients must not call this method.

Parameters:
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 state
Throws:
PartInitException - if this participant was not initialized successfully

dispose

public void dispose()
Disposes of this synchronize participant and is called to free the resources associated with a participant. When a participant is added to the 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 deregister all listeners.

Clients should not call this method (the synchronize manager calls this method at appropriate times).


saveState

public void saveState(IMemento memento)
Saves the participants object state within the memento. This state will be available when the participant is restored via init.

This method can be called multiple times during the lifetime of the participant object.

Parameters:
memento - a memento to receive the object state

addPropertyChangeListener

public void addPropertyChangeListener(IPropertyChangeListener listener)
Adds a listener for changes to properties of this synchronize participant. Has no effect if an identical listener is already registered.

The changes supported by the synchronize view are as follows:

Clients may define additional properties as required.

Parameters:
listener - a property change listener

removePropertyChangeListener

public void removePropertyChangeListener(IPropertyChangeListener listener)
Removes the given property listener from this synchronize participant. Has no effect if an identical listener is not alread registered.

Parameters:
listener - a property listener

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.