當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。