1

I have a class that extends TrayDialog and that has a help button. I have set the folowing:

setDialogHelpAvailable(true);
setHelpAvailable(true);

And I can't find how I'm supposed to implement the Help button in the lower left corner. I've tried

@Override
protected void buttonPressed(int buttonId) {
    super.buttonPressed(buttonId);
    if(buttonId == IDialogConstants.HELP_ID) {
        System.out.println("Help requested");
    }
}

But it doesn't work. I've seen Can't put content behind SWT Wizard Help Button but I have no performHelp() method because I'm not in a wizard.

What am I missing here? thanks

Community
  • 1
  • 1
user2711115
  • 457
  • 3
  • 18

2 Answers2

1

When the help button is pressed TrayDialog looks for a control with a SWT.Help listener. It starts at the currently focused control and moves up through the control's parents until it finds a control with the listener (or runs out of controls).

You can set up a help listener that is connected to a 'help context' in the Eclipse help system using

PlatformUI.getWorkbench().getHelpSystem().setHelp(control, "context-id");

or you can write your own help listener.

greg-449
  • 109,219
  • 232
  • 102
  • 145
1

I had the same problem and solved it by just adding a HelpListener to one of my controls:

Composite area.addHelpListener(new HelpListener() { 

    @Override public void helpRequested(HelpEvent e) { 
        System.out.println("This is the help info"); 
    }
});

and adding the following to my Constructor:

setDialogHelpAvailable(true);
JNYRanger
  • 6,829
  • 12
  • 53
  • 81
YourReflection
  • 375
  • 7
  • 22