Search in sources :

Example 1 with ColumnRenameDialog

use of org.eclipse.nebula.widgets.nattable.columnRename.ColumnRenameDialog in project nebula.widgets.nattable by eclipse.

the class ColumnRenameDialogRunner method main.

public static void main(String[] args) {
    ColumnRenameDialog dialog = new ColumnRenameDialog(new Shell(), "Original", "New");
    dialog.open();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ColumnRenameDialog(org.eclipse.nebula.widgets.nattable.columnRename.ColumnRenameDialog)

Example 2 with ColumnRenameDialog

use of org.eclipse.nebula.widgets.nattable.columnRename.ColumnRenameDialog in project nebula.widgets.nattable by eclipse.

the class ColumnGroupsCommandHandler method displayColumnGroupRenameDialog.

private boolean displayColumnGroupRenameDialog(DisplayColumnGroupRenameDialogCommand command) {
    int columnPosition = command.getColumnPosition();
    ColumnRenameDialog dialog = new ColumnRenameDialog(Display.getDefault().getActiveShell(), null, null);
    Rectangle colHeaderBounds = this.contextLayer.getBoundsByPosition(columnPosition, 0);
    Point point = new Point(colHeaderBounds.x, colHeaderBounds.y + colHeaderBounds.height);
    dialog.setLocation(command.toDisplayCoordinates(point));
    dialog.open();
    if (!dialog.isCancelPressed()) {
        int columnIndex = this.contextLayer.getColumnIndexByPosition(columnPosition);
        ColumnGroup columnGroup = this.model.getColumnGroupByIndex(columnIndex);
        columnGroup.setName(dialog.getNewColumnLabel());
    }
    return true;
}
Also used : ColumnRenameDialog(org.eclipse.nebula.widgets.nattable.columnRename.ColumnRenameDialog) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point) ColumnGroup(org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup) Point(org.eclipse.swt.graphics.Point)

Aggregations

ColumnRenameDialog (org.eclipse.nebula.widgets.nattable.columnRename.ColumnRenameDialog)2 ColumnGroup (org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup)1 Point (org.eclipse.swt.graphics.Point)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 Shell (org.eclipse.swt.widgets.Shell)1