本文整理汇总了Java中org.eclipse.jface.text.rules.MultiLineRule类的典型用法代码示例。如果您正苦于以下问题:Java MultiLineRule类的具体用法?Java MultiLineRule怎么用?Java MultiLineRule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultiLineRule类属于org.eclipse.jface.text.rules包,在下文中一共展示了MultiLineRule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RelationModelPartitionScanner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的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);
}
示例2: ModelScanner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的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);
}
示例3: addGroovyRules
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的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.MultiLineRule; //导入依赖的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.MultiLineRule; //导入依赖的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.MultiLineRule; //导入依赖的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: XMLPartitionScanner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的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);
}
示例8: PartitionScanner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的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));
}
示例9: XMLScanner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的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);
}
示例10: XMLPartitionScanner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的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: XMLTokenScanner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的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);
}
示例12: createTagPartitioner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的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);
}
示例13: ApexPartitionScanner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的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);
}
示例14: MDScanner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的package包/类
public MDScanner(ColorManager cm) {
this.cm = cm;
Token heading = new Token(new TextAttribute(cm.getColor(MDColorConstants.HEADER), null, SWT.BOLD));
Token comment = new Token(new TextAttribute(cm.getColor(MDColorConstants.COMMENT)));
Token emphasis = new Token(new TextAttribute(cm.getColor(MDColorConstants.DEFAULT), null, SWT.ITALIC));
setRules(new IRule[] {
new HeaderRule(heading),
new EmphasisRule("_", emphasis),
new EmphasisRule("***", emphasis),
new EmphasisRule("**", emphasis),
new EmphasisRule("*", emphasis),
new MultiLineRule("<!--", "-->", comment),
new WhitespaceRule(new IWhitespaceDetector() {
public boolean isWhitespace(char c) {
return Character.isWhitespace(c);
}
}),
});
}
示例15: RustPartitionScanner
import org.eclipse.jface.text.rules.MultiLineRule; //导入依赖的package包/类
/**
* Creates the partitioner and sets up the appropriate rules.
*/
public RustPartitionScanner() {
super();
IToken javaDoc= new Token(HOT_DOC);
IToken comment= new Token(RUST_MULTILINE_COMMENT);
IToken other= new Token(RUST_OTHER);
List<IPredicateRule> rules= new ArrayList<>();
// Add rule for single line comments.
rules.add(new EndOfLineRule("//", other)); //$NON-NLS-1$
// Add rule for strings and character constants.
rules.add(new SingleLineRule("\"", "\"", other, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
// Add special case word rule.
rules.add(new WordPredicateRule(comment));
// Add rules for multi-line comments and javadoc.
rules.add(new MultiLineRule("/**", "*/", javaDoc, (char) 0, true)); //$NON-NLS-1$ //$NON-NLS-2$
rules.add(new MultiLineRule("/*", "*/", comment, (char) 0, true)); //$NON-NLS-1$ //$NON-NLS-2$
setPredicateRules(rules.toArray(new IPredicateRule[rules.size()]));
}