diff options
author | Arnaud Cuccuru | 2013-10-03 14:20:59 +0000 |
---|---|---|
committer | Arnaud Cuccuru | 2013-10-03 14:20:59 +0000 |
commit | ffd9d4745816b11109eb1a7e37abdaceb070dad6 (patch) | |
tree | cebc24f4e5a1b7a6066caf40b7988c7ddbbefe17 /plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property | |
parent | e4e865f909583b758452469439937f75d1d1ed52 (diff) | |
download | org.eclipse.papyrus-ffd9d4745816b11109eb1a7e37abdaceb070dad6.tar.gz org.eclipse.papyrus-ffd9d4745816b11109eb1a7e37abdaceb070dad6.tar.xz org.eclipse.papyrus-ffd9d4745816b11109eb1a7e37abdaceb070dad6.zip |
Bug 418594 - [TextEdit] The textual editor for properties generates
inconsistent default values.
In the case of a null value (for the default of the property), a
DestroyElementRequest is used instead of a SetRequest.
Diffstat (limited to 'plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property')
-rw-r--r-- | plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java index 4cc716a9483..acab337eebf 100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java @@ -19,6 +19,7 @@ import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; @@ -206,11 +207,17 @@ public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEd newVisibility); ICommand setVisibilityCommand = provider.getEditCommand(setVisibilityRequest); updateCommand.add(setVisibilityCommand); - - SetRequest setDefaultValueRequest = new SetRequest(property, UMLPackage.eINSTANCE.getProperty_Default(), - newDefault); - ICommand setDefaultValueCommand = provider.getEditCommand(setDefaultValueRequest); - updateCommand.add(setDefaultValueCommand); + + if (newDefault == null && property.getDefaultValue() != null) { + DestroyElementRequest destroyDefaultValueRequest = new DestroyElementRequest(property.getDefaultValue(), false) ; + ICommand destroyDefaultValueCommand = provider.getEditCommand(destroyDefaultValueRequest) ; + updateCommand.add(destroyDefaultValueCommand); + } + else { + SetRequest setDefaultValueRequest = new SetRequest(property, UMLPackage.eINSTANCE.getProperty_Default(), newDefault); + ICommand setDefaultValueCommand = provider.getEditCommand(setDefaultValueRequest); + updateCommand.add(setDefaultValueCommand); + } SetRequest setRedefinedPropertiesRequest = new SetRequest(property, UMLPackage.eINSTANCE.getProperty_RedefinedProperty(), newRedefines); |