diff options
author | Nicolas FAUVERGUE | 2016-11-24 12:49:41 +0000 |
---|---|---|
committer | vincent lorenzo | 2016-11-29 11:01:26 +0000 |
commit | 3ed639ecef256da3eeff86d3b428720561f362df (patch) | |
tree | ea5d0d552c2e0b62cd9ee3cafd907ee69c0ad2e8 /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org | |
parent | b3141df23ca644573f8b2813ad8859722d418bd9 (diff) | |
download | org.eclipse.papyrus-3ed639ecef256da3eeff86d3b428720561f362df.tar.gz org.eclipse.papyrus-3ed639ecef256da3eeff86d3b428720561f362df.tar.xz org.eclipse.papyrus-3ed639ecef256da3eeff86d3b428720561f362df.zip |
Bug 496905: [Diagram][ModelExplorer][Table][Dialog] Papyrus must integrate
the internationalization feature provided by UML.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=496905
Commit of UML for internationalization.
Change-Id: Ia61e5ef4d537f9e9b192bcfe073f921542fe4876
Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java index bb8b39ad497..dce40257884 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 */ package org.eclipse.papyrus.uml.diagram.statemachine.parsers; @@ -18,13 +19,20 @@ import java.text.ParsePosition; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; +import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.uml.diagram.statemachine.part.Messages; import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.UMLPackage; /** * @generated @@ -204,4 +212,44 @@ public class MessageFormatParser extends AbstractAttributeParser { EObject element = (EObject) adapter.getAdapter(EObject.class); return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) + */ + @Override + protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) { + ICommand result = null; + + // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name + if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) { + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) { + final ModelSet modelSet = (ModelSet) element.eResource().getResourceSet(); + if (null != modelSet) { + result = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement) element, (String) value, null)); + } + } + } + + return null != result ? result : super.getModificationCommand(element, feature, value); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) + */ + @Override + protected Object getValue(final EObject element, final EStructuralFeature feature) { + Object result = null; + + if(element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())){ + if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element)) { + result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)element); + } + } + + return null != result ? result : super.getValue(element, feature); + } } |