Runtime

## org.eclipse.gmf.runtime.common.ui.services.elementselection
Class ElementSelectionComposite

    java.lang.Object
      org.eclipse.gmf.runtime.common.ui.services.elementselection.ElementSelectionComposite

All Implemented Interfaces:
  IElementSelectionListener

    public abstract class ElementSelectionComposite

extends java.lang.Object
implements IElementSelectionListener

The element selection composite. The composite functional similar to the JDT select type dialog. There is a filter field and a table containing a list of elements to select from.

The element selection composite requires an IElementSelectionInput as input for the element selection service.

Subclasses must override the `isValidSelection(java.util.List)`and `handleSelection(boolean)` to provide custom validation.

Constructor Summary
`ElementSelectionComposite(java.lang.String title, AbstractElementSelectionInput input)` Constructs a new instance that will create the new composite.
`ElementSelectionComposite(java.lang.String title, AbstractElementSelectionInput input, ElementSelectionService elementSelectionService)` Constructs a new instance that will create the new composite.

Method Summary
`void` `cancel()` Cancel the job running the element selection service.
`Composite` `createComposite(Composite parent)` Creates the composite.
`protected void` `createCompositeAdditions(Composite parent)` The method is provided so that clients can add additional fields to the bottom of the selection composite.
`Text` `getFilterText()` Retreive the filter text field.
`java.util.List` `getSelectedElements()` Gets the user selected elements.
`ElementSelectionServiceJob` `getSelectionServiceJob()` Retreive the element selection service job.
`void` `handleFilterChange()` Handles a filter change.
`protected abstract void` `handleSelection(boolean isValid)` Handle a selection change, where the validity of the new selection is encoded in `isValid`.
`protected void` `handleWidgetDefaultSelected()` Handle the double click of a selection in the table viewer.
`protected abstract boolean` `isValidSelection(java.util.List currentSelectedElements)` Determines if the selected elements are a valid selection.
`void` `matchingObjectEvent(IMatchingObjectEvent matchingObjectEvent)` A matching object event has been sent.
`protected void` `setSelection()` If there is no selection in the composite, set the selection to the provided MatchingObject.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ElementSelectionComposite

    public ElementSelectionComposite(java.lang.String title,
                                     AbstractElementSelectionInput input)

  Constructs a new instance that will create the new composite. I will use the default selection service to process the `input`.

  Parameters:
    `title` - the dialog title
    `input` - the element selection input.

### ElementSelectionComposite

    public ElementSelectionComposite(java.lang.String title,
                                     AbstractElementSelectionInput input,
                                     ElementSelectionService elementSelectionService)

  Constructs a new instance that will create the new composite.

  Parameters:
    `title` - the dialog title
    `input` - the element selection input
    `elementSelectionService` - the selection service to use to process the `input`

Method Detail

### isValidSelection

    protected abstract boolean isValidSelection(java.util.List currentSelectedElements)

  Determines if the selected elements are a valid selection.

  Parameters:
    `currentSelectedElements` - the selected list of Elements
  Returns:
    `true` if the selected elements are a valid selection

### handleSelection

    protected abstract void handleSelection(boolean isValid)

  Handle a selection change, where the validity of the new selection is encoded in `isValid`.

  Parameters:
    `isValid` - `true` if the new selection is valid, `false` otherwise.

### createComposite

    public Composite createComposite(Composite parent)

  Creates the composite.

  Parameters:
    `parent` - the parent composite
  Returns:
    the new composite

### createCompositeAdditions

    protected void createCompositeAdditions(Composite parent)

  The method is provided so that clients can add additional fields to the bottom of the selection composite. For example, clients may want to a checkbox button to the bottom of the composite.

  Parameters:
    `parent` - the parent composite

### handleFilterChange

    public void handleFilterChange()

  Handles a filter change.

### getSelectedElements

    public java.util.List getSelectedElements()

  Gets the user selected elements.

  Returns:
    the user selected elements

### matchingObjectEvent

    public void matchingObjectEvent(IMatchingObjectEvent matchingObjectEvent)

  Description copied from interface: `IElementSelectionListener`
  A matching object event has been sent.

  Specified by:
    `matchingObjectEvent` in interface `IElementSelectionListener`

### cancel

    public void cancel()

  Cancel the job running the element selection service.

### setSelection

    protected void setSelection()

  If there is no selection in the composite, set the selection to the provided MatchingObject.

  Parameters:
    `matchingObject` - the MatchingObject to select.

### getFilterText

    public Text getFilterText()

  Retreive the filter text field.

  Returns:
    the filter text field.

### getSelectionServiceJob

    public ElementSelectionServiceJob getSelectionServiceJob()

  Retreive the element selection service job.

  Returns:
    the element selection service job.

### handleWidgetDefaultSelected

    protected void handleWidgetDefaultSelected()

  Handle the double click of a selection in the table viewer.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.