Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2015-12-03 20:29:23 +0000
committerNicolas FAUVERGUE2015-12-07 13:24:02 +0000
commitc6530a062e243589efeb66ab152fb298528449cc (patch)
treef2878e26fcd8e53d852272ce547817969ee582ca
parenteac3ad1da3b2d45982bedbcbc3f6c7fdef8695d8 (diff)
downloadorg.eclipse.papyrus-c6530a062e243589efeb66ab152fb298528449cc.tar.gz
org.eclipse.papyrus-c6530a062e243589efeb66ab152fb298528449cc.tar.xz
org.eclipse.papyrus-c6530a062e243589efeb66ab152fb298528449cc.zip
Bug 476618: [Table] Improve the re-import mechanism in an existing table
https://bugs.eclipse.org/bugs/show_bug.cgi?id=476618 - Select the added rows for the old paste - Use the old paste when the rows header are pasted - Add the possibility of repeat the single row pasted when columns are selected (+ JUnit tests). - Change the insert icon. Change-Id: I4ed74b29fade6e1f6fc740f8b3322453f3f7be81 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml2
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInNattableManager.java41
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/AbstractPasteInSelectionNattableCommandProvider.java39
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/PasteEObjectAxisInNattableCommandProvider.java33
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/PasteEObjectTreeAxisInNattableCommandProvider.java34
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteCellsOverwriteAll_H1_H1_H1_MultiColumns_Test.notation2
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.di2
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.notation71
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.uml15
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_Initial.txt12
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_Result.txt12
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_ToCopy.txt13
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test_Result.txt24
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test_ToCopy.txt13
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.java49
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteRowsOverwriteFailColumns_H1_H1_H1_MultiColumns_Test.java4
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteRowsOverwriteFailRows_H1_H1_H1_MultiColumns_Test.java4
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AllTests.java2
18 files changed, 311 insertions, 61 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
index c79511dd034..02fb532e27f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
@@ -1758,7 +1758,7 @@
</image>
<image
commandId="org.eclipse.papyrus.infra.nattable.row.insert"
- icon="icons/insert_row.gif">
+ icon="icons/insert.gif">
</image>
<image
commandId="org.eclipse.papyrus.infra.nattable.insert"
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 9eeb387fa59..a9dc9833105 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
@@ -439,28 +439,30 @@ public abstract class AbstractPasteImportInNattableManager extends AbstractPaste
IStatus resultStatus = Status.OK_STATUS;
PasteNattableCommandProvider commandProvider = null;
- if (null != tableSelectionWrapper) {
+
+ if (!isPasteWithOverwrite) {
switch (status.getPasteMode()) {
case PASTE_EOBJECT_ROW:
- commandProvider = new PasteInSelectionTreeNattableCommandProvider(manager, false, false, reader, this.pasteHelper, this.tableSelectionWrapper, this.preferredUserAction, totalSize);
- break;
- case PASTE_EOBJECT_COLUMN:
- commandProvider = new PasteInSelectionTreeNattableCommandProvider(manager, true, false, reader, this.pasteHelper, this.tableSelectionWrapper, this.preferredUserAction, totalSize);
+ commandProvider = new PasteEObjectTreeAxisInNattableCommandProvider(manager, false, reader, this.pasteHelper, totalSize);
break;
default:
break;
}
- } else if (isPasteWithOverwrite) {
- commandProvider = new PasteInSelectionTreeNattableCommandProvider(manager, PasteModeEnumeration.PASTE_EOBJECT_COLUMN.equals(status.getPasteMode()), true, reader, this.pasteHelper, this.tableSelectionWrapper, this.preferredUserAction, totalSize);
- } else {
+ } else if (null != tableSelectionWrapper) {
switch (status.getPasteMode()) {
case PASTE_EOBJECT_ROW:
- commandProvider = new PasteEObjectTreeAxisInNattableCommandProvider(manager, false, reader, this.pasteHelper, totalSize);
+ commandProvider = new PasteInSelectionTreeNattableCommandProvider(manager, false, false, reader, this.pasteHelper, this.tableSelectionWrapper, this.preferredUserAction, totalSize);
+ break;
+ case PASTE_EOBJECT_COLUMN:
+ commandProvider = new PasteInSelectionTreeNattableCommandProvider(manager, true, false, reader, this.pasteHelper, this.tableSelectionWrapper, this.preferredUserAction, totalSize);
break;
default:
break;
}
+ } else {
+ commandProvider = new PasteInSelectionTreeNattableCommandProvider(manager, PasteModeEnumeration.PASTE_EOBJECT_COLUMN.equals(status.getPasteMode()), true, reader, this.pasteHelper, this.tableSelectionWrapper, this.preferredUserAction, totalSize);
}
+
if (null != commandProvider) {
resultStatus = commandProvider.executePasteFromStringCommand(useProgressMonitorDialog, openDialog);
}
@@ -488,29 +490,30 @@ public abstract class AbstractPasteImportInNattableManager extends AbstractPaste
IStatus resultStatus = Status.OK_STATUS;
PasteNattableCommandProvider commandProvider = null;
- if (null != tableSelectionWrapper) {
+
+ if (!isPasteWithOverwrite) {
switch (status.getPasteMode()) {
case PASTE_EOBJECT_ROW:
- commandProvider = new PasteInSelectionNattableCommandProvider(manager, false, false, reader, pasteHelper, tableSelectionWrapper, this.preferredUserAction, totalSize);
- break;
- case PASTE_EOBJECT_COLUMN:
- commandProvider = new PasteInSelectionNattableCommandProvider(manager, true, false, reader, pasteHelper, tableSelectionWrapper, this.preferredUserAction, totalSize);
+ commandProvider = new PasteEObjectAxisInNattableCommandProvider(manager, false, reader, this.pasteHelper, totalSize);
break;
default:
break;
}
- }else if (isPasteWithOverwrite) {
- commandProvider = new PasteInSelectionNattableCommandProvider(manager, PasteModeEnumeration.PASTE_EOBJECT_COLUMN.equals(status.getPasteMode()), true, reader, pasteHelper, tableSelectionWrapper, this.preferredUserAction, totalSize);
- } else {
+ } else if (null != tableSelectionWrapper) {
switch (status.getPasteMode()) {
case PASTE_EOBJECT_ROW:
- commandProvider = new PasteEObjectAxisInNattableCommandProvider(manager, false, reader, this.pasteHelper, totalSize);
+ commandProvider = new PasteInSelectionNattableCommandProvider(manager, false, false, reader, pasteHelper, tableSelectionWrapper, this.preferredUserAction, totalSize);
+ break;
+ case PASTE_EOBJECT_COLUMN:
+ commandProvider = new PasteInSelectionNattableCommandProvider(manager, true, false, reader, pasteHelper, tableSelectionWrapper, this.preferredUserAction, totalSize);
break;
default:
break;
}
+ } else {
+ commandProvider = new PasteInSelectionNattableCommandProvider(manager, PasteModeEnumeration.PASTE_EOBJECT_COLUMN.equals(status.getPasteMode()), true, reader, pasteHelper, tableSelectionWrapper, this.preferredUserAction, totalSize);
}
-
+
if (commandProvider != null) {
resultStatus = commandProvider.executePasteFromStringCommand(useProgressMonitorDialog, openDialog);
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/AbstractPasteInSelectionNattableCommandProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/AbstractPasteInSelectionNattableCommandProvider.java
index 95bd8af6471..0fa98359124 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/AbstractPasteInSelectionNattableCommandProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/AbstractPasteInSelectionNattableCommandProvider.java
@@ -663,7 +663,34 @@ public abstract class AbstractPasteInSelectionNattableCommandProvider implements
if (IStatus.ERROR != canPasteStatus.getSeverity()) {
resultCommand = getPasteColumnsFromStringCommand(contextEditingDomain, tableEditingDomain, fullySelectedColumns, openDialog, progressMonitor, sharedMap, attachedMode);
} else {
- resultCommand = new ErrorTransactionalCommand(contextEditingDomain, PASTE_COMMAND_NAME, null, canPasteStatus);
+ // If only one row is pasted in the columns,
+ // transpose the pastedValues to try to repeat for each row in the table
+ final Map<Object, List<String>> returnedPastedValues = new LinkedHashMap<Object, List<String>>();
+ if(!pastedValues.isEmpty()){
+ for(Object o : pastedValues.keySet()){
+ int i = 0;
+ for(String s : pastedValues.get(o)){
+ if(null == returnedPastedValues.get(i)){
+ returnedPastedValues.put(i, new ArrayList<String>());
+ }
+ returnedPastedValues.get(i).add(s);
+ i++;
+ }
+ }
+ pastedValues = returnedPastedValues;
+
+ // The number of columns must be the same to repeat it
+ if(pastedValues.size() == 1 && fullySelectedColumns.size() == pastedValues.get(pastedValues.keySet().iterator().next()).size()){
+ this.isSingleAxisPasted = true;
+ this.numberSelectedAxis = tableManager.getBodyLayerStack().getRowHideShowLayer().getRowCount();
+ resultCommand = getPasteCellsRowFromStringCommand(contextEditingDomain, tableEditingDomain, tableSelectionWrapper.getSelectedCells(), openDialog, progressMonitor, sharedMap, attachedMode);
+ }
+ }
+
+ // If we can't repeat (not only one line or not the same number of columns), return the error message
+ if(null == resultCommand){
+ resultCommand = new ErrorTransactionalCommand(contextEditingDomain, PASTE_COMMAND_NAME, null, canPasteStatus);
+ }
}
} else {
final Collection<PositionCoordinate> selectedCells = tableSelectionWrapper.getSelectedCells();
@@ -892,11 +919,6 @@ public abstract class AbstractPasteInSelectionNattableCommandProvider implements
pastedValues.get(nbColumnReadByRow).add(cellIter.next());
nbColumnReadByRow++;
}
- } else {
- if (null == pastedValues.get(nbColumnReadByRow)) {
- pastedValues.put(nbColumnReadByRow, new ArrayList<String>());
- }
- pastedValues.get(nbColumnReadByRow).add(null);
}
nbColumnRead = nbColumnRead >= nbColumnReadByRow ? nbColumnRead : nbColumnReadByRow;
nbRowRead++;
@@ -910,7 +932,10 @@ public abstract class AbstractPasteInSelectionNattableCommandProvider implements
// - The rows numbers are not equals -> Error
// - The column read is alone -> Continue and repeat the column pasted
// - The columns numbers are not equals -> Error
- if (nbRowRead != nbRowsSelected) {
+ /*if (1 == nbRowRead && nbColumnsSelected == nbColumnRead){
+ this.isSingleAxisPasted = true;
+ this.numberSelectedAxis = nbRowsSelected;
+ }else*/ if (nbRowRead != nbRowsSelected) {
result = new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.AbstractPasteInSelectionNattableCommandProvider_readrowsexceedsexistingrows);
} else if (1 == nbColumnRead && 1 < nbColumnsSelected) {
this.isSingleAxisPasted = true;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/PasteEObjectAxisInNattableCommandProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/PasteEObjectAxisInNattableCommandProvider.java
index c5e457b0968..6d3ea044367 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/PasteEObjectAxisInNattableCommandProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/PasteEObjectAxisInNattableCommandProvider.java
@@ -55,6 +55,8 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCo
import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
+import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.infra.nattable.Activator;
@@ -286,8 +288,10 @@ public class PasteEObjectAxisInNattableCommandProvider implements PasteNattableC
CheckedOperationHistory.getInstance().execute(pasteCommand, new NullProgressMonitor(), null);
} catch (final ExecutionException e) {
Activator.log.error(e);
+ } finally {
+ sharedMap.clear();
+ tableManager = null;
}
- sharedMap.clear();
} else {
// we create a job in order to don't freeze the UI
final UIJob job = new UIJob(pasteJobName) {
@@ -297,21 +301,33 @@ public class PasteEObjectAxisInNattableCommandProvider implements PasteNattableC
final ICommand pasteCommand = getPasteFromStringCommandInDetachedMode(contextEditingDomain, tableEditingDomain, monitor, sharedMap);
if (pasteCommand == null) {
+ tableManager = null;
return new Status(IStatus.CANCEL, Activator.PLUGIN_ID, PASTE_COMMAND_HAS_BEEN_CANCELLED);
}
// we execute the paste command
if (pasteCommand.canExecute()) {
try {
+ int initialRowsSize = tableManager.getBodyLayerStack().getRowHideShowLayer().getRowCount();
+
CheckedOperationHistory.getInstance().execute(pasteCommand, monitor, null);
+
+
+ int finalRowsSize = tableManager.getBodyLayerStack().getRowHideShowLayer().getRowCount();
+
+ final SelectionLayer selectionLayer = tableManager.getBodyLayerStack().getSelectionLayer();
+ selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, initialRowsSize, false, false));
+ selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, finalRowsSize, true, false));
} catch (final ExecutionException e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "An exception occured during the paste", e); //$NON-NLS-1$
} finally {
+ tableManager = null;
sharedMap.clear();
}
monitor.done();
return Status.OK_STATUS;
} else {
sharedMap.clear();
+ tableManager = null;
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, PASTE_COMMAND_CANT_BE_EXECUTED);
}
}
@@ -333,6 +349,8 @@ public class PasteEObjectAxisInNattableCommandProvider implements PasteNattableC
CheckedOperationHistory.getInstance().execute(pasteCommand, new NullProgressMonitor(), null);
} catch (final ExecutionException e) {
Activator.log.error(e);
+ } finally {
+ tableManager = null;
}
} else {
// we create a job in order to don't freeze the UI
@@ -343,18 +361,30 @@ public class PasteEObjectAxisInNattableCommandProvider implements PasteNattableC
final ICommand pasteCommand = getPasteFromStringCommandInAttachedMode(contextEditingDomain, tableEditingDomain, monitor);
if (pasteCommand == null) {
+ tableManager = null;
return new Status(IStatus.CANCEL, Activator.PLUGIN_ID, PASTE_COMMAND_HAS_BEEN_CANCELLED);
}
// we execute the paste command
if (pasteCommand.canExecute()) {
try {
+ int initialRowsSize = tableManager.getBodyLayerStack().getRowHideShowLayer().getRowCount();
+
CheckedOperationHistory.getInstance().execute(pasteCommand, monitor, null);
+
+ int finalRowsSize = tableManager.getBodyLayerStack().getRowHideShowLayer().getRowCount();
+
+ final SelectionLayer selectionLayer = tableManager.getBodyLayerStack().getSelectionLayer();
+ selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, initialRowsSize, false, false));
+ selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, finalRowsSize, true, false));
} catch (final ExecutionException e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "An exception occured during the paste", e); //$NON-NLS-1$
+ } finally {
+ tableManager = null;
}
monitor.done();
return Status.OK_STATUS;
} else {
+ tableManager = null;
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, PASTE_COMMAND_CANT_BE_EXECUTED);
}
}
@@ -846,7 +876,6 @@ public class PasteEObjectAxisInNattableCommandProvider implements PasteNattableC
*/
private void localDispose() {
this.isDisposed = true;
- this.tableManager = null;
this.typeToCreate = null;
this.containmentFeature = null;
for (final AbstractStringValueConverter current : existingConverters.values()) {
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/PasteEObjectTreeAxisInNattableCommandProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/PasteEObjectTreeAxisInNattableCommandProvider.java
index 1da8b6c3147..01e23170c53 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/PasteEObjectTreeAxisInNattableCommandProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/PasteEObjectTreeAxisInNattableCommandProvider.java
@@ -48,6 +48,8 @@ import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
+import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
@@ -396,8 +398,10 @@ public class PasteEObjectTreeAxisInNattableCommandProvider implements PasteNatta
CheckedOperationHistory.getInstance().execute(pasteCommand, new NullProgressMonitor(), null);
} catch (final ExecutionException e) {
Activator.log.error(e);
+ } finally {
+ sharedMap.clear();
+ this.tableManager = null;
}
- sharedMap.clear();
} else {
// we create a job in order to don't freeze the UI
final UIJob job = new UIJob(pasteJobName) {
@@ -407,20 +411,32 @@ public class PasteEObjectTreeAxisInNattableCommandProvider implements PasteNatta
final ICommand pasteCommand = getPasteFromStringCommandInDetachedMode(contextEditingDomain, tableEditingDomain, monitor, sharedMap);
if (pasteCommand == null) {
+ tableManager = null;
return new Status(IStatus.CANCEL, Activator.PLUGIN_ID, PASTE_COMMAND_HAS_BEEN_CANCELLED);
}
// we execute the paste command
if (pasteCommand.canExecute()) {
try {
+ int initialRowsSize = tableManager.getBodyLayerStack().getRowHideShowLayer().getRowCount();
+
CheckedOperationHistory.getInstance().execute(pasteCommand, monitor, null);
+
+ int finalRowsSize = tableManager.getBodyLayerStack().getRowHideShowLayer().getRowCount();
+
+ final SelectionLayer selectionLayer = tableManager.getBodyLayerStack().getSelectionLayer();
+ selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, initialRowsSize, false, false));
+ selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, finalRowsSize, true, false));
} catch (final ExecutionException e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "An exception occured during the paste", e); //$NON-NLS-1$
} finally {
+ tableManager = null;
sharedMap.clear();
}
+
monitor.done();
return Status.OK_STATUS;
} else {
+ tableManager = null;
sharedMap.clear();
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, PASTE_COMMAND_CANT_BE_EXECUTED);
}
@@ -446,6 +462,8 @@ public class PasteEObjectTreeAxisInNattableCommandProvider implements PasteNatta
CheckedOperationHistory.getInstance().execute(pasteCommand, new NullProgressMonitor(), null);
} catch (final ExecutionException e) {
Activator.log.error(e);
+ } finally {
+ this.tableManager = null;
}
} else {
// we create a job in order to don't freeze the UI
@@ -456,22 +474,33 @@ public class PasteEObjectTreeAxisInNattableCommandProvider implements PasteNatta
final ICommand pasteCommand = getPasteFromStringCommandInAttachedMode(contextEditingDomain, tableEditingDomain, monitor);
if (pasteCommand == null) {
+ tableManager = null;
return new Status(IStatus.CANCEL, Activator.PLUGIN_ID, PASTE_COMMAND_HAS_BEEN_CANCELLED);
}
// we execute the paste command
if (pasteCommand.canExecute()) {
try {
-
+ int initialRowsSize = tableManager.getBodyLayerStack().getRowHideShowLayer().getRowCount();
final EMFCommandOperation op = new EMFCommandOperation(contextEditingDomain, new GMFtoEMFCommandWrapper(pasteCommand));
// EMFOperationCommand c = new EMFOperationCommand(contextEditingDomain, pasteCommand);
CheckedOperationHistory.getInstance().execute(op, monitor, null);
+
+ int finalRowsSize = tableManager.getBodyLayerStack().getRowHideShowLayer().getRowCount();
+
+ final SelectionLayer selectionLayer = tableManager.getBodyLayerStack().getSelectionLayer();
+ selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, initialRowsSize, false, false));
+ selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, finalRowsSize, true, false));
} catch (final Exception e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "An exception occured during the paste", e); //$NON-NLS-1$
+ } finally {
+ tableManager = null;
}
+
monitor.done();
return Status.OK_STATUS;
} else {
+ tableManager = null;
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, PASTE_COMMAND_CANT_BE_EXECUTED);
}
}
@@ -1182,7 +1211,6 @@ public class PasteEObjectTreeAxisInNattableCommandProvider implements PasteNatta
*/
private void localDispose() {
this.isDisposed = true;
- this.tableManager = null;
for (final AbstractStringValueConverter current : existingConverters.values()) {
current.dispose();
}
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteCellsOverwriteAll_H1_H1_H1_MultiColumns_Test.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteCellsOverwriteAll_H1_H1_H1_MultiColumns_Test.notation
index 42512ff0774..befa05a1803 100644
--- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteCellsOverwriteAll_H1_H1_H1_MultiColumns_Test.notation
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteCellsOverwriteAll_H1_H1_H1_MultiColumns_Test.notation
@@ -47,7 +47,7 @@
</axisUsedAsAxisProvider>
<labelProvider xmi:type="nattablelabelprovider:FeatureLabelProviderConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@rowHeaderAxisConfiguration/@ownedLabelConfigurations.1"/>
</ownedAxisConfigurations>
- <ownedAxisConfigurations xmi:type="nattableaxisconfiguration:PasteEObjectConfiguration" xmi:id="_BOaEMHufEeSTu_GUJ96b9g" pastedElementId="org.eclipse.papyrus.uml.Class">
+ <ownedAxisConfigurations xmi:type="nattableaxisconfiguration:PasteEObjectConfiguration" xmi:id="_BOaEMHufEeSTu_GUJ96b9g" detachedMode="false" pastedElementId="org.eclipse.papyrus.uml.Class">
<pasteElementContainementFeature xmi:type="ecore:EReference" href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/>
<axisIdentifier xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_vxwyIILREeWLaq02JKSl_g">
<manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.di b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.notation
new file mode 100644
index 00000000000..71d049d3eb9
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.notation
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nattable:Table xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattable="http://www.eclipse.org/papyrus/nattable/model" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider" xmlns:nattablestyle="http://www.eclipse.org/papyrus/nattable/model/table/nattablestyle" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis http://www.eclipse.org/papyrus/nattable/model#//nattableaxis http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration http://www.eclipse.org/papyrus/nattable/model#//nattableaxisconfiguration http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider http://www.eclipse.org/papyrus/nattable/model#//nattableaxisprovider http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration http://www.eclipse.org/papyrus/nattable/model#//nattableconfiguration http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider http://www.eclipse.org/papyrus/nattable/model#//nattablelabelprovider http://www.eclipse.org/papyrus/nattable/model/table/nattablestyle http://www.eclipse.org/papyrus/nattable/model#//nattablestyle" xmi:id="_zDRtIHucEeSTu_GUJ96b9g" name="ClassTreeTable0" currentRowAxisProvider="_zDRtI3ucEeSTu_GUJ96b9g" currentColumnAxisProvider="_zDRtIXucEeSTu_GUJ96b9g">
+ <styles xmi:type="nattablestyle:IntListValueStyle" xmi:id="_6gzOoHucEeSTu_GUJ96b9g" name="hiddenCategoriesByDepth">
+ <intListValue>0</intListValue>
+ <intListValue>1</intListValue>
+ <intListValue>2</intListValue>
+ </styles>
+ <context xmi:type="uml:Model" href="PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.uml#_yDlxwHucEeSTu_GUJ96b9g"/>
+ <owner xmi:type="uml:Model" href="PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.uml#_yDlxwHucEeSTu_GUJ96b9g"/>
+ <prototype xmi:type="configuration:PapyrusSyncTable" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/classTreeTable.configuration#_P3J1cEr7EeSVGbM3cmVSqQ"/>
+ <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#/"/>
+ <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_zDRtIXucEeSTu_GUJ96b9g" description="This axis provider provides available columns according to the rows of the table (features of the object displayed on the other axis)" name="UML Feature axis provider">
+ <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_Yk1o8mZzEeSDCaDFwPGYVw">
+ <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/>
+ <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement/name"/>
+ </axis>
+ <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_c9OSsHrxEeSFP8xW-pegcg">
+ <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/>
+ <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement/visibility"/>
+ </axis>
+ <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_c9O5wXrxEeSFP8xW-pegcg">
+ <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/>
+ <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//Parameter/direction"/>
+ </axis>
+ <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_c9O5wHrxEeSFP8xW-pegcg">
+ <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/>
+ <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//RedefinableElement/isLeaf"/>
+ </axis>
+ <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_cJYNEGlFEeWEcZU4lwyzjA">
+ <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/>
+ <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier/isAbstract"/>
+ </axis>
+ <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_cJYNEWlFEeWEcZU4lwyzjA">
+ <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/>
+ <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class/isActive"/>
+ </axis>
+ </columnAxisProvidersHistory>
+ <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_zDRtI3ucEeSTu_GUJ96b9g" description="This axis provider manages the rows, according to the wanted hierarchy" name="HierarchicalRowaAxisManager" disconnectSlave="true"/>
+ <localRowHeaderAxisConfiguration xmi:type="nattableaxisconfiguration:LocalTableHeaderAxisConfiguration" xmi:id="_0T5ngHucEeSTu_GUJ96b9g" indexStyle="NUMERIC">
+ <ownedAxisConfigurations xmi:type="nattableaxisconfiguration:TreeFillingConfiguration" xmi:id="_0T6OkXucEeSTu_GUJ96b9g" pasteConfiguration="_BOaEMHufEeSTu_GUJ96b9g" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.treefilling.feature.labelprovider">
+ <axisUsedAsAxisProvider xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_0T6OknucEeSTu_GUJ96b9g">
+ <element xmi:type="ecore:EReference" href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/>
+ </axisUsedAsAxisProvider>
+ <labelProvider xmi:type="nattablelabelprovider:FeatureLabelProviderConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@rowHeaderAxisConfiguration/@ownedLabelConfigurations.1"/>
+ </ownedAxisConfigurations>
+ <ownedAxisConfigurations xmi:type="nattableaxisconfiguration:TreeFillingConfiguration" xmi:id="_0T6Ok3ucEeSTu_GUJ96b9g" pasteConfiguration="_BOaEMnufEeSTu_GUJ96b9g" depth="1" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.treefilling.feature.labelprovider">
+ <axisUsedAsAxisProvider xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_0T6OlHucEeSTu_GUJ96b9g">
+ <element xmi:type="ecore:EReference" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class/ownedOperation"/>
+ </axisUsedAsAxisProvider>
+ <labelProvider xmi:type="nattablelabelprovider:FeatureLabelProviderConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@rowHeaderAxisConfiguration/@ownedLabelConfigurations.1"/>
+ </ownedAxisConfigurations>
+ <ownedAxisConfigurations xmi:type="nattableaxisconfiguration:TreeFillingConfiguration" xmi:id="_0T6OlXucEeSTu_GUJ96b9g" pasteConfiguration="_BOaENHufEeSTu_GUJ96b9g" depth="2" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.treefilling.feature.labelprovider">
+ <axisUsedAsAxisProvider xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_0T6OlnucEeSTu_GUJ96b9g">
+ <element xmi:type="ecore:EReference" href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioralFeature/ownedParameter"/>
+ </axisUsedAsAxisProvider>
+ <labelProvider xmi:type="nattablelabelprovider:FeatureLabelProviderConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@rowHeaderAxisConfiguration/@ownedLabelConfigurations.1"/>
+ </ownedAxisConfigurations>
+ <ownedAxisConfigurations xmi:type="nattableaxisconfiguration:PasteEObjectConfiguration" xmi:id="_BOaEMHufEeSTu_GUJ96b9g" pastedElementId="org.eclipse.papyrus.uml.Class">
+ <pasteElementContainementFeature xmi:type="ecore:EReference" href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/>
+ </ownedAxisConfigurations>
+ <ownedAxisConfigurations xmi:type="nattableaxisconfiguration:PasteEObjectConfiguration" xmi:id="_BOaEMnufEeSTu_GUJ96b9g" pastedElementId="org.eclipse.papyrus.uml.Operation">
+ <pasteElementContainementFeature xmi:type="ecore:EReference" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class/ownedOperation"/>
+ </ownedAxisConfigurations>
+ <ownedAxisConfigurations xmi:type="nattableaxisconfiguration:PasteEObjectConfiguration" xmi:id="_BOaENHufEeSTu_GUJ96b9g" pastedElementId="org.eclipse.papyrus.uml.Parameter">
+ <pasteElementContainementFeature xmi:type="ecore:EReference" href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioralFeature/ownedParameter"/>
+ </ownedAxisConfigurations>
+ <axisManagerConfigurations xmi:type="nattableaxisconfiguration:AxisManagerConfiguration" xmi:id="_0T6OkHucEeSTu_GUJ96b9g" localSpecificConfigurations="_0T6OkXucEeSTu_GUJ96b9g _0T6Ok3ucEeSTu_GUJ96b9g _0T6OlXucEeSTu_GUJ96b9g">
+ <axisManager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/>
+ </axisManagerConfigurations>
+ </localRowHeaderAxisConfiguration>
+</nattable:Table>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.uml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.uml
new file mode 100644
index 00000000000..60363f26ebe
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.uml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_yDlxwHucEeSTu_GUJ96b9g" name="model">
+ <packagedElement xmi:type="uml:Class" xmi:id="_wJSvoGX5EeWnIND9h9eQPg" name="Class1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_wJu0gGX5EeWnIND9h9eQPg" name="Class2"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_3CQOsGX9EeWnIND9h9eQPg" name="Class3"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_3CQ1wGX9EeWnIND9h9eQPg" name="Class4"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_3FuZcGX9EeWnIND9h9eQPg" name="Class5"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_3FvAgGX9EeWnIND9h9eQPg" name="Class6"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_3H5jsGX9EeWnIND9h9eQPg" name="Class7"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_3H5jsWX9EeWnIND9h9eQPg" name="Class8"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_3N0lgGX9EeWnIND9h9eQPg" name="Class9"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_3N1MkGX9EeWnIND9h9eQPg" name="Class10"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_3ViXEGX9EeWnIND9h9eQPg" name="Class11"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_3Vi-IGX9EeWnIND9h9eQPg" name="Class12"/>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_Initial.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_Initial.txt
new file mode 100644
index 00000000000..16b0030abf5
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_Initial.txt
@@ -0,0 +1,12 @@
+Class1 public N/A false false false
+Class2 public N/A false false false
+Class3 public N/A false false false
+Class4 public N/A false false false
+Class5 public N/A false false false
+Class6 public N/A false false false
+Class7 public N/A false false false
+Class8 public N/A false false false
+Class9 public N/A false false false
+Class10 public N/A false false false
+Class11 public N/A false false false
+Class12 public N/A false false false
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_Result.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_Result.txt
new file mode 100644
index 00000000000..83c88ef1d75
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_Result.txt
@@ -0,0 +1,12 @@
+Class1 public N/A true true true
+Class2 public N/A true true true
+Class3 public N/A true true true
+Class4 public N/A true true true
+Class5 public N/A true true true
+Class6 public N/A true true true
+Class7 public N/A true true true
+Class8 public N/A true true true
+Class9 public N/A true true true
+Class10 public N/A true true true
+Class11 public N/A true true true
+Class12 public N/A true true true
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_ToCopy.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_ToCopy.txt
new file mode 100644
index 00000000000..fc1727df4b7
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test_ToCopy.txt
@@ -0,0 +1,13 @@
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
+
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test_Result.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test_Result.txt
index 83c88ef1d75..e93eb1e2706 100644
--- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test_Result.txt
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test_Result.txt
@@ -1,12 +1,12 @@
-Class1 public N/A true true true
-Class2 public N/A true true true
-Class3 public N/A true true true
-Class4 public N/A true true true
-Class5 public N/A true true true
-Class6 public N/A true true true
-Class7 public N/A true true true
-Class8 public N/A true true true
-Class9 public N/A true true true
-Class10 public N/A true true true
-Class11 public N/A true true true
-Class12 public N/A true true true
+Class1 public N/A true false true
+Class2 public N/A true false true
+Class3 public N/A true false true
+Class4 public N/A true false true
+Class5 public N/A true false true
+Class6 public N/A true false true
+Class7 public N/A true false true
+Class8 public N/A true false true
+Class9 public N/A true false true
+Class10 public N/A true false true
+Class11 public N/A true false true
+Class12 public N/A true false true
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test_ToCopy.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test_ToCopy.txt
index fc1727df4b7..d558bc0002d 100644
--- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test_ToCopy.txt
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test_ToCopy.txt
@@ -1,13 +1,2 @@
-true
-true
-true
-true
-true
-true
-true
-true
-true
-true
-true
-true
+true false true
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.java
new file mode 100644
index 00000000000..e2c6cb87bd5
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite;
+
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.selection.command.ClearAllSelectionsCommand;
+import org.eclipse.nebula.widgets.nattable.selection.command.SelectColumnCommand;
+import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
+
+/**
+ * Test pastes overwrite all of selection with hidden categories when a single column is copied.
+ */
+public class PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test extends AbstractPasteColumnsOverwriteTest {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#removeClassName(java.lang.String)
+ */
+ @Override
+ public String removeClassName(final String className) throws Exception {
+ return className.replaceFirst("PasteColumnsOverwriteByOneColumn_", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Manage the selection with the shift key.
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#manageSelection(org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager)
+ */
+ @Override
+ public void manageSelection(final NattableModelManager manager) throws Exception {
+ final NatTable natTable = (NatTable) manager.getAdapter(NatTable.class);
+ natTable.doCommand(new ClearAllSelectionsCommand());
+ manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectColumnCommand(manager.getBodyLayerStack().getSelectionLayer(), 3, 0, false, false));
+ manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectColumnCommand(manager.getBodyLayerStack().getSelectionLayer(), 5, 0, true, false));
+ }
+}
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteRowsOverwriteFailColumns_H1_H1_H1_MultiColumns_Test.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteRowsOverwriteFailColumns_H1_H1_H1_MultiColumns_Test.java
index f22311ca0c1..98353cb80ae 100644
--- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteRowsOverwriteFailColumns_H1_H1_H1_MultiColumns_Test.java
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteRowsOverwriteFailColumns_H1_H1_H1_MultiColumns_Test.java
@@ -14,7 +14,7 @@
package org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.nebula.widgets.nattable.selection.command.SelectColumnCommand;
+import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand;
import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
import org.eclipse.papyrus.infra.nattable.messages.Messages;
import org.junit.Assert;
@@ -43,7 +43,7 @@ public class PasteRowsOverwriteFailColumns_H1_H1_H1_MultiColumns_Test extends Ab
@Override
public void manageSelection(final NattableModelManager manager) throws Exception {
super.manageSelection(manager);
- manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectColumnCommand(manager.getBodyLayerStack().getSelectionLayer(), 0, 11, true, false));
+ manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectRowsCommand(manager.getBodyLayerStack().getSelectionLayer(), 0, 11, true, false));
}
/**
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteRowsOverwriteFailRows_H1_H1_H1_MultiColumns_Test.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteRowsOverwriteFailRows_H1_H1_H1_MultiColumns_Test.java
index c194fff5a52..3a6db135f6a 100644
--- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteRowsOverwriteFailRows_H1_H1_H1_MultiColumns_Test.java
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteRowsOverwriteFailRows_H1_H1_H1_MultiColumns_Test.java
@@ -14,7 +14,7 @@
package org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.nebula.widgets.nattable.selection.command.SelectColumnCommand;
+import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand;
import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
import org.eclipse.papyrus.infra.nattable.messages.Messages;
import org.junit.Assert;
@@ -43,7 +43,7 @@ public class PasteRowsOverwriteFailRows_H1_H1_H1_MultiColumns_Test extends Abstr
@Override
public void manageSelection(final NattableModelManager manager) throws Exception {
super.manageSelection(manager);
- manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectColumnCommand(manager.getBodyLayerStack().getSelectionLayer(), 0, 10, true, false));
+ manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectRowsCommand(manager.getBodyLayerStack().getSelectionLayer(), 0, 10, true, false));
}
/**
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AllTests.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AllTests.java
index c1f8c290ec7..42f8fb593d9 100644
--- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AllTests.java
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AllTests.java
@@ -87,6 +87,7 @@ import org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.Paste
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.PasteCellsOverwriteFailRows_H1_H1_H1_MultiColumns_Test;
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.PasteColumnsOverwriteAll_H1_H1_H1_MultiColumns_Test;
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.PasteColumnsOverwriteAll_V1_V3_V1_MultiColumns_Test;
+import org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test;
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test;
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.PasteColumnsOverwriteFailColumns_H1_H1_H1_MultiColumns_Test;
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.PasteColumnsOverwriteFailRows_H1_H1_H1_MultiColumns_Test;
@@ -310,6 +311,7 @@ import org.junit.runners.Suite.SuiteClasses;
PasteColumnsOverwriteAll_H1_H1_H1_MultiColumns_Test.class,
PasteColumnsOverwriteAll_V1_V3_V1_MultiColumns_Test.class,
PasteColumnsOverwriteByOneLine_H1_H1_H1_MultiColumns_Test.class,
+ PasteColumnsOverwriteByOneColumn_H1_H1_H1_MultiColumns_Test.class,
PasteColumnsOverwriteFailColumns_H1_H1_H1_MultiColumns_Test.class,
PasteColumnsOverwriteFailRows_H1_H1_H1_MultiColumns_Test.class,

Back to the top