Search in sources :

Example 86 with TableViewerColumn

use of org.eclipse.jface.viewers.TableViewerColumn in project tdi-studio-se by Talend.

the class FieldSection method createContents.

@Override
protected void createContents(Composite composite) {
    tableViewer = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL);
    final Table table = tableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(false);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    table.setLayoutData(gd);
    TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.NONE);
    table.addListener(SWT.Resize, new Listener() {

        public void handleEvent(Event event) {
            TableColumn[] columns = table.getColumns();
            int clientWidth = table.getBounds().width;
            columns[0].setWidth(clientWidth);
        }
    });
    if (editable) {
        column.setEditingSupport(new FieldEditingSupport(tableViewer, 0));
    }
    tableViewer.setLabelProvider(new TableLabelProvider());
    tableViewer.setContentProvider(new ContentProvider());
// sorter
// tableViewer.setSorter(new ViewerSorter());
}
Also used : Table(org.eclipse.swt.widgets.Table) PaintListener(org.eclipse.swt.events.PaintListener) Listener(org.eclipse.swt.widgets.Listener) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) GridData(org.eclipse.swt.layout.GridData) Event(org.eclipse.swt.widgets.Event) PaintEvent(org.eclipse.swt.events.PaintEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ITableLabelProvider(org.eclipse.jface.viewers.ITableLabelProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Aggregations

TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)86 TableViewer (org.eclipse.jface.viewers.TableViewer)51 SelectionEvent (org.eclipse.swt.events.SelectionEvent)43 Composite (org.eclipse.swt.widgets.Composite)40 GridData (org.eclipse.swt.layout.GridData)38 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)35 GridLayout (org.eclipse.swt.layout.GridLayout)27 TableColumn (org.eclipse.swt.widgets.TableColumn)26 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)15 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)15 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)15 Table (org.eclipse.swt.widgets.Table)15 Point (org.eclipse.swt.graphics.Point)14 FillLayout (org.eclipse.swt.layout.FillLayout)13 Button (org.eclipse.swt.widgets.Button)12 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)11 MenuEvent (org.eclipse.swt.events.MenuEvent)10 CTabItem (org.eclipse.swt.custom.CTabItem)8 FocusEvent (org.eclipse.swt.events.FocusEvent)8 Event (org.eclipse.swt.widgets.Event)8