Eclipse Platform
Release 3.2

org.eclipse.ui.dialogs
Class SelectionDialog

java.lang.Object
  extended byorg.eclipse.jface.window.Window
      extended byorg.eclipse.jface.dialogs.Dialog
          extended byorg.eclipse.jface.dialogs.TrayDialog
              extended byorg.eclipse.ui.dialogs.SelectionDialog
All Implemented Interfaces:
IShellProvider
Direct Known Subclasses:
ContainerSelectionDialog, FileSelectionDialog, ListDialog, ListSelectionDialog, MarkerResolutionSelectionDialog, PathVariableSelectionDialog, ProjectLocationMoveDialog, ResourceListSelectionDialog, ResourceSelectionDialog, SelectionStatusDialog, TypeFilteringDialog

public abstract class SelectionDialog
extends TrayDialog

The abstract implementation of a selection dialog. It can be primed with initial selections (setInitialSelections), and returns the final selection (via getResult) after completion.

Clients may subclass this dialog to inherit its selection facilities.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
 
Field Summary
 
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
 
Constructor Summary
protected SelectionDialog(Shell parentShell)
          Creates a dialog instance.
 
Method Summary
protected  void configureShell(Shell shell)
          Configures the given shell in preparation for opening this window in it.
protected  void createButtonsForButtonBar(Composite parent)
          Adds buttons to this dialog's button bar.
protected  Label createMessageArea(Composite composite)
          Creates the message area for this dialog.
protected  IDialogSettings getDialogBoundsSettings()
          Gets the dialog settings that should be used for remembering the bounds of the dialog, according to the dialog bounds strategy.
protected  int getDialogBoundsStrategy()
          Get the integer constant that describes the strategy for persisting the dialog bounds.
protected  List getInitialElementSelections()
          Returns the list of initial element selections.
protected  List getInitialSelections()
          Deprecated. use getInitialElementSelections() instead
protected  String getMessage()
          Returns the message for this dialog.
 Button getOkButton()
          Returns the ok button.
 Object[] getResult()
          Returns the list of selections made by the user, or null if the selection was canceled.
 void setDialogBoundsSettings(IDialogSettings settings, int strategy)
          Set the dialog settings that should be used to save the bounds of this dialog.
 void setInitialElementSelections(List selectedElements)
          Sets the initial selection in this selection dialog to the given elements.
 void setInitialSelections(Object[] selectedElements)
          Sets the initial selection in this selection dialog to the given elements.
 void setMessage(String message)
          Sets the message for this dialog.
protected  void setResult(List newResult)
          Set the selections made by the user, or null if the selection was canceled.
protected  void setSelectionResult(Object[] newResult)
          Set the selections made by the user, or null if the selection was canceled.
 void setTitle(String title)
          Sets the title for this dialog.
 
Methods inherited from class org.eclipse.jface.dialogs.TrayDialog
close, closeTray, createButtonBar, createHelpControl, getLayout, getTray, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createContents, createDialogArea, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionDialog

protected SelectionDialog(Shell parentShell)
Creates a dialog instance. Note that the dialog will have no visual representation (no widgets) until it is told to open.

Parameters:
parentShell - the parent shell
Method Detail

configureShell

protected void configureShell(Shell shell)
Description copied from class: Window
Configures the given shell in preparation for opening this window in it.

The default implementation of this framework method sets the shell's image and gives it a grid layout. Subclasses may extend or reimplement.

Overrides:
configureShell in class Window
Parameters:
shell - the shell

createButtonsForButtonBar

protected void createButtonsForButtonBar(Composite parent)
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 the createButton framework method. These standard buttons will be accessible from getCancelButton, and getOKButton. Subclasses may override.

Overrides:
createButtonsForButtonBar in class Dialog
Parameters:
parent - the button bar composite

createMessageArea

protected Label createMessageArea(Composite composite)
Creates the message area for this dialog.

This method is provided to allow subclasses to decide where the message will appear on the screen.

Parameters:
composite - the parent composite
Returns:
the message label

getInitialSelections

protected List getInitialSelections()
Deprecated. use getInitialElementSelections() instead

Returns the initial selection in this selection dialog.

Returns:
the list of initial selected elements or null

getInitialElementSelections

protected List getInitialElementSelections()
Returns the list of initial element selections.

Returns:
List

getMessage

protected String getMessage()
Returns the message for this dialog.

Returns:
the message for this dialog

getOkButton

public Button getOkButton()
Returns the ok button.

Returns:
the ok button or null if the button is not created yet.

getResult

public Object[] getResult()
Returns the list of selections made by the user, or null if the selection was canceled.

Returns:
the array of selected elements, or null if Cancel was pressed

setInitialSelections

public void setInitialSelections(Object[] selectedElements)
Sets the initial selection in this selection dialog to the given elements.

Parameters:
selectedElements - the array of elements to select

setInitialElementSelections

public void setInitialElementSelections(List selectedElements)
Sets the initial selection in this selection dialog to the given elements.

Parameters:
selectedElements - the List of elements to select

setMessage

public void setMessage(String message)
Sets the message for this dialog.

Parameters:
message - the message

setResult

protected void setResult(List newResult)
Set the selections made by the user, or null if the selection was canceled.

Parameters:
newResult - list of selected elements, or null if Cancel was pressed

setSelectionResult

protected void setSelectionResult(Object[] newResult)
Set the selections made by the user, or null if the selection was canceled.

The selections may accessed using getResult.

Parameters:
newResult - - the new values
Since:
2.0

setTitle

public void setTitle(String title)
Sets the title for this dialog.

Parameters:
title - the title

setDialogBoundsSettings

public void setDialogBoundsSettings(IDialogSettings settings,
                                    int strategy)
Set the dialog settings that should be used to save the bounds of this dialog. This method is provided so that clients that directly use SelectionDialogs without subclassing them may specify how the bounds of the dialog are to be saved.

Parameters:
settings - the IDialogSettings that should be used to store the bounds of the dialog
strategy - the integer constant specifying how the bounds are saved. Specified using Dialog.DIALOG_PERSISTLOCATION and Dialog.DIALOG_PERSISTSIZE.
Since:
3.2
See Also:
Dialog.getDialogBoundsStrategy(), Dialog.getDialogBoundsSettings()

getDialogBoundsSettings

protected IDialogSettings getDialogBoundsSettings()
Gets the dialog settings that should be used for remembering the bounds of the dialog, according to the dialog bounds strategy. Overridden to provide the dialog settings that were set using setDialogBoundsSettings(IDialogSettings, int).

Overrides:
getDialogBoundsSettings in class Dialog
Returns:
the dialog settings used to store the dialog's location and/or size, or null if the dialog's bounds should not be stored.
Since:
3.2
See Also:
Dialog.getDialogBoundsStrategy(), setDialogBoundsSettings(IDialogSettings, int)

getDialogBoundsStrategy

protected int getDialogBoundsStrategy()
Get the integer constant that describes the strategy for persisting the dialog bounds. Overridden to provide the dialog bounds strategy that was set using setDialogBoundsSettings(IDialogSettings, int).

Overrides:
getDialogBoundsStrategy in class Dialog
Returns:
the constant describing the strategy for persisting the dialog bounds.
Since:
3.2
See Also:
Dialog.DIALOG_PERSISTLOCATION, Dialog.DIALOG_PERSISTSIZE, Dialog.getDialogBoundsSettings(), setDialogBoundsSettings(IDialogSettings, int)

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.