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


Java RuleBasedPartitionScanner类代码示例

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


RuleBasedPartitionScanner类属于org.eclipse.jface.text.rules包,在下文中一共展示了RuleBasedPartitionScanner类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRecipePartitioner

import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; //导入依赖的package包/类
IDocumentPartitioner createRecipePartitioner() {
    IPredicateRule[] rules = {
            new SingleLineRule("--", null, new Token(SQL_SINGLE_COMMENT), (char) 0, true, false), //$NON-NLS-1$
            new MultiLineRule("/*", "*/", new Token(SQL_MULTI_COMMENT), (char) 0, true),  //$NON-NLS-1$ //$NON-NLS-2$
            new MultiLineRule( "'", "'", new Token(SQL_CHARACTER_STRING_LITERAL), (char) 0 , true) //$NON-NLS-1$ //$NON-NLS-2$
    };

    RuleBasedPartitionScanner scanner = new RuleBasedPartitionScanner();
    scanner.setPredicateRules(rules);

    return new FastPartitioner(scanner, CONTENT_TYPES);
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:13,代码来源:SQLEditorCommonDocumentProvider.java

示例2: createKspPartitionScanner

import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; //导入依赖的package包/类
private IPartitionTokenScanner createKspPartitionScanner() {
	RuleBasedPartitionScanner scanner = new RuleBasedPartitionScanner();
	scanner.setPredicateRules(new IPredicateRule[] {
	/* String entre double quote. */
	new PatternRule("\"", "\"", new Token(KspRegionType.STRING.getContentType()), '\\', false),
	/* Commentaire multi-lignes */
	new PatternRule("/*", "*/", new Token(KspRegionType.COMMENT.getContentType()), '\\', false),
	/* Commentaire fin de ligne */
	new EndOfLineRule("//", new Token(KspRegionType.COMMENT.getContentType())) });
	return scanner;
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:12,代码来源:KspDocumentSetupParticipant.java

示例3: createConnectPartitioner

import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; //导入依赖的package包/类
private IDocumentPartitioner createConnectPartitioner(IDocument document,
		IPredicateRule[] rules, String[] types) {
	RuleBasedPartitionScanner scanner = new RuleBasedPartitionScanner();
	scanner.setPredicateRules(rules);
	IDocumentPartitioner partitioner = new FastPartitioner(scanner, types);
	partitioner.connect(document);
	return partitioner;
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:9,代码来源:AbstractXmlParser.java

示例4: setupDocument

import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; //导入依赖的package包/类
public String setupDocument(Document document) {
    IPartitionTokenScanner scanner = new RuleBasedPartitionScanner();
    FastPartitioner partitioner = new FastPartitioner(scanner, new String[] { IDocument.DEFAULT_CONTENT_TYPE });
    String[] managingPositionCategories = partitioner.getManagingPositionCategories();
    String category = managingPositionCategories[0];
    document.setDocumentPartitioner(partitioner);
    document.addPositionCategory(category);
    return category;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:10,代码来源:PartitionCodeReaderTest.java

示例5: getKeyRegion

import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; //导入依赖的package包/类
public IRegion getKeyRegion(IDocument document, final String searchKey) {
	IPredicateRule[] rules = new IPredicateRule[4];
	rules[0] = new EndOfLineRule("#", Token.UNDEFINED);
	rules[1] = new EndOfLineRule("!", Token.UNDEFINED);
	rules[2] = new WordPatternRule(new PropertyKeyDetector(), "\n", "=",
			KEY_TOKEN);
	rules[3] = new WordPatternRule(new PropertyKeyDetector(), "\n", ":",
			KEY_TOKEN);

	RuleBasedPartitionScanner scanner = new RuleBasedPartitionScanner();
	scanner.setPredicateRules(rules);

	IDocumentPartitioner partitioner = new FastPartitioner(scanner,
			new String[] { KEY });

	IRegion region = null;
	try {
		partitioner.connect(document);

		ITypedRegion[] tagRegions = partitioner.computePartitioning(0,
				document.getLength());

		boolean firstRegion = true;
		for (ITypedRegion tagRegion : tagRegions) {
			if (KEY.equals(tagRegion.getType()) || firstRegion) {
				String key = null;
				try {
					// -1 remove =
					key = document.get(tagRegion.getOffset(),
							tagRegion.getLength() - 1);
					key = key.trim();
				} catch (BadLocationException e) {
					e.printStackTrace();
				}
				// first line isn't caught by the key_token rule
				if (firstRegion && key != null) {
					int indx = key.indexOf('=');
					if (indx != -1) {
						key = key.substring(0, indx).trim();
					}
				}

				if (key != null) {
					key = key.replace("\\ ", " ");
					if (key.equals(searchKey)) {
						region = tagRegion;
						break;
					}
				}
			}
			firstRegion = false;
		}
	} finally {
		if (partitioner != null) {
			partitioner.disconnect();
		}
	}
	return region;
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:60,代码来源:PropertiesParser.java


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