In my E4 Application I have a Toolbar with ToolbarItems, on click on one of them I want to display a small dialog directly under the Toolbaritem. To achieve that I need the coordinates of the button.
Is there a way to pass it via paramters to the @Execute annotated method in my handler?
I solved it via injection of MPart into my Handler and a call of getToolbar. But it looks very dirty.
You can inject the MToolItem
to get the item rather than injecting the MPart
.
@Execute
public void execute(MToolItem mitem)
{
ToolItem item = (ToolItem)mitem.getWidget();
...
}
But you can associate a menu with a tool item by checking the "Menu" check box in the 'Handled Tool Item' entry in the e4xmi file. You will then be able to define menu items as children of the tool item.