diff options
author | Nicolas FAUVERGUE | 2016-07-08 07:40:12 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-08-09 08:09:27 +0000 |
commit | 18800c23e6f91d8f56db694b4ac743ab7de28e43 (patch) | |
tree | 7aa71758a20bdb2cbc058aeaf1dffab1a44e8f35 | |
parent | ef5fb6f168553366f49e17b26e4516206556f803 (diff) | |
download | org.eclipse.papyrus-18800c23e6f91d8f56db694b4ac743ab7de28e43.tar.gz org.eclipse.papyrus-18800c23e6f91d8f56db694b4ac743ab7de28e43.tar.xz org.eclipse.papyrus-18800c23e6f91d8f56db694b4ac743ab7de28e43.zip |
Bug 456841: [Table 2] Copy/paste from Excel in "attached mode" can fail
for cells corresponding to stereotype property typed by an Enum
https://bugs.eclipse.org/bugs/show_bug.cgi?id=456841
It was not need to check if the stereotype was already applied and throw
exception in this case.
We ust have to aply stereotype if this is not the case, and do nothing
otherwise.
Change-Id: I3510f1d020225ce5a185cf6b1e29ebe09957df3c
Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
2 files changed, 19 insertions, 21 deletions
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 c9823c21887..d99684f48ac 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 @@ -1378,7 +1378,9 @@ public abstract class AbstractPasteInSelectionNattableCommandProvider implements final Object columnElement = getColumnElement(realColumnIndex); // Edit the value if this is editable - final boolean isEditable = CellManagerFactory.INSTANCE.isCellEditable(columnElement, rowElement, sharedMap); + final boolean isEditable = null == sharedMap ? + CellManagerFactory.INSTANCE.isCellEditable(columnElement, rowElement) : + CellManagerFactory.INSTANCE.isCellEditable(columnElement, rowElement, sharedMap); if (isEditable) { final AbstractStringValueConverter converter = CellManagerFactory.INSTANCE.getOrCreateStringValueConverterClass(columnElement, rowElement, tableManager, existingConverters, pasteHelper.getMultiValueSeparator()); diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java index da45c521858..5aa07900270 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java @@ -227,16 +227,14 @@ public class StereotypePropertyCellManager extends UMLFeatureCellManager { @Override protected void doExecute() { - if (!applyRequiredStereotype(domain, el, id)) { + // This may apply the required stereotype if needed + applyRequiredStereotype(domain, el, id); + // Now recursively execute the set-string-value command + Command command = getSetValueCommand(domain, columnElement, rowElement, newValue, tableManager); + if (command == null || !command.canExecute()) { throw new OperationCanceledException(); } else { - // Now recursively execute the set-string-value command - Command command = getSetValueCommand(domain, columnElement, rowElement, newValue, tableManager); - if (command == null || !command.canExecute()) { - throw new OperationCanceledException(); - } else { - domain.getCommandStack().execute(command); - } + domain.getCommandStack().execute(command); } } }; @@ -285,20 +283,18 @@ public class StereotypePropertyCellManager extends UMLFeatureCellManager { @Override protected void doExecute() { - if (!applyRequiredStereotype(domain, el, id)) { - throw new OperationCanceledException(); - } else { - // Now recursively execute the set-string-value command - Command command = getSetStringValueCommand(domain, columnElement, rowElement, newValue, valueSolver, tableManager); - if (command != null) { - if (!command.canExecute()) { - throw new OperationCanceledException(); - } else { - domain.getCommandStack().execute(command); - } + // This may apply the required stereotype if needed + applyRequiredStereotype(domain, el, id); + // Now recursively execute the set-string-value command + Command command = getSetStringValueCommand(domain, columnElement, rowElement, newValue, valueSolver, tableManager); + if (command != null) { + if (!command.canExecute()) { + throw new OperationCanceledException(); } else { - // A null command is not an error, it just means there's nothing to set because the value is already correct. + domain.getCommandStack().execute(command); } + } else { + // A null command is not an error, it just means there's nothing to set because the value is already correct. } } }; |