forked from eclipse-pde/eclipse.pde
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path$javaClassPrefix$PresentationReconciler.java
More file actions
31 lines (26 loc) · 1.4 KB
/
$javaClassPrefix$PresentationReconciler.java
File metadata and controls
31 lines (26 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package $packageName$;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.presentation.PresentationReconciler;
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.RuleBasedScanner;
import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
public class $javaClassPrefix$PresentationReconciler extends PresentationReconciler {
private final TextAttribute tagAttribute = new TextAttribute(new Color(new RGB(0,0, 255)));
private final TextAttribute headerAttribute = new TextAttribute(new Color(new RGB(128,128,128)));
public $javaClassPrefix$PresentationReconciler() {
// TODO this is logic for .project file to color tags in blue. Replace with your language logic!
RuleBasedScanner scanner= new RuleBasedScanner();
IRule[] rules = new IRule[2];
rules[1]= new SingleLineRule("<", ">", new Token(tagAttribute));
rules[0]= new SingleLineRule("<?", "?>", new Token(headerAttribute));
scanner.setRules(rules);
DefaultDamagerRepairer dr= new DefaultDamagerRepairer(scanner);
this.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
this.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
}
}