org.eclipse.swt.widgets.Table Java Examples

The following examples show how to use org.eclipse.swt.widgets.Table. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: hop   Author: project-hop   File: PrioritizeStreamsDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Copy information from the meta-data input to the dialog fields.
 */
public void getData() {
  Table table = wFields.table;
  if ( input.getTransformName().length > 0 ) {
    table.removeAll();
  }
  for ( int i = 0; i < input.getTransformName().length; i++ ) {
    TableItem ti = new TableItem( table, SWT.NONE );
    ti.setText( 0, "" + ( i + 1 ) );
    if ( input.getTransformName()[ i ] != null ) {
      ti.setText( 1, input.getTransformName()[ i ] );
    }
  }

  wFields.removeEmptyRows();
  wFields.setRowNums();
  wFields.optWidth( true );

  wTransformName.selectAll();
  wTransformName.setFocus();
}
 
Example #2
Source Project: ermasterr   Author: roundrop   File: CompositeFactory.java    License: Apache License 2.0 6 votes vote down vote up
public static Table createTable(final Composite composite, final int height, final int span, final boolean multi) {
    final GridData gridData = new GridData();
    gridData.horizontalSpan = span;
    gridData.heightHint = height;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    int style = SWT.SINGLE;
    if (multi) {
        style = SWT.MULTI;
    }

    final Table table = new Table(composite, style | SWT.BORDER | SWT.FULL_SELECTION);
    table.setLayoutData(gridData);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    return table;
}
 
Example #3
Source Project: ermaster-b   Author: naoki-iwami   File: ExportToTranslationDictionaryDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void createTable(Composite parent) {
	GridData gridData = new GridData();
	gridData.heightHint = 150;
	gridData.horizontalSpan = 2;
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;

	this.dictionaryTable = new Table(parent, SWT.FULL_SELECTION
			| SWT.BORDER | SWT.MULTI);
	this.dictionaryTable.setHeaderVisible(true);
	this.dictionaryTable.setLinesVisible(true);
	this.dictionaryTable.setLayoutData(gridData);

	TableColumn tableColumn = new TableColumn(this.dictionaryTable,
			SWT.LEFT);
	tableColumn.setWidth(250);
	tableColumn.setText(ResourceString
			.getResourceString("label.physical.name"));

	TableColumn tableColumn1 = new TableColumn(this.dictionaryTable,
			SWT.LEFT);
	tableColumn1.setWidth(250);
	tableColumn1.setText(ResourceString
			.getResourceString("label.logical.name"));

}
 
Example #4
Source Project: tracecompass   Author: tracecompass   File: TmfEventsTable.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Returns true if the column is expanded to take extra available space.
 * This is the last non-zero-width visible column in the column order on
 * Linux. This column's width should not be persisted.
 *
 * @param column
 *            the column
 * @return true if the column is expanded.
 */
private static boolean isExpanded(TableColumn column) {
    if (IS_LINUX) {
        Table table = column.getParent();
        int[] order = table.getColumnOrder();
        for (int i = order.length - 1; i >= 0; i--) {
            TableColumn col = table.getColumn(order[i]);
            if (col == column) {
                return true;
            }
            if (col.getWidth() > 0) {
                return false;
            }
        }
    }
    return false;
}
 
Example #5
Source Project: ermaster-b   Author: naoki-iwami   File: CompositeFactory.java    License: Apache License 2.0 6 votes vote down vote up
public static TableEditor createCheckBoxTableEditor(TableItem tableItem,
		boolean selection, int column) {
	Table table = tableItem.getParent();

	final Button checkBox = new Button(table, SWT.CHECK);
	checkBox.pack();

	TableEditor editor = new TableEditor(table);

	editor.minimumWidth = checkBox.getSize().x;
	editor.horizontalAlignment = SWT.CENTER;
	editor.setEditor(checkBox, tableItem, column);

	checkBox.setSelection(selection);

	return editor;
}
 
Example #6
Source Project: birt   Author: eclipse   File: ResultSetPreviewPage.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public static ResultSetTableAction createResultSetTableAction(
		Table resultSetTable, int operationID )
{
	assert resultSetTable != null;

	ResultSetTableAction rsTableAction = null;

	if ( operationID == COPY_ACTION )
	{
		rsTableAction = new CopyAction( resultSetTable );
	}
	else if ( operationID == SELECTALL_ACTION )
	{
		rsTableAction = new SelectAllAction( resultSetTable );
	}

	return rsTableAction;
}
 
