Adding Help to Dialogs

I’m in the process of updating the help text for my RCP and have found that some of the dialogs that I’m invoking don’t have the ability to directly add help context id’s.

After a bit of digging, I found it’s not that difficult to add help to an object that extends Dialog.

For this example, I’m going to add a help id to the InputDialog class.

[code lang=”java”]
InputDialog dialog = new InputDialog(getShell(), "Title", "Question", value, validator) {

* @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
protected Control createContents(Composite parent) {
Control contents = super.createContents(parent);

IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();

helpSystem.setHelp(contents , "help_id");
return contents;


Basically, we’re creating an anonymous inner class that subclasses InputDialog and overriding the createContents method. In this method we’re invoking the superclass’s createContents method and assigning the help id to the created control.

Related posts ...
In a recent project I had a combo box that I wanted to add additional
Normally, when you view the property pages on Eclipse items, the pages show up in
I had a very frustrating day at work today ... nothing was working right ...
It took a bit of experimentation, but I think this routine could be used to

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.