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


Java IPredicateRule类代码示例

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


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

示例1: buildWordRules

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
private void buildWordRules(List<IPredicateRule> rules, IToken token, DocumentKeyWord[] values) {
	for (DocumentKeyWord keyWord : values) {
		ExactWordPatternRule rule1 = new ExactWordPatternRule(onlyLettersWordDetector, createWordStart(keyWord), token,
				keyWord.isBreakingOnEof());
		rule1.setAllowedPrefix('@');
		rule1.setAllowedPostfix(':');
		rules.add(rule1);

		ExactWordPatternRule rule2 = new ExactWordPatternRule(onlyLettersWordDetector, keyWord.getText().toUpperCase(), token,
				keyWord.isBreakingOnEof());
		rule2.setAllowedPrefix('@');
		rule2.setAllowedPostfix(':');
		rules.add(rule2);
		
	}
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:17,代码来源:BatchDocumentPartitionScanner.java

示例2: RelationModelPartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的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

示例3: addGroovyRules

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
protected void addGroovyRules(List<IPredicateRule> rules) {
	IToken groovyAnnotation = createToken(ANNOTATION);
	IToken javaDocComment = createToken(GROOVY_DOC);
	IToken groovyComment = createToken(COMMENT);
	IToken groovySimpleString = createToken(STRING);
	IToken groovyGString = createToken(GSTRING);
	IToken groovyKeyWord = createToken(GROOVY_KEYWORD);
	IToken javaKeyWord = createToken(JAVA_KEYWORD);
	IToken javaLiteral = createToken(JAVA_LITERAL);

	rules.add(new MultiLineRule("/**", "*/", javaDocComment));
	rules.add(new MultiLineRule("/*", "*/", groovyComment));
	rules.add(new SingleLineRule("//", "", groovyComment));

	rules.add(new MultiLineRule("\"", "\"", groovyGString, '\\'));
	rules.add(new MultiLineRule("\'", "\'", groovySimpleString, '\\'));

	buildWordRules(rules, javaKeyWord, JavaKeyWords.values(), javaWordDetector);
	buildWordRules(rules, javaLiteral, JavaLiteralKeyWords.values(), javaWordDetector);

	buildWordRules(rules, groovyKeyWord, GroovyKeyWords.values(), javaWordDetector);

	buildAnnotationRules(rules, groovyAnnotation, onlyAnnotationWordDetector);
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:25,代码来源:AbstractGroovyBasedDocumentPartitionScanner.java

示例4: EiffelPartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
public EiffelPartitionScanner() {
	super();
	
	IToken multilineComment = new Token(MULTILINE_COMMENT);
	IToken singlelineComment = new Token(SINGLELINE_COMMENT);
	IToken string = new Token(STRING);
	
	List<Object> rules = new ArrayList<>();
	
	//Add rule for single line comments.
	rules.add(new EndOfLineRule("--", singlelineComment));
	
	// Add rule for strings and character constants.
	rules.add(new SingleLineRule("\"", "\"", string, '\\'));
	rules.add(new SingleLineRule("'", "'", string, '\\'));
	
	//Add rules for multi-line comments and eiffeldocs
	rules.add(new MultiLineRule("--[[", "]]", multilineComment, (char) 0, true));
	
	IPredicateRule[] result = new IPredicateRule[rules.size()];
	rules.toArray(result);
	setPredicateRules(result);
}
 
开发者ID:Imhotup,项目名称:LibertyEiffel-Eclipse-Plugin,代码行数:24,代码来源:EiffelPartitionScanner.java

示例5: XMLPartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
public XMLPartitionScanner() {

      IToken xmlComment = new Token(XML_COMMENT);
      IToken xmlPI = new Token(XML_PI);
      IToken startTag = new Token(XML_START_TAG);
      IToken endTag = new Token(XML_END_TAG);
      IToken docType = new Token(XML_DOCTYPE);
      IToken text = new Token(XML_TEXT);

      IPredicateRule[] rules = new IPredicateRule[7];

      rules[0] = new NonMatchingRule();
      rules[1] = new MultiLineRule("<!--", "-->", xmlComment);
      rules[2] = new MultiLineRule("<?", "?>", xmlPI);
      rules[3] = new MultiLineRule("</", ">", endTag);
      rules[4] = new StartTagRule(startTag);
      rules[5] = new MultiLineRule("<!DOCTYPE", ">", docType);
      rules[6] = new XMLTextPredicateRule(text);

      setPredicateRules(rules);
   }
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:22,代码来源:XMLPartitionScanner.java

示例6: SqlCommentPartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
private SqlCommentPartitionScanner() {
	IToken commentToken = new Token(SQL_COMMENT);

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

	rules.add(new EndOfLineRule("--", commentToken, '\\'));
	rules.add(new MultiLineRule("/*", "*/", commentToken, '\\'));
	
	rules.add(new WordPredicateRule(commentToken));
	rules.add(new SingleLineRule("\"", "\"", Token.UNDEFINED, '\\')); 
	rules.add(new SingleLineRule("'", "'", Token.UNDEFINED, '\\'));

	IPredicateRule[] result= new IPredicateRule[rules.size()];
	rules.toArray(result);
	setPredicateRules(result);
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:17,代码来源:SqlCommentPartitionScanner.java

示例7: BibPartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
/**
 * Creates the partitioner and sets up the appropriate rules.
 */
public BibPartitionScanner() {
    super();

    IToken bibEntry = new Token(BIB_ENTRY);

    List rules = new ArrayList();

    // Add rule for single line comments.
    // rules.add(new EndOfLineRule("//", Token.UNDEFINED));

    // Add rule for strings and character constants.
    // rules.add(new SingleLineRule("\"", "\"", Token.UNDEFINED, '\\'));
    // rules.add(new SingleLineRule("'", "'", Token.UNDEFINED, '\\'));

    // Add rules for BibTeX entries
    //rules.add(new MultiLineRule("{", "}", bibEntry, (char) 0, false));
    rules.add(new BibBraceRule(true, bibEntry));;

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

示例8: XMLPartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
public XMLPartitionScanner() {

		IToken xmlComment = new Token(XML_COMMENT);
		IToken xmlPI = new Token(XML_PI);
		IToken startTag = new Token(XML_START_TAG);
		IToken endTag = new Token(XML_END_TAG);
		IToken docType = new Token(XML_DOCTYPE);
		// IToken text = new Token(XML_TEXT);
		// IToken tag = new Token(XML_TAG);

		IPredicateRule[] rules = new IPredicateRule[6];

		rules[0] = new NonMatchingRule();
		rules[1] = new MultiLineRule("<!--", "-->", xmlComment, '\\', true);
		rules[2] = new MultiLineRule("<?", "?>", xmlPI);
		rules[3] = new MultiLineRule("</", ">", endTag);
		rules[4] = new StartTagRule(startTag);
		rules[5] = new MultiLineRule("<!DOCTYPE", ">", docType);

		// rules[6] = new XMLTextPredicateRule(text);
		// rules[7] = new TagRule(tag);

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

示例9: PartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的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

示例10: XMLPartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
public XMLPartitionScanner()
{

	IToken xmlComment = new Token(XML_COMMENT);
	IToken xmlPI = new Token(XML_PI);
	IToken startTag = new Token(XML_START_TAG);
	IToken endTag = new Token(XML_END_TAG);
	IToken docType = new Token(XML_DOCTYPE);
	IToken text = new Token(XML_TEXT);

	IPredicateRule[] rules = new IPredicateRule[7];

	rules[0] = new NonMatchingRule();
	rules[1] = new MultiLineRule("<!--", "-->", xmlComment);
	rules[2] = new MultiLineRule("<?", "?>", xmlPI);
	rules[3] = new MultiLineRule("</", ">", endTag);
	rules[4] = new StartTagRule(startTag);
	rules[5] = new MultiLineRule("<!DOCTYPE", ">", docType);
	rules[6] = new XMLTextPredicateRule(text);

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

示例11: GlslPartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
public GlslPartitionScanner() {
	IToken preprocessorToken = new Token(GLSL_PREPROCESSOR);
	IToken uniformToken = new Token(GLSL_UNIFORM);
	IToken variableToken = new Token(GLSL_VARIABLE);
	IToken commentToken = new Token(GLSL_COMMENT);
	
	setPredicateRules(new IPredicateRule[] {
		new SingleLineRule("#", null, preprocessorToken, '\0', true, false),
		new SingleLineRule("//", null, commentToken, '\0', true, false),
		new SingleLineRule("/*", "*/", commentToken),
		new DeclarationRule(uniformToken, new DeclarationSection[] {
			new DeclarationSection(Glsl.QUALIFIERS),
			new DeclarationSection(Glsl.TYPES)
		}),
		new DeclarationRule(variableToken, new DeclarationSection[] {
			new DeclarationSection(Glsl.TYPES)
		}),
	});
}
 
开发者ID:Johnnei,项目名称:GLSL-Eclipse,代码行数:20,代码来源:GlslPartitionScanner.java

示例12: CompositePartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
/**
 * 
 */
public CompositePartitionScanner(ISubPartitionScanner defaultPartitionScanner, ISubPartitionScanner primaryPartitionScanner,
		IPartitionerSwitchStrategy partitionerSwitchStrategy) {
	this.defaultPartitionScanner = defaultPartitionScanner;
	this.primaryPartitionScanner = primaryPartitionScanner;

	defaultPartitionScanner.initCharacterScanner(this, partitionerSwitchStrategy.getDefaultSwitchStrategy());
	primaryPartitionScanner.initCharacterScanner(this, partitionerSwitchStrategy.getPrimarySwitchStrategy());

	String[][] pairs = partitionerSwitchStrategy.getSwitchTagPairs();
	switchRules = new IPredicateRule[pairs.length][];
	for (int i = 0; i < pairs.length; ++i) {
		switchRules[i] = new IPredicateRule[] { new SingleTagRule(pairs[i][0], new Token(START_SWITCH_TAG)), new SingleTagRule(pairs[i][1], new Token(END_SWITCH_TAG)) };
	}

	currentPartitionScanner = defaultPartitionScanner;
	setDefaultReturnToken(new Token(IDocument.DEFAULT_CONTENT_TYPE));
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:21,代码来源:CompositePartitionScanner.java

示例13: createTagPartitioner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
protected IDocumentPartitioner createTagPartitioner(IDocument document,
		String[] tags) {
	IPredicateRule[] tagRules = new IPredicateRule[tags.length];
	for (int i = 0; i < tags.length; i++) {
		if (CLOSE_TAG_TOKEN.equals(tags[i])) {
			tagRules[i] = new MultiLineRule("</", ">", new Token(tags[i]));
		} else if (COMMENT_TOKEN.equals(tags[i])) {
			tagRules[i] = new MultiLineRule("<!--", "-->", new Token(
					tags[i]));
		} else {
			tagRules[i] = new MultiLineRule("<" + tags[i], ">", new Token(
					tags[i]));
		}
	}
	return createConnectPartitioner(document, tagRules, tags);
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:17,代码来源:AbstractXmlParser.java

示例14: createAttrPartitioner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
private IDocumentPartitioner createAttrPartitioner(IDocument document,
		String[] attrs) {
	IPredicateRule[] attrRules = new IPredicateRule[attrs.length + 2];
	attrRules[0] = new SingleLineRule("\"", "\"", new Token(
			DOUBLE_QUOTES_TOKEN));
	attrRules[1] = new SingleLineRule("'", "'", new Token(
			SINGLE_QUOTES_TOKEN));

	String[] types = new String[attrs.length + 2];
	types[0] = DOUBLE_QUOTES_TOKEN;
	types[1] = SINGLE_QUOTES_TOKEN;

	for (int i = 0; i < attrs.length; i++) {
		attrRules[i + 2] = new WordPatternRule(new AttributeDetector(),
				attrs[i], "=", new Token(attrs[i]));

		types[i + 2] = attrs[i];
	}

	return createConnectPartitioner(document, attrRules, types);
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:22,代码来源:AbstractXmlParser.java

示例15: ApexPartitionScanner

import org.eclipse.jface.text.rules.IPredicateRule; //导入依赖的package包/类
/**
 * Creates the partitioner and sets up the appropriate rules.
 */
public ApexPartitionScanner() {
    super();

    IToken comment = new Token(APEX_MULTILINE_COMMENT);

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

    // Add rule for single line comments.
    rules.add(new EndOfLineRule("//", Token.UNDEFINED));

    // Add rule for strings and character constants.
    rules.add(new SingleLineRule("\"", "\"", Token.UNDEFINED, '\\'));
    rules.add(new SingleLineRule("'", "'", Token.UNDEFINED, '\\'));

    // Add special case word rule.
    rules.add(new WordPredicateRule(comment));

    // Add rules for multi-line comments.
    rules.add(new MultiLineRule("/*", "*/", comment, (char) 0, true));

    IPredicateRule[] result = new IPredicateRule[rules.size()];
    rules.toArray(result);
    setPredicateRules(result);
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:28,代码来源:ApexPartitionScanner.java


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