Dialog Implementation Example

Dialogs must set the help context in the createDialogArea method (to provide context-sensitive help for the dialog itself).

EditDriverDialog (in org.eclipse.datatools.connectivity.internal.ui.dialogs) implements the createDialogArea method like this:

    protected Control createDialogArea(Composite parent) {
        getShell().setData( HelpUtil.CONTEXT_PROVIDER_KEY, this);
        HelpUtil.setHelp( getShell(),
            HelpUtil.getContextId(IHelpConstants.CONTEXT_ID_EDIT_DRIVER_DIALOG,
            ConnectivityUIPlugin.getDefault().getBundle().getSymbolicName()));
       ...
    }
This is similar to the technique in the DataSourceExplorerView, except that EditDriverDialog uses methods of the org.eclipse.datatools.help.HelpUtil class to associate an instance of the context provider delegate with the dialog.

To provide more granular help, at a lower level in the dialog, the dialog could call setHelp, with a unique help context for each control in the dialog.

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.