Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2014-03-11 15:12:38 +0000
committerVincent Lorenzo2014-03-11 15:12:38 +0000
commitddb195962ee95a35451aeab77264639aef586085 (patch)
treea75fabdf729dfa8cb539ac9792f24d4054c932dd
parentb740c91e47696af9ce99dff6ae6eb5e4c969135a (diff)
downloadorg.eclipse.papyrus-ddb195962ee95a35451aeab77264639aef586085.tar.gz
org.eclipse.papyrus-ddb195962ee95a35451aeab77264639aef586085.tar.xz
org.eclipse.papyrus-ddb195962ee95a35451aeab77264639aef586085.zip
430115: [Table2] Paste/Import must be possible when the number of
columns is not the same in the table and in the clipboard/file https://bugs.eclipse.org/bugs/show_bug.cgi?id=430115
-rw-r--r--extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInNattableManager.java14
-rw-r--r--extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java2
-rw-r--r--extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties1
3 files changed, 15 insertions, 2 deletions
diff --git a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInNattableManager.java b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInNattableManager.java
index 13bfe2307be..c1f689580fd 100644
--- a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInNattableManager.java
+++ b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInNattableManager.java
@@ -239,6 +239,7 @@ public abstract class AbstractPasteImportInNattableManager {
* a status indicating if the first line of the file allows to do the paste
*/
private IStatus verifyColumnCountOnFirstLine(final INattableModelManager tableManager, final Reader reader) {
+ final int axisCount = tableManager.getColumnCount();
CSVParser parser = this.pasteHelper.createParser(reader);
//we verify the nb of columns
final RowIterator rowIter = parser.parse();
@@ -250,12 +251,21 @@ public abstract class AbstractPasteImportInNattableManager {
nbCell++;
}
}
- final int axisCount = tableManager.getColumnCount();
+ //430115: [Table2] Paste/Import must be possible when the number of columns is not the same in the table and in the clipboard/file
+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=430115
+ if(axisCount == 0) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.AbstractPasteImportInNattableManager_TheTableDoesntHaveColumns);
+ }
+ //commented because the next line could have data
+ // if(nbCell == 0) {
+ // return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Your data doesn't have cell on the first row");
+ // }
if(axisCount == nbCell) {
return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.AbstractPasteImportInNattableManager_NumberOfColumnsAreEquals);
} else {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.AbstractPasteImportInNattableManager_NumberOfColumnsAreNotEquals, nbCell, axisCount));
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, NLS.bind(Messages.AbstractPasteImportInNattableManager_NumberOfColumnsAreNotEquals, nbCell, axisCount));
}
+
}
diff --git a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
index 2ee63196322..eec308428a3 100644
--- a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
+++ b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
@@ -59,6 +59,8 @@ public class Messages extends NLS {
public static String AbstractPasteImportInNattableManager_TheTableCantCreateElement;
+ public static String AbstractPasteImportInNattableManager_TheTableDoesntHaveColumns;
+
public static String AbstractPasteImportInNattableManager_TheTableHasAConfigurationToPaste;
public static String AbstractPasteImportInNattableManager_TheUserChosesToPasteColumns;
diff --git a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
index 4c646b3cda0..31a35e4fdb6 100644
--- a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
+++ b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
@@ -16,6 +16,7 @@ AbstractPasteImportInNattableManager_TheContextOfTheTableHasNotTheContainmentFea
AbstractPasteImportInNattableManager_TheContextOfTheTableHasTheContainmentFeatureDefinedForThePaste=The context of the table has the containment feature defined for the paste
AbstractPasteImportInNattableManager_TheTableCanCreateElement=The table can create {0} as {1}
AbstractPasteImportInNattableManager_TheTableCantCreateElement=The table can't create {0} as {1}
+AbstractPasteImportInNattableManager_TheTableDoesntHaveColumns=The table doesn't have columns
AbstractPasteImportInNattableManager_TheTableHasAConfigurationToPaste=The table has a configuration to paste {0}.
AbstractPasteImportInNattableManager_TheUserChosesToPasteColumns=The user has chosen to paste columns.
AbstractPasteImportInNattableManager_TheUserChosesToPasteRows=The user has chosen to paste rows.

Back to the top