natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
@Override
protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
return super.createCornerMenu(natTable)
.withStateManagerMenuItemProvider()
.withMenuItemProvider(new IMenuItemProvider() {
@Override
public void addMenuItem(NatTable natTable,
Menu popupMenu) {
MenuItem menuItem = new MenuItem(popupMenu,
SWT.PUSH);
menuItem.setText("Toggle Group By Header"); //$NON-NLS-1$
menuItem.setEnabled(true);
menuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(
SelectionEvent event) {
groupByHeaderLayer
.setVisible(!groupByHeaderLayer
.isVisible());
}
});
}
}).withMenuItemProvider(new IMenuItemProvider() {
@Override
public void addMenuItem(final NatTable natTable,
Menu popupMenu) {
MenuItem menuItem = new MenuItem(popupMenu,
SWT.PUSH);
menuItem.setText("Collapse All"); //$NON-NLS-1$
menuItem.setEnabled(true);
menuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(
SelectionEvent event) {
natTable.doCommand(new TreeCollapseAllCommand());
}
});
}
}).withMenuItemProvider(new IMenuItemProvider() {
@Override
public void addMenuItem(final NatTable natTable,
Menu popupMenu) {
MenuItem menuItem = new MenuItem(popupMenu,