12.8. Creating a Plug-in Menu from Scratch

Problem

You have a plug-in action set, and you want to create a new menu using it.

Solution

To create a new menu, right-click an action set in the Extensions tab, and select New Menu.

Discussion

We’ll continue the example developed in the previous recipe by adding a new menu to the action set created in that recipe. Right-click Action Set 1 in the Extensions tab, and select New Menu. In the Properties view, set the id property of the new menu to Menu1 and the label property to Menu 1, as shown in Figure 12-19, where the new menu appears under Action Set 1.

A new menu

Figure 12-19. A new menu

We’re going to add a menu separator to this menu as a placeholder that will enable us to add other items to the menu later, grouping menu items together. To create a menu separator, right-click the menu, Menu 1, and select New Separator. Set the separator’s name property to Group1, in the Properties view, as shown in Figure 12-20.

A new menu separator

Figure 12-20. A new menu separator

This creates a new menu and adds it to the action set. Now you’ve got to create some menu items and connect an action to them to make something happen. See the next recipe for details.

See Also

Recipe 12.9 on creating actions; Recipe 12.10 on coding plug-in actions; Chapter 11 and Chapter 12 of Eclipse (O’Reilly). ...

Get Eclipse Cookbook 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.