Merge "Bug 549183: [Model2Doc] Tree table import doesn't work when there is only one column"
diff --git a/plugins/integration/nattable/org.eclipse.papyrus.model2doc.integration.nattable.template2structure/OSGI-INF/l10n/bundle.properties b/plugins/integration/nattable/org.eclipse.papyrus.model2doc.integration.nattable.template2structure/OSGI-INF/l10n/bundle.properties
index 8a6e5f8..a8cccd4 100755
--- a/plugins/integration/nattable/org.eclipse.papyrus.model2doc.integration.nattable.template2structure/OSGI-INF/l10n/bundle.properties
+++ b/plugins/integration/nattable/org.eclipse.papyrus.model2doc.integration.nattable.template2structure/OSGI-INF/l10n/bundle.properties
@@ -1,3 +1,3 @@
 #Properties file for org.eclipse.papyrus.model2doc.integration.nattable.template2structure
 Bundle-Vendor = Eclipse Modeling Project
-Bundle-Name = Papyrus-Model2Doc - Nattable Template2structure Integration (Incubation)
\ No newline at end of file
+Bundle-Name = Papyrus-Model2Doc - NatTable Template2structure Integration (Incubation)
\ No newline at end of file
diff --git a/plugins/integration/nattable/org.eclipse.papyrus.model2doc.integration.nattable.template2structure/src/org/eclipse/papyrus/model2doc/integration/nattable/template2structure/internal/mapping/PapyrusTableViewMapper.java b/plugins/integration/nattable/org.eclipse.papyrus.model2doc.integration.nattable.template2structure/src/org/eclipse/papyrus/model2doc/integration/nattable/template2structure/internal/mapping/PapyrusTableViewMapper.java
index 2724027..f23ccc8 100755
--- a/plugins/integration/nattable/org.eclipse.papyrus.model2doc.integration.nattable.template2structure/src/org/eclipse/papyrus/model2doc/integration/nattable/template2structure/internal/mapping/PapyrusTableViewMapper.java
+++ b/plugins/integration/nattable/org.eclipse.papyrus.model2doc.integration.nattable.template2structure/src/org/eclipse/papyrus/model2doc/integration/nattable/template2structure/internal/mapping/PapyrusTableViewMapper.java
@@ -10,7 +10,7 @@
  *
  * Contributors:
  *    Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
+ *    Vincent Lorenzo (CEA LIST) - bug 549183
  *****************************************************************************/
 
 package org.eclipse.papyrus.model2doc.integration.nattable.template2structure.internal.mapping;
@@ -304,10 +304,19 @@
 
 			// 8.2 add the body cells for the row
 			final CellIterator cellIterator = rowIterator.next();
-			while (cellIterator.hasNext()) {
-				final TextCell cell = DocumentStructureFactory.eINSTANCE.createExtendedTextCell();
-				cell.setText(cellIterator.next());
-				row.getCells().add(cell);
+			if (cellIterator != null) {
+				if (!cellIterator.hasNext()) {
+					// in case of tree table with only one column, the empty cells are not in the cellIterator...
+					// see bug 549183
+					final TextCell cell = DocumentStructureFactory.eINSTANCE.createExtendedTextCell();
+					row.getCells().add(cell);
+				} else {
+					while (cellIterator.hasNext()) {
+						final TextCell cell = DocumentStructureFactory.eINSTANCE.createExtendedTextCell();
+						cell.setText(cellIterator.next());
+						row.getCells().add(cell);
+					}
+				}
 			}
 		}
 		return basicTable;