for (int i=0; i<itemCount; i++) { TableItem item = items [i]; for (int j=columnCount-1; j>index; --j) {  item.setText (j, item.getText (j - 1)); item.setImage (j, item.getImage (j - 1)); } if (columnCount > 1) { item.setText (index, ""); item.setImage (index, null);
if (columnCount > 1) { for (int i=0; i<itemCount; i++) { TableItem item = items [i]; Image [] images = item.images; if (images != null) { Image [] temp = new Image [columnCount]; System.arraycopy (images, 0, temp, 0, index); System.arraycopy (images, index, temp, index+1, columnCount-index-1); items [i].images = temp; } String [] strings = item.strings; if (strings != null) { String [] temp = new String [columnCount]; System.arraycopy (strings, 0, temp, 0, index); System.arraycopy (strings, index, temp, index+1, columnCount-index-1); temp [index] = ""; items [i].strings = temp; }
void createItem (TableColumn column, int index) {	if (!(0 <= index && index <= columnCount)) error (SWT.ERROR_INVALID_RANGE);	column.id = COLUMN_ID + idCount++;	int position = index + ((style & SWT.CHECK) != 0 ? 1 : 0);	if (columnCount != 0) {		DataBrowserListViewColumnDesc desc = new DataBrowserListViewColumnDesc ();		desc.headerBtnDesc_version = OS.kDataBrowserListViewLatestHeaderDesc;		desc.propertyDesc_propertyID = column.id;		desc.propertyDesc_propertyType = OS.kDataBrowserCustomType;		desc.propertyDesc_propertyFlags = OS.kDataBrowserDefaultPropertyFlags;		desc.headerBtnDesc_maximumWidth = 0x7fff;		desc.headerBtnDesc_initialOrder = OS.kDataBrowserOrderIncreasing;		OS.AddDataBrowserListViewColumn (handle, desc, position);		OS.SetDataBrowserTableViewNamedColumnWidth (handle, column.id, (short)0);	} 	if (columnCount == columns.length) {		TableColumn [] newColumns = new TableColumn [columnCount + 4];		System.arraycopy (columns, 0, newColumns, 0, columns.length);		columns = newColumns;	}	System.arraycopy (columns, index, columns, index + 1, columnCount++ - index);	columns [index] = column;	//TODO - optimize	for (int i=0; i<itemCount; i++) {		TableItem item = items [i];		for (int j=columnCount-1; j>index; --j) {			// TODO - don't call setter			item.setText (j, item.getText (j - 1));			item.setImage (j, item.getImage (j - 1));		}		if (columnCount > 1) {					item.setText (index, "");			item.setImage (index, null);					Color [] cellBackground = items [i].cellBackground;			if (cellBackground != null) {				Color [] temp = new Color [columnCount];				System.arraycopy (cellBackground, 0, temp, 0, index);				System.arraycopy (cellBackground, index, temp, index+1, columnCount-index-1);				items [i].cellBackground = temp;			}			Color [] cellForeground = items [i].cellForeground;			if (cellForeground != null) {				Color [] temp = new Color [columnCount];				System.arraycopy (cellForeground, 0, temp, 0, index);				System.arraycopy (cellForeground, index, temp, index+1, columnCount-index-1);				items [i].cellForeground = temp;			}		}	}}