return bindingService.getBestActiveBindingFormattedFor(getActionDefinitionId());
}
private Point computeMenuLocation(Control focus, Menu menu) {
Point cursorLocation= focus.getDisplay().getCursorLocation();
Rectangle clientArea= null;
Point result= null;
if (focus instanceof StyledText) {
StyledText styledText= (StyledText)focus;
clientArea= styledText.getClientArea();
result= computeMenuLocation(styledText);
} else if (focus instanceof Tree) {
Tree tree= (Tree)focus;
clientArea= tree.getClientArea();
result= computeMenuLocation(tree);
} else if (focus instanceof Table) {
Table table= (Table)focus;
clientArea= table.getClientArea();
result= computeMenuLocation(table);
}
if (result == null) {
result= focus.toControl(cursorLocation);
}
if (clientArea != null && !clientArea.contains(result)) {
result= new Point(
clientArea.x + clientArea.width / 2,
clientArea.y + clientArea.height / 2);
}
Rectangle shellArea= focus.getShell().getClientArea();
if (!shellArea.contains(focus.getShell().toControl(focus.toDisplay(result)))) {
result= new Point(
shellArea.x + shellArea.width / 2,
shellArea.y + shellArea.height / 2);
}
return focus.toDisplay(result);