Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.eclipse.xtext.ui.editor.templates;
 import java.util.List;
 import  org.eclipse.jface.text.templates.TemplateVariable;
Resolves a template variable to EEnumLiteral literals which are assignment-compatible with the TemplateVariable variable enumeration parameter (e.g. in ${modifier:Enum('[PackageName.]Visibility')}).

Michael Clay - Initial contribution and API
public class EnumTemplateVariableResolver extends
	public List<StringresolveValues(TemplateVariable variable,
			XtextTemplateContext castedContext) {
		String enumerationName = (Stringvariable.getVariableType()
		Grammar grammar = getGrammar(castedContext);
		if (grammar == null)
			return Collections.emptyList();
		EEnum enumeration = (EEnumgetEClassifierForGrammar(enumerationNamegrammar);
		if (enumeration == null) {
			return Collections.emptyList();
		return Lists.transform(enumeration.getELiterals(), new Function<EEnumLiteralString>() {
			public String apply(EEnumLiteral enumLiteral) {
				return enumLiteral.getLiteral();
New to GrepCode? Check out our FAQ X