diff options
author | Vincent Lorenzo | 2015-04-01 15:11:31 +0000 |
---|---|---|
committer | Vincent Lorenzo | 2015-04-01 15:11:31 +0000 |
commit | 4e7c3bc31fd61fbe8dbf4e7337a8a0b3c26218bd (patch) | |
tree | ea6c32ef8516ed736754b4a66cea83f4c29ff91f /plugins | |
parent | 3e0c74e92cf404c17c24834f57b528d943c81382 (diff) | |
download | org.eclipse.papyrus-4e7c3bc31fd61fbe8dbf4e7337a8a0b3c26218bd.tar.gz org.eclipse.papyrus-4e7c3bc31fd61fbe8dbf4e7337a8a0b3c26218bd.tar.xz org.eclipse.papyrus-4e7c3bc31fd61fbe8dbf4e7337a8a0b3c26218bd.zip |
458492: [Table 2] Cell Editor for UML Enumeration do nothing
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/dataprovider/UMLStereotypeSingleEnumerationComboBoxDataProvider.java | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/dataprovider/UMLStereotypeSingleEnumerationComboBoxDataProvider.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/dataprovider/UMLStereotypeSingleEnumerationComboBoxDataProvider.java index 2b07ccd554c..e3260861baa 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/dataprovider/UMLStereotypeSingleEnumerationComboBoxDataProvider.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/dataprovider/UMLStereotypeSingleEnumerationComboBoxDataProvider.java @@ -18,9 +18,12 @@ import java.util.ArrayList; import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
+import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
@@ -91,24 +94,33 @@ public class UMLStereotypeSingleEnumerationComboBoxDataProvider implements IComb if (ste.size() == 1) {
final Stereotype current = ste.get(0);
// the stereotype is maybe not applied on the element, but we allow to edit its values
- EClass stereotypeDefinition = (EClass) current.getProfile().getDefinition(current);
- if (stereotypeDefinition != null) {
- EStructuralFeature feature = stereotypeDefinition.getEStructuralFeature(property.getName());
- if (feature != null) {
- EEnum eenum = null;
+ EObject propertyDef = current.getProfile().getDefinition(property);
+ EEnum eenum = null;
+ if (propertyDef != null) {
+ if (propertyDef instanceof EClass) {
+ // dynamic profile
+ EStructuralFeature feature = ((EClass) propertyDef).getEStructuralFeature(property.getName());
if (feature != null && feature.getEType() instanceof EEnum) {
eenum = (EEnum) feature.getEType();
}
- if (eenum != null) {
- for (EEnumLiteral literal : eenum.getELiterals()) {
- Enumerator value = literal.getInstance();
- literals.add(value);
- }
+
+ // in case of static profile (SysML) we get an eattribute instead of an EClass
+ } else if (propertyDef instanceof EAttribute) {
+ EClassifier tmp = ((EAttribute) propertyDef).getEType();
+ if (tmp instanceof EEnum) {
+ eenum = (EEnum) tmp;
}
}
}
+ if (eenum != null) {
+ for (EEnumLiteral literal : eenum.getELiterals()) {
+ Enumerator value = literal.getInstance();
+ literals.add(value);
+ }
+ }
}
}
return literals;
}
+
}
|