Package org.eclipse.help

## Interface IContextProvider

    public interface IContextProvider

Dynamic context provider. Classes that implement this interface should be returned from adaptable objects when `IContextProvider.class` is used as the adapter key. Adaptable objects must implement `org.eclipse.core.runtime.IAdaptable` interface.

Dynamic context providers should be used for providing focused dynamic help that changes depending on the various platform states. State change criteria is defined by bitwise-OR of the individual state change triggers. Each time a registered trigger occurs, the class that implements this interface will be called again to provide the help context for the given target.

Context provider should be used for all visual artifacts that provide context help that handle context help trigger by handling the SWT help event instead of tagging the artifact with a static context Id.

In addition to providing static help context, this interface can also be used to control the query string that is passed to the help search system on context switches. If not provided, the query string is computed based on the current context. Providing the string explicitly gives the context owners better control over the search outcome.

Since:
  3.1
See Also:
  `IContext`, `IAdaptable`

### Field Summary

Fields
`static int` `NONE` State change trigger indicating a static context provider.
`static int` `SELECTION` State change trigger indicating that the provider should be asked for context help on each selection change.

### Method Summary

All Methods Instance Methods Abstract Methods
`IContext` `getContext​(Object target)` Returns a help context for the given target.
`int` `getContextChangeMask()` Returns the mask created by combining supported change triggers using the bitwise OR operation.
`String` `getSearchExpression​(Object target)` Returns a search expression that should be used to find more information about the current target.

### Field Detail

#### NONE

    static final int NONE

State change trigger indicating a static context provider.

See Also:
  Constant Field Values

#### SELECTION

    static final int SELECTION

State change trigger indicating that the provider should be asked for context help on each selection change.

See Also:
  Constant Field Values

### Method Detail

#### getContextChangeMask

    int getContextChangeMask()

Returns the mask created by combining supported change triggers using the bitwise OR operation.

Returns:
  a bitwise-OR combination of state change triggers or `NONE` for a static provider.

#### getContext

    IContext getContext​(Object target)

Returns a help context for the given target. The number of times this method will be called depends on the context change mask. Static context providers will be called each time the owner of the target is activated. If change triggers are used, the method will be called each time the trigger occurs.

Parameters:
  `target` - the focus of the context help
Returns:
  context help for the provided target or `null` if none is defined.

#### getSearchExpression

    String getSearchExpression​(Object target)

Returns a search expression that should be used to find more information about the current target. If provided, it can be used for background search.

Parameters:
  `target` - the focus of the context help
Returns:
  search expression as defined by the help system search, or `null` if background search is not desired.