org.eclipse.debug.ui.contexts

## Interface IDebugContextProvider

All Known Subinterfaces:
  IDebugContextProvider2

All Known Implementing Classes:
  AbstractDebugContextProvider

    public interface IDebugContextProvider

Interface common to all objects that provide a debug context. A context provider is registered with a debug context service associated with a specific window.

A context provider can provide context information for a specific workbench part. There can only be one context provider registered per part with a context service. When there is more than one context provider per window, the context provider associated with the most recently active part provides the context for that window.

A context provider does not have to be associated with a part. In this case the provider specifies `null` for its part, and provides context information for the window. There can only be one context provider without an associated part registered per context service (i.e. per window). A context provider that provides context without an associated part is only active (i.e. used to provide context information) when there are no other context providers with associated parts registered with that service.

Clients may implement this interface.

Since:
  3.3
See Also:
  `IDebugContextManager`, `IDebugContextService`, `IDebugContextListener`

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `addDebugContextListener(IDebugContextListener listener)` Registers the given listener for debug context events.
`ISelection` `getActiveContext()` Returns the currently active context, possibly empty or `null`.
`IWorkbenchPart` `getPart()` Returns the part associated with this context provider or `null` if none.
`void` `removeDebugContextListener(IDebugContextListener listener)` Unregisters the given listener for debug context events.

### Method Detail

#### getPart

    IWorkbenchPart getPart()

Returns the part associated with this context provider or `null` if none.

Returns:
  part associated with this context provider or `null`

#### addDebugContextListener

    void addDebugContextListener(IDebugContextListener listener)

Registers the given listener for debug context events.

Parameters:
  `listener` - event listener

#### removeDebugContextListener

    void removeDebugContextListener(IDebugContextListener listener)

Unregisters the given listener for debug context events.

Parameters:
  `listener` - event listener

#### getActiveContext

    ISelection getActiveContext()

Returns the currently active context, possibly empty or `null`.

Returns:
  active context, possibly empty or `null`.