8e4d4dc0c61f5b4669e9734616420f9ee796fdf6
1 package eu
.etaxonomy
.taxeditor
.prototype1
.view
;
3 import org
.eclipse
.jface
.text
.TextAttribute
;
4 import org
.eclipse
.jface
.text
.rules
.EndOfLineRule
;
5 import org
.eclipse
.jface
.text
.rules
.IRule
;
6 import org
.eclipse
.jface
.text
.rules
.IToken
;
7 import org
.eclipse
.jface
.text
.rules
.RuleBasedScanner
;
8 import org
.eclipse
.jface
.text
.rules
.SingleLineRule
;
9 import org
.eclipse
.jface
.text
.rules
.Token
;
10 import org
.eclipse
.swt
.graphics
.Color
;
11 import org
.eclipse
.swt
.graphics
.RGB
;
12 import org
.eclipse
.swt
.widgets
.Display
;
14 public class MyRuleScanner
extends RuleBasedScanner
{
15 private static Color TAG_COLOR
= new Color(Display
.getCurrent(), new RGB(200, 0, 0));
16 private static Color COMMENT_COLOR
= new Color(Display
.getCurrent(), new RGB(0, 200, 0));
18 public MyRuleScanner() {
21 new TextAttribute(TAG_COLOR
));
23 IToken commentToken
= new Token(new TextAttribute(COMMENT_COLOR
));
25 IRule
[] rules
= new IRule
[2];
26 //Add rule for processing instructions
27 rules
[0] = new SingleLineRule("<myTag", "myTag>", tagToken
);
28 rules
[1] = (new EndOfLineRule("//", commentToken
)); //$NON-NLS-1$