当前位置: 首页>>代码示例>>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;未经允许,请勿转载。