本文整理匯總了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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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)
}),
});
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}