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


Java WhitespaceRule类代码示例

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


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

示例1: ModelScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public ModelScanner(final ColorManager colorManager) {

    final IToken bracketsToken =
        new Token(new TextAttribute(colorManager.getColor(IValidationColorConstants.BRACKETS)));
    final IToken commToken =
        new Token(new TextAttribute(colorManager.getColor(IValidationColorConstants.COMMENT)));

    final List<IRule> rules = new ArrayList<>();

    rules.add(new WhitespaceRule(new ValidationWhitespaceDetector()));
    rules.add(new BracketsRule(bracketsToken));
    rules.add(new MultiLineRule("/**", "**/", commToken));
    rules.add(new EndOfLineRule("--", commToken));

    final IRule[] result = new IRule[rules.size()];
    rules.toArray(result);
    this.setRules(result);
  }
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:19,代码来源:ModelScanner.java

示例2: TexArgScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
/**
 * A default constructor.
 * @param manager
 */
public TexArgScanner(ColorManager manager) {
    IToken commentToken = new Token(new TextAttribute(manager
            .getColor(ColorManager.COMMENT),
            null,
            manager.getStyle(ColorManager.COMMENT_STYLE)));

    //Commands are colored in argument color with command styles 
    IToken commandToken = new Token(
            new TextAttribute(
                    manager.getColor(ColorManager.CURLY_BRACKETS),
                    null,
                    manager.getStyle(ColorManager.COMMAND_STYLE)));

    List<IRule> rules = new ArrayList<IRule>();
    rules.add(new EndOfLineRule("%", commentToken, '\\'));
    rules.add(new WhitespaceRule(new WhitespaceDetector()));
    rules.add(new WordRule(new TexWord(), commandToken));

    IRule[] result = new IRule[rules.size()];
    rules.toArray(result);
    setRules(result);
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:27,代码来源:TexArgScanner.java

示例3: TexOptArgScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
/**
 * A default constructor.
 * @param manager
 */
public TexOptArgScanner(ColorManager manager) {
    IToken commentToken = new Token(new TextAttribute(manager
            .getColor(ColorManager.COMMENT),
            null,
            manager.getStyle(ColorManager.COMMENT_STYLE)));

    //Commands are colored in argument color with command styles 
    IToken commandToken = new Token(
            new TextAttribute(
                    manager.getColor(ColorManager.SQUARE_BRACKETS),
                    null,
                    manager.getStyle(ColorManager.COMMAND_STYLE)));

    List<IRule> rules = new ArrayList<IRule>();
    rules.add(new EndOfLineRule("%", commentToken, '\\'));
    rules.add(new WhitespaceRule(new WhitespaceDetector()));
    rules.add(new WordRule(new TexWord(), commandToken));

    IRule[] result = new IRule[rules.size()];
    rules.toArray(result);
    setRules(result);
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:27,代码来源:TexOptArgScanner.java

示例4: XMLTagScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public XMLTagScanner(ColorManager manager) {
	IToken string = new Token(new TextAttribute(manager
			.getColor(IXMLColorConstants.STRING)));

	IToken attrValue = new Token(XML_ATTR_VALUE);

	IRule[] rules = new IRule[3];

	// Add rule for double quotes
	rules[0] = new SingleLineRule("\"", "\"", string, '\\');
	// Add a rule for single quotes
	rules[1] = new SingleLineRule("'", "'", string, '\\');
	// Add generic whitespace rule.
	rules[2] = new WhitespaceRule(new NCLWhitespaceDetector());

	setRules(rules);
}
 
开发者ID:ncleclipse,项目名称:ncl30-eclipse,代码行数:18,代码来源:XMLTagScanner.java

示例5: createRules

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
@Override
protected List<IRule> createRules() {
	IToken keywordToken = getToken(Prefs.EDITOR_HTML_KEYWORD_COLOR);
	IToken symbolToken = getToken(Prefs.EDITOR_HTML_SYMBOL_COLOR);
	IToken stringToken = getToken(Prefs.EDITOR_HTML_STRING_COLOR);
	IToken defaultToken = getToken(Prefs.EDITOR_DEFAULT_COLOR);

	WordRule wordRule = new WordRule(new HtmlWordDetector(), defaultToken, true);
	for (String keyword : keywords) {
		wordRule.addWord(keyword, keywordToken);
	}

	WordRule symbolRule = new WordRule(new HtmlSymbolDetector(), defaultToken, true);
	for (String symbol : symbols) {
		symbolRule.addWord(symbol, symbolToken);
	}

	List<IRule> rules = new ArrayList<IRule>();
	rules.add(new SingleLineRule("\"", "\"", stringToken, '\\', true));
	rules.add(new SingleLineRule("'", "'", stringToken, '\\', true));
	rules.add(wordRule);
	rules.add(symbolRule);
	rules.add(new WhitespaceRule(new WhitespaceDetector()));
	return rules;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:26,代码来源:ScannerHtml.java

示例6: createRules

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
@Override
protected List<IRule> createRules() {
	IToken keywordToken = getToken(Prefs.EDITOR_MATH_KEYWORD_COLOR);
	IToken symbolToken = getToken(Prefs.EDITOR_MATH_SYMBOL_COLOR);
	IToken commentToken = getToken(Prefs.EDITOR_MATH_COMMENT_COLOR);
	// IToken defaultToken = getToken(Prefs.EDITOR_DEFAULT_COLOR);

	WordRule wordRule = new WordRule(new MathWordDetector(), keywordToken, true);
	WordRule symbolRule = new WordRule(new MathSymbolDetector(), symbolToken, true);

	List<IRule> rules = new ArrayList<IRule>();
	rules.add(wordRule);
	rules.add(symbolRule);
	rules.add(new EndOfLineRule("%", commentToken));
	rules.add(new WhitespaceRule(new WhitespaceDetector()));
	return rules;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:18,代码来源:ScannerMath.java

示例7: UmpleTagScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public UmpleTagScanner(ColorManager manager) {
	IToken string =
		new Token(
			new TextAttribute(manager.getColor(IUmpleColorConstants.STRING)));

	IRule[] rules = new IRule[3];

	// Add rule for double quotes
	rules[0] = new SingleLineRule("\"", "\"", string, '\\');
	// Add a rule for single quotes
	rules[1] = new SingleLineRule("'", "'", string, '\\');
	// Add generic whitespace rule.
	rules[2] = new WhitespaceRule(new UmpleWhitespaceDetector());

	setRules(rules);
}
 
开发者ID:umple,项目名称:umple,代码行数:17,代码来源:UmpleTagScanner.java

示例8: VelocityStringScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public VelocityStringScanner(VelocityColorProvider manager)
{
    List rules = new ArrayList();
    // Add generic whitespace rule
    rules.add(new WhitespaceRule(new WhitespaceDetector()));
    // Add pattern rule for formal references
    Token token = (Token) manager.getToken(IColorConstants.STRING_REFERENCE);
    rules.add(new PatternRule("$!{", "}", token, (char) 0, true));
    rules.add(new PatternRule("${", "}", token, (char) 0, true));
    // Add pattern rule for shorthand references
    token = (Token) manager.getToken(IColorConstants.STRING_REFERENCE);
    rules.add(new WordPatternRule(new IdentifierDetector(), "$!", null, token));
    rules.add(new WordPatternRule(new IdentifierDetector(), "$", null, token));
    IRule[] result = new IRule[rules.size()];
    rules.toArray(result);
    setRules(result);
    setDefaultReturnToken(manager.getToken(IColorConstants.STRING));
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:19,代码来源:VelocityStringScanner.java

示例9: XMLTagScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public XMLTagScanner(ColorManager manager) {
	IToken string =
		new Token(
			new TextAttribute(manager.getColor(ColorManager.COLOR_STRING)));

	IRule[] rules = new IRule[3];

	// Add rule for double quotes
	rules[0] = new SingleLineRule("\"", "\"", string, '\\');
	// Add a rule for single quotes
	rules[1] = new SingleLineRule("'", "'", string, '\\');
	// Add generic whitespace rule.
	rules[2] = new WhitespaceRule(new WhitespaceDetector());

	setRules(rules);
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:17,代码来源:XMLTagScanner.java

示例10: DMScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public DMScanner(final ColorManager manager)
{
	final IToken dmPreprocessor						= new Token(new TextAttribute(manager.getColor(IDMColorConstants.DM_PREPROCESSOR)));
	final IToken keyword							= new Token(new TextAttribute(manager.getColor(IDMColorConstants.KEYWORD)));
	final IToken defaultToken						= new Token(new TextAttribute(manager.getColor(IDMColorConstants.DEFAULT)));
	final IToken numberToken						= new Token(new TextAttribute(manager.getColor(IDMColorConstants.NUMBER)));

	final IRule[] rules								= new IRule[4];
	//Add rule for processing instructions
	rules[0]										= new EndOfLineRule("#", dmPreprocessor);
	// Add generic whitespace rule.
	rules[1]										= new WhitespaceRule(new DMWhitespaceDetector());
	// Add keyword detection
	rules[2]										= new DMKeywordRule(keyword, defaultToken, false);
	// Add number detection
	rules[3]										= new FloatRule(numberToken);

	this.setRules(rules);
}
 
开发者ID:nullquery,项目名称:BYONDclipse,代码行数:20,代码来源:DMScanner.java

示例11: XMLScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public XMLScanner(ColorManager manager) {
	IToken procInstr =
		new Token(
			new TextAttribute(
				manager.getColor(IXMLColorConstants.PROC_INSTR)));
	IToken docType =
		new Token(
			new TextAttribute(
				manager.getColor(IXMLColorConstants.DOCTYPE)));

	IRule[] rules = new IRule[3];
	//Add rule for processing instructions and doctype
	rules[0] = new MultiLineRule("<?", "?>", procInstr);
	rules[1] = new MultiLineRule("<!DOCTYPE", ">", docType);
	// Add generic whitespace rule.
	rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());

	setRules(rules);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:20,代码来源:XMLScanner.java

示例12: XMLTagScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public XMLTagScanner(ColorManager manager) {
	IToken string =
		new Token(
			new TextAttribute(manager.getColor(IXMLColorConstants.STRING)));

	IRule[] rules = new IRule[3];

	// Add rule for double quotes
	rules[0] = new SingleLineRule("\"", "\"", string, '\\');
	// Add a rule for single quotes
	rules[1] = new SingleLineRule("'", "'", string, '\\');
	// Add generic whitespace rule.
	rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());

	setRules(rules);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:17,代码来源:XMLTagScanner.java

示例13: update

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
/**
 * This method is called when the we need to recreate the scanning rules. 
 * It is called when the scanner is created and when colour preferences
 * and task preferences change. 
 */
/* Override */
protected void update()
{
   LinkedList<IRule> rules = new LinkedList<IRule>();
 
   this.setDefaultReturnToken( getTokenForPreference( Preference.COLOUR_COMMENT ) );
   
   // Add whitespace matcher
   rules.add( new WhitespaceRule( new WhiteSpaceDetector() ) );
   
   WordRule taskRule = new WordRule( new WordDetector(), getTokenForPreference( Preference.COLOUR_COMMENT ) );
   
   // Add all the task tags 
   for( String tag : TaskTag.getTaskTagStrings( 
      PreferenceManager.getPreference( Preference.TASK_TAGS ) ) ) 
   {
      taskRule.addWord( tag, getTokenForPreference( Preference.COLOUR_TASK ) );
   }

   rules.add( taskRule );
   
   // Set the rules
   this.setRules( rules.toArray( new IRule[rules.size()] ) );   
}
 
开发者ID:brocade,项目名称:vTM-eclipse,代码行数:30,代码来源:CommentScanner.java

示例14: XMLTokenScanner

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
/**
 * XMLTokenScanner
 */
public XMLTokenScanner()
{
	List<IRule> rules = new ArrayList<IRule>();

	rules.add(new WhitespaceRule(new WhitespaceDetector()));
	rules.add(new MultiLineRule("<!--", "-->", createToken(XMLTokenType.COMMENT))); //$NON-NLS-1$ //$NON-NLS-2$
	rules.add(new DocTypeRule(createToken(XMLTokenType.DOCTYPE), false));
	rules.add(new MultiLineRule("<![CDATA[", "]]>", createToken(XMLTokenType.CDATA))); //$NON-NLS-1$ //$NON-NLS-2$
	rules.add(new TagRule("?xml", createToken(XMLTokenType.DECLARATION))); //$NON-NLS-1$
	rules.add(new TagRule("/", createToken(XMLTokenType.END_TAG))); //$NON-NLS-1$
	rules.add(new TagRule(createToken(XMLTokenType.START_TAG)));

	// text
	IToken token = createToken(XMLTokenType.TEXT);
	rules.add(new WordRule(new WordDetector(), token));

	setRules(rules.toArray(new IRule[rules.size()]));
	setDefaultReturnToken(token);
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:23,代码来源:XMLTokenScanner.java

示例15: createRules

import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
@Override
protected List<IRule> createRules() {
	setDefaultReturnToken(getToken(PreferenceConstants.PROPERTIES_FILE_COLORING_VALUE));
	List<IRule> rules= new ArrayList<IRule>();

	// Add rule for arguments.
	IToken token= getToken(PreferenceConstants.PROPERTIES_FILE_COLORING_ARGUMENT);
	rules.add(new ArgumentRule(token));

	// Add word rule for assignment operator.
	token= getToken(PreferenceConstants.PROPERTIES_FILE_COLORING_ASSIGNMENT);
	WordRule wordRule= new WordRule(new AssignmentDetector(), token);
	rules.add(wordRule);

	// Add generic whitespace rule.
	rules.add(new WhitespaceRule(new JavaWhitespaceDetector()));

	return rules;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:PropertyValueScanner.java


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