Improve syntax highlight style on focused cells

This commit is contained in:
Clément Fournier 2019-01-16 11:54:16 +01:00
parent ac4c3d49fa
commit fe717c3af5
5 changed files with 40 additions and 13 deletions

View File

@ -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() {

View File

@ -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";

View File

@ -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);

View File

@ -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();

View File

@ -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 */