本文整理汇总了Java中org.eclipse.jface.text.rules.EndOfLineRule类的典型用法代码示例。如果您正苦于以下问题:Java EndOfLineRule类的具体用法?Java EndOfLineRule怎么用?Java EndOfLineRule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EndOfLineRule类属于org.eclipse.jface.text.rules包,在下文中一共展示了EndOfLineRule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RelationModelPartitionScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的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.EndOfLineRule; //导入依赖的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: EiffelPartitionScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的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);
}
示例4: SqlCommentPartitionScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的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);
}
示例5: TexArgScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的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);
}
示例6: TexOptArgScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的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);
}
示例7: createRules
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的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;
}
示例8: DMScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的package包/类
public DMScanner(final ColorManager manager)
{
final IToken dmPreprocessor = new Token(new TextAttribute(manager.getColor(IDMColorConstants.DM_PREPROCESSOR)));
final IToken keyword = new Token(new TextAttribute(manager.getColor(IDMColorConstants.KEYWORD)));
final IToken defaultToken = new Token(new TextAttribute(manager.getColor(IDMColorConstants.DEFAULT)));
final IToken numberToken = new Token(new TextAttribute(manager.getColor(IDMColorConstants.NUMBER)));
final IRule[] rules = new IRule[4];
//Add rule for processing instructions
rules[0] = new EndOfLineRule("#", dmPreprocessor);
// Add generic whitespace rule.
rules[1] = new WhitespaceRule(new DMWhitespaceDetector());
// Add keyword detection
rules[2] = new DMKeywordRule(keyword, defaultToken, false);
// Add number detection
rules[3] = new FloatRule(numberToken);
this.setRules(rules);
}
示例9: createRules
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的package包/类
/**
* Creates the list of <code>IRule</code>.
* If you have to customize rules, override this method.
*
* @return the list of <code>IRule</code>
*/
protected List<IRule> createRules() {
IToken normal = new Token(new TextAttribute(new Color(Display.getCurrent(),
IHTMLColorConstants.FOREGROUND)));
IToken string = new Token(new TextAttribute(new Color(Display.getCurrent(),
IHTMLColorConstants.JAVA_STRING)));
IToken comment = new Token(new TextAttribute(new Color(Display.getCurrent(),
IHTMLColorConstants.JAVA_COMMENT)));
IToken keyword = new Token(new TextAttribute(new Color(Display.getCurrent(),
IHTMLColorConstants.JAVA_KEYWORD)));
List<IRule> rules = new ArrayList<IRule>();
rules.add(new SingleLineRule("\"", "\"", string, '\\'));
rules.add(new SingleLineRule("'", "'", string, '\\'));
rules.add(new SingleLineRule("\\//", null, normal));
rules.add(new EndOfLineRule("//", comment));
WordRule wordRule = new WordRule(new JavaWordDetector(), normal);
for (int i = 0; i < KEYWORDS.length; i++) {
wordRule.addWord(KEYWORDS[i], keyword);
}
rules.add(wordRule);
return rules;
}
示例10: ApexPartitionScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的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);
}
示例11: RustPartitionScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的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()]));
}
示例12: createRules
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的package包/类
@Override
protected List<IRule> createRules() {
List<IRule> rules = new ArrayList<IRule>();
IToken keyword = this.getToken(GnColorConstants.GN_KEYWORD);
IToken numberToken = getToken(GnColorConstants.GN_NUMBER);
IToken comment = this.getToken(GnColorConstants.GN_COMMENT);
IToken other = this.getToken(GnColorConstants.GN_DEFAULT);
rules.add(new EndOfLineRule("#", comment));
rules.add(new WhitespaceRule(new GnWhitespaceDetector()));
WordRule wordRule = new WordRule(new GnWordDetector(), other);
for (int i = 0; i < GnCodeUtil.KEYWORDS.length; i++) {
wordRule.addWord(GnCodeUtil.KEYWORDS[i], keyword);
}
rules.add(wordRule);
NumberRule numberRule = new NumberRule(numberToken);
rules.add(numberRule);
this.setDefaultReturnToken(other);
return rules;
}
示例13: SQLPartitionScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的package包/类
/**
*
*/
public SQLPartitionScanner( )
{
super( );
IToken sqlComment = new Token( COMMENT );
IToken sqlQuoteString = new Token( QUOTE_STRING );
ArrayList rules = new ArrayList( );
rules.add( new MultiLineRule( "\"", "\"", sqlQuoteString, '\\' ) ); //$NON-NLS-1$ //$NON-NLS-2$
rules.add( new MultiLineRule( "\'", "\'", sqlQuoteString, '\\' ) ); //$NON-NLS-1$ //$NON-NLS-2$
rules.add( new EndOfLineRule( "//", sqlComment ) ); //$NON-NLS-1$
rules.add( new EndOfLineRule( "--", sqlComment ) ); //$NON-NLS-1$
rules.add( new MultiLineRule( "/*", "*/", sqlComment ) ); //$NON-NLS-1$ //$NON-NLS-2$
setPredicateRules( (IPredicateRule[]) rules.toArray( new IPredicateRule[rules.size( )] ) );
}
示例14: SamplePartitionScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的package包/类
/**
* Creates the partitioner and sets up the appropriate rules.
*/
public SamplePartitionScanner() {
IToken tkString = new Token(LANG_STRING);
IToken tkRawString = new Token(LANG_RAW_STRING);
IToken tkCharacter = new Token(LANG_CHARACTER);
IToken tkSingleComment = new Token(LANG_SINGLE_COMMENT);
IToken tkMultiComment = new Token(LANG_MULTI_COMMENT);
List<IPredicateRule> rules = new ArrayList<IPredicateRule>();
rules.add(new MultiLineRule("`", "`", tkRawString, NO_ESCAPE, true));
rules.add(new MultiLineRule("\"", "\"", tkString, '\\', true));
rules.add(new SingleLineRule("'", "'", tkCharacter, '\\', true));
rules.add(new EndOfLineRule("//", tkSingleComment, NO_ESCAPE));
rules.add(new MultiLineRule("/*", "*/", tkMultiComment, NO_ESCAPE, true));
setPredicateRules(rules.toArray(new IPredicateRule[rules.size()]));
}
示例15: createKspPartitionScanner
import org.eclipse.jface.text.rules.EndOfLineRule; //导入依赖的package包/类
private IPartitionTokenScanner createKspPartitionScanner() {
RuleBasedPartitionScanner scanner = new RuleBasedPartitionScanner();
scanner.setPredicateRules(new IPredicateRule[] {
/* String entre double quote. */
new PatternRule("\"", "\"", new Token(KspRegionType.STRING.getContentType()), '\\', false),
/* Commentaire multi-lignes */
new PatternRule("/*", "*/", new Token(KspRegionType.COMMENT.getContentType()), '\\', false),
/* Commentaire fin de ligne */
new EndOfLineRule("//", new Token(KspRegionType.COMMENT.getContentType())) });
return scanner;
}