Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2017-07-31 14:36:01 +0000
committervincent lorenzo2017-08-31 08:05:10 +0000
commit67e404d139d4689197e99a0fcfa30caa485e288b (patch)
tree3d85ccfcdd293419b3587291d513fa17b5920a5e /plugins/uml/properties
parent1fd57583d65596c3cb38d5baec98618e2824de29 (diff)
downloadorg.eclipse.papyrus-67e404d139d4689197e99a0fcfa30caa485e288b.tar.gz
org.eclipse.papyrus-67e404d139d4689197e99a0fcfa30caa485e288b.tar.xz
org.eclipse.papyrus-67e404d139d4689197e99a0fcfa30caa485e288b.zip
Bug 515650: [Property View] Internationalization of labels presented in
property pages https://bugs.eclipse.org/bugs/show_bug.cgi?id=515650 Manage internationalization for labels in properties view only for objects that are internationalized by a '*.properties' file. Change-Id: Icaecc4e8aa9389e135fc2257b94ed1386be2f199 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
Diffstat (limited to 'plugins/uml/properties')
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java37
1 files changed, 34 insertions, 3 deletions
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
index 47e5e8ff202..1c14cb0d44a 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2017 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - bug 453445
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - bug 453445, 515650
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 502533
*
*****************************************************************************/
@@ -29,6 +29,7 @@ import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement;
import org.eclipse.papyrus.infra.properties.ui.modelelement.EObjectStructuredValueFactory;
+import org.eclipse.papyrus.infra.properties.ui.modelelement.ILabeledModelElement;
import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.uml.properties.Activator;
@@ -38,7 +39,9 @@ import org.eclipse.papyrus.uml.tools.databinding.PapyrusObservableList;
import org.eclipse.papyrus.uml.tools.databinding.PapyrusObservableValue;
import org.eclipse.papyrus.uml.tools.providers.UMLContentProvider;
import org.eclipse.papyrus.uml.tools.utils.DataTypeUtil;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.common.util.UML2Util;
+import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Stereotype;
/**
@@ -46,7 +49,7 @@ import org.eclipse.uml2.uml.Stereotype;
*
* @author Camille Letavernier
*/
-public class StereotypeModelElement extends EMFModelElement {
+public class StereotypeModelElement extends EMFModelElement implements ILabeledModelElement {
/**
* The stereotype handled by this ModelElement
@@ -177,4 +180,32 @@ public class StereotypeModelElement extends EMFModelElement {
return super.getValueFactory(propertyPath);
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.ILabeledModelElement#getLabel(java.lang.String)
+ */
+ @Override
+ public String getLabel(final String propertyPath) {
+ String result = null;
+
+ final FeaturePath featurePath = getFeaturePath(propertyPath);
+ final EStructuralFeature feature = getFeature(featurePath);
+
+ if (null != feature) {
+ final EObject property = StereotypeUtil.getPropertyByName(stereotype, feature.getName());
+ if (property instanceof NamedElement) {
+ final NamedElement namedElement = (NamedElement) property;
+ final String name = namedElement.getName();
+ final String label = namedElement.getLabel();
+
+ if (!label.equals(name)) {
+ result = label;
+ }
+ }
+ }
+
+ return result;
+ }
}

Back to the top