diff options
author | Nicolas FAUVERGUE | 2016-09-28 08:18:12 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-09-29 11:19:20 +0000 |
commit | 139b053a5b429bbaf012f44a3ec6088698054fde (patch) | |
tree | e0adaca1f1676670b63555b15ece26871ac4ea28 /plugins | |
parent | 4232c5afa7e34f34c5cc4622e868c7bb5d45383e (diff) | |
download | org.eclipse.papyrus-139b053a5b429bbaf012f44a3ec6088698054fde.tar.gz org.eclipse.papyrus-139b053a5b429bbaf012f44a3ec6088698054fde.tar.xz org.eclipse.papyrus-139b053a5b429bbaf012f44a3ec6088698054fde.zip |
Bug 502160: [All Diagrams] NPE on undo of "line color" appearance
attribute
https://bugs.eclipse.org/bugs/show_bug.cgi?id=502160
- Modify the dispose table command to avoid the null pointer when undo
Change-Id: I84b1fcd52915d1e6098f6d9c1e10f9d10308a8c8
Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/NattablePropertyEditor.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/NattablePropertyEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/NattablePropertyEditor.java index 5b81561a06d..653cfe88667 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/NattablePropertyEditor.java +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/NattablePropertyEditor.java @@ -400,7 +400,14 @@ public class NattablePropertyEditor extends AbstractPropertyEditor { displayError("The table can't be initialized");//$NON-NLS-1$ return; } - domain.getCommandStack().execute(cc); + + final ResourceSet resourceSet = getResourceSet(); + // Bug 502160: Remove the resource from the resource set to execute the command without using the editing command stack + resourceSet.getResources().remove(this.resource); + cc.execute(); + // Bug 502160: Re-add the removed resource before the command execute + resourceSet.getResources().add(this.resource); + if (this.table.getContext() == null) { displayError("The context of the table hasn't be set");//$NON-NLS-1$ return; @@ -926,8 +933,13 @@ public class NattablePropertyEditor extends AbstractPropertyEditor { } TransactionalEditingDomain domain = getTableEditingDomain(); if (domain != null && this.table != null) { + final ResourceSet resourceSet = getResourceSet(); + // Bug 502160: Remove the resource from the resource set to execute the command without using the editing command stack + resourceSet.getResources().remove(this.resource); Command cmd = getDisposeTableCommand(domain, this.table); - domain.getCommandStack().execute(cmd); + cmd.execute(); + // Bug 502160: Re-add the removed resource before the command execute + resourceSet.getResources().add(this.resource); } if (NattablePropertyEditor.this.resource != null) { try { |