Java Code Examples for org.eclipse.swt.widgets.TableItem#getParent()

The following examples show how to use org.eclipse.swt.widgets.TableItem#getParent() . 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 File: ChartMakerDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void update(@Nullable ViewerCell cell) {
    if (cell == null) {
        return;
    }

    /* Create a button if it doesn't exist */
    ChartSeriesDialog series = (ChartSeriesDialog) cell.getViewerRow().getElement();
    Button button = series.getButton();

    /* Set the position of the button into the cell */
    TableItem item = (TableItem) cell.getItem();
    TableEditor editor = new TableEditor(item.getParent());
    editor.grabHorizontal = true;
    editor.grabVertical = true;
    editor.setEditor(button, item, cell.getColumnIndex());
    editor.layout();
}
 
Example 2
Source File: CompositeFactory.java    From ermaster-b with 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 3
Source File: CompositeFactory.java    From erflute with Apache License 2.0 5 votes vote down vote up
public static TableEditor createCheckBoxTableEditor(TableItem tableItem, boolean selection, int column) {
    final Table table = tableItem.getParent();

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

    final 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 4
Source File: AbstractSection.java    From uima-uimaj with 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 5
Source File: AbstractSection.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Swap table items.
 *
 * @param itemBelow the item below
 * @param newSelection the new selection
 */
public static void swapTableItems(TableItem itemBelow, int newSelection) {
  Table parent = itemBelow.getParent();
  int i = getIndex(itemBelow);
  TableItem itemAbove = parent.getItems()[i - 1];
  TableItem newItemAbove = new TableItem(parent, SWT.NONE, i - 1);
  copyTableItem(newItemAbove, itemBelow);
  TableItem newItemBelow = new TableItem(parent, SWT.NONE, i);
  copyTableItem(newItemBelow, itemAbove);
  itemAbove.dispose();
  itemBelow.dispose();
  parent.setSelection(newSelection);
}
 
Example 6
Source File: CompositeFactory.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
public static TableEditor createCheckBoxTableEditor(final TableItem tableItem, final boolean selection, final int column) {
    final Table table = tableItem.getParent();

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

    final TableEditor editor = new TableEditor(table);

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

    checkBox.setSelection(selection);

    return editor;
}