Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.ui.util.selector
Class AbstractViewerSelectionDialog<T,V extends org.eclipse.jface.viewers.StructuredViewer>

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by eu.esdihumboldt.hale.ui.util.selector.AbstractViewerSelectionDialog<T,V>
Type Parameters:
T - the type of object that can be selected in the dialog
V - the type of the viewer
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
Direct Known Subclasses:
DataSetTypeSelectionDialog, EntityDialog, PropertyDefinitionDialog, SchemaPresetSelectionDialog, TypeDefinitionDialog

public abstract class AbstractViewerSelectionDialog<T,V extends org.eclipse.jface.viewers.StructuredViewer>
extends org.eclipse.jface.dialogs.Dialog

Abstract selection dialog based on a structured viewer.

Author:
Simon Templer
Partner:
01 / Fraunhofer Institute for Computer Graphics Research

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.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
AbstractViewerSelectionDialog(org.eclipse.swt.widgets.Shell parentShell, String title, T initialSelection)
          Constructor.
 
Method Summary
static boolean acceptObject(org.eclipse.jface.viewers.Viewer viewer, org.eclipse.jface.viewers.ViewerFilter[] filters, Object candidate)
          Determines if the given object matches the given filters.
protected  void buttonPressed(int buttonId)
           
protected  void cancelPressed()
           
protected  void configureShell(org.eclipse.swt.widgets.Shell newShell)
           
protected  void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent)
           
protected  org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
           
protected  org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
           
protected abstract  V createViewer(org.eclipse.swt.widgets.Composite parent)
          Create the tree viewer.
 org.eclipse.jface.viewers.ViewerFilter[] getFilters()
           
 T getObject()
          Get the selected object.
protected abstract  T getObjectFromSelection(org.eclipse.jface.viewers.ISelection selection)
          Retrieve the selected entity from the given selection
protected  void okPressed()
           
 void setFilters(org.eclipse.jface.viewers.ViewerFilter[] filters)
          Set the viewer filters
protected abstract  void setupViewer(V viewer, T initialSelection)
          Setup the tree viewer with label provider, content provider and input.
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractViewerSelectionDialog

public AbstractViewerSelectionDialog(org.eclipse.swt.widgets.Shell parentShell,
                                     String title,
                                     T initialSelection)
Constructor.

Parameters:
parentShell - the parent shell
title - the dialog title
initialSelection - the entity definition to select initially (if possible), may be null
Method Detail

createContents

protected org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
Overrides:
createContents in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.createContents(Composite)

configureShell

protected void configureShell(org.eclipse.swt.widgets.Shell newShell)
Overrides:
configureShell in class org.eclipse.jface.window.Window
See Also:
Window.configureShell(Shell)

createDialogArea

protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
Overrides:
createDialogArea in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.createDialogArea(Composite)

createViewer

protected abstract V createViewer(org.eclipse.swt.widgets.Composite parent)
Create the tree viewer.

Parameters:
parent - the parent composite
Returns:
the tree viewer

createButtonsForButtonBar

protected void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent)
Overrides:
createButtonsForButtonBar in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.createButtonsForButtonBar(Composite)

buttonPressed

protected void buttonPressed(int buttonId)
Overrides:
buttonPressed in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.buttonPressed(int)

acceptObject

public static boolean acceptObject(org.eclipse.jface.viewers.Viewer viewer,
                                   org.eclipse.jface.viewers.ViewerFilter[] filters,
                                   Object candidate)
Determines if the given object matches the given filters.

Parameters:
viewer - the viewer
filters - the viewer filters
candidate - the object to test
Returns:
if the object is accepted by all filters

setupViewer

protected abstract void setupViewer(V viewer,
                                    T initialSelection)
Setup the tree viewer with label provider, content provider and input. Don't set any viewer filters as they will be overridden by those provided through setFilters(ViewerFilter[]).

Parameters:
viewer - the tree viewer
initialSelection - the object to select (if possible), may be null

okPressed

protected void okPressed()
Overrides:
okPressed in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.okPressed()

getObjectFromSelection

protected abstract T getObjectFromSelection(org.eclipse.jface.viewers.ISelection selection)
Retrieve the selected entity from the given selection

Parameters:
selection - the selection
Returns:
the selected entity or null

cancelPressed

protected void cancelPressed()
Overrides:
cancelPressed in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.cancelPressed()

getObject

public T getObject()
Get the selected object.

Returns:
the object or null

setFilters

public void setFilters(org.eclipse.jface.viewers.ViewerFilter[] filters)
Set the viewer filters

Parameters:
filters - the filters

getFilters

public org.eclipse.jface.viewers.ViewerFilter[] getFilters()
Returns:
the filters

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d