Fix synchronization problem
This commit is contained in:
@ -23,6 +23,9 @@ public enum AvailableSyntaxHighlighters {
|
||||
JAVA("java", JavaSyntaxHighlighter.INSTANCE),
|
||||
APEX("apex", ApexSyntaxHighlighter.INSTANCE),
|
||||
XML("xml", XmlSyntaxHighlighter.INSTANCE),
|
||||
XSL("xsl", XmlSyntaxHighlighter.INSTANCE),
|
||||
WSDL("wsdl", XmlSyntaxHighlighter.INSTANCE),
|
||||
POM("pom", XmlSyntaxHighlighter.INSTANCE),
|
||||
XPATH("xpath", XPathSyntaxHighlighter.INSTANCE);
|
||||
|
||||
|
||||
|
@ -142,10 +142,11 @@ public class CustomCodeArea extends CodeArea {
|
||||
}
|
||||
|
||||
|
||||
private void launchAsyncSyntaxHighlighting(SyntaxHighlighter computer) {
|
||||
private synchronized void launchAsyncSyntaxHighlighting(SyntaxHighlighter computer) {
|
||||
this.syntaxHighlighter = computer;
|
||||
if (executorService != null) {
|
||||
executorService.shutdown();
|
||||
executorService = null;
|
||||
}
|
||||
if (isSyntaxHighlightingEnabled && syntaxHighlighter != null) {
|
||||
executorService = Executors.newSingleThreadExecutor();
|
||||
|
@ -35,7 +35,7 @@ public class XPathSyntaxHighlighter extends SimpleRegexSyntaxHighlighter {
|
||||
.or("path", "//?")
|
||||
.or("paren", "[()]")
|
||||
.or("bracket", "[\\[\\]]")
|
||||
.or("string", "'([^'\\\\]|\\\\.)*'")
|
||||
.or("string", "('([^'\\\\]|\\\\.)*')|(\"([^\"\\\\]|\\\\.)*\")")
|
||||
.or("single-line-comment", "\\(:.*:\\)")
|
||||
.create();
|
||||
|
||||
|
@ -25,8 +25,8 @@ public class XmlSyntaxHighlighter extends SimpleRegexSyntaxHighlighter {
|
||||
.or("xml-prolog", "<[?]xml.*[?]>")
|
||||
.or("lt-gt", "</?|/?>")
|
||||
.or("tag-name", "\\b(?<=(</?))[\\w:]++")
|
||||
.or("attribute-name", "\\w+(?=\\s*=\\s*\")")
|
||||
.or("string", "\"([^\"\\\\]|\\\\.)*\"")
|
||||
.or("attribute-name", "\\w+(?=\\s*=\\s*[\"'])")
|
||||
.or("string", "('([^'\\\\]|\\\\.)*')|(\"([^\"\\\\]|\\\\.)*\")")
|
||||
.create(Pattern.DOTALL);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user