KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > $packageName$ > XMLTagScanner


1 package $packageName$;
2
3 import org.eclipse.jface.text.*;
4 import org.eclipse.jface.text.rules.*;
5
6 public class XMLTagScanner extends RuleBasedScanner {
7
8     public XMLTagScanner(ColorManager manager) {
9         IToken string =
10             new Token(
11                 new TextAttribute(manager.getColor(IXMLColorConstants.STRING)));
12
13         IRule[] rules = new IRule[3];
14
15         // Add rule for double quotes
16
rules[0] = new SingleLineRule("\"", "\"", string, '\\');
17         // Add a rule for single quotes
18
rules[1] = new SingleLineRule("'", "'", string, '\\');
19         // Add generic whitespace rule.
20
rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());
21
22         setRules(rules);
23     }
24 }
25
Popular Tags