use of org.eclipse.nebula.widgets.nattable.util.GCFactory in project nebula.widgets.nattable by eclipse.
the class MenuItemProviders method autoResizeColumnMenuItemProvider.
public static IMenuItemProvider autoResizeColumnMenuItemProvider(final String menuLabel) {
return new IMenuItemProvider() {
@Override
public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
MenuItem autoResizeColumns = new MenuItem(popupMenu, SWT.PUSH);
autoResizeColumns.setText(Messages.getLocalizedMessage(menuLabel));
// $NON-NLS-1$
autoResizeColumns.setImage(GUIHelper.getImage("auto_resize"));
autoResizeColumns.setEnabled(true);
autoResizeColumns.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
int columnPosition = getNatEventData(event).getColumnPosition();
natTable.doCommand(new InitializeAutoResizeColumnsCommand(natTable, columnPosition, natTable.getConfigRegistry(), new GCFactory(natTable)));
}
});
}
};
}
use of org.eclipse.nebula.widgets.nattable.util.GCFactory in project nebula.widgets.nattable by eclipse.
the class AutoResizeColumnAction method run.
@Override
public void run(NatTable natTable, MouseEvent event) {
Point clickPoint = new Point(event.x, event.y);
int column = CellEdgeDetectUtil.getColumnPositionToResize(natTable, clickPoint);
InitializeAutoResizeColumnsCommand command = new InitializeAutoResizeColumnsCommand(natTable, column, natTable.getConfigRegistry(), new GCFactory(natTable));
natTable.doCommand(command);
}
use of org.eclipse.nebula.widgets.nattable.util.GCFactory 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