Fix maven

This commit is contained in:
Clément Fournier
2017-10-16 16:04:00 +02:00
parent a986e38b3d
commit d7d502e0c4
7 changed files with 86 additions and 10 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>pmd-ui</artifactId>
<name>PMD UI Applications</name>
@ -15,6 +16,40 @@
<java.version>8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration combine.self="override">
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>1.8</version>
</jdk>
</toolchains>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
@ -36,6 +71,36 @@
<artifactId>pmd-apex</artifactId>
<version>6.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-jsp</artifactId>
<version>6.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-plsql</artifactId>
<version>6.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-visualforce</artifactId>
<version>6.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-xml</artifactId>
<version>6.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-vm</artifactId>
<version>6.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-javascript</artifactId>
<version>6.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -424,4 +424,9 @@ public class MainDesignerController implements Initializable, SettingsOwner {
}
public void invalidateAst() {
nodeInfoPanelController.invalidateInfo();
xpathPanelController.invalidateResults(false);
sourceEditorController.clearNodeHighlight();
}
}

View File

@ -127,6 +127,7 @@ public class SourceEditorController implements Initializable, SettingsOwner {
*/
public void refreshAST() {
String source = codeEditorArea.getText();
Node previous = astManager.compilationUnitProperty().get();
Node current;
try {
current = astManager.updateCompilationUnit(source);
@ -134,6 +135,9 @@ public class SourceEditorController implements Initializable, SettingsOwner {
invalidateAST(true);
return;
}
if (previous != current) {
parent.invalidateAst();
}
setUpToDateCompilationUnit(current);
codeEditorArea.clearPrimaryStyleLayer();

View File

@ -34,6 +34,7 @@ import javafx.scene.control.ListView;
import javafx.scene.control.TitledPane;
import javafx.util.StringConverter;
/**
* XPath panel controller.
*
@ -123,7 +124,7 @@ public class XPathPanelController implements Initializable, SettingsOwner {
xpathResultListView.setItems(results);
violationsTitledPane.setText("Matched nodes\t(" + results.size() + ")");
} catch (XPathEvaluationException e) {
notifyXPathError(e);
invalidateResults(true);
designerApp.getLogger().logEvent(new LogEntry(e, Category.XPATH_EVALUATION_EXCEPTION));
}
@ -132,8 +133,9 @@ public class XPathPanelController implements Initializable, SettingsOwner {
}
public void invalidateResults() {
public void invalidateResults(boolean error) {
xpathResultListView.getItems().clear();
violationsTitledPane.setText("Matched nodes" + (error ? "\t(error)" : ""));
}
@ -142,12 +144,6 @@ public class XPathPanelController implements Initializable, SettingsOwner {
}
private void notifyXPathError(Throwable t) {
// Currently dismisses the exception
violationsTitledPane.setText("Matched nodes\t(error)");
}
public StringProperty xpathVersionProperty() {
return xpathEvaluator.xpathVersionProperty();
}

View File

@ -121,7 +121,7 @@ public class CustomCodeArea extends CodeArea {
public boolean isInRange(Node n) {
return n.getEndLine() <= getParagraphs().size()
&& (n.getEndLine() != getParagraphs().size()
|| n.getEndColumn() <= getParagraph(n.getEndLine() - 2).length());
|| n.getEndColumn() <= getParagraph(n.getEndLine() - 1).length());
}

View File

@ -62,6 +62,11 @@ public abstract class SimpleRegexSyntaxHighlighter implements SyntaxHighlighter
} catch (StackOverflowError so) {
// matcher.find overflowed, might happen when coloring ginormous files with incorrect language
}
if (lastKwEnd == 0) { // no spans found/ no text
builder.add(Collections.emptySet(), text.length());
}
return builder.create();
}

View File

@ -86,6 +86,7 @@ class StyleContext implements Iterable<StyleLayer> {
return allSpans.stream()
.filter(spans -> spans != base)
.filter(spans -> spans.length() <= codeArea.getLength())
.reduce(allSpans.get(0),
(accumulator, elt) -> accumulator.overlay(elt, (style1, style2) -> {
Set<String> styles = new HashSet<>(style1);