textBox.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event)
{
StyledText s = (StyledText)event.widget;
Menu menu = new Menu (s.getShell(), SWT.POP_UP);
MenuItem item = new MenuItem (menu, SWT.PUSH);
item.setText("Click here");
s.setMenu(menu);
menu.setVisible(true);
event.doit = false;
}
});