# 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.

- The first call, `getShell().setData()` tells the help system that the dialog will use the help-helper’s delegated setHelp method to provide help contexts.
- The second call, `HelpUtil.setHelp()` is a method that wraps the IWorkbench.setHelp call in a unique listener, so that the help system can find the correct help context for this control (in this case, the shell for 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.

Parent topic: Context-Sensitive Help UI Implementation