Runtime

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

    java.lang.Object
      org.eclipse.gmf.runtime.common.core.service.AbstractProvider
          org.eclipse.gmf.runtime.common.ui.services.elementselection.AbstractElementSelectionProvider

All Implemented Interfaces:
  IProvider, IElementSelectionProvider

    public abstract class AbstractElementSelectionProvider

extends AbstractProvider
implements IElementSelectionProvider

Abstract implementation of an element selection provider.

Constructor Summary
`AbstractElementSelectionProvider()`

Method Summary
`protected ElementSelectionServiceJob` `createSelectionJob()` Creates the selection service job that runs the provider's search.
`protected void` `fireEndOfMatchesEvent()` Fire an end of matches event since there are no more matches.
`protected void` `fireMatchingObjectEvent(IMatchingObject matchingObject)` Fire a matching object event.
`protected void` `fireMatchingObjectEvent(IMatchingObjectEvent matchingObjectEvent)` Send the matching object event to the listener.
`protected IElementSelectionInput` `getElementSelectionInput()` Retrieve the element selection input.
`protected IElementSelectionListener` `getElementSelectionListener()` Retrieve the element selection listener.
`protected java.lang.String` `getJobName()` Get the name for the ElementSelectionServiceJob.
`ElementSelectionServiceJob` `getMatchingObjects(IElementSelectionInput input, IElementSelectionListener listener)` Retrieve a list of matching objects from the provider.
`boolean` `provides(IOperation operation)` Indicates whether this provider provides the specified operation.
`java.lang.Object` `resolve(IMatchingObject object)` Resolve the matching object to a modeling object.
`void` `run(IProgressMonitor monitor)` Retrieve the list of matching objects from the provider.

Methods inherited from class org.eclipse.gmf.runtime.common.core.service.AbstractProvider
`addProviderChangeListener, fireProviderChange, removeProviderChangeListener`

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

Methods inherited from interface org.eclipse.gmf.runtime.common.core.service.IProvider
`addProviderChangeListener, removeProviderChangeListener`

Constructor Detail

### AbstractElementSelectionProvider

    public AbstractElementSelectionProvider()

Method Detail

### provides

    public boolean provides(IOperation operation)

  Indicates whether this provider provides the specified operation.

  Providers generally cast the operation to a service specific `IOperation`-derived class in order to determine whether they support the request.

  Specified by:
    `provides` in interface `IProvider`
  Parameters:
    `operation` - The operation in question.
  Returns:
    `true` if this provider provides the operation; `false` otherwise.

### getMatchingObjects

    public ElementSelectionServiceJob getMatchingObjects(IElementSelectionInput input,
                                                         IElementSelectionListener listener)

  Retrieve a list of matching objects from the provider.

  The provider is given an IElementSelectionInput and IElementSelectionListener and creates a ElementSelectionServiceJob.

  The provider returns IMatchingObjectEvent to the IElementSelectionListener. If there are ten matching objects, then eleven IMatchingObjectEvent will be sent to the listener. The first ten will have type MatchingObjectEventType.MATCH and will have a matching object. The eleventh event will have type MatchingObjectEventType.END_OF_MATCHES.

  Specified by:
    `getMatchingObjects` in interface `IElementSelectionProvider`
  Parameters:
    `input` - the element selection input.
    `listener` - the provider will send matching object events to this listener.
  Returns:
    the job that is running this provider.

### createSelectionJob

    protected ElementSelectionServiceJob createSelectionJob()

  Creates the selection service job that runs the provider's search. This method should configure the new job with the appropriate priority, scheduling rules, etc. but should not schedule it.

  Returns:
    a new selection provider job

### resolve

    public java.lang.Object resolve(IMatchingObject object)

  Resolve the matching object to a modeling object.

  Specified by:
    `resolve` in interface `IElementSelectionProvider`
  Parameters:
    `object` - the matching object.
  Returns:
    a modeling object.

### run

    public void run(IProgressMonitor monitor)

  Retrieve the list of matching objects from the provider.

  The ElementSelectionServiceJob will invoke run. Clients must not call this method.

  Specified by:
    `run` in interface `IElementSelectionProvider`
  Parameters:
    `monitor` - a progress monitor in which the provider is running.

### getJobName

    protected java.lang.String getJobName()

  Get the name for the ElementSelectionServiceJob. Clients can override.

  Returns:
    the name for the job.

### fireEndOfMatchesEvent

    protected void fireEndOfMatchesEvent()

  Fire an end of matches event since there are no more matches.

### fireMatchingObjectEvent

    protected void fireMatchingObjectEvent(IMatchingObject matchingObject)

  Fire a matching object event.

  Parameters:
    `matchingObject` - the matching object.

### fireMatchingObjectEvent

    protected void fireMatchingObjectEvent(IMatchingObjectEvent matchingObjectEvent)

  Send the matching object event to the listener.

  Parameters:
    `matchingObjectEvent` - the matching object event.

### getElementSelectionInput

    protected IElementSelectionInput getElementSelectionInput()

  Retrieve the element selection input.

  Returns:
    the element selection input.

### getElementSelectionListener

    protected IElementSelectionListener getElementSelectionListener()

  Retrieve the element selection listener.

  Returns:
    the element selection listener.

Runtime

Guidelines for using Eclipse APIs.

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