Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormgolubev2012-03-19 04:56:06 -0400
committermgolubev2012-03-19 04:56:06 -0400
commitece667d03dcdc927bb9b0bd1ef151123257a6813 (patch)
tree5b7dbeda2562437aee43a28aabfdb566a0f5d9a6
parent6a9212fb9519b27147eab35b2ea13c6b8b31a8ee (diff)
downloadorg.eclipse.gmf-tooling-158116-choice-labels-merging.tar.gz
org.eclipse.gmf-tooling-158116-choice-labels-merging.tar.xz
org.eclipse.gmf-tooling-158116-choice-labels-merging.zip
[158116] - Fixed CCE on applying the value from EnumParser158116-choice-labels-merging
-rw-r--r--plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/parsers/EnumParser.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/parsers/EnumParser.java b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/parsers/EnumParser.java
index 7f4e1b12e..a498d14f6 100644
--- a/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/parsers/EnumParser.java
+++ b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/parsers/EnumParser.java
@@ -15,19 +15,24 @@ public class EnumParser extends ChoiceParserBase {
super(enumFeature);
}
+ @SuppressWarnings("unchecked")
@Override
protected Collection<Object> getItems(EObject element) {
List<Object> result = new ArrayList<Object>();
EAttribute enumFeature = (EAttribute) getFeature();
EEnum type = (EEnum) enumFeature.getEType();
- for (EEnumLiteral literal : type.getELiterals()) {
- result.add(literal.getLiteral());
+ @SuppressWarnings("rawtypes")
+ Class<? extends Enum> enumeratorClass = (Class<? extends Enum>) type.getInstanceClass();
+ for (EEnumLiteral eLiteral : type.getELiterals()) {
+ Object literalValue = Enum.valueOf(enumeratorClass, eLiteral.getLiteral());
+ result.add(literalValue);
}
return result;
}
@Override
protected String getEditChoice(EObject element, Object item) {
- return item.toString();
+ return ((Enum<?>) item).name();
}
+
}

Back to the top