Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2011 itemis AG ( 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 /
 package org.eclipse.xtext.ui.editor.model;
import  org.eclipse.xtext.ide.LexerIdeBindings;
import  org.eclipse.xtext.ide.editor.syntaxcoloring.HighlightingStyles;

Sebastian Zarnekow - Initial contribution and API
public abstract class TokenTypeToStringMapper {
	private String[] mappedValues;
	public void setTokenDefProvider(@Named(LexerIdeBindings.HIGHLIGHTING) ITokenDefProvider tokenDefProvider) {
	protected void initIds(Map<IntegerStringtokenDefMap) {
		 = new String[tokenDefMap.size()];
		for (Entry<IntegerStringentry : tokenDefMap.entrySet()) {
			if (entry.getKey() >= .)
				[entry.getKey() - .] = calculateId(entry.getValue(), entry.getKey());
	protected abstract String calculateId(String tokenNameint tokenType);
	protected String getMappedValue(int tokenType) {
		if (tokenType == .)
			return HighlightingStyles.INVALID_TOKEN_ID;
		return [tokenType-.];
New to GrepCode? Check out our FAQ X