Example #7
Source Project: offspring   Author: incentivetoken   File: BuyOrderTableViewer.java    License: MIT License 6 votes vote down vote up
public BuyOrderTableViewer(Composite parent, UISynchronize sync) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION
      | SWT.BORDER);

  this.contentProvider = new BuyOrderContentProvider(sync);
  this.comparator = new BuyOrderComparator();

  setUseHashlookup(false);
  setContentProvider(contentProvider);
  setComparator(comparator);

  createColumns();

  /* Pack the columns */
  for (TableColumn column : getTable().getColumns())
    column.pack();

  Table table = getTable();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
}
 
Example #8
Source Project: neoscada   Author: eclipse   File: EventViewTable.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void widgetSelected ( final SelectionEvent e )
{
    final Table table = this.tableViewer.getTable ();
    final TableColumn newColumn = (TableColumn)e.widget;
    final TableColumn currentColumn = table.getSortColumn ();

    final EventTableColumn column = (EventTableColumn)newColumn.getData ( COLUMN_KEY );
    if ( column == EventTableColumn.reservedColumnSourceTimestamp || column == EventTableColumn.reservedColumnEntryTimestamp )
    {
        final int currentDir = table.getSortDirection ();
        int newDir = SWT.UP;
        if ( newColumn == currentColumn )
        {
            newDir = currentDir == SWT.UP ? SWT.DOWN : SWT.UP;
        }
        else
        {
            table.setSortColumn ( newColumn );
        }
        table.setSortDirection ( newDir );
        this.tableViewer.setSorter ( new EventTableSorter ( column, newDir ) );
    }
}
 
