Interface MenuBuilder
- All Known Implementing Classes:
BasicMenuBuilder
public interface MenuBuilder
The MenuBuilder is responsible for the construction of some kind of menu UI in response to
contributions it receives.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateContentToolbarItems(Bar toolbar) Fills the toolbar with the installed actions and submenus.Creates aContextMenucontaining the installed actions and submenus.voidfillContextMenu(ContextMenu contextMenu) Fills theContextMenuwith the installed actions and submenus.findSubMenu(String id) Find aMenuBuilderfor an existing sub-menu.Return the (read-only) list of group names already defined.Return the (read-only) list of sub-menu ids already defined.voidinstallAction(Action action) Install the given action into the default menu groupGROUP_DEFAULT.voidinstallAction(String group, Action action) Install the given action into the given menu group.installSubMenu(String group, String id, Action action) Install a sub-menu and return aMenuBuilderfor it.
-
Field Details
-
GROUP_DEFAULT
The name of the default menu group. By convention it is the last group in the menu.- See Also:
-
-
Method Details
-
installAction
Install the given action into the default menu groupGROUP_DEFAULT.- Parameters:
action- theActionto install.
-
installAction
Install the given action into the given menu group. If the group does not exist, it will be created on the fly.- Parameters:
group- the group into which to install itaction- theActionto install- See Also:
-
getGroups
Return the (read-only) list of group names already defined.- Returns:
- a list of Strings.
-
findSubMenu
Find aMenuBuilderfor an existing sub-menu. If the sub-menu does not exist, this will returnnull.- Parameters:
id- the sub-menu's id- Returns:
- the
MenuBuilderornull, if there is no sub-menu with the given id.
-
installSubMenu
Install a sub-menu and return aMenuBuilderfor it. If the sub-menu already exists, this method will throw anIllegalArgumentException.- Parameters:
group- the group into which to install itid- the sub-menu's idaction- the action describing the sub-menu.- Returns:
- a
MenuBuilderfor the sub-menu - Throws:
IllegalArgumentException- if a sub-menu for the given id already exists or any of the parameters isnull.
-
getSubMenuIDs
Return the (read-only) list of sub-menu ids already defined.- Returns:
- a list of Strings.
-
createContentToolbarItems
Fills the toolbar with the installed actions and submenus. Adds separators between different groups.- Parameters:
toolbar- the toolbar which should be filled
-
createContextMenu
ContextMenu createContextMenu()Creates aContextMenucontaining the installed actions and submenus. Adds a separator between different groups.- Returns:
- the created context menu
-