public org.eclipse.jface.text.rules.IToken nextToken() { boolean isOriginalToken = true; if (!nextTokens.isEmpty()) { currentToken = nextTokens.remove(0); isOriginalToken = false; } else { currentToken = lexer.getNextToken(); } if (currentToken == null || !currentToken.canBeUsedForSyntaxHighlighting()) { return org.eclipse.jface.text.rules.Token.EOF; } if (isOriginalToken) { splitCurrentToken(); } org.eclipse.jface.text.TextAttribute textAttribute = null; String tokenName = currentToken.getName(); if (tokenName != null) { tudresden.ocl20.pivot.language.ocl.resource.ocl.IOclTokenStyle staticStyle = getStaticTokenStyle(); // now call dynamic token styler to allow to apply modifications to the static // style tudresden.ocl20.pivot.language.ocl.resource.ocl.IOclTokenStyle dynamicStyle = getDynamicTokenStyle(staticStyle); if (dynamicStyle != null) { textAttribute = getTextAttribute(dynamicStyle); } } return new org.eclipse.jface.text.rules.Token(textAttribute); }
public void setRange(org.eclipse.jface.text.IDocument document, int offset, int length) { this.offset = offset; try { lexer.setText(document.get(offset, length)); } catch (org.eclipse.jface.text.BadLocationException e) { // ignore this error. It might occur during editing when locations are outdated // quickly. } }