Time for action – adding the view menu
The next step is to add the view menu, which is the drop-down menu shown by the triangle in the top-right of the original view. Adding this takes the same pattern as before, but the drop-down menu requires an additional tag to be shown as a view menu.
- Add a method
createViewMenu
in theSampleView
class. Add a call to thecreatePartControl
method so that it is called when the view is created. - In the
createViewMenu
method, create an instance ofMMenu
usingMMenuFactory.INSTANCE.createMenu()
. - Add the
menu
to thepart
usingpart.getMenus().add(menu)
. - To configure the
menu
as a view menu, add a tagViewMenu
usingmenu.getTags().add("ViewMenu")
. - As with toolbar items, a menu item can either be handled or direct. A ...
Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.