當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。