Search in sources :

Example 1 with ChooseColumnsFromCategoriesCommand

use of org.eclipse.nebula.widgets.nattable.columnCategories.ChooseColumnsFromCategoriesCommand in project nebula.widgets.nattable by eclipse.

the class MenuItemProviders method categoriesBasedColumnChooserMenuItemProvider.

public static IMenuItemProvider categoriesBasedColumnChooserMenuItemProvider(final String menuLabel) {
    return new IMenuItemProvider() {

        @Override
        public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
            MenuItem columnChooser = new MenuItem(popupMenu, SWT.PUSH);
            columnChooser.setText(Messages.getLocalizedMessage(menuLabel));
            // $NON-NLS-1$
            columnChooser.setImage(GUIHelper.getImage("column_categories_chooser"));
            columnChooser.setEnabled(true);
            columnChooser.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    natTable.doCommand(new ChooseColumnsFromCategoriesCommand(natTable));
                }
            });
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) ChooseColumnsFromCategoriesCommand(org.eclipse.nebula.widgets.nattable.columnCategories.ChooseColumnsFromCategoriesCommand)

Aggregations

NatTable (org.eclipse.nebula.widgets.nattable.NatTable)1 ChooseColumnsFromCategoriesCommand (org.eclipse.nebula.widgets.nattable.columnCategories.ChooseColumnsFromCategoriesCommand)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Menu (org.eclipse.swt.widgets.Menu)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1