use of org.eclipse.nebula.widgets.nattable.resize.command.InitializeAutoResizeRowsCommand in project nebula.widgets.nattable by eclipse.
the class InitializeAutoResizeRowsCommandHandler method doCommand.
@Override
protected boolean doCommand(InitializeAutoResizeRowsCommand initCommand) {
int rowPosition = initCommand.getRowPosition();
if (this.selectionLayer.isRowPositionFullySelected(rowPosition)) {
initCommand.setSelectedRowPositions(this.selectionLayer.getFullySelectedRowPositions());
} else {
initCommand.setSelectedRowPositions(new int[] { rowPosition });
}
// Fire command carrying the selected columns
initCommand.getSourceLayer().doCommand(new AutoResizeRowsCommand(initCommand));
return true;
}
use of org.eclipse.nebula.widgets.nattable.resize.command.InitializeAutoResizeRowsCommand in project nebula.widgets.nattable by eclipse.
the class AutoResizeRowAction method run.
@Override
public void run(NatTable natTable, MouseEvent event) {
Point clickPoint = new Point(event.x, event.y);
int row = CellEdgeDetectUtil.getRowPositionToResize(natTable, clickPoint);
InitializeAutoResizeRowsCommand command = new InitializeAutoResizeRowsCommand(natTable, row, natTable.getConfigRegistry(), new GCFactory(natTable));
natTable.doCommand(command);
}
use of org.eclipse.nebula.widgets.nattable.resize.command.InitializeAutoResizeRowsCommand in project nebula.widgets.nattable by eclipse.
the class MenuItemProviders method autoResizeRowMenuItemProvider.
public static IMenuItemProvider autoResizeRowMenuItemProvider(final String menuLabel) {
return new IMenuItemProvider() {
@Override
public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
MenuItem autoResizeRows = new MenuItem(popupMenu, SWT.PUSH);
autoResizeRows.setText(Messages.getLocalizedMessage(menuLabel));
autoResizeRows.setEnabled(true);
autoResizeRows.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
int rowPosition = getNatEventData(event).getRowPosition();
natTable.doCommand(new InitializeAutoResizeRowsCommand(natTable, rowPosition, natTable.getConfigRegistry(), new GCFactory(natTable)));
}
});
}
};
}
Aggregations