[5] | 1 | package de.ugoe.cs.swe.bnftools.ui.syntaxcoloring;
|
---|
| 2 |
|
---|
| 3 | import org.eclipse.swt.SWT;
|
---|
| 4 | import org.eclipse.swt.graphics.RGB;
|
---|
| 5 | import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultHighlightingConfiguration;
|
---|
| 6 | import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfigurationAcceptor;
|
---|
| 7 | import org.eclipse.xtext.ui.editor.utils.TextStyle;
|
---|
| 8 |
|
---|
| 9 | public class EtsiBnfHighlightingConfiguration extends DefaultHighlightingConfiguration {
|
---|
| 10 |
|
---|
| 11 | public static final String ID_ID = "Id";
|
---|
| 12 | public static final String CROSSREF_ID = "Crossreference";
|
---|
| 13 | public static final String OPERATOR_ID = "Operator";
|
---|
| 14 | public static final String PARENTHESES_ID = "Parentheses";
|
---|
| 15 | public static final String RULENAME_ID = "Rule Name";
|
---|
| 16 | public static final String TOKENRULE_ID = "Token Rule";
|
---|
| 17 | public static final String SECTIONHEADER_ID = "Section Header";
|
---|
| 18 |
|
---|
| 19 | @Override
|
---|
| 20 | public void configure(IHighlightingConfigurationAcceptor acceptor) {
|
---|
| 21 | super.configure(acceptor);
|
---|
| 22 | acceptor.acceptDefaultHighlighting(ID_ID, "Rule Id", IdTextStyle());
|
---|
| 23 | acceptor.acceptDefaultHighlighting(OPERATOR_ID, "Operator", OperatorTextStyle());
|
---|
| 24 | acceptor.acceptDefaultHighlighting(PARENTHESES_ID, "Parentheses", ParenthesesTextStyle());
|
---|
| 25 | acceptor.acceptDefaultHighlighting(CROSSREF_ID, "Rule Crossreference", CrossreferenceTextStyle());
|
---|
| 26 | acceptor.acceptDefaultHighlighting(RULENAME_ID, "Rule Name", RuleNameTextStyle());
|
---|
| 27 | acceptor.acceptDefaultHighlighting(TOKENRULE_ID, "Token Rule", TokenRuleTextStyle());
|
---|
| 28 | acceptor.acceptDefaultHighlighting(SECTIONHEADER_ID, "SectionHeader", SectionHeaderTextStyle());
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | public TextStyle IdTextStyle() {
|
---|
| 32 | TextStyle textStyle = new TextStyle();
|
---|
| 33 | textStyle.setColor(new RGB(60, 60, 60));
|
---|
| 34 | return textStyle;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public TextStyle RuleNameTextStyle() {
|
---|
| 38 | TextStyle textStyle = new TextStyle();
|
---|
| 39 | textStyle.setColor(new RGB(60, 60, 60));
|
---|
| 40 | textStyle.setBackgroundColor(new RGB(200,255,200));
|
---|
| 41 | textStyle.setStyle(SWT.BOLD);
|
---|
| 42 | return textStyle;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | public TextStyle TokenRuleTextStyle() {
|
---|
| 46 | TextStyle textStyle = new TextStyle();
|
---|
| 47 | textStyle.setColor(new RGB(60, 60, 60));
|
---|
| 48 | textStyle.setBackgroundColor(new RGB(255,200,255));
|
---|
| 49 | textStyle.setStyle(SWT.BOLD);
|
---|
| 50 | return textStyle;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | public TextStyle SectionHeaderTextStyle() {
|
---|
| 54 | TextStyle textStyle = new TextStyle();
|
---|
| 55 | textStyle.setColor(new RGB(255, 255, 255));
|
---|
| 56 | textStyle.setBackgroundColor(new RGB(120,120,120));
|
---|
| 57 | textStyle.setStyle(SWT.BOLD);
|
---|
| 58 | return textStyle;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | public TextStyle CrossreferenceTextStyle() {
|
---|
| 62 | TextStyle textStyle = new TextStyle();
|
---|
| 63 | textStyle.setColor(new RGB(60, 60, 60));
|
---|
| 64 | textStyle.setStyle(SWT.ITALIC);
|
---|
| 65 | return textStyle;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | public TextStyle OperatorTextStyle() {
|
---|
| 69 | TextStyle textStyle = new TextStyle();
|
---|
| 70 | textStyle.setColor(new RGB(200, 100, 0));
|
---|
| 71 | return textStyle;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | public TextStyle ParenthesesTextStyle() {
|
---|
| 75 | TextStyle textStyle = new TextStyle();
|
---|
| 76 | textStyle.setColor(new RGB(255, 0, 255));
|
---|
| 77 | return textStyle;
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | public TextStyle punctuationTextStyle() {
|
---|
| 81 | TextStyle textStyle = new TextStyle();
|
---|
| 82 | textStyle.setColor(new RGB(255, 0, 0));
|
---|
| 83 | textStyle.setStyle(SWT.BOLD);
|
---|
| 84 | return textStyle;
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | }
|
---|