public final class SyncInfoCompareInput extends CompareEditorInput implements IResourceChangeListener
SyncInfo editor input used as input to a two-way or three-way
compare viewer. It defines methods for accessing the three sides for the
compare, and a name and image which is used when displaying the three way input
in an editor. This input can alternately be used to show compare results in
a dialog by calling CompareUI.openCompareDialog(org.eclipse.compare.CompareEditorInput).
The editor will not update when the elements in the sync info are changed.
Supports saving the local resource that is changed in the editor and will be updated when the local resources is changed.
This class cannot be subclassed by clients.
SyncInfoDIRTY_STATE| Constructor and Description |
|---|
SyncInfoCompareInput(ISynchronizeParticipant participant,
SyncInfo sync)
Creates a compare editor input based on an existing
SyncInfo
from the given participant. |
SyncInfoCompareInput(String description,
SyncInfo sync)
Creates a compare editor input based on an existing
SyncInfo. |
| Modifier and Type | Method and Description |
|---|---|
Control |
createContents(Composite parent)
Create the SWT controls that are used to display the result of the compare operation.
|
boolean |
equals(Object other) |
Object |
getAdapter(Class adapter)
Returns an object which is an instance of the given class
associated with this object.
|
ImageDescriptor |
getImageDescriptor()
Returns the image descriptor for this input.
|
SyncInfo |
getSyncInfo() |
String |
getTitle()
Returns the title which will be used in the compare editor's title bar.
|
Image |
getTitleImage()
Returns the title image which will be used in the compare editor's title bar.
|
String |
getToolTipText()
Returns the tool tip text for this editor input.
|
protected Object |
prepareInput(IProgressMonitor monitor)
Runs the compare operation and returns the compare result.
|
void |
resourceChanged(IResourceChangeEvent event)
Note that until the compare editor inputs can be part of the compare editors lifecycle we
can't register as a listener because there is no dispose() method to remove the listener.
|
void |
saveChanges(IProgressMonitor pm)
Save any unsaved changes.
|
addPropertyChangeListener, contributeToToolBar, createDiffViewer, createOutlineContents, exists, findContentViewer, findStructureViewer, getCompareConfiguration, getCompareResult, getMessage, getName, getPersistable, isSaveNeeded, removePropertyChangeListener, run, save, setDirty, setFocus, setMessage, setTitlepublic SyncInfoCompareInput(String description, SyncInfo sync)
SyncInfo.description - a description of the context of this sync info. This
is displayed to the user.sync - the SyncInfo used as the base for the compare input.public SyncInfoCompareInput(ISynchronizeParticipant participant, SyncInfo sync)
SyncInfo
from the given participant.participant - the participant from which the sync info was obtained. The
name of the participant is used as the description which is displayed to the user.sync - the SyncInfo used as the base for the compare input.public Control createContents(Composite parent)
CompareEditorInputSubclasses may override if they need to change the layout or wiring between panes.
createContents in class CompareEditorInputparent - the parent control under which the control must be createdpublic Object getAdapter(Class adapter)
IAdaptablenull if
no such object can be found.getAdapter in interface IAdaptablegetAdapter in class CompareEditorInputadapter - the adapter class to look upnull if this object does not
have an adapter for the given classpublic void resourceChanged(IResourceChangeEvent event)
resourceChanged in interface IResourceChangeListenerevent - the resource change eventIResourceDeltapublic Image getTitleImage()
CompareEditorInputgetTitleImage in class CompareEditorInputnull if noneprotected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
CompareEditorInputnull is returned no differences were found and no compare editor needs to be opened.
Progress should be reported to the given progress monitor.
A request to cancel the operation should be honored and acknowledged
by throwing InterruptedException.
Note: this method is typically called in a modal context thread which doesn't have a Display assigned. Implementors of this method shouldn't therefore allocated any SWT resources in this method.
prepareInput in class CompareEditorInputmonitor - the progress monitor to use to display progress and receive
requests for cancelationnull if there are no differencesInvocationTargetException - if the prepareInput method must propagate a checked exception,
it should wrap it inside an InvocationTargetException; runtime exceptions are automatically
wrapped in an InvocationTargetException by the calling contextInterruptedException - if the operation detects a request to cancel,
using IProgressMonitor.isCanceled(), it should exit by throwing
InterruptedExceptionpublic String getTitle()
CompareEditorInputsetTitle.getTitle in class CompareEditorInputpublic ImageDescriptor getImageDescriptor()
IEditorInputNote: although a null return value has never been permitted from this method, there are many known buggy implementations that return null. Clients that need the image for an editor are advised to use IWorkbenchPart.getImage() instead of IEditorInput.getImageDescriptor(), or to recover from a null return value in a manner that records the ID of the problematic editor input. Implementors that have been returning null from this method should pick some other default return value (such as ImageDescriptor.getMissingImageDescriptor()).
getImageDescriptor in interface IEditorInputgetImageDescriptor in class CompareEditorInputnull if
there is no image.public String getToolTipText()
IEditorInputgetToolTipText in interface IEditorInputgetToolTipText in class CompareEditorInputnull.public void saveChanges(IProgressMonitor pm) throws CoreException
CompareEditorInputISavable.save on them.saveChanges in class CompareEditorInputpm - an IProgressMonitor that the implementation of save may use to show progressCoreExceptionpublic SyncInfo getSyncInfo()
Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.