diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/ApexSyntaxHighlighter.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/ApexSyntaxHighlighter.java index 819a4df65e..cd41563968 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/ApexSyntaxHighlighter.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/ApexSyntaxHighlighter.java @@ -8,6 +8,7 @@ import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighti import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.BOOLEAN; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.BRACE; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.BRACKET; +import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.IDENTIFIER; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.KEYWORD; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.MULTIL_COMMENT; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.PAREN; @@ -65,6 +66,7 @@ public class ApexSyntaxHighlighter extends SimpleRegexSyntaxHighlighter { .or(STRING.css, "'[^'\\\\]*(\\\\.[^'\\\\]*)*'") .or(BOOLEAN.css, asWord("(?i)true|false")) .or(ANNOTATION.css, "@[\\w]+") + .or(IDENTIFIER.css, asWord("[\\w_$]+")) .create(Pattern.DOTALL | Pattern.CASE_INSENSITIVE); public ApexSyntaxHighlighter() { diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/HighlightClasses.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/HighlightClasses.java index d1148ab687..ce52de1c36 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/HighlightClasses.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/HighlightClasses.java @@ -8,7 +8,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; - /** * @author Clément Fournier * @since 6.0.0 @@ -33,23 +32,25 @@ public enum HighlightClasses { NULL("null", Constants.LITERAL), NUMBER("number", Constants.LITERAL), - KEYWORD("keyword"), + KEYWORD(Constants.KEYWORD), ANNOTATION("annotation"), - CLASS_IDENTIFIER("class-identifier"), - + + IDENTIFIER(Constants.IDENTIFIER), + CLASS_IDENTIFIER("class-identifier", Constants.IDENTIFIER), + // XPath specific - XPATH_ATTRIBUTE("attribute", Constants.XPATH), - XPATH_AXIS("axis", Constants.XPATH), - XPATH_FUNCTION("function", Constants.XPATH), + XPATH_ATTRIBUTE("attribute", Constants.XPATH, Constants.IDENTIFIER), + XPATH_AXIS("axis", Constants.XPATH, Constants.KEYWORD), + XPATH_FUNCTION(Constants.FUNCTION, Constants.XPATH, Constants.IDENTIFIER), XPATH_PATH("path", Constants.XPATH, Constants.PUNCTUATION), - XPATH_KIND_TEST("kind-test", "function", Constants.XPATH), + XPATH_KIND_TEST("kind-test", Constants.XPATH, Constants.FUNCTION), XML_CDATA_TAG("cdata-tag", Constants.XML), XML_CDATA_CONTENT("cdata-content", Constants.XML), XML_PROLOG("xml-prolog", Constants.XML), - XML_LT_GT("lt-gt", Constants.XML), - XML_TAG_NAME("tag-name", Constants.XML), - XML_ATTRIBUTE_NAME("attribute-name", Constants.XML); + XML_LT_GT("lt-gt", Constants.XML, Constants.PUNCTUATION), + XML_TAG_NAME("tag-name", Constants.XML, Constants.IDENTIFIER), + XML_ATTRIBUTE_NAME("attribute-name", Constants.XML, Constants.IDENTIFIER); /** Name of the css class. */ @@ -62,6 +63,9 @@ public enum HighlightClasses { private static final class Constants { + static final String IDENTIFIER = "identifier"; + static final String FUNCTION = "function"; + static final String KEYWORD = "keyword"; static final String LITERAL = "literal"; static final String COMMENT = "comment"; static final String PUNCTUATION = "punctuation"; diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/JavaSyntaxHighlighter.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/JavaSyntaxHighlighter.java index 99ce7dda02..2c7f46ce97 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/JavaSyntaxHighlighter.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/JavaSyntaxHighlighter.java @@ -10,6 +10,7 @@ import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighti import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.BRACKET; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.CHAR; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.CLASS_IDENTIFIER; +import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.IDENTIFIER; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.KEYWORD; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.MULTIL_COMMENT; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.NULL; @@ -62,6 +63,7 @@ public final class JavaSyntaxHighlighter extends SimpleRegexSyntaxHighlighter { .or(BOOLEAN.css, asWord("true|false")) .or(ANNOTATION.css, "@[\\w]+") .or(CLASS_IDENTIFIER.css, asWord("[A-Z][\\w_$]*")) + .or(IDENTIFIER.css, asWord("[\\w_$]+")) .create(Pattern.DOTALL); diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/XPathSyntaxHighlighter.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/XPathSyntaxHighlighter.java index 538905b9a4..25da70f5d7 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/XPathSyntaxHighlighter.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/syntaxhighlighting/XPathSyntaxHighlighter.java @@ -5,6 +5,7 @@ package net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.BRACKET; +import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.IDENTIFIER; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.KEYWORD; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.MULTIL_COMMENT; import static net.sourceforge.pmd.util.fxdesigner.util.codearea.syntaxhighlighting.HighlightClasses.NUMBER; @@ -61,6 +62,7 @@ public class XPathSyntaxHighlighter extends SimpleRegexSyntaxHighlighter { .or(NUMBER.css, "(\\.\\d++\\b|\\b\\d++\\.|(\\b\\d++(\\.\\d*+)?([eE][+-]?\\d+)?))") .or(STRING.css, "('([^']|'')*')|(\"([^\"]|\"\")*\")") .or(URI.css, "Q\\{[^{}]*}") + .or(IDENTIFIER.css, asWord("[\\w_$]+")) .create(); diff --git a/pmd-ui/src/main/resources/net/sourceforge/pmd/util/fxdesigner/less/syntax-highlighting.less b/pmd-ui/src/main/resources/net/sourceforge/pmd/util/fxdesigner/less/syntax-highlighting.less index 5c8897f2da..2f45ffa0c0 100644 --- a/pmd-ui/src/main/resources/net/sourceforge/pmd/util/fxdesigner/less/syntax-highlighting.less +++ b/pmd-ui/src/main/resources/net/sourceforge/pmd/util/fxdesigner/less/syntax-highlighting.less @@ -4,11 +4,28 @@ /* Rules for the syntax highlighters. - This file doesn't include highlight rules, so that highlight is not displayed - on controls that display node rich text if only this file is set as stylesheet. + This file doesn't include layer highlight rules (eg .xpath-highlight .depth-0), so that + layer highlight is not displayed on controls that display node rich text if only this + file is set as stylesheet. */ +.list-cell:focused .code { + // more readable styles on focused cells w/ blue background + + &.identifier { + -fx-fill: white !important; + } + + &.keyword, &.literal { + -fx-fill: #dddddd; + } + + &.punctuation { + -fx-fill: black; + } +} + .code { /* Common classes */