Search in sources :

Example 1 with DisplayColumnGroupRenameDialogCommand

use of org.eclipse.nebula.widgets.nattable.group.command.DisplayColumnGroupRenameDialogCommand in project nebula.widgets.nattable by eclipse.

the class ColumnGroupMenuItemProviders method renameColumnGroupMenuItemProvider.

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

        @Override
        public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
            MenuItem columnStyleEditor = new MenuItem(popupMenu, SWT.PUSH);
            columnStyleEditor.setText(menuLabel);
            columnStyleEditor.setEnabled(true);
            columnStyleEditor.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    NatEventData natEventData = MenuItemProviders.getNatEventData(e);
                    int columnPosition = natEventData.getColumnPosition();
                    natTable.doCommand(new DisplayColumnGroupRenameDialogCommand(natTable, columnPosition));
                }
            });
        }
    };
}
Also used : DisplayColumnGroupRenameDialogCommand(org.eclipse.nebula.widgets.nattable.group.command.DisplayColumnGroupRenameDialogCommand) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) IMenuItemProvider(org.eclipse.nebula.widgets.nattable.ui.menu.IMenuItemProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) MenuItem(org.eclipse.swt.widgets.MenuItem) NatEventData(org.eclipse.nebula.widgets.nattable.ui.NatEventData) Menu(org.eclipse.swt.widgets.Menu)

Example 2 with DisplayColumnGroupRenameDialogCommand

use of org.eclipse.nebula.widgets.nattable.group.command.DisplayColumnGroupRenameDialogCommand in project nebula.widgets.nattable by eclipse.

the class MenuItemProviders method renameColumnGroupMenuItemProvider.

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

        @Override
        public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
            MenuItem columnStyleEditor = new MenuItem(popupMenu, SWT.PUSH);
            columnStyleEditor.setText(Messages.getLocalizedMessage(menuLabel));
            columnStyleEditor.setEnabled(true);
            columnStyleEditor.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    NatEventData natEventData = MenuItemProviders.getNatEventData(e);
                    int columnPosition = natEventData.getColumnPosition();
                    natTable.doCommand(new DisplayColumnGroupRenameDialogCommand(natTable, columnPosition));
                }
            });
        }
    };
}
Also used : DisplayColumnGroupRenameDialogCommand(org.eclipse.nebula.widgets.nattable.group.command.DisplayColumnGroupRenameDialogCommand) 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) NatEventData(org.eclipse.nebula.widgets.nattable.ui.NatEventData) Menu(org.eclipse.swt.widgets.Menu)

Aggregations

NatTable (org.eclipse.nebula.widgets.nattable.NatTable)2 DisplayColumnGroupRenameDialogCommand (org.eclipse.nebula.widgets.nattable.group.command.DisplayColumnGroupRenameDialogCommand)2 NatEventData (org.eclipse.nebula.widgets.nattable.ui.NatEventData)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Menu (org.eclipse.swt.widgets.Menu)2 MenuItem (org.eclipse.swt.widgets.MenuItem)2 IMenuItemProvider (org.eclipse.nebula.widgets.nattable.ui.menu.IMenuItemProvider)1