Class EditionSelectionDialog
- All Implemented Interfaces:
IShellProvider
In addition it is possible to specify a subsection of the input element (e.g. a method in a Java source file) by means of a "path". In this case the dialog compares only the subsection (as specified by the path) with the corresponding subsection in the list of editions. Only those editions are shown where the subsection differs from the same subsection in another edition thereby minimizing the number of presented variants. This functionality can be used to implement "Replace from Local History" for the Java language.
Subsections of an input element are determined by first finding an
IStructureCreator
for the input's type.
Then the method locate
is used to extract the subsection.
Each edition (variant in the list of variants) must implement the IModificationDate
interface
so that the dialog can sort the editions and present them in a tree structure where every
node corresponds one day.
The functionality is surfaced in a single function selectEdition
.
Clients may instantiate this class; it is not intended to be subclassed.
- See Also:
- Restriction:
- This class is not intended to be subclassed by clients.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
-
Field Summary
Fields inherited from class org.eclipse.compare.internal.ResizableDialog
fBundle
Fields inherited from class org.eclipse.jface.dialogs.Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred
-
Constructor Summary
ConstructorDescriptionEditionSelectionDialog
(Shell parent, ResourceBundle bundle) Deprecated.Creates a new modal, resizable dialog. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
createButtonsForButtonBar
(Composite parent) Deprecated.Adds buttons to this dialog's button bar.protected Control
createDialogArea
(Composite parent2) Deprecated.Creates and returns the contents of the upper part of this dialog (above the button bar).protected Image
getEditionImage
(ITypedElement selectedEdition, ITypedElement item) Deprecated.Returns an image for identifying the edition side of a compare viewer.protected String
getEditionLabel
(ITypedElement selectedEdition, ITypedElement item) Deprecated.Returns a label for identifying the edition side of a compare viewer.Deprecated.Returns the editions that have been selected with the most recent call toselectEdition
.protected String
getShortEditionLabel
(ITypedElement edition, ITypedElement item, Date date) Deprecated.Returns a label for identifying a node in the edition tree viewer.Deprecated.Returns the input target that has been specified with the most recent call toselectEdition
.protected String
getTargetLabel
(ITypedElement target, ITypedElement item) Deprecated.Returns a label for identifying the target side of a compare viewer.protected void
Deprecated.Overidden to disable dismiss on double click in compare mode.selectEdition
(ITypedElement target, ITypedElement[] inputEditions, Object ppath) Deprecated.Presents this modal dialog with the functionality described in the class comment above.selectPreviousEdition
(ITypedElement target, ITypedElement[] inputEditions, Object ppath) Deprecated.Select the previous edition (presenting a UI).void
setAddMode
(boolean addMode) Deprecated.Controls whether theEditionSelectionDialog
is in 'add' mode or 'replace' mode (the default).void
setCompareMode
(boolean compareMode) Deprecated.Controls whether theEditionSelectionDialog
is in 'compare' mode or 'add/replace' (the default) mode.void
setEditionTitleArgument
(String titleArgument) Deprecated.Sets an additional and optional argument for the edition pane's title.void
setEditionTitleImage
(Image titleImage) Deprecated.Sets an optional image for the edition pane's title.void
setHelpContextId
(String contextId) Deprecated.Sets the help context for this dialog.void
setHideIdenticalEntries
(boolean hide) Deprecated.Controls whether identical entries are shown or not (default).void
setTargetIsRight
(boolean isRight) Deprecated.Controls whether workspace target is on the left (the default) or right hand side.Methods inherited from class org.eclipse.compare.internal.ResizableDialog
close, configureShell, getInitialLocation, getInitialSize
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getOKButton, initializeBounds, initializeDialogUnits, isResizable, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
-
Constructor Details
-
EditionSelectionDialog
Deprecated.Creates a new modal, resizable dialog. Various titles, icons, and labels are configured from the given resource bundle. The following resource keys are used:key type description title String dialog title width Integer initial width of dialog height Integer initial height of dialog treeTitleFormat MessageFormat pane title for edition tree; arg 0 is the target dateIcon String icon for node in edition tree; path relative to plug-in timeIcon String icon for leaf in edition tree; path relative to plug-in todayFormat MessageFormat format string if date is todays date; arg 0 is date yesterdayFormat MessageFormat format string if date is yesterdays date; arg 0 is date dayFormat MessageFormat format string if date is any other date; arg 0 is date editionLabel String label for editions side of compare viewer; arg 0 is the date targetLabel String label for target side of compare viewer buttonLabel String label for OK button; default is IDialogConstants.OK_LABEL
- Parameters:
parent
- if notnull
the new dialog stays on top of this parent shellbundle
-ResourceBundle
to configure the dialog
-
-
Method Details
-
setHelpContextId
Deprecated.Sets the help context for this dialog.- Overrides:
setHelpContextId
in classResizableDialog
- Parameters:
contextId
- the help context id.- Since:
- 3.2
-
setEditionTitleArgument
Deprecated.Sets an additional and optional argument for the edition pane's title.- Parameters:
titleArgument
- an optional argument for the edition pane's title- Since:
- 2.0
-
setEditionTitleImage
Deprecated.Sets an optional image for the edition pane's title.- Parameters:
titleImage
- an optional image for the edition pane's title- Since:
- 2.0
-
selectPreviousEdition
public ITypedElement selectPreviousEdition(ITypedElement target, ITypedElement[] inputEditions, Object ppath) Deprecated.Select the previous edition (presenting a UI).- Parameters:
target
- the input object against which the editions are compared; must not benull
inputEditions
- the list of editions (element type:ITypedElement
s)ppath
- Ifnull
dialog shows full input; if nonnull
it extracts a subsection- Returns:
- returns the selected edition or
null
if error occurred. The returnedITypedElement
is one of the original editions ifpath
wasnull
; otherwise it is anITypedElement
returned fromIStructureCreator.locate(path, item)
- Since:
- 2.0
-
selectEdition
public ITypedElement selectEdition(ITypedElement target, ITypedElement[] inputEditions, Object ppath) Deprecated.Presents this modal dialog with the functionality described in the class comment above.- Parameters:
target
- the input object against which the editions are compared; must not benull
inputEditions
- the list of editions (element type:ITypedElement
s)ppath
- Ifnull
dialog shows full input; if nonnull
it extracts a subsection- Returns:
- returns the selected edition or
null
if dialog was cancelled. The returnedITypedElement
is one of the original editions ifpath
wasnull
; otherwise it is anITypedElement
returned fromIStructureCreator.locate(path, item)
-
setHideIdenticalEntries
public void setHideIdenticalEntries(boolean hide) Deprecated.Controls whether identical entries are shown or not (default). This method must be called beforeselectEdition
.- Parameters:
hide
- if true identical entries are hidden; otherwise they are shown.- Since:
- 2.0
-
setTargetIsRight
public void setTargetIsRight(boolean isRight) Deprecated.Controls whether workspace target is on the left (the default) or right hand side.- Parameters:
isRight
- if true target is shown on right hand side.- Since:
- 2.0
-
setAddMode
public void setAddMode(boolean addMode) Deprecated.Controls whether theEditionSelectionDialog
is in 'add' mode or 'replace' mode (the default).- Parameters:
addMode
- if true dialog is in 'add' mode.- Since:
- 2.0
-
setCompareMode
public void setCompareMode(boolean compareMode) Deprecated.Controls whether theEditionSelectionDialog
is in 'compare' mode or 'add/replace' (the default) mode.- Parameters:
compareMode
- if true dialog is in 'add' mode.- Since:
- 2.0
-
getTarget
Deprecated.Returns the input target that has been specified with the most recent call toselectEdition
. If a notnull
path was specified this method returns a subsection of this target (IStructureCreator.locate(path, target)
) instead of the input target.For example if the
target
is a Java compilation unit andpath
specifies a method, the value returned fromgetTarget
will be the method not the compilation unit.- Returns:
- the last specified target or a subsection thereof.
-
getSelection
Deprecated.Returns the editions that have been selected with the most recent call toselectEdition
.- Returns:
- the selected editions as an array.
- Since:
- 2.1
-
getTargetLabel
Deprecated.Returns a label for identifying the target side of a compare viewer. This implementation extracts the value for the key "targetLabel" from the resource bundle and passes it as the format argument toMessageFormat.format
. The single format argument forMessageFormat.format
("{0}" in the format string) is the name of the given input element.Subclasses may override to create their own label.
- Parameters:
target
- the target element for which a label must be returneditem
- if a path has been specified inselectEdition
a sub element of the given target; otherwise the same as target- Returns:
- a label the target side of a compare viewer
-
getEditionLabel
Deprecated.Returns a label for identifying the edition side of a compare viewer. This implementation extracts the value for the key "editionLabel" from the resource bundle and passes it as the format argument toMessageFormat.format
. The single format argument forMessageFormat.format
("{0}" in the format string) is the formatted modification date of the given input element.Subclasses may override to create their own label.
- Parameters:
selectedEdition
- the selected edition for which a label must be returneditem
- if a path has been specified inselectEdition
a sub element of the given selectedEdition; otherwise the same as selectedEdition- Returns:
- a label for the edition side of a compare viewer
-
getShortEditionLabel
Deprecated.Returns a label for identifying a node in the edition tree viewer. This implementation extracts the value for the key "workspaceTreeFormat" or "treeFormat" (in that order) from the resource bundle and passes it as the format argument toMessageFormat.format
. The single format argument forMessageFormat.format
("{0}" in the format string) is the formatted modification date of the given input element.Subclasses may override to create their own label.
- Parameters:
edition
- the edition for which a label must be returneditem
- if a path has been specified inedition
a sub element of the given edition; otherwise the same as editiondate
- this date will be returned as part of the formatted string- Returns:
- a label of a node in the edition tree viewer
- Since:
- 2.0
-
getEditionImage
Deprecated.Returns an image for identifying the edition side of a compare viewer. This implementation extracts the value for the key "editionLabel" from the resource bundle and passes it as the format argument toMessageFormat.format
. The single format argument forMessageFormat.format
("{0}" in the format string) is the formatted modification date of the given input element.Subclasses may override to create their own label.
- Parameters:
selectedEdition
- the selected edition for which a label must be returneditem
- if a path has been specified inselectEdition
a sub element of the given selectedEdition; otherwise the same as selectedEdition- Returns:
- a label the edition side of a compare viewer
- Since:
- 2.0
-
createDialogArea
Deprecated.Description copied from class:Dialog
Creates and returns the contents of the upper part of this dialog (above the button bar).The
Dialog
implementation of this framework method creates and returns a newComposite
with standard margins and spacing.The returned control's layout data must be an instance of
GridData
. This method must not modify the parent's layout.Subclasses must override this method but may call
super
as in the following example:Composite composite = (Composite) super.createDialogArea(parent); //add controls to composite as necessary return composite;
- Overrides:
createDialogArea
in classDialog
- Parameters:
parent2
- the parent composite to contain the dialog area- Returns:
- the dialog area control
-
createButtonsForButtonBar
Deprecated.Description copied from class:Dialog
Adds buttons to this dialog's button bar.The
Dialog
implementation of this framework method adds standard ok and cancel buttons using thecreateButton
framework method. These standard buttons will be accessible fromgetCancelButton
, andgetOKButton
. Subclasses may override.Note: The common button order is: {other buttons}, OK, Cancel. On some platforms,
Dialog.initializeBounds()
will move the default button to the right.- Overrides:
createButtonsForButtonBar
in classDialog
- Parameters:
parent
- the button bar composite
-
okPressed
protected void okPressed()Deprecated.Overidden to disable dismiss on double click in compare mode.
-
org.eclipse.team.ui.history.IHistoryPageSource
in conjunction with theorg.eclipse.team.ui.history.IHistoryView
or aHistoryPageCompareEditorInput
. For sub-file elements, aorg.eclipse.team.ui.history.ElementLocalHistoryPageSource
can be used.