Example #9
Source Project: erflute   Author: dbflute-session   File: RelationshipByExistingColumnsDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void createForeignKeyColumnMapper(Composite composite) {
    final GridData tableGridData = new GridData();
    tableGridData.horizontalSpan = 2;
    tableGridData.heightHint = 100;
    tableGridData.horizontalAlignment = GridData.FILL;
    tableGridData.grabExcessHorizontalSpace = true;
    foreignKeyColumnMapper = new Table(composite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    foreignKeyColumnMapper.setLayoutData(tableGridData);
    foreignKeyColumnMapper.setHeaderVisible(true);
    foreignKeyColumnMapper.setLinesVisible(true);
    final TableColumn referredColumn = new TableColumn(foreignKeyColumnMapper, SWT.NONE);
    referredColumn.setWidth(COLUMN_WIDTH);
    referredColumn.setText("Referred Column");
    final TableColumn foreignKeyColumn = new TableColumn(foreignKeyColumnMapper, SWT.NONE);
    foreignKeyColumn.setWidth(COLUMN_WIDTH);
    foreignKeyColumn.setText("ForeignKey Column");
}
 
Example #10
Source Project: erflute   Author: dbflute-session   File: IndexDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void initializeIndexColumnList(Composite parent) {
    final GridData gridData = new GridData();
    gridData.heightHint = 150;
    gridData.verticalSpan = 2;
    indexColumnList = new Table(parent, SWT.FULL_SELECTION | SWT.BORDER);
    indexColumnList.setHeaderVisible(true);
    indexColumnList.setLayoutData(gridData);
    indexColumnList.setLinesVisible(false);
    final TableColumn tableColumn = new TableColumn(indexColumnList, SWT.CENTER);
    tableColumn.setWidth(150);
    tableColumn.setText(DisplayMessages.getMessage("label.column.name"));
    if (DBManagerFactory.getDBManager(table.getDiagram()).isSupported(DBManager.SUPPORT_DESC_INDEX)) {
        final TableColumn tableColumn1 = new TableColumn(indexColumnList, SWT.CENTER);
        tableColumn1.setWidth(50);
        tableColumn1.setText(DisplayMessages.getMessage("label.order.desc"));
    }
}
 
Example #11
Source Project: n4js   Author: eclipse   File: SetupOptionsPage.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/** Expects one row selected in the table and returns value of second row. */
private String getTableItem(Table table) {
	String result = "";
	if (table == null)
		return result;

	TableItem[] items = table.getSelection();

	if (items.length >= 2) {
		String text = Strings.nullToEmpty(table.getToolTipText());
		if (!text.isEmpty())
			text = " :: " + text;
		throw new RuntimeException("Multiple selections are not supported" + text);
	}

	if (items.length == 1 && items[0] != null)
		// first is the display name, second is data
		result = Strings.nullToEmpty(items[0].getText(1));

	return result;
}
 
Example #12
Source Project: birt   Author: eclipse   File: MenuStylesDialog.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private CellEditor[] getCellEditors( Table table )
{
	CellEditor[] editors = new CellEditor[COLUMNS.length];
	editors[0] = new TextCellEditor( table ) {

		@Override
		protected void keyReleaseOccured( KeyEvent keyEvent )
		{
			super.keyReleaseOccured( keyEvent );
			if ( keyEvent.character == '\r' )
			{
				fTableViewer.editElement( fTableViewer.getElementAt( fTable.getSelectionIndex( ) ),
					1 );
			}

		}
	};
	editors[1] = new TextCellEditor( table );
	return editors;
}
 
Example #13
Source Project: JDeodorant   Author: tsantalis   File: CloneDiffTooltip.java    License: MIT License 6 votes vote down vote up
protected void packAndFillLastColumn(Table table) {
    int columnsWidth = 0;
    for (int i = 0; i < table.getColumnCount() - 1; i++) {
        columnsWidth += table.getColumn(i).getWidth();
    }
    TableColumn lastColumn = table.getColumn(table.getColumnCount() - 1);
    lastColumn.pack();

    Rectangle area = table.getClientArea();

    Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    int width = area.width - 2*table.getBorderWidth();

    if (preferredSize.y > area.height + table.getHeaderHeight()) {
        // Subtract the scrollbar width from the total column width
        // if a vertical scrollbar will be required
        Point vBarSize = table.getVerticalBar().getSize();
        width -= vBarSize.x;
    }

    // last column is packed, so that is the minimum. If more space is available, add it.
    if(lastColumn.getWidth() < width - columnsWidth) {
        lastColumn.setWidth(width - columnsWidth + 4);
    }
}
 
Example #14
Source Project: cmake4eclipse   Author: 15knots   File: DefinesViewer.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private TableViewer createViewer(Composite parent) {
    TableViewer viewer = new TableViewer(parent, SWT.BORDER | SWT.H_SCROLL
        | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);

    createColumns(parent, viewer);

    final Table table = viewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    viewer.setContentProvider(new CmakeDefineTableContentProvider());
    viewer.setLabelProvider(new CmakeVariableLabelProvider());

    // Layout the viewer
    GridData gridData = new GridData();
    gridData.verticalAlignment = GridData.FILL;
//    gridData.horizontalSpan = 2;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    viewer.getControl().setLayoutData(gridData);
    return viewer;
  }
 
Example #15
Source Project: MergeProcessor   Author: aposin   File: GitRepositoryPreferencePageView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param parent a widget which will be the parent of the new instance (cannot
 *               be null)
 * @param style  the style of widget to construct
 */
public GitRepositoryPreferencePageView(Composite parent, int style) {
	super(parent, style);
	final TableColumnLayout tableColumnLayout = new TableColumnLayout();
	setLayout(tableColumnLayout);

	tableViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION);
	final Table table = tableViewer.getTable();
	table.setHeaderVisible(true);
	table.setLinesVisible(true);

	columnRepository = new TableViewerColumn(tableViewer, SWT.NONE);
	TableColumn colRepository = columnRepository.getColumn();
	tableColumnLayout.setColumnData(colRepository, new ColumnWeightData(1));
	colRepository.setText("Repository");

	columnLocalPath = new TableViewerColumn(tableViewer, SWT.NONE);
	TableColumn colLocalPath = columnLocalPath.getColumn();
	tableColumnLayout.setColumnData(colLocalPath, new ColumnWeightData(1));
	colLocalPath.setText("Local Path");

	columnMemory = new TableViewerColumn(tableViewer, SWT.RIGHT);
	TableColumn colMemory = columnMemory.getColumn();
	tableColumnLayout.setColumnData(colMemory, new ColumnPixelData(80, true, true));
	colMemory.setText("Memory");

	final Menu menu = new Menu(tableViewer.getTable());
	menuItemGoToRepository = new MenuItem(menu, SWT.NONE);
	menuItemGoToRepository.setText("Go to Repository");
	tableViewer.getTable().setMenu(menu);
}
 
Example #16
Source Project: tracecompass   Author: tracecompass   File: SWTBotUtils.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Get the bounds of a cell (SWT.Rectangle) for the specified row and column
 * index in a table
 *
 * @param table
 *            the table
 * @param row
 *            the row of the table to look up
 * @param col
 *            the column of the table to look up
 * @return the bounds in display relative coordinates
 */
