Class PopupMenuBuilder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classWrapper class to build up aContributionItembased on a givenIMenuItemProvider. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected final MenuItemStateMapCollection of all registered enablement state checkers for configured id's.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected org.eclipse.jface.action.MenuManagerTheMenuManagerthat is used by this popup menu builder.protected NatTableThe active NatTable instance the context menu should be added to.protected PopupMenuBuilderThe parentPopupMenuBuilderin case this instance is for building a submenu.protected org.eclipse.swt.widgets.MenuTheMenuthat is created with this popup menu builder.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected final MenuItemStateMapCollection of all registered visibility state checkers for configured id's. -
Constructor Summary
ConstructorsConstructorDescriptionPopupMenuBuilder(org.eclipse.jface.action.MenuManager manager) PopupMenuBuilder(NatTable parent) CreatesPopupMenuBuilderthat builds up a newMenuthat is only configurable with this instance ofPopupMenuBuilder.PopupMenuBuilder(NatTable parent, org.eclipse.jface.action.MenuManager manager) PopupMenuBuilder(NatTable natTable, PopupMenuBuilder parent, org.eclipse.jface.action.MenuManager menuManager) Constructor to create a submenu.PopupMenuBuilder(NatTable natTable, PopupMenuBuilder parent, org.eclipse.swt.widgets.Menu menu) Constructor to create a submenu.PopupMenuBuilder(NatTable natTable, org.eclipse.swt.widgets.Menu menu) Creates a popup menu builder based on the given menu. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.swt.widgets.Menubuild()Builds and returns the createdMenu.org.eclipse.swt.widgets.Menubuild(boolean diposeMenuManager) Builds and returns the createdMenu.org.eclipse.jface.action.MenuManagerSets the given NatTable to this builder and returns theMenuManagerthat is used to create the context menu.Build the submenu and return the parentPopupMenuBuilderto implement the builder pattern.protected NatEventDataprotected booleanprotected booleanAdds the menu item for auto resizing selected columns to the popup menu.withAutoResizeSelectedColumnsMenuItem(String menuLabel) Adds the menu item for auto resizing selected columns to the popup menu.withAutoResizeSelectedRowsMenuItem(String menuLabel) withCategoriesBasedColumnChooser(String menuLabel) withClearAllFilters(String menuLabel) withColumnChooserMenuItem(String menuLabel) withColumnRenameDialog(String menuLabel) withColumnStyleEditor(String menuLabel) withContributionItem(org.eclipse.jface.action.ContributionItem contributionItem) Adds the menu item(s) provided by the givenContributionItemto the popup menu.Adds the menu item for creating a column group with the new performance ColumnGroupHeaderLayer.withCreateColumnGroupMenuItem(String menuLabel) Adds the menu item for creating a column group with the new performance ColumnGroupHeaderLayer.withCreateColumnGroupsMenuItem(String menuLabel) Adds the menu item for creating a row group with the new performance RowGroupHeaderLayer.withCreateRowGroupMenuItem(String menuLabel) Adds the menu item for creating a row group with the new performance RowGroupHeaderLayer.withEnabledState(String id, IMenuItemState state) Associate a enabledIMenuItemStatewith the menu item identified by the given id.Add the menu item for exporting to image to the popup menu.withExportToImageMenuItem(String menuLabel) Add the menu item for exporting to image to the popup menu.Adds the menu item for for freezing a grid at a given column position.withFreezeColumnMenuItem(String menuLabel) Adds the menu item for for freezing a grid at a given column position.withFreezePositionMenuItem(boolean include) Adds the menu item for freezing a grid at a given cell position.withFreezePositionMenuItem(String menuLabel, boolean include) Adds the menu item for freezing a grid at a given cell position.Adds the menu item for for freezing a grid at a given row position.withFreezeRowMenuItem(String menuLabel) Adds the menu item for for freezing a grid at a given row position.Adds the menu item for hiding a column to the popup menu.withHideColumnMenuItem(String menuLabel) Adds the menu item for hiding a column to the popup menu.Adds the menu item for hiding a row to the popup menu by using theRowHideCommand.withHideRowMenuItem(String menuLabel) Adds the menu item for hiding a row to the popup menu by using theRowHideCommand.Adds the menu item for hiding a row to the popup menu by using theRowPositionHideCommand.withHideRowPositionMenuItem(String menuLabel) Adds the menu item for hiding a row to the popup menu by using theRowPositionHideCommand.withMenuItemProvider(String id, IMenuItemProvider menuItemProvider) Adds the menu item provided by the givenIMenuItemProviderto the popup menu.withMenuItemProvider(IMenuItemProvider menuItemProvider) Adds the menu item provided by the givenIMenuItemProviderto the popup menu.withRemoveColumnGroupMenuItem(String menuLabel) Adds the menu item for removing a row group.withRemoveRowGroupMenuItem(String menuLabel) Adds the menu item for removing a row group.withRenameColumnGroupMenuItem(String menuLabel) Adds the menu item for renaming a row group.withRenameRowGroupMenuItem(String menuLabel) Adds the menu item for renaming a row group.Adds a separator to the popup menu.withSeparator(String id) Adds a separator to the popup menu with the given id.Adds the menu item for showing all columns to the popup menu.withShowAllColumnsMenuItem(String menuLabel) Adds the menu item for showing all columns to the popup menu.Adds the menu item for showing all rows to the popup menu.withShowAllRowsMenuItem(String menuLabel) Adds the menu item for showing all rows to the popup menu.Adds the menu item for opening the view management dialog to the popup menu.withStateManagerMenuItemProvider(String menuLabel) Adds the menu item for opening the view management dialog to the popup menu.withSubMenu(String label) Adds a submenu to the popup menu with the given label.withSubMenu(String id, String label) Adds a submenu to the popup menu with the given id and label.withSubMenu(String id, String label, org.eclipse.jface.resource.ImageDescriptor image) Adds a submenu to the popup menu with the given id, label and image.Adds a menu item for toggling the visibility of the filter row.withToggleFilterRow(String menuLabel) Adds a menu item for toggling the visibility of the filter row.Adds the menu item for removing a frozen state.withUnfreezeMenuItem(String menuLabel) Adds the menu item for removing a frozen state.withUngroupColumnsMenuItem(String menuLabel) Adds the menu item for ungrouping selected rows from an existing row group.withUngroupRowsMenuItem(String menuLabel) Adds the menu item for ungrouping selected rows from an existing row group.withVisibleState(String id, IMenuItemState state) Associate a visibilityIMenuItemStatewith the menu item identified by the given id.
-
Field Details
-
HIDE_COLUMN_MENU_ITEM_ID
- See Also:
-
SHOW_ALL_COLUMNS_MENU_ITEM_ID
- See Also:
-
HIDE_ROW_MENU_ITEM_ID
- See Also:
-
SHOW_ALL_ROWS_MENU_ITEM_ID
- See Also:
-
AUTO_RESIZE_COLUMN_MENU_ITEM_ID
- See Also:
-
AUTO_RESIZE_ROW_MENU_ITEM_ID
- See Also:
-
AUTO_RESIZE_ALL_SELECTED_COLUMN_MENU_ITEM_ID
- See Also:
-
COLUMN_CHOOSER_MENU_ITEM_ID
- See Also:
-
COLUMN_STYLE_EDITOR_MENU_ITEM_ID
- See Also:
-
COLUMN_RENAME_MENU_ITEM_ID
- See Also:
-
CREATE_COLUMN_GROUP_MENU_ITEM_ID
- See Also:
-
RENAME_COLUMN_GROUP_MENU_ITEM_ID
- See Also:
-
REMOVE_COLUMN_GROUP_MENU_ITEM_ID
- See Also:
-
UNGROUP_COLUMNS_MENU_ITEM_ID
- See Also:
-
INSPECT_LABEL_MENU_ITEM_ID
- See Also:
-
CATEGORIES_BASED_COLUMN_CHOOSER_MENU_ITEM_ID
- See Also:
-
CLEAR_ALL_FILTERS_MENU_ITEM_ID
- See Also:
-
TOGGLE_FILTER_ROW_MENU_ITEM_ID
- See Also:
-
STATE_MANAGER_MENU_ITEM_ID
- See Also:
-
SEPARATOR_MENU_ITEM_ID
- See Also:
-
EXPORT_IMAGE_MENU_ITEM_ID
- Since:
- 1.5
- See Also:
-
CREATE_ROW_GROUP_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
-
RENAME_ROW_GROUP_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
-
REMOVE_ROW_GROUP_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
-
UNGROUP_ROWS_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
-
FREEZE_COLUMN_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
-
FREEZE_ROW_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
-
FREEZE_POSITION_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
-
UNFREEZE_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
-
natTable
The active NatTable instance the context menu should be added to. Needed in advance to be able to add custom menu items that need the NatTable instance. -
popupMenu
protected org.eclipse.swt.widgets.Menu popupMenuTheMenuthat is created with this popup menu builder. -
visibility
Collection of all registered visibility state checkers for configured id's. -
enablement
Collection of all registered enablement state checkers for configured id's. -
parentBuilder
The parentPopupMenuBuilderin case this instance is for building a submenu.- Since:
- 2.3
-
-
Constructor Details
-
PopupMenuBuilder
CreatesPopupMenuBuilderthat builds up a newMenuthat is only configurable with this instance ofPopupMenuBuilder. Uses aMenuManagerinternally to be able to configure visibility and enabled states.- Parameters:
parent- The active NatTable instance the context menu should be added to.
-
PopupMenuBuilder
public PopupMenuBuilder(org.eclipse.jface.action.MenuManager manager) Creates aPopupMenuBuilderthat builds up a newMenuusing the givenMenuManager.Note: If this constructor is used a
Menucan only be created by usingbuild(NatTable), otherwise it will fail with an exception.- Parameters:
manager- TheMenuManagerthat should be used to create theMenu.- Since:
- 1.6
-
PopupMenuBuilder
- Parameters:
parent- The active NatTable instance the context menu should be added to.manager- TheMenuManagerthat should be used to create theMenu.
-
PopupMenuBuilder
Creates a popup menu builder based on the given menu. Using this enables the possibility to use configured context menus from plugin.xml and adding NatTable commands programmatically.As an example you might want to create a PopupMenuBuilder by using a configured menu with the id org.eclipse.nebula.widgets.nattable.example.contextmenu
ISelectionProvider isp = new RowSelectionProvider<?>(selectionLayer, bodyDataProvider, false); MenuManager menuManager = new MenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); getSite().registerContextMenu( "org.eclipse.nebula.widgets.nattable.example.contextmenu", menuManager, isp); PopupMenuBuilder popupMenu = new PopupMenuBuilder(menuManager.createContextMenu(natTable));For usage with Eclipse 4 you can use the
EMenuServiceto register the menu to a NatTable instance. Afterwards get the menu and remove it from the NatTable to avoid the SWT control menu. The generated menu carries aMenuManagerin theWidget.getData()which will be used within thisPopupMenuBuilder.menuService.registerContextMenu(natTable, menuId); Menu swtMenu = natTable.getMenu(); natTable.setMenu(null);
- Parameters:
natTable- The active NatTable instance which might be needed for creation of menu items that need the NatTable instance to work.menu- The registered context menu.
-
-
Method Details
-
withContributionItem
public PopupMenuBuilder withContributionItem(org.eclipse.jface.action.ContributionItem contributionItem) Adds the menu item(s) provided by the givenContributionItemto the popup menu. You can use this to add your own item to the popup menu.This method is only working if the
PopupMenuBuilderis using aMenuManager.Using this adds support for visibility and enabled states of menu items.
- Parameters:
contributionItem- TheContributionItemthat is used to add a menu item to the menu.- Returns:
- The current
PopupMenuBuilderwith the added item. - Throws:
IllegalStateException- if thisPopupMenuBuilderdoes not use aMenuManager
-
withHideColumnMenuItem
Adds the menu item for hiding a column to the popup menu. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilderwith the hide column menu item added. - See Also:
-
withHideColumnMenuItem
Adds the menu item for hiding a column to the popup menu. Uses the given String as label for the menu item.- Parameters:
menuLabel- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilderwith the hide column menu item added. - See Also:
-
withShowAllColumnsMenuItem
Adds the menu item for showing all columns to the popup menu. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilderwith the show all columns menu item added. - See Also:
-
withShowAllColumnsMenuItem
Adds the menu item for showing all columns to the popup menu. Uses the given String as label for the menu item.- Parameters:
menuLabel- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilderwith the show all columns menu item added. - See Also:
-
withExportToImageMenuItem
Add the menu item for exporting to image to the popup menu. Use the default text localized in NatTable core resource bundles.IMPORTANT: the
ImageExporterneeds to be configured for the configuration attributeExportConfigAttributes.TABLE_EXPORTERto really export to an image. Also theExportTableCommandHandlerneeds to be registered on anILayerin the layer stack, e.g. the GridLayer.- Returns:
- The
PopupMenuBuilderwith the export to image menu item added. - Since:
- 1.5
- See Also:
-
withExportToImageMenuItem
Add the menu item for exporting to image to the popup menu. Use the given String as label for the menu item.IMPORTANT: the
ImageExporterneeds to be configured for the configuration attributeExportConfigAttributes.TABLE_EXPORTERto really export to an image. Also theExportTableCommandHandlerneeds to be registered on anILayerin the layer stack, e.g. the GridLayer.- Parameters:
menuLabel- The label to use for exporting to image in the popup menu.- Returns:
- The
PopupMenuBuilderwith the exporting to image menu item added. - Since:
- 1.5
- See Also:
-
withHideRowMenuItem
Adds the menu item for hiding a row to the popup menu by using theRowHideCommand. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilderwith the hide row menu item added. - See Also:
-
withHideRowMenuItem
Adds the menu item for hiding a row to the popup menu by using theRowHideCommand. Uses the given String as label for the menu item.- Parameters:
menuLabel- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilderwith the hide row menu item added. - See Also:
-
withHideRowPositionMenuItem
Adds the menu item for hiding a row to the popup menu by using theRowPositionHideCommand. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilderwith the hide row menu item added. - Since:
- 1.6
- See Also:
-
withHideRowPositionMenuItem
Adds the menu item for hiding a row to the popup menu by using theRowPositionHideCommand. Uses the given String as label for the menu item.- Parameters:
menuLabel- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilderwith the hide row menu item added. - Since:
- 1.6
- See Also:
-
withShowAllRowsMenuItem
Adds the menu item for showing all rows to the popup menu. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilderwith the show all rows menu item added. - See Also:
-
withShowAllRowsMenuItem
Adds the menu item for showing all rows to the popup menu. Uses the given String as label for the menu item.- Parameters:
menuLabel- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilderwith the show all rows menu item added. - See Also:
-
withAutoResizeSelectedColumnsMenuItem
Adds the menu item for auto resizing selected columns to the popup menu. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilderwith the resize selected columns menu item added. - See Also:
-
withAutoResizeSelectedColumnsMenuItem
Adds the menu item for auto resizing selected columns to the popup menu. Uses the given String as label for the menu item.- Returns:
- The
PopupMenuBuilderwith the resize selected columns menu item added. - See Also:
-
withAutoResizeSelectedRowsMenuItem
-
withAutoResizeSelectedRowsMenuItem
-
withColumnChooserMenuItem
-
withColumnChooserMenuItem
-
withColumnStyleEditor
-
withColumnStyleEditor
-
withColumnRenameDialog
-
withColumnRenameDialog
-
withCreateColumnGroupsMenuItem
-
withCreateColumnGroupsMenuItem
-
withCreateColumnGroupMenuItem
Adds the menu item for creating a column group with the new performance ColumnGroupHeaderLayer.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withCreateColumnGroupMenuItem
Adds the menu item for creating a column group with the new performance ColumnGroupHeaderLayer.- Parameters:
menuLabel- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withUngroupColumnsMenuItem
-
withUngroupColumnsMenuItem
-
withRenameColumnGroupMenuItem
-
withRenameColumnGroupMenuItem
-
withRemoveColumnGroupMenuItem
-
withRemoveColumnGroupMenuItem
-
withCreateRowGroupMenuItem
Adds the menu item for creating a row group with the new performance RowGroupHeaderLayer.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withCreateRowGroupMenuItem
Adds the menu item for creating a row group with the new performance RowGroupHeaderLayer.- Parameters:
menuLabel- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withUngroupRowsMenuItem
Adds the menu item for ungrouping selected rows from an existing row group.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withUngroupRowsMenuItem
Adds the menu item for ungrouping selected rows from an existing row group.- Parameters:
menuLabel- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withRenameRowGroupMenuItem
Adds the menu item for renaming a row group.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withRenameRowGroupMenuItem
Adds the menu item for renaming a row group.- Parameters:
menuLabel- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withRemoveRowGroupMenuItem
Adds the menu item for removing a row group.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withRemoveRowGroupMenuItem
Adds the menu item for removing a row group.- Parameters:
menuLabel- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezeColumnMenuItem
Adds the menu item for for freezing a grid at a given column position.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezeColumnMenuItem
Adds the menu item for for freezing a grid at a given column position.- Parameters:
menuLabel- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezeRowMenuItem
Adds the menu item for for freezing a grid at a given row position.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezeRowMenuItem
Adds the menu item for for freezing a grid at a given row position.- Parameters:
menuLabel- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezePositionMenuItem
Adds the menu item for freezing a grid at a given cell position. This menu item is intended to be used in a body menu.- Parameters:
include- whether the selected cell should be included in the freeze region or not. Include means the freeze borders will be to the right and bottom, while exclude means the freeze borders are to the left and top.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezePositionMenuItem
Adds the menu item for freezing a grid at a given cell position. This menu item is intended to be used in a body menu.- Parameters:
menuLabel- The label to be used for showing the menu item.include- whether the selected cell should be included in the freeze region or not. Include means the freeze borders will be to the right and bottom, while exclude means the freeze borders are to the left and top.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withUnfreezeMenuItem
Adds the menu item for removing a frozen state.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withUnfreezeMenuItem
Adds the menu item for removing a frozen state.- Parameters:
menuLabel- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withInspectLabelsMenuItem
-
withCategoriesBasedColumnChooser
-
withCategoriesBasedColumnChooser
-
withClearAllFilters
-
withClearAllFilters
-
withToggleFilterRow
Adds a menu item for toggling the visibility of the filter row. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilderwith the toggle filter row menu item added. - See Also:
-
withToggleFilterRow
Adds a menu item for toggling the visibility of the filter row. Uses the given String as label for the menu item.- Parameters:
menuLabel- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilderwith the toggle filter row menu item added. - See Also:
-
withStateManagerMenuItemProvider
Adds the menu item for opening the view management dialog to the popup menu. Uses the default text localized in NatTable core resource bundles. Uses the given String as label for the menu item.- Returns:
- The
PopupMenuBuilderwith the menu item added for showing the view management dialog for managing NatTable states. - See Also:
-
withStateManagerMenuItemProvider
Adds the menu item for opening the view management dialog to the popup menu.- Parameters:
menuLabel- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilderwith the menu item added for showing the view management dialog for managing NatTable states. - See Also:
-
withSeparator
Adds a separator to the popup menu.- Returns:
- The
PopupMenuBuilderwith an added separator. - See Also:
-
withSeparator
Adds a separator to the popup menu with the given id.- Parameters:
id- The id to identify the separator. Necessary if there should be visibility constraints for specific separators.- Returns:
- The
PopupMenuBuilderwith an added separator. - See Also:
-
withSubMenu
Adds a submenu to the popup menu with the given label.- Parameters:
label- The label to be used for the submenu.- Returns:
- the
PopupMenuBuilderof the submenu. - Since:
- 2.3
- See Also:
-
withSubMenu
Adds a submenu to the popup menu with the given id and label.- Parameters:
id- The id to identify the submenu. Necessary if there should be visibility constraints for specific submenus.label- The label to be used for the submenu.- Returns:
- the
PopupMenuBuilderof the submenu. - Since:
- 2.3
- See Also:
-
withSubMenu
public PopupMenuBuilder withSubMenu(String id, String label, org.eclipse.jface.resource.ImageDescriptor image) Adds a submenu to the popup menu with the given id, label and image.- Parameters:
id- The id to identify the submenu. Necessary if there should be visibility constraints for specific submenus.label- The label to be used for the submenu.image- The image to be used for the submenu.- Returns:
- the
PopupMenuBuilderof the submenu. - Since:
- 2.3
- See Also:
-
MenuManager(String, ImageDescriptor, String)
-
buildSubMenu
Build the submenu and return the parentPopupMenuBuilderto implement the builder pattern.- Returns:
- The parent
PopupMenuBuilder. - Since:
- 2.3
-
build
Sets the given NatTable to this builder and returns theMenuManagerthat is used to create the context menu.Note: Calling this method only brings the builder to a working state. The creation of the
Menuneeds to be done using theMenuManager. In this case the caller is also responsible for theMenudisposal.- Parameters:
natTable- The NatTable instance for which theMenushould be created by using the returnedMenuManager. Needed to make theIMenuItemProviderwork.- Returns:
- The
MenuManagerthat is used by this builder. - Since:
- 1.6
-
build
public org.eclipse.swt.widgets.Menu build()Builds and returns the createdMenu.Note: Calling this method will also add a
DisposeListenerto the NatTable instance to ensure the createdMenuis disposed when the NatTable itself gets disposed.- Returns:
- The
Menuthat is created by this builder.
-
build
public org.eclipse.swt.widgets.Menu build(boolean diposeMenuManager) Builds and returns the createdMenu.Note: Calling this method will also add a
DisposeListenerto the NatTable instance to ensure the createdMenuis disposed when the NatTable itself gets disposed. Via thediposeMenuManagerparameter it is possible to configure if also the internally usedMenuManagershould be disposed or not.Note: Generally it is recommended to trigger the disposal of the
MenuManager. Especially if submenus are created, as otherwise theMenuItemof the submenu will not be disposed and causes resource leaks.- Parameters:
diposeMenuManager-trueif the internally usedMenuManagershould be disposed,falseif not. Default isfalseto avoid unintentionally disposing it.- Returns:
- The
Menuthat is created by this builder. - Since:
- 2.3
-
isEnabled
- Parameters:
contributionItemId- The id of the menu item to check.- Returns:
trueif the menu item is enabled,falseif not.- Since:
- 2.3
- See Also:
-
isVisible
- Parameters:
contributionItemId- The id of the menu item to check.- Returns:
trueif the menu item is visible,falseif not.- Since:
- 2.3
- See Also:
-
getNatEventData
Return theNatEventDatathat is set to theMenucreated by thisPopupMenuBuilder. For a sub menu theNatEventDataof the root parent menu is returned.- Returns:
- The
NatEventDataset to the createdMenu. - Since:
- 2.3