diff options
author | Nicolas FAUVERGUE | 2015-10-01 15:06:01 +0000 |
---|---|---|
committer | Nicolas FAUVERGUE | 2015-10-01 19:41:27 +0000 |
commit | 60594a14e427f92f8d07b81cedccec5db603d901 (patch) | |
tree | 4ed7de5d17e5ce25660c7702a40c5734634a32b3 | |
parent | f43b8ffa3b22b4aca1a01efceace352df23a2fe0 (diff) | |
download | org.eclipse.papyrus-60594a14e427f92f8d07b81cedccec5db603d901.tar.gz org.eclipse.papyrus-60594a14e427f92f8d07b81cedccec5db603d901.tar.xz org.eclipse.papyrus-60594a14e427f92f8d07b81cedccec5db603d901.zip |
Bug 476618: [Table] Improve the re-import mechanism in an existing table
https://bugs.eclipse.org/bugs/show_bug.cgi?id=476618
Correction of problems for flat tables.
+ JUnit tests on flat tables
Change-Id: Ia8bfc3a0fab1b4004428ef57fdfa63e84700ee59
Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
67 files changed, 1662 insertions, 40 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 206e2184587..a2bd7e4fbe7 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 @@ -142,13 +142,22 @@ public abstract class AbstractPasteImportInNattableManager { // // new PasteImportStatusDialog(Display.getDefault().getActiveShell(), INVERTED_MESSAGE).open(); // // return false; // } - final PasteEnablementStatus pasteStatus = findPasteModeFromTableConfiguration(this.tableManager); - if (pasteStatus.getPasteMode() == PasteModeEnumeration.PASTE_EOBJECT_ROW_OR_COLUMN) { - final boolean value = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), PasteImportStatusDialog.DIALOG_TITLE, Messages.AbstractPasteImportInNattableManager_WhatAreYouPasting); - if (value) { - pasteStatus.getColumnStatus().add(new Status(IStatus.CANCEL, Activator.PLUGIN_ID, Messages.AbstractPasteImportInNattableManager_TheUserChosesToPasteRows)); - } else { - pasteStatus.getRowStatus().add(new Status(IStatus.CANCEL, Activator.PLUGIN_ID, Messages.AbstractPasteImportInNattableManager_TheUserChosesToPasteColumns)); + + PasteEnablementStatus pasteStatus = null; + if (!isNeededPasteConfiguration()) { + // If the paste is a paste overwrite on cells, no need to check the paste configuration + final MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, Messages.AbstractPasteImportInNattableManager_NoPasteConfigurationNeeded, null); + status.add(new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.AbstractPasteImportInNattableManager_NoPasteConfigurationNeeded)); + pasteStatus = new PasteEnablementStatus(null, status); + } else { + pasteStatus = findPasteModeFromTableConfiguration(this.tableManager); + if (pasteStatus.getPasteMode() == PasteModeEnumeration.PASTE_EOBJECT_ROW_OR_COLUMN) { + final boolean value = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), PasteImportStatusDialog.DIALOG_TITLE, Messages.AbstractPasteImportInNattableManager_WhatAreYouPasting); + if (value) { + pasteStatus.getColumnStatus().add(new Status(IStatus.CANCEL, Activator.PLUGIN_ID, Messages.AbstractPasteImportInNattableManager_TheUserChosesToPasteRows)); + } else { + pasteStatus.getRowStatus().add(new Status(IStatus.CANCEL, Activator.PLUGIN_ID, Messages.AbstractPasteImportInNattableManager_TheUserChosesToPasteColumns)); + } } } final PasteModeEnumeration pasteMode = pasteStatus.getPasteMode(); @@ -173,6 +182,21 @@ public abstract class AbstractPasteImportInNattableManager { } /** + * Some paste actions don't need paste configuration. This methos allows to determinate if a paste configuration is needed for the paste action. + * + * @return <code>true</code> if a paste configuration is needed, <code>false</code> otherwise. + */ + protected boolean isNeededPasteConfiguration() { + boolean result = true; + + if (null != tableSelectionWrapper && tableSelectionWrapper.getFullySelectedColumns().isEmpty() && tableSelectionWrapper.getFullySelectedRows().isEmpty() && !tableSelectionWrapper.getSelectedCells().isEmpty()) { + result = false; + } + + return result; + } + + /** * Manage the status when can't paste. * * @param pasteStatus 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 c78fab1fbfa..297e7b3bc86 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 @@ -50,6 +50,8 @@ public class Messages extends NLS { public static String AbstractPasteImportInNattableManager_NoPasteConfiguration; public static String AbstractPasteImportInNattableManager_NoPasteConfiguration2; + + public static String AbstractPasteImportInNattableManager_NoPasteConfigurationNeeded; public static String AbstractPasteImportInNattableManager_NumberOfColumnsAreEquals; 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 5860aad265a..24ca05091e3 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 @@ -10,6 +10,7 @@ AbstractPasteImportInNattableManager_EnablementStatusForPasteInTheTable=Enableme AbstractPasteImportInNattableManager_INVERTED_MESSAGE=The axis of your table are inverted. This case is not yet managed. You must have elements as rows and features as columns. AbstractPasteImportInNattableManager_NoPasteConfiguration=Neither of the row paste configuration and column paste configuration allows to create elements in the table\n. AbstractPasteImportInNattableManager_NoPasteConfiguration2=Your table has no paste configuration +AbstractPasteImportInNattableManager_NoPasteConfigurationNeeded=No paste configuration is needed for this type of paste AbstractPasteImportInNattableManager_NumberOfColumnsAreEquals=The number of columns by rows is the same as the number of columns in the table AbstractPasteImportInNattableManager_NumberOfColumnsAreNotEquals=The number of columns by rows is not the same as the number of columns in the table.\n You are trying to paste {0} columns in a table which has {1} columns AbstractPasteImportInNattableManager_PasteColumnsError=\n Paste column error:\n\t 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 67f1ef99d7b..9e7e19f61ae 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 @@ -739,7 +739,10 @@ public abstract class AbstractPasteInSelectionNattableCommandProvider implements int realColumnIndex = columnHideShowLayer.getColumnIndexByPosition(nbColmnRead); // Get the row object and column attribute from their indexes - final Object rowElement = ((IAxis) tableManager.getRowElement(realRowIndex)).getElement(); + Object rowElement = tableManager.getRowElement(realRowIndex); + if(rowElement instanceof IAxis){ + rowElement = ((IAxis) rowElement).getElement(); + } final Object columnElement = tableManager.getColumnElement(realColumnIndex); // Edit the value if this is editable diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test.di b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_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/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test.notation b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test.notation new file mode 100644 index 00000000000..03ca580d186 --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test.notation @@ -0,0 +1,20 @@ +<?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: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" xmi:id="_FERfIGhHEeWchZKsEGp2Eg" name="RequirementTable0" currentRowAxisProvider="_FESGMWhHEeWchZKsEGp2Eg" currentColumnAxisProvider="_FERfIWhHEeWchZKsEGp2Eg"> + <context xmi:type="uml:Model" href="PasteOverwriteAll_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <owner xmi:type="uml:Model" href="PasteOverwriteAll_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <prototype xmi:type="configuration:PapyrusSyncTable" href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb3txhEeOqHvRyiN87hA"/> + <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#/"/> + <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_FERfIWhHEeWchZKsEGp2Eg" description="Provides the columns of the tables with a default configuration" name="Requirements Feature Columns Provider"> + <axis xmi:type="nattableaxis:FeatureIdAxis" xmi:id="_FERfImhHEeWchZKsEGp2Eg" element="property_of_stereotype:/SysML::Requirements::Requirement::id"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.1"/> + </axis> + <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_FERfI2hHEeWchZKsEGp2Eg"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.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:FeatureIdAxis" xmi:id="_FESGMGhHEeWchZKsEGp2Eg" element="property_of_stereotype:/SysML::Requirements::Requirement::text"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.1"/> + </axis> + </columnAxisProvidersHistory> + <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_FESGMWhHEeWchZKsEGp2Eg" description="Provides the requirements directly owned by the context of the table" name="Requirement Axis Provider" disconnectSlave="true"/> +</nattable:Table> diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test.uml b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test.uml new file mode 100644 index 00000000000..bbeea505249 --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test.uml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Requirements="http://www.eclipse.org/papyrus/0.7.0/SysML/Requirements" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/0.7.0/SysML/Requirements http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"> + <uml:Model xmi:id="_nAjG8GIeEeWkqekCWoLl5g" name="RootElement"> + <packagedElement xmi:type="uml:Class" xmi:id="_pYCiwGIeEeWkqekCWoLl5g" name="Class1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p2QIwGIeEeWkqekCWoLl5g" name="CopyOf_Class1_1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p5RnkGIeEeWkqekCWoLl5g" name="CopyOf_Class1_2"/> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZN74GgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZN74WgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#/"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_TZ_nULU5EduiKqCzJMWbGw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZOi8GgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZPKAGgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//modelelements"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_Gx8MgLX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZPxEGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZPxEWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_fSw28LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZQYIGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZQYIWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//portandflows"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_rpx28LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZQ_MGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZQ_MWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//constraints"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_5WYJ0LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZRmQGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZRmQWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//activities"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_C2zXMLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZSNUGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZSNUWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//allocations"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_NxdG4LX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZS0YGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZS0YWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_OOJC4LX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZTbcGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZTbcWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//interactions"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_meOioLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZUCgGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZUCgWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//statemachines"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_nAF5kLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZUpkGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZUpkWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//usecases"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_neZmMLX8EduFmqQsrNB9lw"/> + </profileApplication> + </uml:Model> + <Requirements:Requirement xmi:id="_CA5NsGhHEeWchZKsEGp2Eg" base_Class="_pYCiwGIeEeWkqekCWoLl5g"/> + <Requirements:Requirement xmi:id="_CrCW4GhHEeWchZKsEGp2Eg" base_Class="_p2QIwGIeEeWkqekCWoLl5g"/> + <Requirements:Requirement xmi:id="_DaVF0GhHEeWchZKsEGp2Eg" base_Class="_p5RnkGIeEeWkqekCWoLl5g"/> +</xmi:XMI> diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Initial.txt b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Initial.txt new file mode 100644 index 00000000000..3425e9bb95d --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Initial.txt @@ -0,0 +1,3 @@ + Class1 + CopyOf_Class1_1 + CopyOf_Class1_2
\ No newline at end of file diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Result.txt b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Result.txt new file mode 100644 index 00000000000..10d4176a2fb --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Result.txt @@ -0,0 +1,3 @@ + Class1 aaaa + Class2 bbbb + Class3 cccc diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test_ToCopy.txt b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test_ToCopy.txt new file mode 100644 index 00000000000..e39c478894d --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteAll_Test_ToCopy.txt @@ -0,0 +1,4 @@ + Class1 aaaa + Class2 bbbb + Class3 cccc + diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.di b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_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/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.notation b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.notation new file mode 100644 index 00000000000..c48a0069f65 --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.notation @@ -0,0 +1,20 @@ +<?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: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" xmi:id="_FERfIGhHEeWchZKsEGp2Eg" name="RequirementTable0" currentRowAxisProvider="_FESGMWhHEeWchZKsEGp2Eg" currentColumnAxisProvider="_FERfIWhHEeWchZKsEGp2Eg"> + <context xmi:type="uml:Model" href="PasteOverwriteByOneLine_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <owner xmi:type="uml:Model" href="PasteOverwriteByOneLine_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <prototype xmi:type="configuration:PapyrusSyncTable" href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb3txhEeOqHvRyiN87hA"/> + <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#/"/> + <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_FERfIWhHEeWchZKsEGp2Eg" description="Provides the columns of the tables with a default configuration" name="Requirements Feature Columns Provider"> + <axis xmi:type="nattableaxis:FeatureIdAxis" xmi:id="_FERfImhHEeWchZKsEGp2Eg" element="property_of_stereotype:/SysML::Requirements::Requirement::id"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.1"/> + </axis> + <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_FERfI2hHEeWchZKsEGp2Eg"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.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:FeatureIdAxis" xmi:id="_FESGMGhHEeWchZKsEGp2Eg" element="property_of_stereotype:/SysML::Requirements::Requirement::text"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.1"/> + </axis> + </columnAxisProvidersHistory> + <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_FESGMWhHEeWchZKsEGp2Eg" description="Provides the requirements directly owned by the context of the table" name="Requirement Axis Provider" disconnectSlave="true"/> +</nattable:Table> diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.uml b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.uml new file mode 100644 index 00000000000..bbeea505249 --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.uml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Requirements="http://www.eclipse.org/papyrus/0.7.0/SysML/Requirements" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/0.7.0/SysML/Requirements http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"> + <uml:Model xmi:id="_nAjG8GIeEeWkqekCWoLl5g" name="RootElement"> + <packagedElement xmi:type="uml:Class" xmi:id="_pYCiwGIeEeWkqekCWoLl5g" name="Class1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p2QIwGIeEeWkqekCWoLl5g" name="CopyOf_Class1_1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p5RnkGIeEeWkqekCWoLl5g" name="CopyOf_Class1_2"/> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZN74GgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZN74WgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#/"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_TZ_nULU5EduiKqCzJMWbGw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZOi8GgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZPKAGgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//modelelements"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_Gx8MgLX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZPxEGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZPxEWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_fSw28LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZQYIGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZQYIWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//portandflows"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_rpx28LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZQ_MGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZQ_MWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//constraints"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_5WYJ0LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZRmQGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZRmQWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//activities"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_C2zXMLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZSNUGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZSNUWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//allocations"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_NxdG4LX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZS0YGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZS0YWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_OOJC4LX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZTbcGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZTbcWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//interactions"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_meOioLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZUCgGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZUCgWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//statemachines"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_nAF5kLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZUpkGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZUpkWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//usecases"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_neZmMLX8EduFmqQsrNB9lw"/> + </profileApplication> + </uml:Model> + <Requirements:Requirement xmi:id="_CA5NsGhHEeWchZKsEGp2Eg" base_Class="_pYCiwGIeEeWkqekCWoLl5g"/> + <Requirements:Requirement xmi:id="_CrCW4GhHEeWchZKsEGp2Eg" base_Class="_p2QIwGIeEeWkqekCWoLl5g"/> + <Requirements:Requirement xmi:id="_DaVF0GhHEeWchZKsEGp2Eg" base_Class="_p5RnkGIeEeWkqekCWoLl5g"/> +</xmi:XMI> diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Initial.txt b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Initial.txt new file mode 100644 index 00000000000..3425e9bb95d --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Initial.txt @@ -0,0 +1,3 @@ + Class1 + CopyOf_Class1_1 + CopyOf_Class1_2
\ No newline at end of file diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Result.txt b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Result.txt new file mode 100644 index 00000000000..10d4176a2fb --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Result.txt @@ -0,0 +1,3 @@ + Class1 aaaa + Class2 bbbb + Class3 cccc diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_ToCopy.txt b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_ToCopy.txt new file mode 100644 index 00000000000..e39c478894d --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_ToCopy.txt @@ -0,0 +1,4 @@ + Class1 aaaa + Class2 bbbb + Class3 cccc + diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.di b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_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/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.notation b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.notation new file mode 100644 index 00000000000..e44d73e6670 --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.notation @@ -0,0 +1,20 @@ +<?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: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" xmi:id="_FERfIGhHEeWchZKsEGp2Eg" name="RequirementTable0" currentRowAxisProvider="_FESGMWhHEeWchZKsEGp2Eg" currentColumnAxisProvider="_FERfIWhHEeWchZKsEGp2Eg"> + <context xmi:type="uml:Model" href="PasteOverwriteFailCellColumns_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <owner xmi:type="uml:Model" href="PasteOverwriteFailCellColumns_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <prototype xmi:type="configuration:PapyrusSyncTable" href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb3txhEeOqHvRyiN87hA"/> + <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#/"/> + <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_FERfIWhHEeWchZKsEGp2Eg" description="Provides the columns of the tables with a default configuration" name="Requirements Feature Columns Provider"> + <axis xmi:type="nattableaxis:FeatureIdAxis" xmi:id="_FERfImhHEeWchZKsEGp2Eg" element="property_of_stereotype:/SysML::Requirements::Requirement::id"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.1"/> + </axis> + <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_FERfI2hHEeWchZKsEGp2Eg"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.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:FeatureIdAxis" xmi:id="_FESGMGhHEeWchZKsEGp2Eg" element="property_of_stereotype:/SysML::Requirements::Requirement::text"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.1"/> + </axis> + </columnAxisProvidersHistory> + <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_FESGMWhHEeWchZKsEGp2Eg" description="Provides the requirements directly owned by the context of the table" name="Requirement Axis Provider" disconnectSlave="true"/> +</nattable:Table> diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.uml b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.uml new file mode 100644 index 00000000000..bbeea505249 --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.uml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Requirements="http://www.eclipse.org/papyrus/0.7.0/SysML/Requirements" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/0.7.0/SysML/Requirements http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"> + <uml:Model xmi:id="_nAjG8GIeEeWkqekCWoLl5g" name="RootElement"> + <packagedElement xmi:type="uml:Class" xmi:id="_pYCiwGIeEeWkqekCWoLl5g" name="Class1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p2QIwGIeEeWkqekCWoLl5g" name="CopyOf_Class1_1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p5RnkGIeEeWkqekCWoLl5g" name="CopyOf_Class1_2"/> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZN74GgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZN74WgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#/"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_TZ_nULU5EduiKqCzJMWbGw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZOi8GgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZPKAGgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//modelelements"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_Gx8MgLX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZPxEGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZPxEWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_fSw28LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZQYIGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZQYIWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//portandflows"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_rpx28LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZQ_MGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZQ_MWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//constraints"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_5WYJ0LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZRmQGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZRmQWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//activities"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_C2zXMLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZSNUGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZSNUWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//allocations"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_NxdG4LX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZS0YGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZS0YWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_OOJC4LX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZTbcGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZTbcWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//interactions"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_meOioLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZUCgGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZUCgWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//statemachines"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_nAF5kLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZUpkGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZUpkWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//usecases"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_neZmMLX8EduFmqQsrNB9lw"/> + </profileApplication> + </uml:Model> + <Requirements:Requirement xmi:id="_CA5NsGhHEeWchZKsEGp2Eg" base_Class="_pYCiwGIeEeWkqekCWoLl5g"/> + <Requirements:Requirement xmi:id="_CrCW4GhHEeWchZKsEGp2Eg" base_Class="_p2QIwGIeEeWkqekCWoLl5g"/> + <Requirements:Requirement xmi:id="_DaVF0GhHEeWchZKsEGp2Eg" base_Class="_p5RnkGIeEeWkqekCWoLl5g"/> +</xmi:XMI> diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_Initial.txt b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_Initial.txt new file mode 100644 index 00000000000..3425e9bb95d --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_Initial.txt @@ -0,0 +1,3 @@ + Class1 + CopyOf_Class1_1 + CopyOf_Class1_2
\ No newline at end of file diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_ToCopy.txt b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_ToCopy.txt new file mode 100644 index 00000000000..e39c478894d --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_ToCopy.txt @@ -0,0 +1,4 @@ + Class1 aaaa + Class2 bbbb + Class3 cccc + diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.di b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_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/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.notation b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.notation new file mode 100644 index 00000000000..5c4951e9355 --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.notation @@ -0,0 +1,20 @@ +<?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: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" xmi:id="_FERfIGhHEeWchZKsEGp2Eg" name="RequirementTable0" currentRowAxisProvider="_FESGMWhHEeWchZKsEGp2Eg" currentColumnAxisProvider="_FERfIWhHEeWchZKsEGp2Eg"> + <context xmi:type="uml:Model" href="PasteOverwriteFailCellRows_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <owner xmi:type="uml:Model" href="PasteOverwriteFailCellRows_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <prototype xmi:type="configuration:PapyrusSyncTable" href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb3txhEeOqHvRyiN87hA"/> + <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#/"/> + <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_FERfIWhHEeWchZKsEGp2Eg" description="Provides the columns of the tables with a default configuration" name="Requirements Feature Columns Provider"> + <axis xmi:type="nattableaxis:FeatureIdAxis" xmi:id="_FERfImhHEeWchZKsEGp2Eg" element="property_of_stereotype:/SysML::Requirements::Requirement::id"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.1"/> + </axis> + <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_FERfI2hHEeWchZKsEGp2Eg"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.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:FeatureIdAxis" xmi:id="_FESGMGhHEeWchZKsEGp2Eg" element="property_of_stereotype:/SysML::Requirements::Requirement::text"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.sysml.nattable.requirement.config/configs/requirement.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.1"/> + </axis> + </columnAxisProvidersHistory> + <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_FESGMWhHEeWchZKsEGp2Eg" description="Provides the requirements directly owned by the context of the table" name="Requirement Axis Provider" disconnectSlave="true"/> +</nattable:Table> diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.uml b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.uml new file mode 100644 index 00000000000..bbeea505249 --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.uml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Requirements="http://www.eclipse.org/papyrus/0.7.0/SysML/Requirements" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/0.7.0/SysML/Requirements http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"> + <uml:Model xmi:id="_nAjG8GIeEeWkqekCWoLl5g" name="RootElement"> + <packagedElement xmi:type="uml:Class" xmi:id="_pYCiwGIeEeWkqekCWoLl5g" name="Class1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p2QIwGIeEeWkqekCWoLl5g" name="CopyOf_Class1_1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p5RnkGIeEeWkqekCWoLl5g" name="CopyOf_Class1_2"/> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZN74GgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZN74WgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#/"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_TZ_nULU5EduiKqCzJMWbGw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZOi8GgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZPKAGgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//modelelements"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_Gx8MgLX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZPxEGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZPxEWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_fSw28LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZQYIGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZQYIWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//portandflows"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_rpx28LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZQ_MGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZQ_MWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//constraints"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_5WYJ0LX7EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZRmQGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZRmQWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//activities"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_C2zXMLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZSNUGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZSNUWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//allocations"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_NxdG4LX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZS0YGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZS0YWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_OOJC4LX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZTbcGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZTbcWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//interactions"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_meOioLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZUCgGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZUCgWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//statemachines"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_nAF5kLX8EduFmqQsrNB9lw"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_4ZUpkGgREeW_BJ00xUargw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_4ZUpkWgREeW_BJ00xUargw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//usecases"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_neZmMLX8EduFmqQsrNB9lw"/> + </profileApplication> + </uml:Model> + <Requirements:Requirement xmi:id="_CA5NsGhHEeWchZKsEGp2Eg" base_Class="_pYCiwGIeEeWkqekCWoLl5g"/> + <Requirements:Requirement xmi:id="_CrCW4GhHEeWchZKsEGp2Eg" base_Class="_p2QIwGIeEeWkqekCWoLl5g"/> + <Requirements:Requirement xmi:id="_DaVF0GhHEeWchZKsEGp2Eg" base_Class="_p5RnkGIeEeWkqekCWoLl5g"/> +</xmi:XMI> diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_Initial.txt b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_Initial.txt new file mode 100644 index 00000000000..3425e9bb95d --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_Initial.txt @@ -0,0 +1,3 @@ + Class1 + CopyOf_Class1_1 + CopyOf_Class1_2
\ No newline at end of file diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_ToCopy.txt b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_ToCopy.txt new file mode 100644 index 00000000000..e39c478894d --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_ToCopy.txt @@ -0,0 +1,4 @@ + Class1 aaaa + Class2 bbbb + Class3 cccc + diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteOverwriteTest.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteOverwriteTest.java new file mode 100644 index 00000000000..07b7eaf8ad0 --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/AbstractPasteOverwriteTest.java @@ -0,0 +1,287 @@ +/***************************************************************************** + * 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.sysml.nattable.requirement.tests.paste.overwrite; + +import java.awt.Toolkit; +import java.awt.datatransfer.StringSelection; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.common.util.URI; +import org.eclipse.nebula.widgets.nattable.NatTable; +import org.eclipse.nebula.widgets.nattable.selection.command.ClearAllSelectionsCommand; +import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; +import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; +import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; +import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; +import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; +import org.eclipse.papyrus.infra.nattable.utils.TableClipboardUtils; +import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; +import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.junit.utils.GenericUtils; +import org.eclipse.papyrus.sysml.nattable.requirement.tests.Activator; +import org.eclipse.papyrus.sysml.nattable.requirement.tests.paste.without.service.edit.AbstractOpenTableTest; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.commands.ICommandService; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * This class allows to manage the paste with overwrite tests. + */ +public abstract class AbstractPasteOverwriteTest extends AbstractOpenTableTest { + + /** + * The path of the model to test. + */ + public static final String PASTE_FOLDER_PATH = "/resources/paste_overwrite/"; //$NON-NLS-1$ + + /** + * The suffix of the file containing the initial content. + */ + public static final String INITIAL_POST_FILE_NAME = "_Initial"; //$NON-NLS-1$ + + /** + * The suffix of the file containing the content to copy. + */ + public static final String TOCOPY_POST_FILE_NAME = "_ToCopy"; //$NON-NLS-1$ + + /** + * The suffix of the file containing the result content. + */ + public static final String RESULT_POST_FILE_NAME = "_Result"; //$NON-NLS-1$ + + /** + * Constructor. + */ + public AbstractPasteOverwriteTest() { + super(); + } + + /** + * Initialize the model. + * + * @throws Exception + * The caught exception. + */ + @Before + public void initModel() throws Exception { + initModel("RequirementTable0", getClass().getSimpleName(), getBundle()); //$NON-NLS-1$ + }; + + /** + * This allows to test the paste. + * + * @throws Exception + * The caught exception + */ + @Test + public void testPaste() throws Exception { + // Open the table and get the manager + testOpenExistingTable(getClass().getSimpleName(), "RequirementTable0"); //$NON-NLS-1$ + final IEditorPart editorPart = editor.getActiveEditor(); + Assert.assertTrue("Table editor must be a nattable editor", editorPart instanceof NatTableEditor); //$NON-NLS-1$ + final INattableModelManager currentManager = (INattableModelManager) editor.getAdapter(INattableModelManager.class); + Assert.assertTrue("The manager must be a nattable model manager", currentManager instanceof NattableModelManager); //$NON-NLS-1$ + final NattableModelManager manager = (NattableModelManager) currentManager; + + // Check the table context before command + checkTableContent(manager, INITIAL_POST_FILE_NAME); + + // Manage the selection + manageSelection(manager); + + // fill the clipboard + final ICommandService commandService = EclipseCommandUtils.getCommandService(); + Assert.assertNotNull("The command service must not be null", commandService); //$NON-NLS-1$ + final String fileName = getSuffixStateFileName(manager, TOCOPY_POST_FILE_NAME); + final String str = FileUtils.getStringFromPlatformFile(Activator.PLUGIN_ID, getSourcePath(), fileName); + fillClipboard(str); + + // Get the paste command + final Command cmd = commandService.getCommand("org.eclipse.ui.edit.paste"); //$NON-NLS-1$ + final IHandler handler = cmd.getHandler(); + Assert.assertTrue("The handler must be enabled", handler.isEnabled()); //$NON-NLS-1$ + + // Execute the command with the non-UI parameters + final Map<Object, Object> parameters = new HashMap<Object, Object>(); + parameters.put(PasteInTableHandler.OPEN_DIALOG_ON_FAIL_BOOLEAN_PARAMETER, Boolean.FALSE); + parameters.put(PasteInTableHandler.OPEN__PROGRESS_MONITOR_DIALOG, Boolean.FALSE); + final ExecutionEvent event = new ExecutionEvent(cmd, parameters, null, null); + flushDisplayEvents(); + final Object res = cmd.executeWithChecks(event); + Assert.assertTrue("The result must be a status", res instanceof IStatus); //$NON-NLS-1$ + final IStatus status = (IStatus) res; + + // Check the returned status + checkReturned_Status(status); + + if (status.isOK()) { + // Check the table content after command + checkTableContent(manager, RESULT_POST_FILE_NAME); + + // Undo/Redo + testUndo_Redo(manager); + } + } + + /** + * This allows to set the selection in table for the paste. The initial selection is the first cell of the table. + * + * @param manager + * The tree nattable model manager. + * @throws Exception + * The caught exception. + */ + protected void manageSelection(final NattableModelManager manager) throws Exception { + final NatTable natTable = (NatTable) manager.getAdapter(NatTable.class); + natTable.doCommand(new ClearAllSelectionsCommand()); + manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 0, 0, false, false)); + + flushDisplayEvents(); + } + + /** + * This allows to test the undo redo commands. + * + * @param treeManager + * The tree nattable model manager. + * @throws Exception + * The caught exception. + */ + protected void testUndo_Redo(final NattableModelManager treeManager) throws Exception { + // Check the undo + getTransactionalEditingDomain().getCommandStack().undo(); + // Check the table context after undo + checkTableContent(treeManager, INITIAL_POST_FILE_NAME); + + // Check the redo + getTransactionalEditingDomain().getCommandStack().redo(); + // Check the table context after redo + checkTableContent(treeManager, RESULT_POST_FILE_NAME); + } + + /** + * This allows to check the returned status. + * + * @param status + * The status. + */ + protected void checkReturned_Status(final IStatus status) { + Assert.assertTrue("The status must be OK", status.isOK()); //$NON-NLS-1$ + } + + /** + * This allows to check the table content comparing the table content with file content. + * + * @param manager + * The nattable model manager. + * @param suffixFileName + * The suffix of the file to check. + * @throws Exception + * The caught exception. + */ + protected void checkTableContent(final NattableModelManager manager, final String suffixFileName) throws Exception { + flushDisplayEvents(); + manager.selectAll(); + manager.copyToClipboard(); + String clipboard = getClipboardContent(); + // we check than the contents of the clipboard (so the displayed table) is the same than the wanted result + Assert.assertNotNull("Clipboard must not be null", clipboard); //$NON-NLS-1$ + String str = getWantedString(getSuffixStateFileName(manager, suffixFileName)); + // we check than the contents of the clipboard (so the displayed table) is the same than the wanted result + Assert.assertEquals("The clipboard must be equals to string which one it is filled", str, clipboard); //$NON-NLS-1$ + } + + /** + * Get the string content from a file. + * + * @param fileName + * a file name + * @return + * the text stored in the file associated to this test + */ + protected String getWantedString(final String fileName) { + return FileUtils.getStringFromPlatformFile(Activator.PLUGIN_ID, getSourcePath(), fileName, FileUtils.getSystemPropertyLineSeparator());// $NON-NLS-1$ + } + + /** + * Get the file name corresponding to the model with the suffix in parameter. + * + * @param manager + * The nattable model manager. + * @param suffixFileName + * The suffix of the file to get. + * @return The file name corresponding + */ + protected String getSuffixStateFileName(final NattableModelManager manager, final String suffixFileName) { + URI uri = manager.getTable().eResource().getURI(); + uri = uri.trimFileExtension(); + final StringBuffer buffer = new StringBuffer(uri.lastSegment()); + buffer.append(suffixFileName); + buffer.append(FileUtils.DOT_STRING); + buffer.append(FileUtils.TEXT_EXTENSION); + return buffer.toString(); + } + + /** + * Get the clipboard contents. + * + * @return + * the clipboard contents. + */ + protected String getClipboardContent() { + String clipboard = TableClipboardUtils.getClipboardContentsAsString(); + return clipboard; + } + + /** + * This allows to fill the clipboard with the string in parameter. + * + * @param newClipBoardContents + * The string needed to fill the clipboard. + */ + protected void fillClipboard(final String newClipBoardContents) { + + // its seems that the clipboard must be filled with the same way than we read it! + java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + + StringSelection s = new StringSelection(newClipBoardContents); + clipboard.setContents(s, s); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.tests.AbstractOpenTableTest#getSourcePath() + */ + @Override + protected String getSourcePath() { + return PASTE_FOLDER_PATH; + } + + /** + * This allow to close the opened editors. + */ + @AfterClass + public static void endOfTest() { + GenericUtils.closeAllEditors(); + } +} diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteAll_Test.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteAll_Test.java new file mode 100644 index 00000000000..e16702596bf --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteAll_Test.java @@ -0,0 +1,44 @@ +/***************************************************************************** + * 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.sysml.nattable.requirement.tests.paste.overwrite; + +import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; +import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; + +/** + * Test pastes overwrite all of selection with hidden categories. + */ +public class PasteOverwriteAll_Test extends AbstractPasteOverwriteTest { + + /** + * Constructor. + */ + public PasteOverwriteAll_Test() { + super(); + } + + /** + * 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 + protected void manageSelection(final NattableModelManager manager) throws Exception { + super.manageSelection(manager); + manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 2, 2, true, false)); + + flushDisplayEvents(); + } +} diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteByOneLine_Test.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteByOneLine_Test.java new file mode 100644 index 00000000000..ae8b1f109be --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteByOneLine_Test.java @@ -0,0 +1,44 @@ +/***************************************************************************** + * 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.sysml.nattable.requirement.tests.paste.overwrite; + +import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; +import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; + +/** + * Test pastes overwrite all of selection with hidden categories when a single line is copied. + */ +public class PasteOverwriteByOneLine_Test extends AbstractPasteOverwriteTest { + + /** + * Constructor. + */ + public PasteOverwriteByOneLine_Test() { + super(); + } + + /** + * 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 + protected void manageSelection(final NattableModelManager manager) throws Exception { + super.manageSelection(manager); + manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 2, 2, true, false)); + + flushDisplayEvents(); + } +} diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteFailCellColumns_Test.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteFailCellColumns_Test.java new file mode 100644 index 00000000000..db472e98f8f --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteFailCellColumns_Test.java @@ -0,0 +1,58 @@ +/***************************************************************************** + * 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.sysml.nattable.requirement.tests.paste.overwrite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; +import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; +import org.eclipse.papyrus.infra.nattable.messages.Messages; +import org.junit.Assert; + +/** + * Test pastes overwrite when the number of columns to paste is not equals to the number of columns selected. + */ +public class PasteOverwriteFailCellColumns_Test extends AbstractPasteOverwriteTest { + + /** + * Constructor. + */ + public PasteOverwriteFailCellColumns_Test() { + super(); + } + + /** + * 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 + protected void manageSelection(final NattableModelManager manager) throws Exception { + super.manageSelection(manager); + manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 1, 2, true, false)); + + flushDisplayEvents(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#checkReturned_Status(org.eclipse.core.runtime.IStatus) + */ + @Override + protected void checkReturned_Status(final IStatus status) { + Assert.assertEquals("Error must be caught", IStatus.ERROR, status.getSeverity()); //$NON-NLS-1$ + Assert.assertEquals("Error message is not the expected message", Messages.AbstractPasteInSelectionNattableCommandProvider_readcolumnsexceedsexistingcolumns, status.getMessage()); //$NON-NLS-1$ + } +} diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteFailCellRows_Test.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteFailCellRows_Test.java new file mode 100644 index 00000000000..d9d26ba7f48 --- /dev/null +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/paste/overwrite/PasteOverwriteFailCellRows_Test.java @@ -0,0 +1,59 @@ +/***************************************************************************** + * 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.sysml.nattable.requirement.tests.paste.overwrite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; +import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; +import org.eclipse.papyrus.infra.nattable.messages.Messages; +import org.junit.Assert; + +/** + * Test pastes overwrite when the number of rows to paste is not equals to the number of rows selected. + */ +public class PasteOverwriteFailCellRows_Test extends AbstractPasteOverwriteTest { + + /** + * Constructor. + */ + public PasteOverwriteFailCellRows_Test() { + super(); + } + + /** + * 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 + protected void manageSelection(final NattableModelManager manager) throws Exception { + super.manageSelection(manager); + manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 2, 1, true, false)); + + flushDisplayEvents(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#checkReturned_Status(org.eclipse.core.runtime.IStatus) + */ + @Override + protected void checkReturned_Status(final IStatus status) { + Assert.assertEquals("Error must be caught", IStatus.ERROR, status.getSeverity()); //$NON-NLS-1$ + Assert.assertEquals("Error message is not the expected message", Messages.AbstractPasteInSelectionNattableCommandProvider_readrowsexceedsexistingrows, status.getMessage()); //$NON-NLS-1$ + } + +} diff --git a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/AllTests.java b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/AllTests.java index 5cad8741624..b574c263c45 100755 --- a/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/AllTests.java +++ b/tests/junit/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/AllTests.java @@ -16,6 +16,10 @@ import org.eclipse.papyrus.sysml.nattable.requirement.tests.bugs.AxisChangeIndex import org.eclipse.papyrus.sysml.nattable.requirement.tests.bugs.AxisChangeIndexWithoutConfigurationTest; import org.eclipse.papyrus.sysml.nattable.requirement.tests.bugs.InvertedAxisChangeIndexWithConfigurationTest; import org.eclipse.papyrus.sysml.nattable.requirement.tests.bugs.InvertedAxisChangeIndexWithoutConfigurationTest; +import org.eclipse.papyrus.sysml.nattable.requirement.tests.paste.overwrite.PasteOverwriteAll_Test; +import org.eclipse.papyrus.sysml.nattable.requirement.tests.paste.overwrite.PasteOverwriteByOneLine_Test; +import org.eclipse.papyrus.sysml.nattable.requirement.tests.paste.overwrite.PasteOverwriteFailCellColumns_Test; +import org.eclipse.papyrus.sysml.nattable.requirement.tests.paste.overwrite.PasteOverwriteFailCellRows_Test; import org.eclipse.papyrus.sysml.nattable.requirement.tests.paste.without.service.edit.Bug443814_Enumeration; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -36,6 +40,10 @@ import org.junit.runners.Suite.SuiteClasses; OpenTableTest.class, TableCreationInUMLModel.class, RevealRequirementTableTest.class, + PasteOverwriteAll_Test.class, + PasteOverwriteByOneLine_Test.class, + PasteOverwriteFailCellColumns_Test.class, + PasteOverwriteFailCellRows_Test.class }) public class AllTests { diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_H1_H1_H1_MultiColmns_Test_Result.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_H1_H1_H1_MultiColmns_Test_Result.txt deleted file mode 100644 index 79cc4d2c53f..00000000000 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_H1_H1_H1_MultiColmns_Test_Result.txt +++ /dev/null @@ -1,12 +0,0 @@ -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class11 public false N/A -Class12 public false N/A
\ No newline at end of file diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_H1_H1_H1_MultiColmns_Test_Result.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_H1_H1_H1_MultiColmns_Test_Result.txt deleted file mode 100644 index 79cc4d2c53f..00000000000 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_H1_H1_H1_MultiColmns_Test_Result.txt +++ /dev/null @@ -1,12 +0,0 @@ -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class_X private true N/A -Class11 public false N/A -Class12 public false N/A
\ No newline at end of file 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/AbstractPasteOverwriteTest.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/AbstractPasteOverwriteTest.java index ca1750cfeb8..f2375eea1cc 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/AbstractPasteOverwriteTest.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/AbstractPasteOverwriteTest.java @@ -311,7 +311,6 @@ public abstract class AbstractPasteOverwriteTest extends AbstractOpenTableTest { protected void manageSelection(final TreeNattableModelManager treeManager) throws Exception { final NatTable natTable = (NatTable) treeManager.getAdapter(NatTable.class); natTable.doCommand(new ClearAllSelectionsCommand()); - // manager.getBodyLayerStack().getSelectionLayer().selectCell(0, 0, false, false); treeManager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(treeManager.getBodyLayerStack().getSelectionLayer(), 0, 0, false, false)); flushDisplayEvents(); 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/PasteOverwriteAll_H1_H1_H1_MultiColmns_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/PasteOverwriteAll_H1_H1_H1_MultiColmns_Test.java index fa3f3d14d40..ad372f1f135 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/PasteOverwriteAll_H1_H1_H1_MultiColmns_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/PasteOverwriteAll_H1_H1_H1_MultiColmns_Test.java @@ -24,7 +24,7 @@ public class PasteOverwriteAll_H1_H1_H1_MultiColmns_Test extends AbstractPasteOv * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#removeClassName(java.lang.String) */ @Override - public String removeClassName(String className) throws Exception { + public String removeClassName(final String className) throws Exception { return className.replaceFirst("PasteOverwriteAll_", ""); //$NON-NLS-1$ //$NON-NLS-2$ } 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/PasteOverwriteAll_V1_V3_V1_MultiColmns_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/PasteOverwriteAll_V1_V3_V1_MultiColmns_Test.java index 83857fd1fa9..04b11f07b06 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/PasteOverwriteAll_V1_V3_V1_MultiColmns_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/PasteOverwriteAll_V1_V3_V1_MultiColmns_Test.java @@ -24,7 +24,7 @@ public class PasteOverwriteAll_V1_V3_V1_MultiColmns_Test extends AbstractPasteOv * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#removeClassName(java.lang.String) */ @Override - public String removeClassName(String className) throws Exception { + public String removeClassName(final String className) throws Exception { return className.replaceFirst("PasteOverwriteAll_", ""); //$NON-NLS-1$ //$NON-NLS-2$ } 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/PasteOverwriteByOneLine_H1_H1_H1_MultiColmns_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/PasteOverwriteByOneLine_H1_H1_H1_MultiColmns_Test.java index 0bfb06c9551..b86402b3dbe 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/PasteOverwriteByOneLine_H1_H1_H1_MultiColmns_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/PasteOverwriteByOneLine_H1_H1_H1_MultiColmns_Test.java @@ -27,7 +27,7 @@ public class PasteOverwriteByOneLine_H1_H1_H1_MultiColmns_Test extends AbstractP * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#removeClassName(java.lang.String) */ @Override - public String removeClassName(String className) throws Exception { + public String removeClassName(final String className) throws Exception { return className.replaceFirst("PasteOverwriteByOneLine_", ""); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -38,7 +38,7 @@ public class PasteOverwriteByOneLine_H1_H1_H1_MultiColmns_Test extends AbstractP * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#manageSelection(org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager) */ @Override - protected void manageSelection(TreeNattableModelManager manager) throws Exception { + protected void manageSelection(final TreeNattableModelManager manager) throws Exception { super.manageSelection(manager); manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 3, 9, 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/PasteOverwriteFailCellColumns_H1_H1_H1_MultiColmns_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/PasteOverwriteFailCellColumns_H1_H1_H1_MultiColmns_Test.java index a379fe405b8..eca8749881d 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/PasteOverwriteFailCellColumns_H1_H1_H1_MultiColmns_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/PasteOverwriteFailCellColumns_H1_H1_H1_MultiColmns_Test.java @@ -30,7 +30,7 @@ public class PasteOverwriteFailCellColumns_H1_H1_H1_MultiColmns_Test extends Abs * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#removeClassName(java.lang.String) */ @Override - public String removeClassName(String className) throws Exception { + public String removeClassName(final String className) throws Exception { return className.replaceFirst("PasteOverwriteFailCellColumns_", ""); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -41,7 +41,7 @@ public class PasteOverwriteFailCellColumns_H1_H1_H1_MultiColmns_Test extends Abs * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#manageSelection(org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager) */ @Override - protected void manageSelection(TreeNattableModelManager manager) throws Exception { + protected void manageSelection(final TreeNattableModelManager manager) throws Exception { super.manageSelection(manager); manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 2, 2, true, false)); diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test.di b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_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.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test.notation new file mode 100644 index 00000000000..a31848aac7d --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test.notation @@ -0,0 +1,35 @@ +<?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: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" xmi:id="_4OqVQGhfEeWkeMVi2iCQkA" name="GenericTable0" currentRowAxisProvider="_4OqVQmhfEeWkeMVi2iCQkA" currentColumnAxisProvider="_4OqVQWhfEeWkeMVi2iCQkA"> + <context xmi:type="uml:Model" href="PasteOverwriteAll_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <owner xmi:type="uml:Model" href="PasteOverwriteAll_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <prototype xmi:type="configuration:PapyrusSyncTable" href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb2NxhEeOqHvRyiN87hA"/> + <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#/"/> + <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_4OqVQWhfEeWkeMVi2iCQkA" 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="_46Kwc2hfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.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="_46KwaGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.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="_46KwkmhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier/isAbstract"/> + </axis> + </columnAxisProvidersHistory> + <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_4OqVQmhfEeWkeMVi2iCQkA" description="This axis provider contains the object dropped by the user into the table" name="DroppedElementAxisProvider"> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_4jeHoGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteAll_Test.uml#_pYCiwGIeEeWkqekCWoLl5g"/> + </axis> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_4t8SQGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteAll_Test.uml#_p2QIwGIeEeWkqekCWoLl5g"/> + </axis> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_46KJUGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteAll_Test.uml#_p5RnkGIeEeWkqekCWoLl5g"/> + </axis> + </rowAxisProvidersHistory> +</nattable:Table> diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test.uml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test.uml new file mode 100644 index 00000000000..39cac3474d9 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test.uml @@ -0,0 +1,6 @@ +<?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="_nAjG8GIeEeWkqekCWoLl5g" name="RootElement"> + <packagedElement xmi:type="uml:Class" xmi:id="_pYCiwGIeEeWkqekCWoLl5g" name="Class1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p2QIwGIeEeWkqekCWoLl5g" name="CopyOf_Class1_1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p5RnkGIeEeWkqekCWoLl5g" name="CopyOf_Class1_2"/> +</uml:Model> diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Initial.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Initial.txt new file mode 100644 index 00000000000..84721ff937f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Initial.txt @@ -0,0 +1,3 @@ +Class1 false false +CopyOf_Class1_1 false false +CopyOf_Class1_2 false false diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Result.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Result.txt new file mode 100644 index 00000000000..9a963647910 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test_Result.txt @@ -0,0 +1,3 @@ +Class1_1 true true +Class2 true true +Class3 true true diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test_ToCopy.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test_ToCopy.txt new file mode 100644 index 00000000000..5f13293b17d --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteAll_Test_ToCopy.txt @@ -0,0 +1,4 @@ +Class1_1 true true +Class2 true true +Class3 true true + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.di b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_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.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.notation new file mode 100644 index 00000000000..6e2e5221862 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.notation @@ -0,0 +1,35 @@ +<?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: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" xmi:id="_4OqVQGhfEeWkeMVi2iCQkA" name="GenericTable0" currentRowAxisProvider="_4OqVQmhfEeWkeMVi2iCQkA" currentColumnAxisProvider="_4OqVQWhfEeWkeMVi2iCQkA"> + <context xmi:type="uml:Model" href="PasteOverwriteByOneLine_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <owner xmi:type="uml:Model" href="PasteOverwriteByOneLine_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <prototype xmi:type="configuration:PapyrusSyncTable" href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb2NxhEeOqHvRyiN87hA"/> + <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#/"/> + <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_4OqVQWhfEeWkeMVi2iCQkA" 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="_46Kwc2hfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.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="_46KwaGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.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="_46KwkmhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier/isAbstract"/> + </axis> + </columnAxisProvidersHistory> + <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_4OqVQmhfEeWkeMVi2iCQkA" description="This axis provider contains the object dropped by the user into the table" name="DroppedElementAxisProvider"> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_4jeHoGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteByOneLine_Test.uml#_pYCiwGIeEeWkqekCWoLl5g"/> + </axis> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_4t8SQGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteByOneLine_Test.uml#_p2QIwGIeEeWkqekCWoLl5g"/> + </axis> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_46KJUGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteByOneLine_Test.uml#_p5RnkGIeEeWkqekCWoLl5g"/> + </axis> + </rowAxisProvidersHistory> +</nattable:Table> diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.uml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.uml new file mode 100644 index 00000000000..39cac3474d9 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test.uml @@ -0,0 +1,6 @@ +<?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="_nAjG8GIeEeWkqekCWoLl5g" name="RootElement"> + <packagedElement xmi:type="uml:Class" xmi:id="_pYCiwGIeEeWkqekCWoLl5g" name="Class1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p2QIwGIeEeWkqekCWoLl5g" name="CopyOf_Class1_1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p5RnkGIeEeWkqekCWoLl5g" name="CopyOf_Class1_2"/> +</uml:Model> diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Initial.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Initial.txt new file mode 100644 index 00000000000..84721ff937f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Initial.txt @@ -0,0 +1,3 @@ +Class1 false false +CopyOf_Class1_1 false false +CopyOf_Class1_2 false false diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Result.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Result.txt new file mode 100644 index 00000000000..47f9edf9d73 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_Result.txt @@ -0,0 +1,3 @@ +ClassX true true +ClassX true true +ClassX true true diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_ToCopy.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_ToCopy.txt new file mode 100644 index 00000000000..da6fda7b361 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteByOneLine_Test_ToCopy.txt @@ -0,0 +1,2 @@ +ClassX true true + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.di b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_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.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.notation new file mode 100644 index 00000000000..eba4d92537b --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.notation @@ -0,0 +1,35 @@ +<?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: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" xmi:id="_4OqVQGhfEeWkeMVi2iCQkA" name="GenericTable0" currentRowAxisProvider="_4OqVQmhfEeWkeMVi2iCQkA" currentColumnAxisProvider="_4OqVQWhfEeWkeMVi2iCQkA"> + <context xmi:type="uml:Model" href="PasteOverwriteFailCellColumns_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <owner xmi:type="uml:Model" href="PasteOverwriteFailCellColumns_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <prototype xmi:type="configuration:PapyrusSyncTable" href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb2NxhEeOqHvRyiN87hA"/> + <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#/"/> + <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_4OqVQWhfEeWkeMVi2iCQkA" 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="_46Kwc2hfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.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="_46KwaGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.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="_46KwkmhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier/isAbstract"/> + </axis> + </columnAxisProvidersHistory> + <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_4OqVQmhfEeWkeMVi2iCQkA" description="This axis provider contains the object dropped by the user into the table" name="DroppedElementAxisProvider"> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_4jeHoGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteFailCellColumns_Test.uml#_pYCiwGIeEeWkqekCWoLl5g"/> + </axis> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_4t8SQGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteFailCellColumns_Test.uml#_p2QIwGIeEeWkqekCWoLl5g"/> + </axis> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_46KJUGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteFailCellColumns_Test.uml#_p5RnkGIeEeWkqekCWoLl5g"/> + </axis> + </rowAxisProvidersHistory> +</nattable:Table> diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.uml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.uml new file mode 100644 index 00000000000..39cac3474d9 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test.uml @@ -0,0 +1,6 @@ +<?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="_nAjG8GIeEeWkqekCWoLl5g" name="RootElement"> + <packagedElement xmi:type="uml:Class" xmi:id="_pYCiwGIeEeWkqekCWoLl5g" name="Class1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p2QIwGIeEeWkqekCWoLl5g" name="CopyOf_Class1_1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p5RnkGIeEeWkqekCWoLl5g" name="CopyOf_Class1_2"/> +</uml:Model> diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_Initial.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_Initial.txt new file mode 100644 index 00000000000..84721ff937f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_Initial.txt @@ -0,0 +1,3 @@ +Class1 false false +CopyOf_Class1_1 false false +CopyOf_Class1_2 false false diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_ToCopy.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_ToCopy.txt new file mode 100644 index 00000000000..5f13293b17d --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellColumns_Test_ToCopy.txt @@ -0,0 +1,4 @@ +Class1_1 true true +Class2 true true +Class3 true true + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.di b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_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.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.notation new file mode 100644 index 00000000000..50c817d2f0e --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.notation @@ -0,0 +1,35 @@ +<?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: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" xmi:id="_4OqVQGhfEeWkeMVi2iCQkA" name="GenericTable0" currentRowAxisProvider="_4OqVQmhfEeWkeMVi2iCQkA" currentColumnAxisProvider="_4OqVQWhfEeWkeMVi2iCQkA"> + <context xmi:type="uml:Model" href="PasteOverwriteFailCellRows_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <owner xmi:type="uml:Model" href="PasteOverwriteFailCellRows_Test.uml#_nAjG8GIeEeWkqekCWoLl5g"/> + <prototype xmi:type="configuration:PapyrusSyncTable" href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb2NxhEeOqHvRyiN87hA"/> + <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#/"/> + <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_4OqVQWhfEeWkeMVi2iCQkA" 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="_46Kwc2hfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.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="_46KwaGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.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="_46KwkmhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier/isAbstract"/> + </axis> + </columnAxisProvidersHistory> + <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_4OqVQmhfEeWkeMVi2iCQkA" description="This axis provider contains the object dropped by the user into the table" name="DroppedElementAxisProvider"> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_4jeHoGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteFailCellRows_Test.uml#_pYCiwGIeEeWkqekCWoLl5g"/> + </axis> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_4t8SQGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteFailCellRows_Test.uml#_p2QIwGIeEeWkqekCWoLl5g"/> + </axis> + <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_46KJUGhfEeWkeMVi2iCQkA"> + <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/> + <element xmi:type="uml:Class" href="PasteOverwriteFailCellRows_Test.uml#_p5RnkGIeEeWkqekCWoLl5g"/> + </axis> + </rowAxisProvidersHistory> +</nattable:Table> diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.uml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.uml new file mode 100644 index 00000000000..39cac3474d9 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test.uml @@ -0,0 +1,6 @@ +<?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="_nAjG8GIeEeWkqekCWoLl5g" name="RootElement"> + <packagedElement xmi:type="uml:Class" xmi:id="_pYCiwGIeEeWkqekCWoLl5g" name="Class1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p2QIwGIeEeWkqekCWoLl5g" name="CopyOf_Class1_1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_p5RnkGIeEeWkqekCWoLl5g" name="CopyOf_Class1_2"/> +</uml:Model> diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_Initial.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_Initial.txt new file mode 100644 index 00000000000..84721ff937f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_Initial.txt @@ -0,0 +1,3 @@ +Class1 false false +CopyOf_Class1_1 false false +CopyOf_Class1_2 false false diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_ToCopy.txt b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_ToCopy.txt new file mode 100644 index 00000000000..5f13293b17d --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/resources/paste_overwrite/PasteOverwriteFailCellRows_Test_ToCopy.txt @@ -0,0 +1,4 @@ +Class1_1 true true +Class2 true true +Class3 true true + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteOverwriteTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteOverwriteTest.java new file mode 100644 index 00000000000..46c68ba5904 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/AbstractPasteOverwriteTest.java @@ -0,0 +1,287 @@ +/***************************************************************************** + * 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.generic.tests.paste.overwrite; + +import java.awt.Toolkit; +import java.awt.datatransfer.StringSelection; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.common.util.URI; +import org.eclipse.nebula.widgets.nattable.NatTable; +import org.eclipse.nebula.widgets.nattable.selection.command.ClearAllSelectionsCommand; +import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; +import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; +import org.eclipse.papyrus.infra.nattable.handler.PasteInTableHandler; +import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; +import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; +import org.eclipse.papyrus.infra.nattable.utils.TableClipboardUtils; +import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils; +import org.eclipse.papyrus.infra.tools.util.FileUtils; +import org.eclipse.papyrus.junit.utils.GenericUtils; +import org.eclipse.papyrus.uml.nattable.generic.tests.Activator; +import org.eclipse.papyrus.uml.nattable.generic.tests.tests.AbstractGenericTableTest; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.commands.ICommandService; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * This class allows to manage the paste with overwrite tests. + */ +public abstract class AbstractPasteOverwriteTest extends AbstractGenericTableTest { + + /** + * The path of the model to test. + */ + public static final String PASTE_FOLDER_PATH = "/resources/paste_overwrite/"; //$NON-NLS-1$ + + /** + * The suffix of the file containing the initial content. + */ + public static final String INITIAL_POST_FILE_NAME = "_Initial"; //$NON-NLS-1$ + + /** + * The suffix of the file containing the content to copy. + */ + public static final String TOCOPY_POST_FILE_NAME = "_ToCopy"; //$NON-NLS-1$ + + /** + * The suffix of the file containing the result content. + */ + public static final String RESULT_POST_FILE_NAME = "_Result"; //$NON-NLS-1$ + + /** + * Constructor. + */ + public AbstractPasteOverwriteTest() { + super(); + } + + /** + * Initialize the model. + * + * @throws Exception + * The caught exception. + */ + @Before + public void initModel() throws Exception { + initModel("GenericTable", getClass().getSimpleName(), getBundle()); //$NON-NLS-1$ + }; + + /** + * This allows to test the paste. + * + * @throws Exception + * The caught exception + */ + @Test + public void testPaste() throws Exception { + // Open the table and get the manager + loadGenericTable(); + final IEditorPart editorPart = editor.getActiveEditor(); + Assert.assertTrue("Table editor must be a nattable editor", editorPart instanceof NatTableEditor); //$NON-NLS-1$ + final INattableModelManager currentManager = (INattableModelManager) editor.getAdapter(INattableModelManager.class); + Assert.assertTrue("The manager must be a nattable model manager", currentManager instanceof NattableModelManager); //$NON-NLS-1$ + final NattableModelManager manager = (NattableModelManager) currentManager; + + // Check the table context before command + checkTableContent(manager, INITIAL_POST_FILE_NAME); + + // Manage the selection + manageSelection(manager); + + // fill the clipboard + final ICommandService commandService = EclipseCommandUtils.getCommandService(); + Assert.assertNotNull("The command service must not be null", commandService); //$NON-NLS-1$ + final String fileName = getSuffixStateFileName(manager, TOCOPY_POST_FILE_NAME); + final String str = FileUtils.getStringFromPlatformFile(Activator.PLUGIN_ID, getSourcePath(), fileName); + fillClipboard(str); + + // Get the paste command + final Command cmd = commandService.getCommand("org.eclipse.ui.edit.paste"); //$NON-NLS-1$ + final IHandler handler = cmd.getHandler(); + Assert.assertTrue("The handler must be enabled", handler.isEnabled()); //$NON-NLS-1$ + + // Execute the command with the non-UI parameters + final Map<Object, Object> parameters = new HashMap<Object, Object>(); + parameters.put(PasteInTableHandler.OPEN_DIALOG_ON_FAIL_BOOLEAN_PARAMETER, Boolean.FALSE); + parameters.put(PasteInTableHandler.OPEN__PROGRESS_MONITOR_DIALOG, Boolean.FALSE); + final ExecutionEvent event = new ExecutionEvent(cmd, parameters, null, null); + flushDisplayEvents(); + final Object res = cmd.executeWithChecks(event); + Assert.assertTrue("The result must be a status", res instanceof IStatus); //$NON-NLS-1$ + final IStatus status = (IStatus) res; + + // Check the returned status + checkReturned_Status(status); + + if (status.isOK()) { + // Check the table content after command + checkTableContent(manager, RESULT_POST_FILE_NAME); + + // Undo/Redo + testUndo_Redo(manager); + } + } + + /** + * This allows to set the selection in table for the paste. The initial selection is the first cell of the table. + * + * @param manager + * The tree nattable model manager. + * @throws Exception + * The caught exception. + */ + protected void manageSelection(final NattableModelManager manager) throws Exception { + final NatTable natTable = (NatTable) manager.getAdapter(NatTable.class); + natTable.doCommand(new ClearAllSelectionsCommand()); + manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 0, 0, false, false)); + + flushDisplayEvents(); + } + + /** + * This allows to test the undo redo commands. + * + * @param treeManager + * The tree nattable model manager. + * @throws Exception + * The caught exception. + */ + protected void testUndo_Redo(final NattableModelManager treeManager) throws Exception { + // Check the undo + getTransactionalEditingDomain().getCommandStack().undo(); + // Check the table context after undo + checkTableContent(treeManager, INITIAL_POST_FILE_NAME); + + // Check the redo + getTransactionalEditingDomain().getCommandStack().redo(); + // Check the table context after redo + checkTableContent(treeManager, RESULT_POST_FILE_NAME); + } + + /** + * This allows to check the returned status. + * + * @param status + * The status. + */ + protected void checkReturned_Status(final IStatus status) { + Assert.assertTrue("The status must be OK", status.isOK()); //$NON-NLS-1$ + } + + /** + * This allows to check the table content comparing the table content with file content. + * + * @param manager + * The nattable model manager. + * @param suffixFileName + * The suffix of the file to check. + * @throws Exception + * The caught exception. + */ + protected void checkTableContent(final NattableModelManager manager, final String suffixFileName) throws Exception { + flushDisplayEvents(); + manager.selectAll(); + manager.copyToClipboard(); + String clipboard = getClipboardContent(); + // we check than the contents of the clipboard (so the displayed table) is the same than the wanted result + Assert.assertNotNull("Clipboard must not be null", clipboard); //$NON-NLS-1$ + String str = getWantedString(getSuffixStateFileName(manager, suffixFileName)); + // we check than the contents of the clipboard (so the displayed table) is the same than the wanted result + Assert.assertEquals("The clipboard must be equals to string which one it is filled", str, clipboard); //$NON-NLS-1$ + } + + /** + * Get the string content from a file. + * + * @param fileName + * a file name + * @return + * the text stored in the file associated to this test + */ + protected String getWantedString(final String fileName) { + return FileUtils.getStringFromPlatformFile(Activator.PLUGIN_ID, getSourcePath(), fileName, FileUtils.getSystemPropertyLineSeparator());// $NON-NLS-1$ + } + + /** + * Get the file name corresponding to the model with the suffix in parameter. + * + * @param manager + * The nattable model manager. + * @param suffixFileName + * The suffix of the file to get. + * @return The file name corresponding + */ + protected String getSuffixStateFileName(final NattableModelManager manager, final String suffixFileName) { + URI uri = manager.getTable().eResource().getURI(); + uri = uri.trimFileExtension(); + final StringBuffer buffer = new StringBuffer(uri.lastSegment()); + buffer.append(suffixFileName); + buffer.append(FileUtils.DOT_STRING); + buffer.append(FileUtils.TEXT_EXTENSION); + return buffer.toString(); + } + + /** + * Get the clipboard contents. + * + * @return + * the clipboard contents. + */ + protected String getClipboardContent() { + String clipboard = TableClipboardUtils.getClipboardContentsAsString(); + return clipboard; + } + + /** + * This allows to fill the clipboard with the string in parameter. + * + * @param newClipBoardContents + * The string needed to fill the clipboard. + */ + protected void fillClipboard(final String newClipBoardContents) { + + // its seems that the clipboard must be filled with the same way than we read it! + java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + + StringSelection s = new StringSelection(newClipBoardContents); + clipboard.setContents(s, s); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.tests.AbstractOpenTableTest#getSourcePath() + */ + @Override + protected String getSourcePath() { + return PASTE_FOLDER_PATH; + } + + /** + * This allow to close the opened editors. + */ + @AfterClass + public static void endOfTest() { + GenericUtils.closeAllEditors(); + } +} diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteAll_Test.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteAll_Test.java new file mode 100644 index 00000000000..697b45af07b --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteAll_Test.java @@ -0,0 +1,27 @@ +/***************************************************************************** + * 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.generic.tests.paste.overwrite; + +/** + * Test pastes overwrite all of selection with hidden categories. + */ +public class PasteOverwriteAll_Test extends AbstractPasteOverwriteTest { + + /** + * Constructor. + */ + public PasteOverwriteAll_Test() { + super(); + } +} diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteByOneLine_Test.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteByOneLine_Test.java new file mode 100644 index 00000000000..046abc22a02 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteByOneLine_Test.java @@ -0,0 +1,44 @@ +/***************************************************************************** + * 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.generic.tests.paste.overwrite; + +import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; +import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; + +/** + * Test pastes overwrite all of selection with hidden categories when a single line is copied. + */ +public class PasteOverwriteByOneLine_Test extends AbstractPasteOverwriteTest { + + /** + * Constructor. + */ + public PasteOverwriteByOneLine_Test() { + super(); + } + + /** + * 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 + protected void manageSelection(final NattableModelManager manager) throws Exception { + super.manageSelection(manager); + manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 2, 2, true, false)); + + flushDisplayEvents(); + } +} diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteFailCellColumns_Test.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteFailCellColumns_Test.java new file mode 100644 index 00000000000..0ab61d736bd --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteFailCellColumns_Test.java @@ -0,0 +1,58 @@ +/***************************************************************************** + * 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.generic.tests.paste.overwrite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; +import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; +import org.eclipse.papyrus.infra.nattable.messages.Messages; +import org.junit.Assert; + +/** + * Test pastes overwrite when the number of columns to paste is not equals to the number of columns selected. + */ +public class PasteOverwriteFailCellColumns_Test extends AbstractPasteOverwriteTest { + + /** + * Constructor. + */ + public PasteOverwriteFailCellColumns_Test() { + super(); + } + + /** + * 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 + protected void manageSelection(final NattableModelManager manager) throws Exception { + super.manageSelection(manager); + manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 1, 2, true, false)); + + flushDisplayEvents(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#checkReturned_Status(org.eclipse.core.runtime.IStatus) + */ + @Override + protected void checkReturned_Status(final IStatus status) { + Assert.assertEquals("Error must be caught", IStatus.ERROR, status.getSeverity()); //$NON-NLS-1$ + Assert.assertEquals("Error message is not the expected message", Messages.AbstractPasteInSelectionNattableCommandProvider_readcolumnsexceedsexistingcolumns, status.getMessage()); //$NON-NLS-1$ + } +} diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteFailCellRows_Test.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteFailCellRows_Test.java new file mode 100644 index 00000000000..3405ed7a30b --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/paste/overwrite/PasteOverwriteFailCellRows_Test.java @@ -0,0 +1,59 @@ +/***************************************************************************** + * 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.generic.tests.paste.overwrite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; +import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; +import org.eclipse.papyrus.infra.nattable.messages.Messages; +import org.junit.Assert; + +/** + * Test pastes overwrite when the number of rows to paste is not equals to the number of rows selected. + */ +public class PasteOverwriteFailCellRows_Test extends AbstractPasteOverwriteTest { + + /** + * Constructor. + */ + public PasteOverwriteFailCellRows_Test() { + super(); + } + + /** + * 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 + protected void manageSelection(final NattableModelManager manager) throws Exception { + super.manageSelection(manager); + manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 2, 1, true, false)); + + flushDisplayEvents(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#checkReturned_Status(org.eclipse.core.runtime.IStatus) + */ + @Override + protected void checkReturned_Status(final IStatus status) { + Assert.assertEquals("Error must be caught", IStatus.ERROR, status.getSeverity()); //$NON-NLS-1$ + Assert.assertEquals("Error message is not the expected message", Messages.AbstractPasteInSelectionNattableCommandProvider_readrowsexceedsexistingrows, status.getMessage()); //$NON-NLS-1$ + } + +} diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/tests/AllTests.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/tests/AllTests.java index 55240328df0..d61bbfe3776 100755 --- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/tests/AllTests.java +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.tests/src/org/eclipse/papyrus/uml/nattable/generic/tests/tests/AllTests.java @@ -19,6 +19,10 @@ import org.eclipse.papyrus.uml.nattable.generic.tests.bugs.AxisChangeIndexWithou import org.eclipse.papyrus.uml.nattable.generic.tests.bugs.InvertedAxisChangeIndexWithConfigurationTest; import org.eclipse.papyrus.uml.nattable.generic.tests.bugs.InvertedAxisChangeIndexWithoutConfigurationTest; import org.eclipse.papyrus.uml.nattable.generic.tests.bugs.OpenAndDeleteTest; +import org.eclipse.papyrus.uml.nattable.generic.tests.paste.overwrite.PasteOverwriteAll_Test; +import org.eclipse.papyrus.uml.nattable.generic.tests.paste.overwrite.PasteOverwriteByOneLine_Test; +import org.eclipse.papyrus.uml.nattable.generic.tests.paste.overwrite.PasteOverwriteFailCellColumns_Test; +import org.eclipse.papyrus.uml.nattable.generic.tests.paste.overwrite.PasteOverwriteFailCellRows_Test; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @@ -38,7 +42,11 @@ import org.junit.runners.Suite.SuiteClasses; FilterStringMatcherTest.class, FilterEEnumMatcherTest.class, FilterNumericMatcherTest.class, - FilterUMLEnumerationMatcherTest.class + FilterUMLEnumerationMatcherTest.class, + PasteOverwriteAll_Test.class, + PasteOverwriteByOneLine_Test.class, + PasteOverwriteFailCellColumns_Test.class, + PasteOverwriteFailCellRows_Test.class }) public class AllTests { // JUnit 4 test suite |