Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html /
 
 package org.eclipse.xtext.ui.editor.templates;
 

Author(s):
Sebastian Zarnekow - Initial contribution and API
public class ContextTypeIdHelper {
	public String getId(AbstractElement element) {
		if (!(element instanceof Keyword))
			throw new IllegalArgumentException("Unsupported context element: " + element);
		return GrammarUtil.getGrammar(element).getName()+".kw_"+((Keywordelement).getValue();
	}
	public String getId(AbstractRule rule) {
		if (!(rule instanceof ParserRule))
			throw new IllegalArgumentException("Unsupported context rule: " + rule);
		return GrammarUtil.getGrammar(rule).getName()+"."+rule.getName();
	}
New to GrepCode? Check out our FAQ X