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


Java IRule類代碼示例

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


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

示例1: RelationModelPartitionScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的package包/類
public RelationModelPartitionScanner() {
  final IToken commentPartition = new Token(RelationModelPartitionScanner.RELATION_MODEL_COMMENT);
  final IToken optionPartition = new Token(RelationModelPartitionScanner.RELATION_MODEL_OPTION);
  final IToken universePartition =
      new Token(RelationModelPartitionScanner.RELATION_MODEL_UNIVERSE);
  final IToken relBoundPartition =
      new Token(RelationModelPartitionScanner.RELATION_MODEL_REL_BOUND);

  final List<IRule> rules = new ArrayList<IRule>();
  rules.add(new MultiLineRule("/**", "**/", commentPartition));
  rules.add(new EndOfLineRule("--", commentPartition));
  // rules.add(new EndOfLineRule("//", commentPartition));
  rules.add(new MultiLineRule("options {", "}", optionPartition));
  rules.add(new MultiLineRule("universe {", "}", universePartition));
  rules.add(new MultiLineRule("universe [", "]", universePartition));
  rules.add(new RelationBoundsRule("relations", "}", relBoundPartition));

  final IPredicateRule[] result = new IPredicateRule[rules.size()];
  rules.toArray(result);
  this.setPredicateRules(result);
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:22,代碼來源:RelationModelPartitionScanner.java

示例2: ModelScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的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

示例3: XMLTextScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的package包/類
public XMLTextScanner( ColorManager colorManager) {

      ESCAPED_CHAR = new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.ESCAPED_CHAR)));
      CDATA_START = new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.CDATA)));
      CDATA_END = new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.CDATA)));
      CDATA_TEXT = new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.CDATA_TEXT)));
      IRule[] rules = new IRule[2];

      // Add rule to pick up escaped chars
      // Add rule to pick up start of CDATA section
      rules[0] = new CDataRule(CDATA_START, true);
      // Add a rule to pick up end of CDATA sections
      rules[1] = new CDataRule(CDATA_END, false);
      setRules(rules);

   }
 
開發者ID:nextinterfaces,項目名稱:http4e,代碼行數:17,代碼來源:XMLTextScanner.java

示例4: TexArgScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的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

示例5: TexOptArgScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的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

示例6: XMLTextScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的package包/類
public XMLTextScanner(ColorManager colorManager) {

		ESCAPED_CHAR = new Token(new TextAttribute(colorManager
				.getColor(IXMLColorConstants.ESCAPED_CHAR)));
		CDATA_START = new Token(new TextAttribute(colorManager
				.getColor(IXMLColorConstants.CDATA)));
		CDATA_END = new Token(new TextAttribute(colorManager
				.getColor(IXMLColorConstants.CDATA)));
		CDATA_TEXT = new Token(new TextAttribute(colorManager
				.getColor(IXMLColorConstants.CDATA_TEXT)));
		IRule[] rules = new IRule[2];

		// Add rule to pick up escaped chars
		// Add rule to pick up start of CDATA section
		//rules[0] = new CDataRule(CDATA_START, true);
		// Add a rule to pick up end of CDATA sections
		//rules[1] = new CDataRule(CDATA_END, false);
		setRules(rules);

	}
 
開發者ID:ncleclipse,項目名稱:ncl30-eclipse,代碼行數:21,代碼來源:XMLTextScanner.java

示例7: XMLTagScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的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

示例8: createRules

import org.eclipse.jface.text.rules.IRule; //導入依賴的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

示例9: createRules

import org.eclipse.jface.text.rules.IRule; //導入依賴的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

示例10: PartitionScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的package包/類
public PartitionScanner() {
	super();

	IToken matter = new Token(Partitions.FRONT_MATTER);
	IToken comment = new Token(Partitions.COMMENT);
	IToken codeblock = new Token(Partitions.CODEBLOCK);
	IToken htmlblock = new Token(Partitions.HTMLBLOCK);
	IToken dotblock = new Token(Partitions.DOTBLOCK);
	IToken mathblock = new Token(Partitions.MATHBLOCK);

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

	rules.add(new FrontMatterRule("---", "---", matter, '\\'));
	rules.add(new MatchRule("\\$\\S", "\\S\\$", mathblock, '\\', false));
	rules.add(new MultiLineRule("$$", "$$", mathblock, '\\'));
	rules.add(new MultiLineRule("<!--", "-->", comment, '\\'));
	rules.add(new HtmlCodeRule(htmlblock));
	rules.add(new DotCodeRule(dotblock));
	rules.add(new MultiLineRule("~~~", "~~~", codeblock, '\\'));
	rules.add(new MultiLineRule("```", "```", codeblock, '\\'));
	rules.add(new IndentedCodeRule(codeblock));

	IPredicateRule[] rule = new IPredicateRule[rules.size()];
	setPredicateRules(rules.toArray(rule));
}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:26,代碼來源:PartitionScanner.java

示例11: createRules

import org.eclipse.jface.text.rules.IRule; //導入依賴的package包/類
@Override
protected List<IRule> createRules() {
	List<IRule> rules = new ArrayList<IRule>();

	Token tagBorder = getToken(IJSXColorConstants.TAG_BORDER);
	Token tagName = getToken(IJSXColorConstants.TAG_NAME);
	Token tagAttributeName = getToken(IJSXColorConstants.TAG_ATTRIBUTE_NAME);
	Token tagAttributeEquals = getToken(IJSXColorConstants.TAG_ATTRIBUTE_EQUALS);
	Token tagAttributeValue = getToken(IJSXColorConstants.TAG_ATTRIBUTE_VALUE);

	rules.add(new SingleLineRule("\"", "\"", tagAttributeValue, '\\'));
	rules.add(new SingleLineRule("'", "'", tagAttributeValue, '\\'));
	rules.add(new SingleLineRule("{", "}", tagAttributeValue, '\\'));
	rules.add(new JSXTagRule(tagName, tagBorder));
	rules.add(new WordRule(new NameDetector(), tagAttributeName));

	// setDefaultReturnToken(token);
	return rules;
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:20,代碼來源:JSXScanner.java

示例12: nextToken

import org.eclipse.jface.text.rules.IRule; //導入依賴的package包/類
public IToken nextToken() {
IToken token;
tokenOffset = offset;
column = UNDEFINED;
Iterator<?> ruleIterator = rules.iterator();
while(ruleIterator.hasNext()) {
    IRule rule = (IRule)ruleIterator.next();
    token = rule.evaluate(this);
    if(!token.isUndefined()) {
        return token;
    }
    if(ruleIterator.hasNext()) {
    	offset = tokenOffset;
    }
}
if(rules.size() <= 0) {
	read();
}
if (read() == EOF) {
	return Token.EOF;
} else {
	unread();
	return defaultToken;
}
  }
 
開發者ID:anb0s,項目名稱:LogViewer,代碼行數:26,代碼來源:DynamicRuleBasedScanner.java

示例13: UmpleTagScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的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

示例14: VelocityStringScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的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

示例15: XMLTagScanner

import org.eclipse.jface.text.rules.IRule; //導入依賴的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


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