|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jface.window.Window org.eclipse.jface.dialogs.Dialog org.eclipse.compare.internal.ResizableDialog org.eclipse.compare.EditionSelectionDialog
A dialog where one input element can be compared against a list of historic variants (editions) of the same input element. The dialog can be used to implement functions like "Compare/Replace with Version" or "Compare/Replace from Local History" on workspace resources.
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.
Nested Class Summary |
Nested classes 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, dialogArea, DLG_IMG_ERROR, 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 |
Constructor Summary | |
EditionSelectionDialog(Shell parent,
ResourceBundle bundle)
Creates a new modal, resizable dialog. |
Method Summary | |
protected void | createButtonsForButtonBar(Composite parent)
Adds buttons to this dialog's button bar. |
protected Control | createDialogArea(Composite parent2)
Creates and returns the contents of the upper part of this dialog (above the button bar). |
protected Image | getEditionImage(ITypedElement selectedEdition,
ITypedElement item)
Returns an image for identifying the edition side of a compare viewer. |
protected String | getEditionLabel(ITypedElement selectedEdition,
ITypedElement item)
Returns a label for identifying the edition side of a compare viewer. |
ITypedElement[] | getSelection()
Returns the editions that have been selected with the most recent call to selectEdition. |
protected String | getShortEditionLabel(ITypedElement edition,
ITypedElement item,
Date date)
Returns a label for identifying a node in the edition tree viewer. |
ITypedElement | getTarget()
Returns the input target that has been specified with the most recent call to selectEdition. |
protected String | getTargetLabel(ITypedElement target,
ITypedElement item)
Returns a label for identifying the target side of a compare viewer. |
protected void | okPressed()
Overidden to disable dismiss on double click in compare mode. |
ITypedElement | selectEdition(ITypedElement target,
ITypedElement[] inputEditions,
Object ppath)
Presents this modal dialog with the functionality described in the class comment above. |
ITypedElement | selectPreviousEdition(ITypedElement target,
ITypedElement[] inputEditions,
Object ppath)
Select the previous edition (presenting a UI). |
void | setAddMode(boolean addMode)
Controls whether the EditionSelectionDialog is in 'add' mode or 'replace' mode (the default). |
void | setCompareMode(boolean compareMode)
Controls whether the EditionSelectionDialog is in 'compare' mode or 'add/replace' (the default) mode. |
void | setEditionTitleArgument(String titleArgument)
Sets an additional and optional argument for the edition pane's title. |
void | setEditionTitleImage(Image titleImage)
Sets an optional image for the edition pane's title. |
void | setHideIdenticalEntries(boolean hide)
Controls whether identical entries are shown or not (default). |
void | setTargetIsRight(boolean isRight)
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, setHelpContextId |
Methods inherited from class org.eclipse.jface.window.Window |
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setExceptionHandler, setReturnCode, setShellStyle, setWindowManager |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EditionSelectionDialog(Shell parent, ResourceBundle bundle)
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 plugin timeIcon String icon for leaf in edition tree; path relative to plugin 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
Method Detail |
public void setEditionTitleArgument(String titleArgument)
public void setEditionTitleImage(Image titleImage)
public ITypedElement selectPreviousEdition(ITypedElement target, ITypedElement[] inputEditions, Object ppath)
public ITypedElement selectEdition(ITypedElement target, ITypedElement[] inputEditions, Object ppath)
public void setHideIdenticalEntries(boolean hide)
public void setTargetIsRight(boolean isRight)
public void setAddMode(boolean addMode)
public void setCompareMode(boolean compareMode)
public ITypedElement getTarget()
For example if the target is a Java compilation unit and path specifies a method, the value returned from getTarget will be the method not the compilation unit.
public ITypedElement[] getSelection()
protected String getTargetLabel(ITypedElement target, ITypedElement item)
Subclasses may override to create their own label.
protected String getEditionLabel(ITypedElement selectedEdition, ITypedElement item)
Subclasses may override to create their own label.
protected String getShortEditionLabel(ITypedElement edition, ITypedElement item, Date date)
Subclasses may override to create their own label.
protected Image getEditionImage(ITypedElement selectedEdition, ITypedElement item)
Subclasses may override to create their own label.
protected Control createDialogArea(Composite parent2)
The Dialog implementation of this framework method creates and returns a new Composite 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;
protected void createButtonsForButtonBar(Composite parent)
The Dialog implementation of this framework method adds standard ok and cancel buttons using the createButton framework method. These standard buttons will be accessible from getCancelButton, and getOKButton. Subclasses may override.
protected void okPressed()
|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.