本文整理汇总了Java中org.eclipse.jface.text.rules.IWhitespaceDetector类的典型用法代码示例。如果您正苦于以下问题:Java IWhitespaceDetector类的具体用法?Java IWhitespaceDetector怎么用?Java IWhitespaceDetector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IWhitespaceDetector类属于org.eclipse.jface.text.rules包,在下文中一共展示了IWhitespaceDetector类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MDScanner
import org.eclipse.jface.text.rules.IWhitespaceDetector; //导入依赖的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);
}
}),
});
}
示例2: SQLKeywordScanner
import org.eclipse.jface.text.rules.IWhitespaceDetector; //导入依赖的package包/类
/**
*
*/
public SQLKeywordScanner( )
{
super( );
IToken sqlKeywordsToken = new Token( new TextAttribute( ColorManager.getColor(127, 0, 85), null, SWT.BOLD ) );
ArrayList rules = new ArrayList( );
rules.add( new SQLKeywordRule( sqlKeywordsToken, reservedwords ) );
rules.add( new SQLKeywordRule( sqlKeywordsToken, types ) );
rules.add( new SQLKeywordRule( sqlKeywordsToken, constants ) );
rules.add( new SQLKeywordRule( sqlKeywordsToken, functions ) );
rules.add( new SQLKeywordRule( sqlKeywordsToken, predicates ) );
// Add generic whitespace rule.
rules.add( new WhitespaceRule( new IWhitespaceDetector( ) {
public boolean isWhitespace( char c )
{
return Character.isWhitespace( c );
}
} ) );
setRules( (IRule[]) rules.toArray( new IRule[rules.size( )] ) );
this.setDefaultReturnToken( new Token( new TextAttribute( Display.getDefault( ).getSystemColor( SWT.COLOR_LIST_FOREGROUND ))));
}
示例3: JSScanner
import org.eclipse.jface.text.rules.IWhitespaceDetector; //导入依赖的package包/类
/**
* Creates a new JSScanner object.
*
*/
public JSScanner( )
{
List rules = new ArrayList( );
// Add generic whitespace rule.
rules.add( new WhitespaceRule( new IWhitespaceDetector( ) {
public boolean isWhitespace( char c )
{
return Character.isWhitespace( c );
}
} ) );
IRule[] result = new IRule[rules.size( )];
rules.toArray( result );
setRules( result );
}
示例4: RelBoundScanner
import org.eclipse.jface.text.rules.IWhitespaceDetector; //导入依赖的package包/类
public RelBoundScanner(final ColorManager manager) {
final IToken token = new Token(new TextAttribute(manager.getColor(IColorConstants.REL_BOUND)));
final IToken bracketsToken =
new Token(new TextAttribute(manager.getColor(IColorConstants.REL_BOUND_BRACKETS)));
final IToken commentToken =
new Token(new TextAttribute(manager.getColor(IColorConstants.COMMENT)));
final List<IRule> rules = new ArrayList<IRule>();
rules.add(new MultiLineRule("/**", "**/", commentToken));
rules.add(new EndOfLineRule("--", commentToken));
// rules.add(new EndOfLineRule("//", commentToken));
rules.add(new BracketsRule(bracketsToken));
rules.add(new WhitespaceRule(new IWhitespaceDetector() {
@Override
public boolean isWhitespace(final char c) {
return Character.isWhitespace(c);
}
}));
this.setDefaultReturnToken(token);
final IRule[] result = new IRule[rules.size()];
rules.toArray(result);
this.setRules(result);
}
示例5: createRules
import org.eclipse.jface.text.rules.IWhitespaceDetector; //导入依赖的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) });
}
示例6: GlslScanner
import org.eclipse.jface.text.rules.IWhitespaceDetector; //导入依赖的package包/类
public GlslScanner() {
Activator plugin = Activator.getDefault();
final WordRule wordRule = GlslScanners.createWordRule();
final Token keywordToken = new Token(new TextAttribute(plugin.getColor(GlslEditor.KEYWORD_COLOR), null, SWT.BOLD));
final Token typeToken = new Token(new TextAttribute(plugin.getColor(GlslEditor.TYPE_COLOR)));
final Token qualifierToken = new Token(new TextAttribute(plugin.getColor(GlslEditor.QUALIFIER_COLOR), null, SWT.BOLD));
final Token functionToken = new Token(new TextAttribute(plugin.getColor(GlslEditor.FUNCTION_COLOR)));
final Token builtInVariableToken = new Token(new TextAttribute(plugin.getColor(GlslEditor.BUILT_IN_VARIABLES_COLOR)));
final Token commentToken = new Token(new TextAttribute(plugin.getColor(GlslEditor.COMMENTS_COLOR)));
List<IRule> rules = new ArrayList<>();
// Rules which affect entire lines at once
rules.add(new SingleLineRule("//", null, commentToken, '\0', true, false));
// Rules which don't affect entire lines
rules.add(new SingleLineRule("/*", "*/", commentToken));
rules.add(wordRule);
GlslScanners.addToWordRule(wordRule, Glsl.KEYWORDS, keywordToken);
GlslScanners.addToWordRule(wordRule, Glsl.TYPES, typeToken);
GlslScanners.addToWordRule(wordRule, Glsl.QUALIFIERS, qualifierToken);
GlslScanners.addToWordRule(wordRule, Glsl.FUNCTIONS, functionToken);
GlslScanners.addToWordRule(wordRule, Glsl.VARIABLES, builtInVariableToken);
rules.add(new WhitespaceRule(new IWhitespaceDetector() {
@Override
public boolean isWhitespace(char c) {
return Character.isWhitespace(c);
}
}));
IRule[] rulesArray = new IRule[rules.size()];
for (int i = 0; i < rulesArray.length; i++) {
rulesArray[i] = rules.get(i);
}
setRules(rulesArray);
}
示例7: createRules
import org.eclipse.jface.text.rules.IWhitespaceDetector; //导入依赖的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),
});
}
示例8: createWhitespaceRule
import org.eclipse.jface.text.rules.IWhitespaceDetector; //导入依赖的package包/类
private IRule createWhitespaceRule() {
IWhitespaceDetector detector = new IWhitespaceDetector() {
@Override
public boolean isWhitespace(char c) {
return Character.isWhitespace(c);
}
};
return new WhitespaceRule(detector);
}
示例9: getDefaultWhitespaceDetector
import org.eclipse.jface.text.rules.IWhitespaceDetector; //导入依赖的package包/类
/**
* Factory method for the whitespace detector
*/
public static IWhitespaceDetector getDefaultWhitespaceDetector()
{
return new TLAWhitespaceDetector();
}