summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmusset2009-03-05 14:03:30 (EST)
committerjmusset2009-03-05 14:03:30 (EST)
commit5eaf4a122162f7a8d938586e29550e89253da310 (patch)
tree0219fe96d2371d5644876171663b5df48ef4f2e6
parent1285a893d3f7ad541fd41df7f8a12b629c594006 (diff)
downloadorg.eclipse.acceleo-5eaf4a122162f7a8d938586e29550e89253da310.zip
org.eclipse.acceleo-5eaf4a122162f7a8d938586e29550e89253da310.tar.gz
org.eclipse.acceleo-5eaf4a122162f7a8d938586e29550e89253da310.tar.bz2
change the template declaration color
-rw-r--r--plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/internal/ide/ui/editors/template/scanner/AcceleoBehavioralFeatureScanner.java39
-rw-r--r--plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/internal/ide/ui/editors/template/scanner/IAcceleoColorConstants.java2
2 files changed, 37 insertions, 4 deletions
diff --git a/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/internal/ide/ui/editors/template/scanner/AcceleoBehavioralFeatureScanner.java b/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/internal/ide/ui/editors/template/scanner/AcceleoBehavioralFeatureScanner.java
index c0ae5df..46c47ea 100644
--- a/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/internal/ide/ui/editors/template/scanner/AcceleoBehavioralFeatureScanner.java
+++ b/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/internal/ide/ui/editors/template/scanner/AcceleoBehavioralFeatureScanner.java
@@ -47,9 +47,14 @@ public class AcceleoBehavioralFeatureScanner extends AbstractAcceleoScanner {
computeFirstVariableRule(rules, IAcceleoConstants.QUERY, manager);
computeFirstVariableRule(rules, IAcceleoConstants.MACRO, manager);
rules.add(new WhitespaceRule(new AcceleoWhitespaceDetector()));
+ rules.add(computeDelimiterRule(IAcceleoConstants.DEFAULT_BEGIN, manager));
+ rules.add(computeDelimiterRule(IAcceleoConstants.DEFAULT_END, manager));
+ rules.add(computeKeywordRule(IAcceleoConstants.TEMPLATE, manager));
+ rules.add(computeKeywordRule(IAcceleoConstants.QUERY, manager));
+ rules.add(computeKeywordRule(IAcceleoConstants.MACRO, manager));
setRules(rules.toArray(new IRule[rules.size()]));
setDefaultReturnToken(new Token(new TextAttribute(manager
- .getColor(IAcceleoColorConstants.BEHAVIORAL_FEATURE), null, SWT.BOLD)));
+ .getColor(IAcceleoColorConstants.BEHAVIORAL_FEATURE))));
}
/**
@@ -68,10 +73,38 @@ public class AcceleoBehavioralFeatureScanner extends AbstractAcceleoScanner {
final String unknown = "*"; //$NON-NLS-1$
rules.add(new FirstVariableRule(new String[] {IAcceleoConstants.DEFAULT_BEGIN, behaviorType, unknown,
unknown, IAcceleoConstants.PARENTHESIS_BEGIN,}, new Token(new TextAttribute(foreGroundColor,
- backGroundColor, SWT.BOLD))));
+ backGroundColor, SWT.NONE))));
rules.add(new FirstVariableRule(new String[] {IAcceleoConstants.DEFAULT_BEGIN, behaviorType, unknown,
IAcceleoConstants.PARENTHESIS_BEGIN,}, new Token(new TextAttribute(foreGroundColor,
- backGroundColor, SWT.BOLD))));
+ backGroundColor, SWT.NONE))));
+ }
+
+ /**
+ * Creates a rule for the given keyword.
+ *
+ * @param keyword
+ * is the keyword
+ * @param manager
+ * is the color manager
+ * @return the new keyword rule
+ */
+ private IRule computeKeywordRule(String keyword, ColorManager manager) {
+ return new KeywordRule(keyword, true, false, new Token(new TextAttribute(manager
+ .getColor(IAcceleoColorConstants.BEHAVIORAL_FEATURE), null, SWT.BOLD)));
+ }
+
+ /**
+ * Creates a rule for the given delimiter.
+ *
+ * @param delimiter
+ * is the delimiter text
+ * @param manager
+ * is the color manager
+ * @return the new delimiter rule
+ */
+ private IRule computeDelimiterRule(String delimiter, ColorManager manager) {
+ return new KeywordRule(delimiter, false, false, new Token(new TextAttribute(manager
+ .getColor(IAcceleoColorConstants.BEHAVIORAL_FEATURE), null, SWT.BOLD)));
}
/**
diff --git a/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/internal/ide/ui/editors/template/scanner/IAcceleoColorConstants.java b/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/internal/ide/ui/editors/template/scanner/IAcceleoColorConstants.java
index b73bef1..0cd22c9 100644
--- a/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/internal/ide/ui/editors/template/scanner/IAcceleoColorConstants.java
+++ b/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/internal/ide/ui/editors/template/scanner/IAcceleoColorConstants.java
@@ -67,7 +67,7 @@ public interface IAcceleoColorConstants {
/**
* First variable background color.
*/
- RGB FIRST_VARIABLE = new RGB(239, 239, 239);
+ RGB FIRST_VARIABLE = new RGB(242, 242, 242);
/**
* Default color.