View Implementation Example

The DataSourceExplorerView (in org.eclipse.datatools.connectivity.ui.dse) first implements the interface, and then it creates an instance of the

    private ContextProviderDelegate contextProviderDelegate = new

The symbolic name is usually the plug-in ID. Providing the symbolic name as shown above will avoid broken code, if the plug-in’s ID changes.

The plug-in ID passed to the ContextProviderDelegate must indicate which plug-in the help context is actually associated with. In the example above, the help context is associated with the DSEPlugin, that is, the plug-in that contributes the DataSourceExplorerView UI component. However, the help context could be associated with a separate plug-in, for example, if the plug-in “owner” of the UI component is not the same as the plug-in that contributes the UI component.

Implementation of the IContextProvider methods looks like this:

    public IContext getContext(Object target) {
        return contextProviderDelegate.getContext(target);

    public int getContextChangeMask() {
        return contextProviderDelegate.getContextChangeMask();

    public String getSearchExpression(Object target) {
        return contextProviderDelegate.getSearchExpression(target);

After implementing the IContextProvider methods, the view must set the help context for the control in the createPartControl method:

    public void createPartControl(Composite parent) {

The string passed to the setHelp method is actually an abstract helpKey constant, whose property key is mapped to a concrete help context ID string by the ContextProviderDelegate.

All helpKey constant strings must be declared in an interface class.