String text = getText (0);
String text = getText (0, false);
void computeDisplayText (int columnIndex, GC gc) {	int columnCount = parent.columns.length;	if (columnCount == 0) {		String text = getText (0);		textWidths [columnIndex] = gc.stringExtent (text).x;		return;	}	TableColumn column = parent.columns [columnIndex];	int availableWidth = column.width - 2 * parent.getCellPadding () - 2 * MARGIN_TEXT;	if (columnIndex == 0) {		availableWidth -= parent.col0ImageWidth;		if (parent.col0ImageWidth > 0) availableWidth -= Table.MARGIN_IMAGE;		if ((parent.style & SWT.CHECK) != 0) {			availableWidth -= parent.checkboxBounds.width;			availableWidth -= Table.MARGIN_IMAGE;		}	} else {		Image image = getImage (columnIndex);		if (image != null) {			availableWidth -= image.getBounds ().width;			availableWidth -= Table.MARGIN_IMAGE;		}	}	String text = getText (columnIndex);	int textWidth = gc.stringExtent (text).x;	if (textWidth <= availableWidth) {		displayTexts [columnIndex] = text;		textWidths [columnIndex] = textWidth;		return;	}	/* Ellipsis will be needed, so subtract their width from the available text width */	int ellipsisWidth = gc.stringExtent (Table.ELLIPSIS).x;	availableWidth -= ellipsisWidth;	if (availableWidth <= 0) {		displayTexts [columnIndex] = Table.ELLIPSIS;		textWidths [columnIndex] = ellipsisWidth;		return;	}	/* Make initial guess. */	int index = Math.min (availableWidth / gc.getFontMetrics ().getAverageCharWidth (), text.length ());	textWidth = gc.stringExtent (text.substring (0, index)).x;	/* Initial guess is correct. */	if (availableWidth == textWidth) {		displayTexts [columnIndex] = text.substring (0, index) + Table.ELLIPSIS;		textWidths [columnIndex] = textWidth + ellipsisWidth;		return;	}	/* Initial guess is too high, so reduce until fit is found. */	if (availableWidth < textWidth) {		do {			index--;			if (index < 0) {				displayTexts [columnIndex] = Table.ELLIPSIS;				textWidths [columnIndex] = ellipsisWidth;				return;			}			text = text.substring (0, index);			textWidth = gc.stringExtent (text).x;		} while (availableWidth < textWidth);		displayTexts [columnIndex] = text + Table.ELLIPSIS;		textWidths [columnIndex] = textWidth + ellipsisWidth;		return;	}		/* Initial guess is too low, so increase until overrun is found. */	int previousWidth = 0;	while (textWidth < availableWidth) {		index++;		previousWidth = textWidth;		textWidth = gc.stringExtent (text.substring (0, index)).x;	}	displayTexts [columnIndex] = text.substring (0, index - 1) + Table.ELLIPSIS;	textWidths [columnIndex] = previousWidth + ellipsisWidth;}