use of org.eclipse.nebula.widgets.nattable.group.command.RemoveColumnGroupCommand in project nebula.widgets.nattable by eclipse.
the class ColumnGroupMenuItemProviders method removeColumnGroupMenuItemProvider.
public static IMenuItemProvider removeColumnGroupMenuItemProvider(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();
int columnIndex = natEventData.getNatTable().getColumnIndexByPosition(columnPosition);
natTable.doCommand(new RemoveColumnGroupCommand(columnIndex));
}
});
}
};
}
use of org.eclipse.nebula.widgets.nattable.group.command.RemoveColumnGroupCommand in project nebula.widgets.nattable by eclipse.
the class MenuItemProviders method removeColumnGroupMenuItemProvider.
public static IMenuItemProvider removeColumnGroupMenuItemProvider(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();
int columnIndex = natEventData.getNatTable().getColumnIndexByPosition(columnPosition);
natTable.doCommand(new RemoveColumnGroupCommand(columnIndex));
}
});
}
};
}
Aggregations