if (firstRowIsHeader)
{
if (rowIterator.hasNext())
{
final Row headerRow = (Row) rowIterator.next();
final short cellCount = headerRow.getLastCellNum();
for (short colIdx = 0; colIdx < cellCount; colIdx++)
{
final Cell cell = headerRow.getCell(colIdx);
if (cell != null)
{
while (colIdx > tableModel.getColumnCount())
{
tableModel.addColumn(Messages.getString("TableDataSourceEditor.Column",
String.valueOf(tableModel.getColumnCount())), Object.class);
}
final RichTextString string = cell.getRichStringCellValue();
if (string != null)
{
tableModel.addColumn(string.getString(), Object.class);
}
else
{
tableModel.addColumn(Messages.getString("TableDataSourceEditor.Column", String.valueOf(colIdx)), Object.class);
}
}
}
}
}
Object[] rowData = null;
while (rowIterator.hasNext())
{
final Row row = (Row) rowIterator.next();
final short cellCount = row.getLastCellNum();
if (cellCount == -1)
{
continue;
}
if (rowData == null || rowData.length != cellCount)
{
rowData = new Object[cellCount];
}
for (short colIdx = 0; colIdx < cellCount; colIdx++)
{
final Cell cell = row.getCell(colIdx);
final Object value;
if (cell != null)
{
if (cell.getCellType() == Cell.CELL_TYPE_STRING)