0

As a tooltip can just provide less hints,we decide to add F1(context sensitive) help to the UI components such as a draw2d figure.But facing a problem that: we can't find suitable positions and parameters to invoke the method IWorkbenchHelpSystem.setHelp(Control control, String contextId).

Now we do a workaround like this:

//in UserDefinedEditPart
@Override
protected IFigure createFigure() {
    //set help... (FIXME)   
    PlatformUI.getWorkbench().getHelpSystem().setHelp(Display.getCurrent().getActiveShell(), PublicConstants.CONTEXT_ID);
    return new UserDefinedFigure();
}

As you see,setHelp() method' first parameter should be a SWT or JFace Control,but it was set to be the the current workbench.I think a figure in draw2d is lightweight and has not be associated with anything about SWT or JFace.

Thanks for solution advice.

Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68
Sam Su
  • 6,532
  • 8
  • 39
  • 80

1 Answers1

0

The widgets of SWT and draw2d are quite different from each other. SWT just provides a platform to draw2d, where something "can be drawn". Hence, for SWT, there is no way to differentiate between a draw2d Label, or say a draw2d Connection. All it understands is that something by a "Figure" (which may have any number of figures as it's children) will be painted in some specified area (painted, that's it, no semantics to it).

You may have a look at the org.eclipse.jface.dialogs.PopupDialog class. May be you can make a custom help Dialog (it is not too difficult to extend) with extending this class.

Saurabh
  • 63
  • 8