本文整理汇总了Java中org.eclipse.jface.text.rules.NumberRule类的典型用法代码示例。如果您正苦于以下问题:Java NumberRule类的具体用法?Java NumberRule怎么用?Java NumberRule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NumberRule类属于org.eclipse.jface.text.rules包,在下文中一共展示了NumberRule类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createRules
import org.eclipse.jface.text.rules.NumberRule; //导入依赖的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;
}
开发者ID:chromium,项目名称:eclipse-gn,代码行数:24,代码来源:GnCodeScanner.java
示例2: createRules
import org.eclipse.jface.text.rules.NumberRule; //导入依赖的package包/类
/**
* Use the default Eclipse higlighting scheme.
*/
private void createRules() {
Token keywordToken = new Token(keywordAttribute);
Token commentToken = new Token(commentAttribute);
Token docToken = new Token(docAttribute);
Token stringToken = new Token(stringAttribute);
Token numberToken = new Token(numberAttribute);
Token normalToken = new Token(normalAttribute);
setDefaultReturnToken(normalToken);
setRules(new IRule[] { new EndOfLineRule("//", commentToken),//$NON-NLS-2$
new KeywordRule(keywordToken),//$NON-NLS-2$
new MultiLineRule("/**", "*/", docToken, (char) 0, false), //$NON-NLS-2$
new MultiLineRule("/*", "*/", commentToken, (char) 0, false), //$NON-NLS-2$
new SingleLineRule("\"", "\"", stringToken, '\\'), //$NON-NLS-2$
// Regexp
new SingleLineRule("/", "/", stringToken, '\\'), //$NON-NLS-2$
new SingleLineRule("'", "'", stringToken, '\\'), //$NON-NLS-2$
new WhitespaceRule(new IWhitespaceDetector() {
public boolean isWhitespace(char c) {
return Character.isWhitespace(c);
}
}),//$NON-NLS-2$
new WordRule(new WordDetector(), normalToken),//$NON-NLS-2$
new NumberRule(numberToken) });
}
开发者ID:Nodeclipse,项目名称:GradleEditor,代码行数:30,代码来源:GradleCodeScanner.java
示例3: TexScanner
import org.eclipse.jface.text.rules.NumberRule; //导入依赖的package包/类
/**
* A default constructor.
* @param manager
*/
public TexScanner(ColorManager manager) {
// A token that defines how to color numbers
IToken numberToken = new Token(new TextAttribute(manager
.getColor(ColorManager.TEX_NUMBER),
null,
manager.getStyle(ColorManager.TEX_NUMBER_STYLE)));
// A token that defines how to color command words (\command_word)
IToken commandToken = new Token(new TextAttribute(manager
.getColor(ColorManager.COMMAND),
null,
manager.getStyle(ColorManager.COMMAND_STYLE)));
IToken commentToken = new Token(new TextAttribute(manager
.getColor(ColorManager.COMMENT),
null,
manager.getStyle(ColorManager.COMMENT_STYLE)));
// A token that defines how to color special characters (\_, \&, \~ ...)
IToken specialCharToken = new Token(new TextAttribute(manager
.getColor(ColorManager.TEX_SPECIAL),
null,
manager.getStyle(ColorManager.TEX_SPECIAL_STYLE)));
List<IRule> rules = new ArrayList<IRule>();
rules.add(new TexSpecialCharRule(specialCharToken));
rules.add(new WordRule(new TexWord(), commandToken));
rules.add(new NumberRule(numberToken));
rules.add(new EndOfLineRule("%", commentToken, '\\'));
rules.add(new WhitespaceRule(new WhitespaceDetector()));
IRule[] result = new IRule[rules.size()];
rules.toArray(result);
setRules(result);
}
开发者ID:eclipse,项目名称:texlipse,代码行数:40,代码来源:TexScanner.java
示例4: createRules
import org.eclipse.jface.text.rules.NumberRule; //导入依赖的package包/类
/**
* Use the default Eclipse higlighting scheme.
*/
private void createRules() {
Token keywordToken = new Token(
new TextAttribute(EditorColors.getColor(new RGB(127, 0, 85)), null, SWT.BOLD));
commentToken = new Token(commentAttribute);
Token jsDocToken = new Token(jsDocAttribute);
Token stringToken = new Token(
new TextAttribute(EditorColors.getColor(new RGB(42, 0, 255)), null, SWT.NORMAL));
RGB blackRgb = new RGB(0, 0, 0);
Token numberToken = new Token(
new TextAttribute(EditorColors.getColor(blackRgb), null, SWT.NORMAL));
Token normalToken = new Token(
new TextAttribute(EditorColors.getColor(blackRgb), null, SWT.NORMAL));
setDefaultReturnToken(normalToken);
setRules(new IRule[] {
new EndOfLineRule("//", commentToken), //$NON-NLS-1$
new KeywordRule(keywordToken),
new MultiLineRule("/**", "*/", jsDocToken, (char) 0, false), //$NON-NLS-1$ //$NON-NLS-2$
new MultiLineRule("/*", "*/", commentToken, (char) 0, false), //$NON-NLS-1$ //$NON-NLS-2$
new SingleLineRule("\"", "\"", stringToken, '\\'), //$NON-NLS-1$ //$NON-NLS-2$
// Regexp
new SingleLineRule("/", "/", stringToken, '\\'), //$NON-NLS-1$ //$NON-NLS-2$
new SingleLineRule("'", "'", stringToken, '\\'), //$NON-NLS-1$ //$NON-NLS-2$
new WhitespaceRule(new IWhitespaceDetector() {
public boolean isWhitespace(char c) {
return Character.isWhitespace(c);
}
}),
new WordRule(new WordDetector(), normalToken),
new NumberRule(numberToken),
});
}
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:43,代码来源:JsCodeScanner.java
示例5: initialize
import org.eclipse.jface.text.rules.NumberRule; //导入依赖的package包/类
protected void initialize(String[] keywords) {
ColorRegistry registry = JFaceResources.getColorRegistry();
IToken keyword = new Token(new TextAttribute(registry.get(KEYWORD_COLOR), null, SWT.BOLD));
IToken string = new Token(new TextAttribute(registry.get(STRING_COLOR)));
IToken number = new Token(new TextAttribute(registry.get(NUMBER_COLOR)));
IToken annotation = new Token(new TextAttribute(registry.get(ANNOTATION_COLOR)));
IToken defaultToken = new Token(new TextAttribute(registry.get(DEFAULT_COLOR)));
List<IRule> rules = new ArrayList<IRule>();
// strings
rules.add(new SingleLineRule("\"", "\"", string, '\\'));
// annotations
rules.add(new MultiLineRule("[", "]", annotation));
// numbers
rules.add(new NumberRule(number));
// keywords and normal (default) text
WordRule wordRule = new WordRule(new WordDetector(), defaultToken);
for (int i = 0; i < keywords.length; i++) {
wordRule.addWord(keywords[i], keyword);
}
rules.add(wordRule);
setRules(rules.toArray(new IRule[rules.size()]));
}
开发者ID:abstratt,项目名称:textuml,代码行数:30,代码来源:SyntaxHighlighter.java
示例6: createRules
import org.eclipse.jface.text.rules.NumberRule; //导入依赖的package包/类
private IRule[] createRules() {
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
IToken tokenKeyword = new Token(new TextAttribute(colorRegistry.get(COLOR_KEY_KEYWORD), null, SWT.BOLD));
IToken tokenNumber = new Token(new TextAttribute(colorRegistry.get(COLOR_KEY_NUMBER)));
IToken tokenParam = new Token(new TextAttribute(colorRegistry.get(COLOR_KEY_PARAM)));
IToken tokenName = new Token(new TextAttribute(null));
return new IRule[] {
createKeywordRule(tokenKeyword),
new NumberRule(tokenNumber),
createParamRule(tokenParam),
createWhitespaceRule(),
createNameRule(tokenName)
};
}
开发者ID:yinonavraham,项目名称:myLOGO4Eclipse,代码行数:15,代码来源:LogoScriptSourceViewerConfiguration.java
示例7: BibEntryScanner
import org.eclipse.jface.text.rules.NumberRule; //导入依赖的package包/类
/**
* Creates a BibTeX entry scanner
*/
public BibEntryScanner(BibColorProvider provider) {
IToken keyword = new Token(new TextAttribute(provider
.getColor(BibColorProvider.KEYWORD)));
IToken type = new Token(new TextAttribute(provider
.getColor(BibColorProvider.TYPE)));
IToken string = new Token(new TextAttribute(provider
.getColor(BibColorProvider.STRING)));
IToken comment = new Token(new TextAttribute(provider
.getColor(BibColorProvider.SINGLE_LINE_COMMENT)));
IToken other = new Token(new TextAttribute(provider
.getColor(BibColorProvider.DEFAULT)));
List rules = new ArrayList();
// Add rule for single line comments.
// Not supported inside entries.
// rules.add(new EndOfLineRule("%", comment));
rules.add(new BibSeparatorRule(keyword));
// Add rule for strings and character constants.
// Note that escaping is not possible in BibTeX.
// rules.add(new MultiLineRule("\"", "\"", string));
// rules.add(new MultiLineRule("\"", "\"", string, (char) 0, true));
rules.add(new BibStringRule(string));
// this must be preceded by # or =
// rules.add(new BibBraceRule(false, string));
// Add generic whitespace rule.
rules.add(new WhitespaceRule(new WhitespaceDetector()));
// Add word rule for keywords, types, and constants.
WordRule wordRule = new WordRule(new BibWordDetector(), type);
// wordRule.addWord("author", keyword);
rules.add(wordRule);
rules.add(new NumberRule(string));
IRule[] result= new IRule[rules.size()];
rules.toArray(result);
setRules(result);
}
开发者ID:eclipse,项目名称:texlipse,代码行数:48,代码来源:BibEntryScanner.java
示例8: TexTikzScanner
import org.eclipse.jface.text.rules.NumberRule; //导入依赖的package包/类
/**
* A default constructor.
* @param manager
*/
public TexTikzScanner(ColorManager manager) {
IToken commandToken = new Token(
new TextAttribute(
manager.getColor(ColorManager.COMMAND),
null,
manager.getStyle(ColorManager.COMMAND_STYLE)));
IToken specialCharToken = new Token(new TextAttribute(manager
.getColor(ColorManager.TEX_SPECIAL),
null,
manager.getStyle(ColorManager.TEX_SPECIAL_STYLE)));
IToken numberToken = new Token(new TextAttribute(manager
.getColor(ColorManager.TEX_NUMBER),
null,
manager.getStyle(ColorManager.TEX_NUMBER_STYLE)));
IToken commentToken = new Token(new TextAttribute(manager
.getColor(ColorManager.COMMENT),
null,
manager.getStyle(ColorManager.COMMENT_STYLE)));
IToken argToken = new Token(
new TextAttribute(
manager.getColor(ColorManager.CURLY_BRACKETS),
null,
manager.getStyle(ColorManager.CURLY_BRACKETS_STYLE)));
IToken optArgToken = new Token(
new TextAttribute(
manager.getColor(ColorManager.SQUARE_BRACKETS),
null,
manager.getStyle(ColorManager.SQUARE_BRACKETS_STYLE)));
List<IRule> rules = new ArrayList<IRule>();
rules.add(new TexSpecialCharRule(specialCharToken));
rules.add(new WordRule(new TexWord(), commandToken));
rules.add(new NumberRule(numberToken));
rules.add(new EndOfLineRule("%", commentToken, '\\'));
rules.add(new WhitespaceRule(new WhitespaceDetector()));
rules.add(new MultiLineRule("{", "}", argToken, '\\'));
rules.add(new MultiLineRule("[", "]", optArgToken, '\\'));
IRule[] result = new IRule[rules.size()];
rules.toArray(result);
setRules(result);
}
开发者ID:eclipse,项目名称:texlipse,代码行数:52,代码来源:TexTikzScanner.java
注:本文中的org.eclipse.jface.text.rules.NumberRule类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论