I'm looking to create a toolbar with a drop-down menu largely identical to Eclipse's "Open Console" button in the console view.
I can do this by programmatically adding actions (which is what the Console View does), however I'm looking to do this via commands & handlers in plugin.xml.
The instructions at https://wiki.eclipse.org/Menu_Contributions/Dropdown_Command are extremely good, however I'm looking to show the drop-down menu when the button itself is clicked (I.E.: clicking the button behaves the same as clicking the drop-down menu triangle to the right of the button). Again: identical to how the "Open Console" button works.
However I've no clue how to do this in "plugin.xml land". I've tried the following in the handler:
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Event e = (Event) event.getTrigger();
ToolBar t = ((ToolItem) e.widget).getParent();
Menu m = t.getMenu();
m.setVisible(true);
[...]
... however t.getMenu()
returns a null ...