1 package eu
.etaxonomy
.taxeditor
.designproposal1
.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
.SWT
;
11 import org
.eclipse
.swt
.graphics
.Color
;
12 import org
.eclipse
.swt
.graphics
.RGB
;
13 import org
.eclipse
.swt
.widgets
.Display
;
15 import com
.swtdesigner
.SWTResourceManager
;
17 public class MyRuleScanner
extends RuleBasedScanner
{
18 private static Color TAG_COLOR
= new Color(Display
.getCurrent(), new RGB(200, 0, 0));
19 private static Color COMMENT_COLOR
= new Color(Display
.getCurrent(), new RGB(0, 200, 0));
21 public MyRuleScanner() {
23 new Token(new TextAttribute(TAG_COLOR
));
24 // new TextAttribute(TAG_COLOR,
27 // SWTResourceManager.getFont("Georgia", 11, SWT.NONE)));
29 IToken commentToken
= new Token(new TextAttribute(COMMENT_COLOR
));
31 IRule
[] rules
= new IRule
[2];
32 //Add rule for processing instructions
33 rules
[0] = new SingleLineRule("<myTag", "myTag>", tagToken
);
34 rules
[1] = new EndOfLineRule("//", commentToken
); //$NON-NLS-1$