Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2014-03-11 15:13:39 +0000
committerVincent Lorenzo2014-03-11 15:13:39 +0000
commite677d8492683aeb279606c035a2c79cc148099e1 (patch)
tree6e81dcfdc157734a3af82594d94b49f964111ff7 /plugins/infra
parentc087f608e73e488c8e5a3cf116d95f3a96dbe3aa (diff)
downloadorg.eclipse.papyrus-e677d8492683aeb279606c035a2c79cc148099e1.tar.gz
org.eclipse.papyrus-e677d8492683aeb279606c035a2c79cc148099e1.tar.xz
org.eclipse.papyrus-e677d8492683aeb279606c035a2c79cc148099e1.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
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInNattableManager.java14
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java2
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties1
3 files changed, 15 insertions, 2 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInNattableManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInNattableManager.java
index 13bfe2307be..c1f689580fd 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInNattableManager.java
+++ b/plugins/infra/nattable/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/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
index 2ee63196322..eec308428a3 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
+++ b/plugins/infra/nattable/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/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
index 4c646b3cda0..31a35e4fdb6 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
+++ b/plugins/infra/nattable/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