Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2013 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.model;
 
import  org.eclipse.jface.text.DocumentEvent;

The old version of the DocumentTokenSource. It assumes that all tokens before the damaged region can change with a DocumentEvent therefore the entire document is being lexed.

Author(s):
koehnlein - Initial contribution and API
Since:
2.4

Since:
2.4
	protected RepairEntryData getRepairEntryData(DocumentEvent ethrows Exception {
		int tokenStartsAt = 0;
		int tokenInfoIdx = 0;
		TokenSource source = createTokenSource(e.fDocument.get());
		CommonToken token = (CommonTokensource.nextToken();
		// find start idx
		while (true) {
			if (token == .) {
				break;
			}
			if (tokenInfoIdx >= getInternalModifyableTokenInfos().size())
				break;
			TokenInfo tokenInfo = getInternalModifyableTokenInfos().get(tokenInfoIdx);
			if (tokenInfo.getAntlrTokenType() != token.getType()
					|| token.getStopIndex() - token.getStartIndex() + 1 != tokenInfo.getLength())
				break;
			if (tokenStartsAt + tokenInfo.getLength() > e.fOffset)
				break;
			tokenStartsAt += tokenInfo.getLength();
			tokenInfoIdx++;
			token = (CommonTokensource.nextToken();
		}
		return new RepairEntryData(tokenStartsAttokenInfoIdxtokensource);
	}
New to GrepCode? Check out our FAQ X