Java 类org.eclipse.xtext.ui.editor.model.DocumentTokenSource 实例源码

项目:statecharts    文件:StyleRanges.java   
public List<StyleRange> getRanges(String expression) {
    final List<StyleRange> ranges = Lists.newArrayList();
    DocumentEvent event = new DocumentEvent();
    event.fDocument = new DummyDocument(expression);
    DocumentTokenSource tokenSource = tokenSourceProvider.get();
    tokenSource.updateStructure(event);
    Iterator<ILexerTokenRegion> iterator = tokenSource.getTokenInfos().iterator();
    while (iterator.hasNext()) {
        ILexerTokenRegion next = iterator.next();
        TextAttribute attribute = attributeProvider.getAttribute(tokenTypeMapper.getId(next.getLexerTokenType()));
        StyleRange range = new StyleRange(next.getOffset(), next.getLength(), attribute.getForeground(),
                attribute.getBackground());
        range.font = attribute.getFont();
        range.fontStyle = attribute.getStyle();
        ranges.add(range);
    }
    return ranges;
}
项目:n4js    文件:N4JSUiModule.java   
/**
 * Configure the parser based token source for the coloring.
 */
public Class<? extends DocumentTokenSource> bindDocumentTokenSource() {
    return ParserBasedDocumentTokenSource.class;
}
项目:n4js    文件:N4JSDocument.java   
/**
 * Creates a new instance, delegates to {@link XtextDocument#XtextDocument(DocumentTokenSource, ITextEditComposer)}.
 */
@Inject
public N4JSDocument(DocumentTokenSource tokenSource, ITextEditComposer composer) {
    super(tokenSource, composer);
}
项目:dsl-devkit    文件:ResponsiveXtextDocument.java   
@Inject
public ResponsiveXtextDocument(final DocumentTokenSource tokenSource, final ITextEditComposer composer) {
  super(tokenSource, composer);
}
项目:dsl-devkit    文件:XtextGMFDocument.java   
@Inject
public XtextGMFDocument(final DocumentTokenSource tokenSource, final ITextEditComposer composer) {
  super(tokenSource, composer);
}
项目:statecharts    文件:ParallelReadXtextDocument.java   
@Inject
public ParallelReadXtextDocument(DocumentTokenSource tokenSource, ITextEditComposer composer) {
    super(tokenSource, composer);
}
项目:CooperateModelingEnvironment    文件:CooperateXtextDocument.java   
@Inject
public CooperateXtextDocument(DocumentTokenSource tokenSource, ITextEditComposer composer) {
    super(tokenSource, composer);
}