當前位置: 首頁>>代碼示例>>Java>>正文


Java RuleBasedScanner類代碼示例

本文整理匯總了Java中org.eclipse.jface.text.rules.RuleBasedScanner的典型用法代碼示例。如果您正苦於以下問題:Java RuleBasedScanner類的具體用法?Java RuleBasedScanner怎麽用?Java RuleBasedScanner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RuleBasedScanner類屬於org.eclipse.jface.text.rules包,在下文中一共展示了RuleBasedScanner類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getImpexScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
protected RuleBasedScanner getImpexScanner(String partition) {
	
	RuleBasedScanner scanner = scanMap.get(partition); 
	if (scanner == null) {
		scanner = new ImpexRuleScanner(ColorProvider.getInstance());
		if (partition != null) {
			switch (partition) {
			case ImpexDocumentPartitioner.IMPEX_INSTRUCTION:
				scanner = new InstructionsRuleScanner(ColorProvider.getInstance());
				break;
			}
		}
		
	}
	return scanner;
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:17,代碼來源:ImpexSourceViewerConfig.java

示例2: createPreprocessorScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
public static final RuleBasedScanner createPreprocessorScanner() {
	final TextAttribute attribute = new TextAttribute(
		Activator.getDefault().getColor(GlslEditor.PREPROCESSOR_COLOR), null, SWT.BOLD
	);
	final Token preprocessorToken = new Token(attribute);
	
	IRule[] rules = new IRule[Glsl.PREPROCESSORS.length];
	for (int i = 0; i < rules.length; i++) {
		rules[i] = new SingleLineRule(Glsl.PREPROCESSORS[i], null, preprocessorToken, '\0',
				true, false);
	}
	
	RuleBasedScanner scanner = new RuleBasedScanner();
	scanner.setRules(rules);
	return scanner;
}
 
開發者ID:Johnnei,項目名稱:GLSL-Eclipse,代碼行數:17,代碼來源:GlslScanners.java

示例3: createRecipeScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
private RuleBasedScanner createRecipeScanner() {
    RuleBasedScanner recipeScanner= new RuleBasedScanner();

    IRule[] rules= {
            sqlSyntaxRules()
    };
    recipeScanner.setRules(rules);
    return recipeScanner;
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:10,代碼來源:SQLEditorSourceViewerConfiguration.java

示例4: getCommentScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
private RuleBasedScanner getCommentScanner(){
   if (commentScanner == null) {
       commentScanner = new HCommentScanner();
       commentScanner.setDefaultReturnToken(new Token(new TextAttribute(ResourceUtils.getColor(Styles.COMMENT))));
   }
   return commentScanner;
}
 
開發者ID:nextinterfaces,項目名稱:http4e,代碼行數:8,代碼來源:HConfiguration.java

示例5: getValueScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
private RuleBasedScanner getValueScanner(){
   if (valueScanner == null) {
       valueScanner = new HValueScanner();
       valueScanner.setDefaultReturnToken(new Token(new TextAttribute(ResourceUtils.getColor(Styles.STRING))));
   }
   return valueScanner;
}
 
開發者ID:nextinterfaces,項目名稱:http4e,代碼行數:8,代碼來源:HConfiguration.java

示例6: getDefaultScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
private RuleBasedScanner getDefaultScanner(){
   if (defaultScanner == null) {
       defaultScanner = new HDefaultScanner();
       defaultScanner.setDefaultReturnToken(new Token(new TextAttribute(ResourceUtils.getColor(Styles.KEY))));
   }
   return defaultScanner;
}
 
開發者ID:nextinterfaces,項目名稱:http4e,代碼行數:8,代碼來源:HConfiguration.java

示例7: evaluate

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
	if (fColumn == UNDEFINED) return doEvaluate(scanner, resume);

	int c = scanner.read();
	scanner.unread();
	if (c == fStartSequence[0] && fColumn == scanner.getColumn()) {
		if (((RuleBasedScanner) scanner).getTokenOffset() == 0) {
			return doEvaluate(scanner, resume);
		}
	}
	return Token.UNDEFINED;
}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:14,代碼來源:FrontMatterRule.java

示例8: createCommentScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
public static final RuleBasedScanner createCommentScanner() {
	final TextAttribute attribute = new TextAttribute(
		Activator.getDefault().getColor(GlslEditor.COMMENTS_COLOR)
	);
	
	final Token commentToken = new Token(attribute);
	
	RuleBasedScanner scanner = new RuleBasedScanner();
	scanner.setDefaultReturnToken(commentToken);
	scanner.setRules(new IRule[0]);
	return scanner;
}
 
開發者ID:Johnnei,項目名稱:GLSL-Eclipse,代碼行數:13,代碼來源:GlslScanners.java

示例9: createVariableDeclarationScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
public static final RuleBasedScanner createVariableDeclarationScanner() {
	final Token qualifierToken = new Token(new TextAttribute(
		Activator.getDefault().getColor(GlslEditor.QUALIFIER_COLOR)
	));
	final Token typeToken = new Token(new TextAttribute(
		Activator.getDefault().getColor(GlslEditor.TYPE_COLOR)
	));
	final Token builtInVariableToken = new Token(new TextAttribute(
		Activator.getDefault().getColor(GlslEditor.BUILT_IN_VARIABLES_COLOR)
	));
	final Token functionToken = new Token(new TextAttribute(
		Activator.getDefault().getColor(GlslEditor.FUNCTION_COLOR)
	));
	
	WordRule wordRule = createWordRule();
	addToWordRule(wordRule, Glsl.QUALIFIERS, qualifierToken);
	addToWordRule(wordRule, Glsl.TYPES, typeToken);
	addToWordRule(wordRule, Glsl.VARIABLES, builtInVariableToken);
	addToWordRule(wordRule, Glsl.FUNCTIONS, functionToken);
	
	RuleBasedScanner scanner = new RuleBasedScanner();
	scanner.setRules(new IRule[] {
		wordRule,
		// TODO Variable highlighting
	});
	
	return scanner;
}
 
開發者ID:Johnnei,項目名稱:GLSL-Eclipse,代碼行數:29,代碼來源:GlslScanners.java

示例10: getStartEndTokenScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
private ITokenScanner getStartEndTokenScanner() {
	if (startEndTokenScanner == null) {
		RuleBasedScanner ts = new RuleBasedScanner();
		IToken seqToken = new Token(getStartEndTokenType());
		List<IRule> rules = new ArrayList<IRule>();
		for (String[] pair : getPartitionerSwitchStrategy().getSwitchTagPairs()) {
			rules.add(new SingleTagRule(pair[0], seqToken));
			rules.add(new SingleTagRule(pair[1], seqToken));
		}
		ts.setRules(rules.toArray(new IRule[rules.size()]));
		ts.setDefaultReturnToken(new Token("text")); //$NON-NLS-1$
		startEndTokenScanner = ts;
	}
	return startEndTokenScanner;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:16,代碼來源:CompositeSourceViewerConfiguration.java

示例11: getJavaScriptScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
protected RuleBasedScanner getJavaScriptScanner() {
    if (javaScriptScanner == null) {
        javaScriptScanner = new InnerJavaScriptScanner();
        RGB rgb = IHTMLColorConstants.FOREGROUND;
        Color color = new Color(Display.getCurrent(), rgb);
        javaScriptScanner.setDefaultReturnToken(new Token(new TextAttribute(color)));
    }
    return javaScriptScanner;
}
 
開發者ID:apache,項目名稱:syncope,代碼行數:10,代碼來源:HTMLSourceConfiguration.java

示例12: getCSSScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
protected RuleBasedScanner getCSSScanner() {
    if (cssScanner == null) {
        cssScanner = new InnerCSSScanner();
        RGB rgb = IHTMLColorConstants.FOREGROUND;
        Color color = new Color(Display.getCurrent(), rgb);
        cssScanner.setDefaultReturnToken(new Token(new TextAttribute(color)));
    }
    return cssScanner;
}
 
開發者ID:apache,項目名稱:syncope,代碼行數:10,代碼來源:HTMLSourceConfiguration.java

示例13: getCommentScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
ITokenScanner getCommentScanner() {
    // lazy init
    if (this.commentScanner == null) {
        final Token comment = new Token(new TextAttribute(JFaceResources.getColorRegistry().get(COMMENT_COLOR)));
        // no rules needed, because this will apply to comment partition
        // only
        final RuleBasedScanner ruleBasedScanner = new RuleBasedScanner();
        // this will apply the syntax
        ruleBasedScanner.setDefaultReturnToken(comment);
        this.commentScanner = ruleBasedScanner;
    }
    return commentScanner;
}
 
開發者ID:abstratt,項目名稱:textuml,代碼行數:14,代碼來源:SyntaxHighlighter.java

示例14: getDefaultScanner

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
/**
 * Gets default scanner
 * 
 * @return scanner
 */
protected RuleBasedScanner getDefaultScanner( )
{
	if ( scanner == null )
	{
		scanner = new JSScanner( );
		scanner.setDefaultReturnToken( new Token( UIUtil.getAttributeFor( ReportPlugin.EXPRESSION_CONTENT_COLOR_PREFERENCE ) ) );
	}
	return scanner;
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:15,代碼來源:JSSourceViewerConfiguration.java

示例15: getBytemanRuleScannerForLine

import org.eclipse.jface.text.rules.RuleBasedScanner; //導入依賴的package包/類
protected RuleBasedScanner getBytemanRuleScannerForLine() {
	if (defLineScanner == null) {
		defLineScanner = new BytemanRuleScannerForDefLine(tokenManager);
		defLineScanner.setDefaultReturnToken(
				tokenManager.getToken(TokenManager.TOKEN_BYTEMAN_DEFAULT));
	}
	return defLineScanner;
}
 
開發者ID:masao-kunii,項目名稱:byteman-editor,代碼行數:9,代碼來源:BytemanRuleConfiguration.java


注:本文中的org.eclipse.jface.text.rules.RuleBasedScanner類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。