The pop-up menu can be created in an almost identical way to the view menu. As before, it needs to be registered with the menu service but the code can be dramatically simplified by representing it in the fragment.e4xmi
file.
Go to the
fragment.e4xmi
file, and go to the Menus element beneath the Sample View part descriptor. Add a child Popup Menu to the Menus element, either with the context-sensitive menu and by choosing Add child | Popup Menu, or by selecting Popup Menu from the dropdown and clicking on the Add button.In the newly created Popup Menu, set the ID to
com.packtpub.e4.migration.views.SampleView.popup
.Select Handled Menu Item from the dropdown and click on Add.
Add the
Action 1
similar to before by setting these:Label:
Action 1
Tooltip:
Action 1 tooltip
Icon URI:
platform:/plugin/org.eclipse.ui/icons/full/obj16/info_tsk.png
or use the Find … button as beforeEnsure that the Enabled checkbox is selected
Click on the Find...