public static Rectangle getCellBounds(final Table table, final int row, final int col) {
    return UIThreadRunnable.syncExec(new Result<Rectangle>() {
        @Override
        public Rectangle run() {
            TableItem item = table.getItem(row);
            Rectangle bounds = item.getBounds(col);
            Point p = table.toDisplay(bounds.x, bounds.y);
            Rectangle rect = new Rectangle(p.x, p.y, bounds.width, bounds.height);
            return rect;
        }
    });
}
 
Example #17
Source Project: birt   Author: eclipse   File: FilterHandleProvider.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public CellEditor[] getEditors( final Table table )
{
	if ( editors == null )
	{
		editors = new CellEditor[columnKeys.length];
		editors[0] = new TextCellEditor( table );
		editors[1] = new TextCellEditor( table );
		editors[2] = new TextCellEditor( table );
		editors[3] = new TextCellEditor( table );
	}

	return editors;
}
 
Example #18
Source Project: e4macs   Author: MulgaSoft   File: BufferDialog.java    License: Eclipse Public License 1.0 5 votes vote down vote up
void showTip(String txt, ItemPkg tp, Table table)  {
	tip = new Shell((Shell) null, SWT.ON_TOP | SWT.TOOL);
	tip.setLayout(new FillLayout());
	tip.setBackground(table.getBackground());
	createBufferTip(tip, (IEditorReference)getSelectables().get(txt));
	Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	Rectangle rect = tp.getBounds();
	Point pt = table.toDisplay(rect.x + getSizeAdjustment(), rect.y
			- size.y);
	tip.setBounds(pt.x, pt.y, size.x, size.y);
	tip.setVisible(true);
}
 
Example #19
Source Project: olca-app   Author: GreenDelta   File: SearchResultViewer.java    License: Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Create a new viewer.
 */
public SearchResultViewer(Table table) {
	super(table);
	createColumns(); // must be done before label provider is set
	setLabelProvider(new SearchResultLabel());
	setContentProvider(new ArrayContentProvider());
}
 
Example #20
Source Project: tmxeditor8   Author: heartsome   File: PreTranslationResultDialog.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));

	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(1, false);
	gl_composite.verticalSpacing = 0;
	gl_composite.marginWidth = 0;
	gl_composite.marginHeight = 0;
	composite.setLayout(gl_composite);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

	tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
	Table table = tableViewer.getTable();

	GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	tableGd.heightHint = 220;
	table.setLayoutData(tableGd);

	table.setLinesVisible(true);
	table.setHeaderVisible(true);

	String[] clmnTitles = new String[] { Messages.getString("dialog.PreTranslationResultDialog.clmnTitles1"),
			Messages.getString("dialog.PreTranslationResultDialog.clmnTitles2"),
			Messages.getString("dialog.PreTranslationResultDialog.clmnTitles3"),
			Messages.getString("dialog.PreTranslationResultDialog.clmnTitles4"),
			Messages.getString("dialog.PreTranslationResultDialog.clmnTitles5"),
			Messages.getString("dialog.PreTranslationResultDialog.clmnTitles6") };
	int[] clmnBounds = { 60, 200, 100, 110, 110, 110 };
	for (int i = 0; i < clmnTitles.length; i++) {
		createTableViewerColumn(tableViewer, clmnTitles[i], clmnBounds[i], i);
	}

	tableViewer.setLabelProvider(new TableViewerLabelProvider());
	tableViewer.setContentProvider(new ArrayContentProvider());
	tableViewer.setInput(this.getTableViewerInput());
	return container;
}
 
Example #21
Source Project: uima-uimaj   Author: apache   File: AbstractSection.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets the index.
 *
 * @param item the item
 * @return the index
 */
public static int getIndex(TableItem item) {
  Table parent = item.getParent();
  TableItem[] items = parent.getItems();
  for (int i = items.length - 1; i >= 0; i--) {
    if (items[i] == item)
      return i;
  }
  throw new InternalErrorCDE("invalid state"); //$NON-NLS-1$
}
 
