public abstract class TrayDialog extends Dialog
TrayDialog
is a specialized Dialog
that can contain
a tray on its side. The tray's content is provided as a DialogTray
.
It is recommended to subclass this class instead of Dialog
in all
cases except where the dialog should never show a tray. For example, dialogs
which are very short, simple, and quick to dismiss (e.g. a message dialog with
an OK button) should subclass Dialog
.
Note: Trays are not supported on dialogs that use a custom layout on the
Shell
by overriding Window#getLayout()
.
DialogTray
,
Window.getLayout()
Window.IExceptionHandler
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
CANCEL, OK, resizeHasOccurred
Modifier | Constructor and Description |
---|---|
protected |
TrayDialog(IShellProvider parentShell)
Creates a tray dialog with the given parent.
|
protected |
TrayDialog(Shell shell)
Creates a tray dialog instance.
|
Modifier and Type | Method and Description |
---|---|
void |
closeTray()
Closes this dialog's tray, disposing its widgets.
|
protected Control |
createButtonBar(Composite parent)
Creates and returns the contents of this dialog's button bar.
|
protected Control |
createHelpControl(Composite parent)
Creates a new help control that provides access to context help.
|
protected Layout |
getLayout()
The tray dialog's default layout is a modified version of the default
Window layout that can accomodate a tray, however it still
conforms to the description of the Window default layout. |
DialogTray |
getTray()
Returns the tray currently shown in the dialog, or
null
if there is no tray. |
protected void |
handleShellCloseEvent()
Notifies that the window's close button was pressed, the close menu was
selected, or the ESCAPE key pressed.
|
static boolean |
isDialogHelpAvailable()
Tests if dialogs that have help control should show it
all the time or only when explicitly requested for
each dialog instance.
|
boolean |
isHelpAvailable()
Returns whether or not context help is available for this dialog.
|
void |
openTray(DialogTray tray)
Constructs the tray's widgets and displays the tray in this dialog.
|
static void |
setDialogHelpAvailable(boolean helpAvailable)
Sets whether JFace dialogs that support help control should
show the control by default.
|
void |
setHelpAvailable(boolean helpAvailable)
Sets whether or not context help is available for this dialog.
|
applyDialogFont, buttonPressed, cancelPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonsForButtonBar, createContents, createDialogArea, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, isResizable, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
canHandleShellCloseEvent, configureShell, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
protected TrayDialog(Shell shell)
shell
- the parent shell, or null
to create a top-level shellprotected TrayDialog(IShellProvider parentShell)
parentShell
- the object that returns the current parent shellpublic void closeTray() throws IllegalStateException
IllegalStateException
- if the tray was not openprotected void handleShellCloseEvent()
Window
The default implementation of this framework method sets the window's
return code to CANCEL
and closes the window using
close
. Subclasses may extend or reimplement.
handleShellCloseEvent
in class Window
protected Control createButtonBar(Composite parent)
Dialog
The Dialog
implementation of this framework method lays
out a button bar and calls the createButtonsForButtonBar
framework method to populate it. Subclasses may override.
The returned control's layout data must be an instance of
GridData
.
createButtonBar
in class Dialog
parent
- the parent composite to contain the button barprotected Control createHelpControl(Composite parent)
The TrayDialog
implementation of this method creates
the control, registers it for selection events including selection,
Note that the parent's layout is assumed to be a GridLayout
and the number of columns in this layout is incremented. Subclasses may
override.
parent
- the parent compositepublic boolean isHelpAvailable()
protected Layout getLayout()
Window
layout that can accomodate a tray, however it still
conforms to the description of the Window
default layout.
Note: Trays may not be supported with all custom layouts on the dialog's
Shell. To avoid problems, use a single outer Composite
for
your dialog area, and set your custom layout on that Composite
.
getLayout
in class Window
null
for no layoutWindow.getLayout()
public DialogTray getTray()
null
if there is no tray.null
if there is nonepublic void openTray(DialogTray tray) throws IllegalStateException, UnsupportedOperationException
tray
- the tray to show in this dialogIllegalStateException
- if the dialog already has a tray openUnsupportedOperationException
- if the dialog does not support trays,
for example if it uses a custom layout.public void setHelpAvailable(boolean helpAvailable)
helpAvailable
- whether or not context help is available for the dialogpublic static boolean isDialogHelpAvailable()
true
if dialogs that support help
control should show it by default, false
otherwise.public static void setDialogHelpAvailable(boolean helpAvailable)
false
,
help control can still be shown on a per-dialog basis.helpAvailable
- true
to show the help
control, false
otherwise.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.