Eclipse Platform
Release 3.1

org.eclipse.team.ui.synchronize
Class ParticipantPageSaveablePart

java.lang.Object
  extended byorg.eclipse.team.ui.SaveablePartAdapter
      extended byorg.eclipse.team.ui.synchronize.ParticipantPageSaveablePart
All Implemented Interfaces:
IAdaptable, IContentChangeListener, ISaveablePart, ISaveableWorkbenchPart, IWorkbenchPart

public class ParticipantPageSaveablePart
extends SaveablePartAdapter
implements IContentChangeListener

Displays a synchronize participant page combined with the compare/merge infrastructure. This only works if the synchronize page viewer provides selections that are of the following types: ITypedElement and ICompareInput.

Since:
3.0

Field Summary
 
Fields inherited from interface org.eclipse.team.ui.ISaveableWorkbenchPart
PROP_DIRTY
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
ParticipantPageSaveablePart(Shell shell, CompareConfiguration cc, ISynchronizePageConfiguration pageConfiguration, ISynchronizeParticipant participant)
          Creates a part for the provided participant.
 
Method Summary
 void contentChanged(IContentChangeNotifier source)
          Called whenever the content of the given source has changed.
 void createPartControl(Composite parent2)
          Creates the SWT controls for this workbench part.
 void dispose()
          Disposes of this workbench part.
 void doSave(IProgressMonitor pm)
          Saves the contents of this part.
 Control getControl()
          Returns the primary control for this part.
 ISynchronizePageConfiguration getPageConfiguration()
          Return the synchronize page configuration for this part
 ISynchronizeParticipant getParticipant()
          Return the Synchronize participant for this part
 String getTitle()
          Returns the title of this workbench part.
 Image getTitleImage()
          Returns the title image of this workbench part.
 boolean isDirty()
          Returns whether the contents of this part have changed since the last save operation.
 void setNavigator(ISynchronizePageConfiguration configuration)
          This method should not be called from clients.
 void setShowContentPanes(boolean showContentPanes)
          Set whether the file contents panes should be shown.
 
Methods inherited from class org.eclipse.team.ui.SaveablePartAdapter
addPropertyListener, doSaveAs, getAdapter, getSite, getTitleToolTip, isSaveAsAllowed, isSaveOnCloseNeeded, removePropertyListener, setFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParticipantPageSaveablePart

public ParticipantPageSaveablePart(Shell shell,
                                   CompareConfiguration cc,
                                   ISynchronizePageConfiguration pageConfiguration,
                                   ISynchronizeParticipant participant)
Creates a part for the provided participant. The page configuration is used when creating the participant page and the resulting compare/merge panes will be configured with the provided compare configuration.

For example, clients can decide if the user can edit the compare panes by calling CompareConfiguration.setLeftEditable(boolean) or CompareConfiguration.setRightEditable(boolean).

Parameters:
shell - the parent shell for this part
cc - the compare configuration that will be used to create the compare panes
pageConfiguration - the configuration that will be provided to the participant prior to creating the page
participant - the participant whose page will be displayed in this part
Method Detail

dispose

public void dispose()
Description copied from interface: IWorkbenchPart
Disposes of this workbench part.

This is the last method called on the IWorkbenchPart. At this point the part controls (if they were ever created) have been disposed as part of an SWT composite. There is no guarantee that createPartControl() has been called, so the part controls may never have been created.

Within this method a part may release any resources, fonts, images, etc.  held by this part. It is also very important to deregister all listeners from the workbench.

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

Specified by:
dispose in interface IWorkbenchPart
Overrides:
dispose in class SaveablePartAdapter

getTitleImage

public Image getTitleImage()
Description copied from interface: IWorkbenchPart
Returns the title image of this workbench part. If this value changes the part must fire a property listener event with PROP_TITLE.

The title image is usually used to populate the title bar of this part's visual container. Since this image is managed by the part itself, callers must not dispose the returned image.

Specified by:
getTitleImage in interface IWorkbenchPart
Returns:
the title image

getTitle

public String getTitle()
Description copied from interface: IWorkbenchPart
Returns the title of this workbench part. If this value changes the part must fire a property listener event with PROP_TITLE.

The title is used to populate the title bar of this part's visual container.

Specified by:
getTitle in interface IWorkbenchPart
Returns:
the workbench part title (not null)

isDirty

public boolean isDirty()
Description copied from interface: ISaveablePart
Returns whether the contents of this part have changed since the last save operation. If this value changes the part must fire a property listener event with PROP_DIRTY.

Specified by:
isDirty in interface ISaveablePart
Returns:
true if the contents have been modified and need saving, and false if they have not changed since the last save

contentChanged

public void contentChanged(IContentChangeNotifier source)
Description copied from interface: IContentChangeListener
Called whenever the content of the given source has changed.

Specified by:
contentChanged in interface IContentChangeListener
Parameters:
source - the source whose contents has changed

doSave

public void doSave(IProgressMonitor pm)
Description copied from interface: ISaveablePart
Saves the contents of this part.

If the save is successful, the part should fire a property changed event reflecting the new dirty state (PROP_DIRTY property).

If the save is cancelled through user action, or for any other reason, the part should invoke setCancelled on the IProgressMonitor to inform the caller.

This method is long-running; progress and cancellation are provided by the given progress monitor.

Specified by:
doSave in interface ISaveablePart
Parameters:
pm - the progress monitor

createPartControl

public void createPartControl(Composite parent2)
Description copied from interface: IWorkbenchPart
Creates the SWT controls for this workbench part.

Clients should not call this method (the workbench calls this method when it needs to, which may be never).

For implementors this is a multi-step process:

  1. Create one or more controls within the parent.
  2. Set the parent layout as needed.
  3. Register any global actions with the site's IActionBars.
  4. Register any context menus with the site.
  5. Register a selection provider with the site, to make it available to the workbench's ISelectionService (optional).

Specified by:
createPartControl in interface IWorkbenchPart
Parameters:
parent2 - the parent control

setNavigator

public void setNavigator(ISynchronizePageConfiguration configuration)
This method should not be called from clients. TODO: using internal compare classes to support page navigation. This is required because we are building our own compare editor input that includes a participant page instead of a viewer.


setShowContentPanes

public void setShowContentPanes(boolean showContentPanes)
Set whether the file contents panes should be shown. If they are not, only the resource tree will be shown.

Parameters:
showContentPanes - whether to show contents pane
Since:
3.1

getControl

public Control getControl()
Returns the primary control for this part.

Returns:
the primary control for this part.

getPageConfiguration

public ISynchronizePageConfiguration getPageConfiguration()
Return the synchronize page configuration for this part

Returns:
Returns the pageConfiguration.

getParticipant

public ISynchronizeParticipant getParticipant()
Return the Synchronize participant for this part

Returns:
Returns the participant.

Eclipse Platform
Release 3.1

Guidelines for using Eclipse APIs.

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