Example #22
Source Project: translationstudio8   Author: heartsome   File: CSV2TMXConverterDialog.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridLayoutFactory.swtDefaults().spacing(0, 0).numColumns(1).applyTo(tparent);
	GridDataFactory.fillDefaults().hint(750, 500).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tparent);

	createMenu();
	createToolBar(tparent);

	table = new Table(tparent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
	table.setLinesVisible(true);
	table.setHeaderVisible(true);
	table.setLayoutData(new GridData(GridData.FILL_BOTH));
	Composite cmpStatus = new Composite(tparent, SWT.BORDER);
	cmpStatus.setLayout(new GridLayout(2, true));
	cmpStatus.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	lblRowCount = new Label(cmpStatus, SWT.None);
	lblRowCount.setText(MessageFormat.format(Messages.getString("dialog.CSV2TMXConverterDialog.lblRowCount"), 0));
	lblRowCount.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
	lblColCount = new Label(cmpStatus, SWT.None);
	lblColCount.setText(MessageFormat.format(Messages.getString("dialog.CSV2TMXConverterDialog.lblColCount"), 0));
	lblColCount.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

	tparent.layout();
	getShell().layout();
	return tparent;
}
 
Example #23
Source Project: olca-app   Author: GreenDelta   File: ProjectParameterTable.java    License: Mozilla Public License 2.0 5 votes vote down vote up
public void updateVariant(ProjectVariant variant) {
	int idx = getIndex(variant);
	if (idx == -1)
		return;
	Column column = columns[idx];
	Table table = viewer.getTable();
	String title = column.getTitle() == null ? "" : column.getTitle();
	table.getColumn(idx + LABEL_COLS).setText(title);
	viewer.refresh();
}
 
Example #24
Source Project: depan   Author: google   File: EdgeDisplayTableControl.java    License: Apache License 2.0 5 votes vote down vote up
private void configSorters(Table table) {
  int index = 0;
  for (TableColumn column : table.getColumns()) {
    final int colIndex = index++;

    column.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent event) {
        updateSortColumn((TableColumn) event.widget, colIndex);
      }
    });
  }
}
 
Example #25
Source Project: birt   Author: eclipse   File: GroupHandleProvider.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public CellEditor[] getEditors( Table table )
{
	if ( editors == null )
	{
		editors = new TextCellEditor[columnKeys.length];
		editors[0] = new TextCellEditor( table );
		editors[1] = new TextCellEditor( table );
	}
	return null;
}
 
Example #26
Source Project: hop   Author: project-hop   File: PrioritizeStreamsDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void get() {
  wFields.removeAll();
  Table table = wFields.table;

  for ( int i = 0; i < previousTransforms.length; i++ ) {
    TableItem ti = new TableItem( table, SWT.NONE );
    ti.setText( 0, "" + ( i + 1 ) );
    ti.setText( 1, previousTransforms[ i ] );
  }
  wFields.removeEmptyRows();
  wFields.setRowNums();
  wFields.optWidth( true );

}
 
Example #27
Source Project: elexis-3-core   Author: elexis   File: TableViewerSorter.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private void tableColumnClicked(TableColumn column){
	Table table = column.getParent();
	if (column.equals(table.getSortColumn())) {
		table.setSortDirection(table.getSortDirection() == SWT.UP ? SWT.DOWN : SWT.UP);
	} else {
		table.setSortColumn(column);
		table.setSortDirection(SWT.UP);
	}
	
	tableViewer.refresh();
	
}
 
Example #28
Source Project: e4macs   Author: MulgaSoft   File: SelectionDialog.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private String getCellText(Event event, Table table) {
	String result = null;
	ItemPkg item = getCell(event,table);
	if (item != null){
		result = item.getText();
	}
	return result;
}
 
Example #29
Source Project: nebula   Author: eclipse   File: TableComboSnippet1.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * load a list of rows with a single column
 * @return
 */
private static List<TableItem> loadSingleDataset(Table table) {
	List<TableItem> rowList = new ArrayList<TableItem>();
	
	int total = (modelList == null ? 0 : modelList.size());
	
	for (int index=0; index < total; index++) {
		TableItem ti = new TableItem(table, SWT.NONE);
		Model model = (Model)modelList.get(index);
		ti.setText(model.getDescription());
		rowList.add(ti);
	}
	
	return rowList;
}
 
Example #30
Source Project: depan   Author: google   File: RelationDisplayTableControl.java    License: Apache License 2.0 5 votes vote down vote up
private void setSortColumn(
    TableColumn column, int colIndex, int direction) {

  ViewerComparator sorter = buildColumnSorter(colIndex);
  if (SWT.UP == direction) {
    sorter = new InverseSorter(sorter);
  }

  Table tableControl = (Table) propViewer.getControl();
  propViewer.setComparator(sorter);
  tableControl.setSortColumn(column);
  tableControl.setSortDirection(direction);
}