Time for action – creating the view menu

The view menu is the dropdown shown with a triangular icon, and is currently created in the SampleView class in the createView method. This can be recreated in the fragment editor by adding a view menu to the part descriptor.

  1. Open the fragment.e4xmi file and navigate to the Sample View part descriptor. Under that, there is a Menus element and a dropdown choice box. Select View Menu from the list and click on the Add button to add a View Menu.
  2. In the newly created View Menu, there is a drop-down choice box. Choose Handled Menu Item and click on Add.
  3. Add the following to the Handled Menu Item:
    1. Label: Action 1
    2. Tooltip: Action 1 tooltip
    3. Icon URI: platform:/plugin/org.eclipse.ui/icons/full/obj16/info_tsk.png or use ...

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.