Package org.eclipse.team.ui.history
Class HistoryPageCompareEditorInput
java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.eclipse.compare.CompareEditorInput
org.eclipse.team.ui.PageCompareEditorInput
org.eclipse.team.ui.history.HistoryPageCompareEditorInput
- All Implemented Interfaces:
ICompareContainer,IContentChangeListener,IPropertyChangeNotifier,IAdaptable,IRunnableContext,IRunnableWithProgress,IEditorInput
Displays a history page combined with the compare/merge infrastructure. This only works properly if the
history page adapts to an
IHistoryCompareAdapter.- Since:
- 3.3
-
Field Summary
Fields inherited from class org.eclipse.compare.CompareEditorInput
DIRTY_STATE, PROP_SELECTED_EDITION, PROP_TITLE, PROP_TITLE_IMAGE -
Constructor Summary
ConstructorsConstructorDescriptionHistoryPageCompareEditorInput(CompareConfiguration configuration, IHistoryPageSource pageSource, Object object) Create a history page compare editor input for the given page and object. -
Method Summary
Modifier and TypeMethodDescriptionprotected ICompareInputasCompareInput(ISelection selection) Return a compare input that represents the selection.protected IPagecreatePage(CompareViewerPane parent, IToolBarManager toolBarManager) Create the page for this part and return the top level control for the page.protected final IPagecreatePage(CompareViewerPane parent, IToolBarManager toolBarManager, boolean allowMultiSelection) final IHistoryPageReturn the history page for this input ornullif the page hasn't been created yet.Returns the label to be used for theOKbutton when this input is displayed in a dialog.protected ISelectionProviderReturn the selection provider for the page.protected voidCallback that occurs when the UI associated with this compare editor input is disposed.protected voidHandle a property change event from the history page.booleanReturns whether this input is intended to be used to select a particular edition of an element in a dialog.protected booleanReturn whether this compare editor input is being used in a replace dialog.booleanTheOKbutton was pressed in a dialog.protected voidperformReplace(Object selectedObject) A replace has been requested.protected voidprepareInput(ICompareInput input, CompareConfiguration configuration, IProgressMonitor monitor) Prepare the compare input for display in a content viewer.protected ObjectprepareInput(IProgressMonitor monitor) Runs the compare operation and returns the compare result.voidsetReplace(boolean isReplace) Set whether this compare editor input is being used in a replace dialog.Methods inherited from class org.eclipse.team.ui.PageCompareEditorInput
canRunAsJob, contentChanged, createStructureInputPane, prepareCompareInput, setPageDescriptionMethods inherited from class org.eclipse.compare.CompareEditorInput
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
-
Constructor Details
-
HistoryPageCompareEditorInput
public HistoryPageCompareEditorInput(CompareConfiguration configuration, IHistoryPageSource pageSource, Object object) Create a history page compare editor input for the given page and object.- Parameters:
configuration- the compare configurationpageSource- the page sourceobject- the object whose history is to be displayed
-
-
Method Details
-
prepareInput
protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException Description copied from class:CompareEditorInputRuns the compare operation and returns the compare result. Ifnullis 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 throwingInterruptedException.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.
- Specified by:
prepareInputin classCompareEditorInput- Parameters:
monitor- the progress monitor to use to display progress and receive requests for cancellation- Returns:
- the result of the compare operation, or
nullif there are no differences - Throws:
InvocationTargetException- if theprepareInputmethod must propagate a checked exception, it should wrap it inside anInvocationTargetException; runtime exceptions are automatically wrapped in anInvocationTargetExceptionby the calling contextInterruptedException- if the operation detects a request to cancel, usingIProgressMonitor.isCanceled(), it should exit by throwingInterruptedException
-
handleDispose
protected void handleDispose()Description copied from class:CompareEditorInputCallback that occurs when the UI associated with this compare editor input is disposed. This method will only be invoked if the UI has been created (i.e. after the call toCompareEditorInput.createContents(Composite). Subclasses can extend this method but ensure that the overridden method is invoked.- Overrides:
handleDisposein classPageCompareEditorInput
-
createPage
Description copied from class:PageCompareEditorInputCreate the page for this part and return the top level control for the page.- Specified by:
createPagein classPageCompareEditorInput- Parameters:
parent- the parent compositetoolBarManager- the toolbar manager for the page- Returns:
- the top-level control for the page
-
createPage
protected final IPage createPage(CompareViewerPane parent, IToolBarManager toolBarManager, boolean allowMultiSelection) - Since:
- 3.11
-
asCompareInput
Description copied from class:PageCompareEditorInputReturn a compare input that represents the selection. This input is used to feed the structure and content viewers. By default, a compare input is returned if the selection is of size 1 and the selected element implementsICompareInput. Subclasses may override.- Overrides:
asCompareInputin classPageCompareEditorInput- Parameters:
selection- the selection- Returns:
- a compare input representing the selection
-
getSelectionProvider
Description copied from class:PageCompareEditorInputReturn the selection provider for the page. This method is called after the page is created in order to register a selection listener on the page.- Specified by:
getSelectionProviderin classPageCompareEditorInput- Returns:
- the selection provider for the page
-
prepareInput
protected void prepareInput(ICompareInput input, CompareConfiguration configuration, IProgressMonitor monitor) throws InvocationTargetException Description copied from class:PageCompareEditorInputPrepare the compare input for display in a content viewer. This method is called fromPageCompareEditorInput.prepareCompareInput(ICompareInput)and may be called from a non-UI thread. This method should not be called by others.- Specified by:
prepareInputin classPageCompareEditorInput- Parameters:
input- the inputconfiguration- the compare configurationmonitor- a progress monitor- Throws:
InvocationTargetException- if an error occurs
-
getHistoryPage
Return the history page for this input ornullif the page hasn't been created yet.- Returns:
- the history page for this input
-
handlePropertyChange
Handle a property change event from the history page.- Parameters:
event- the change event
-
isEditionSelectionDialog
public boolean isEditionSelectionDialog()Description copied from class:CompareEditorInputReturns whether this input is intended to be used to select a particular edition of an element in a dialog. The result of this method is only consider if neither sides of the input are editable. By default,falseis returned.- Overrides:
isEditionSelectionDialogin classCompareEditorInput- Returns:
- whether this input is intended to be used to select a particular edition of an element in a dialog
- See Also:
-
isReplaceDialog
protected boolean isReplaceDialog()Return whether this compare editor input is being used in a replace dialog.- Returns:
- whether this compare editor input is being used in a replace dialog
-
setReplace
public void setReplace(boolean isReplace) Set whether this compare editor input is being used in a replace dialog.- Parameters:
isReplace- whether this compare editor input is being used in a replace dialog
-
getOKButtonLabel
Description copied from class:CompareEditorInputReturns the label to be used for theOKbutton 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 (seeCompareEditorInput.isEditionSelectionDialog().- Overrides:
getOKButtonLabelin classCompareEditorInput- Returns:
- the label to be used for the
OKbutton when this input is displayed in a dialog
-
okPressed
public boolean okPressed()Description copied from class:CompareEditorInputTheOKbutton 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 (seeCompareEditorInput.isEditionSelectionDialog()), it is up to subclasses to override this method in order to perform the appropriate operation on the selected edition.- Overrides:
okPressedin classCompareEditorInput- Returns:
- whether the dialog should be closed or not.
-
performReplace
A replace has been requested. This method will be invoked ifisReplaceDialog()istrueand the user has clicked the "Replace" button. By default, this method does nothing. Subclasses may override.- Parameters:
selectedObject- the selected object- Throws:
CoreException- if an error occurs performing the replace
-