当前位置: 首页>>代码示例>>Java>>正文


Java ITokenScanner.setRange方法代码示例

本文整理汇总了Java中org.eclipse.jface.text.rules.ITokenScanner.setRange方法的典型用法代码示例。如果您正苦于以下问题:Java ITokenScanner.setRange方法的具体用法?Java ITokenScanner.setRange怎么用?Java ITokenScanner.setRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.text.rules.ITokenScanner的用法示例。


在下文中一共展示了ITokenScanner.setRange方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.eclipse.jface.text.rules.ITokenScanner; //导入方法依赖的package包/类
public static void configure(TextLayout textLayout) {
	String text = textLayout.getText();
	Document doc = new Document(text);
	ITokenScanner scanner = getRecipeScanner(doc);
	scanner.setRange(doc, 0, doc.getLength());
	IToken token;
	while ((token = scanner.nextToken()) != Token.EOF) {
		int offset = scanner.getTokenOffset();
		int length = scanner.getTokenLength();
		Object data = token.getData();
		if (data != null && data instanceof TextStyle) {
			TextStyle textStyle = (TextStyle) data;
			textLayout.setStyle(textStyle, offset, offset + length - 1);
		}
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:17,代码来源:TagStyleConfigurator.java

示例2: configure

import org.eclipse.jface.text.rules.ITokenScanner; //导入方法依赖的package包/类
public static void configure(TextLayout textLayout) {
	String text = textLayout.getText();
	Document doc = new Document(text);
	ITokenScanner scanner = getRecipeScanner(doc);
	scanner.setRange(doc, 0, doc.getLength());
	IToken token;
	while ((token = scanner.nextToken()) != Token.EOF) {
		int offset = scanner.getTokenOffset();
		int length = scanner.getTokenLength();
		Object data = token.getData();
		if (data != null && data instanceof TextStyle) {
			TextStyle textStyle = (TextStyle) data;
			textLayout.setStyle(textStyle, offset, offset + length - 1);
		}
	}
	scanner = null;
	doc = null;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:19,代码来源:TagStyleConfigurator.java

示例3: scan

import org.eclipse.jface.text.rules.ITokenScanner; //导入方法依赖的package包/类
public static String scan(ITokenScanner scanner, IDocument document) {
    scanner.setRange(document, 0, document.getLength());

    ArrayList<String> found = new ArrayList<String>();
    FastStringBuffer buf = new FastStringBuffer();
    IToken token = scanner.nextToken();
    while (!token.isEOF()) {
        Object data = token.getData();
        if (data != null) {
            buf.clear();
            buf.append(data.toString()).append(":");
            buf.append(scanner.getTokenOffset()).append(":");
            buf.append(scanner.getTokenLength());
            found.add(buf.toString());
        } else {
            buf.clear();
            buf.append("null").append(":");
            buf.append(scanner.getTokenOffset()).append(":");
            buf.append(scanner.getTokenLength());
            found.add(buf.toString());
        }
        token = scanner.nextToken();
    }
    return listToExpected(found);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:26,代码来源:TestUtils.java

示例4: queueDelegate

import org.eclipse.jface.text.rules.ITokenScanner; //导入方法依赖的package包/类
/**
 * Queue the specified delegate token scanner with offset:length range for return by nextToken() The given delegate
 * will be used until EOF token returned.
 * 
 * @param tokenScanner
 * @param offset
 * @param length
 */
public void queueDelegate(ITokenScanner tokenScanner, int offset, int length)
{
	tokenScanner.setRange(fDocument, offset, length);
	queue.add(new Entry(tokenScanner, null, offset, length));
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:14,代码来源:QueuedRuleBasedScanner.java


注:本文中的org.eclipse.jface.text.rules.ITokenScanner.setRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。