diff options
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/source/Highlightable.java | 5 | ||||
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/batch/source/DefaultHighlightable.java | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/source/Highlightable.java b/sonar-plugin-api/src/main/java/org/sonar/api/source/Highlightable.java index 4230b2ccdee..5171dec0ae9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/source/Highlightable.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/source/Highlightable.java @@ -36,6 +36,11 @@ public interface Highlightable extends Perspective { HighlightingBuilder highlight(int startOffset, int endOffset, String typeOfText); + /** + * @since 5.6 + */ + HighlightingBuilder highlight(int startLine, int startLineOffset, int endLine, int endLineOffset, String typeOfText); + void done(); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DefaultHighlightable.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DefaultHighlightable.java index 80403efc298..52e56e4703b 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DefaultHighlightable.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DefaultHighlightable.java @@ -60,6 +60,12 @@ public class DefaultHighlightable implements Highlightable { } @Override + public HighlightingBuilder highlight(int startLine, int startLineOffset, int endLine, int endLineOffset, String typeOfText) { + // Do nothing + return this; + } + + @Override public void done() { // Do nothing } @@ -81,6 +87,13 @@ public class DefaultHighlightable implements Highlightable { } @Override + public HighlightingBuilder highlight(int startLine, int startLineOffset, int endLine, int endLineOffset, String typeOfText) { + TypeOfText type = org.sonar.api.batch.sensor.highlighting.TypeOfText.forCssClass(typeOfText); + defaultHighlighting.highlight(startLine, startLineOffset, endLine, endLineOffset, type); + return this; + } + + @Override public void done() { defaultHighlighting.save(); } |