public class HistoryPageCompareEditorInput extends PageCompareEditorInput
IHistoryCompareAdapter
.DIRTY_STATE, PROP_SELECTED_EDITION, PROP_TITLE, PROP_TITLE_IMAGE
Constructor and Description |
---|
HistoryPageCompareEditorInput(CompareConfiguration configuration,
IHistoryPageSource pageSource,
Object object)
Create a history page compare editor input for the given page and object.
|
Modifier and Type | Method and Description |
---|---|
protected ICompareInput |
asCompareInput(ISelection selection)
Return a compare input that represents the selection.
|
protected IPage |
createPage(CompareViewerPane parent,
IToolBarManager toolBarManager)
Create the page for this part and return the top level control
for the page.
|
IHistoryPage |
getHistoryPage()
Return the history page for this input or
null if the
page hasn't been created yet. |
String |
getOKButtonLabel()
Return the label to be used for the
OK
button when this input is displayed in a dialog. |
protected ISelectionProvider |
getSelectionProvider()
Return the selection provider for the page.
|
protected void |
handleDispose()
Callback that occurs when the UI associated with this compare editor
input is disposed.
|
protected void |
handlePropertyChange(PropertyChangeEvent event)
Handle a property change event from the history page.
|
boolean |
isEditionSelectionDialog()
Return whether this input is intended to be used to select
a particular edition of an element in a dialog.
|
protected boolean |
isReplaceDialog()
Return whether this compare editor input is being used in a replace
dialog.
|
boolean |
okPressed()
The
OK button was pressed in a dialog. |
protected void |
performReplace(Object selectedObject)
A replace has been requested.
|
protected void |
prepareInput(ICompareInput input,
CompareConfiguration configuration,
IProgressMonitor monitor)
Prepare the compare input for display in a content viewer.
|
protected Object |
prepareInput(IProgressMonitor monitor)
Runs the compare operation and returns the compare result.
|
void |
setReplace(boolean isReplace)
Set whether this compare editor input is being used in a replace
dialog.
|
canRunAsJob, contentChanged, createStructureInputPane, prepareCompareInput, setPageDescription
addCompareInputChangeListener, addPropertyChangeListener, belongsTo, cancelPressed, contentsCreated, contributeToToolBar, createContents, createContentViewerSwitchingPane, createDiffViewer, createOutlineContents, exists, findContentViewer, findStructureViewer, firePropertyChange, flushLeftViewers, flushRightViewers, flushViewers, getActionBars, getAdapter, getCancelButtonLabel, getCompareConfiguration, getCompareResult, getContainer, getContentViewerDescriptor, getImageDescriptor, getMessage, getName, getNavigator, getPersistable, getSelectedEdition, getServiceLocator, getStructureViewerDescriptor, getTitle, getTitleImage, getToolTipText, getWorkbenchPart, isDirty, isLeftSaveNeeded, isRightSaveNeeded, isSaveNeeded, registerContextMenu, removeCompareInputChangeListener, removePropertyChangeListener, run, run, runAsynchronously, save, saveChanges, setContainer, setContentViewerDescriptor, setDirty, setFocus, setFocus2, setHelpContextId, setLeftDirty, setMessage, setRightDirty, setStatusMessage, setStructureViewerDescriptor, setTitle
public HistoryPageCompareEditorInput(CompareConfiguration configuration, IHistoryPageSource pageSource, Object object)
configuration
- the compare configurationpageSource
- the page sourceobject
- the object whose history is to be displayedprotected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
CompareEditorInput
null
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 CompareEditorInput
monitor
- 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
InterruptedException
protected void handleDispose()
CompareEditorInput
CompareEditorInput.createContents(Composite)
.
Subclasses can extend this method but ensure that the overridden method
is invoked.handleDispose
in class PageCompareEditorInput
protected IPage createPage(CompareViewerPane parent, IToolBarManager toolBarManager)
PageCompareEditorInput
createPage
in class PageCompareEditorInput
parent
- the parent compositetoolBarManager
- the toolbar manager for the pageprotected ICompareInput asCompareInput(ISelection selection)
PageCompareEditorInput
ICompareInput
.
Subclasses may override.asCompareInput
in class PageCompareEditorInput
selection
- the selectionprotected ISelectionProvider getSelectionProvider()
PageCompareEditorInput
getSelectionProvider
in class PageCompareEditorInput
protected void prepareInput(ICompareInput input, CompareConfiguration configuration, IProgressMonitor monitor) throws InvocationTargetException
PageCompareEditorInput
PageCompareEditorInput.prepareCompareInput(ICompareInput)
and may be called
from a non-UI thread. This method should not be called by others.prepareInput
in class PageCompareEditorInput
input
- the inputconfiguration
- the compare configurationmonitor
- a progress monitorInvocationTargetException
public final IHistoryPage getHistoryPage()
null
if the
page hasn't been created yet.protected void handlePropertyChange(PropertyChangeEvent event)
event
- the change eventpublic boolean isEditionSelectionDialog()
CompareEditorInput
false
is returned.isEditionSelectionDialog
in class CompareEditorInput
CompareEditorInput.getOKButtonLabel()
,
CompareEditorInput.okPressed()
,
CompareEditorInput.getSelectedEdition()
protected boolean isReplaceDialog()
public void setReplace(boolean isReplace)
isReplace
- whether this compare editor input is being used in a replace
dialogpublic String getOKButtonLabel()
CompareEditorInput
OK
button when this input is displayed in a dialog.
By default, different labels are used depending on
whether the input is editable or is for edition selection
(see CompareEditorInput.isEditionSelectionDialog()
.getOKButtonLabel
in class CompareEditorInput
OK
button when this input is displayed in a dialogpublic boolean okPressed()
CompareEditorInput
OK
button was pressed in a dialog. If one or both of
the sides of the input is editable then any changes will be saved. If the
input is for edition selection (see CompareEditorInput.isEditionSelectionDialog()
),
it is up to subclasses to override this method in order to perform the
appropriate operation on the selected edition.okPressed
in class CompareEditorInput
protected void performReplace(Object selectedObject) throws CoreException
isReplaceDialog()
is true
and the user has clicked the "Replace" button.
By default, this method does nothing.
Subclasses may override.selectedObject
- the selected objectCoreException
- if an error occurs performing the replace
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.