本文整理汇总了Java中org.eclipse.jface.text.rules.WhitespaceRule类的典型用法代码示例。如果您正苦于以下问题:Java WhitespaceRule类的具体用法?Java WhitespaceRule怎么用?Java WhitespaceRule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WhitespaceRule类属于org.eclipse.jface.text.rules包,在下文中一共展示了WhitespaceRule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ModelScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的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);
}
示例2: TexArgScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的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);
}
示例3: TexOptArgScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的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);
}
示例4: XMLTagScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public XMLTagScanner(ColorManager manager) {
IToken string = new Token(new TextAttribute(manager
.getColor(IXMLColorConstants.STRING)));
IToken attrValue = new Token(XML_ATTR_VALUE);
IRule[] rules = new IRule[3];
// Add rule for double quotes
rules[0] = new SingleLineRule("\"", "\"", string, '\\');
// Add a rule for single quotes
rules[1] = new SingleLineRule("'", "'", string, '\\');
// Add generic whitespace rule.
rules[2] = new WhitespaceRule(new NCLWhitespaceDetector());
setRules(rules);
}
示例5: createRules
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
@Override
protected List<IRule> createRules() {
IToken keywordToken = getToken(Prefs.EDITOR_HTML_KEYWORD_COLOR);
IToken symbolToken = getToken(Prefs.EDITOR_HTML_SYMBOL_COLOR);
IToken stringToken = getToken(Prefs.EDITOR_HTML_STRING_COLOR);
IToken defaultToken = getToken(Prefs.EDITOR_DEFAULT_COLOR);
WordRule wordRule = new WordRule(new HtmlWordDetector(), defaultToken, true);
for (String keyword : keywords) {
wordRule.addWord(keyword, keywordToken);
}
WordRule symbolRule = new WordRule(new HtmlSymbolDetector(), defaultToken, true);
for (String symbol : symbols) {
symbolRule.addWord(symbol, symbolToken);
}
List<IRule> rules = new ArrayList<IRule>();
rules.add(new SingleLineRule("\"", "\"", stringToken, '\\', true));
rules.add(new SingleLineRule("'", "'", stringToken, '\\', true));
rules.add(wordRule);
rules.add(symbolRule);
rules.add(new WhitespaceRule(new WhitespaceDetector()));
return rules;
}
示例6: createRules
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的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;
}
示例7: UmpleTagScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public UmpleTagScanner(ColorManager manager) {
IToken string =
new Token(
new TextAttribute(manager.getColor(IUmpleColorConstants.STRING)));
IRule[] rules = new IRule[3];
// Add rule for double quotes
rules[0] = new SingleLineRule("\"", "\"", string, '\\');
// Add a rule for single quotes
rules[1] = new SingleLineRule("'", "'", string, '\\');
// Add generic whitespace rule.
rules[2] = new WhitespaceRule(new UmpleWhitespaceDetector());
setRules(rules);
}
示例8: VelocityStringScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public VelocityStringScanner(VelocityColorProvider manager)
{
List rules = new ArrayList();
// Add generic whitespace rule
rules.add(new WhitespaceRule(new WhitespaceDetector()));
// Add pattern rule for formal references
Token token = (Token) manager.getToken(IColorConstants.STRING_REFERENCE);
rules.add(new PatternRule("$!{", "}", token, (char) 0, true));
rules.add(new PatternRule("${", "}", token, (char) 0, true));
// Add pattern rule for shorthand references
token = (Token) manager.getToken(IColorConstants.STRING_REFERENCE);
rules.add(new WordPatternRule(new IdentifierDetector(), "$!", null, token));
rules.add(new WordPatternRule(new IdentifierDetector(), "$", null, token));
IRule[] result = new IRule[rules.size()];
rules.toArray(result);
setRules(result);
setDefaultReturnToken(manager.getToken(IColorConstants.STRING));
}
示例9: XMLTagScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public XMLTagScanner(ColorManager manager) {
IToken string =
new Token(
new TextAttribute(manager.getColor(ColorManager.COLOR_STRING)));
IRule[] rules = new IRule[3];
// Add rule for double quotes
rules[0] = new SingleLineRule("\"", "\"", string, '\\');
// Add a rule for single quotes
rules[1] = new SingleLineRule("'", "'", string, '\\');
// Add generic whitespace rule.
rules[2] = new WhitespaceRule(new WhitespaceDetector());
setRules(rules);
}
示例10: DMScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的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);
}
示例11: XMLScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的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);
}
示例12: XMLTagScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
public XMLTagScanner(ColorManager manager) {
IToken string =
new Token(
new TextAttribute(manager.getColor(IXMLColorConstants.STRING)));
IRule[] rules = new IRule[3];
// Add rule for double quotes
rules[0] = new SingleLineRule("\"", "\"", string, '\\');
// Add a rule for single quotes
rules[1] = new SingleLineRule("'", "'", string, '\\');
// Add generic whitespace rule.
rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());
setRules(rules);
}
示例13: update
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
/**
* This method is called when the we need to recreate the scanning rules.
* It is called when the scanner is created and when colour preferences
* and task preferences change.
*/
/* Override */
protected void update()
{
LinkedList<IRule> rules = new LinkedList<IRule>();
this.setDefaultReturnToken( getTokenForPreference( Preference.COLOUR_COMMENT ) );
// Add whitespace matcher
rules.add( new WhitespaceRule( new WhiteSpaceDetector() ) );
WordRule taskRule = new WordRule( new WordDetector(), getTokenForPreference( Preference.COLOUR_COMMENT ) );
// Add all the task tags
for( String tag : TaskTag.getTaskTagStrings(
PreferenceManager.getPreference( Preference.TASK_TAGS ) ) )
{
taskRule.addWord( tag, getTokenForPreference( Preference.COLOUR_TASK ) );
}
rules.add( taskRule );
// Set the rules
this.setRules( rules.toArray( new IRule[rules.size()] ) );
}
示例14: XMLTokenScanner
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的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);
}
示例15: createRules
import org.eclipse.jface.text.rules.WhitespaceRule; //导入依赖的package包/类
@Override
protected List<IRule> createRules() {
setDefaultReturnToken(getToken(PreferenceConstants.PROPERTIES_FILE_COLORING_VALUE));
List<IRule> rules= new ArrayList<IRule>();
// Add rule for arguments.
IToken token= getToken(PreferenceConstants.PROPERTIES_FILE_COLORING_ARGUMENT);
rules.add(new ArgumentRule(token));
// Add word rule for assignment operator.
token= getToken(PreferenceConstants.PROPERTIES_FILE_COLORING_ASSIGNMENT);
WordRule wordRule= new WordRule(new AssignmentDetector(), token);
rules.add(wordRule);
// Add generic whitespace rule.
rules.add(new WhitespaceRule(new JavaWhitespaceDetector()));
return rules;
}