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.