Time for action – adding the pop-up
A pop-up menu is very similar to creating a toolbar or view menu; however, there are a few extra steps required to hook it up to the viewer and to ensure that the right pop-up menu is connected to the right part. As with the view menu, a tag is required; but instead of being a generic hard-coded value, the pop-up tag requires a tight binding with the pop-up menu.
- Create a method called
createPopupMenu
in theSampleView
class. It will need to take an SWTControl
parameter, which will be the one that is used to trigger the menu. - Ensure that the
createPopupMenu
is called from the end of thecreatePartControl
method, passing in thecontrol
from theviewer
as the argument:createPopupMenu(viewer.getControl());
- First, ...
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.