use of org.eclipse.nebula.widgets.nattable.ui.NatEventData in project nebula.widgets.nattable by eclipse.
the class CellLabelMouseEventMatcher method matches.
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
NatEventData eventData = NatEventData.createInstanceFromEvent(event);
LabelStack customLabels = natTable.getConfigLabelsByPosition(eventData.getColumnPosition(), eventData.getRowPosition());
return super.matches(natTable, event, regionLabels) && customLabels.getLabels().contains(this.labelToMatch);
}
use of org.eclipse.nebula.widgets.nattable.ui.NatEventData 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));
}
});
}
};
}
use of org.eclipse.nebula.widgets.nattable.ui.NatEventData 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