aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-protocol
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-scanner-protocol')
-rw-r--r--sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
index 64ad8683d9a..c7ab72ff6d3 100644
--- a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
+++ b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
@@ -104,6 +104,8 @@ public class ScannerReportViewerApp {
private JEditorPane pluginEditor;
private JScrollPane cpdTextBlocksTab;
private JEditorPane cpdTextBlocksEditor;
+ private JScrollPane significantCodeTab;
+ private JEditorPane significantCodeEditor;
/**
* Create the application.
@@ -255,6 +257,7 @@ public class ScannerReportViewerApp {
updateMeasures(component);
updateScm(component);
updateCpdTextBlocks(component);
+ updateSignificantCode(component);
}
private void updateCpdTextBlocks(Component component) {
@@ -271,6 +274,22 @@ public class ScannerReportViewerApp {
}
}
+ private void updateSignificantCode(Component component) {
+ significantCodeEditor.setText("");
+ if (reader.hasCoverage(component.getRef())) {
+ try (CloseableIterator<ScannerReport.LineSgnificantCode> it = reader.readComponentSignificantCode(component.getRef())) {
+ if (it != null) {
+ while (it.hasNext()) {
+ ScannerReport.LineSgnificantCode textBlock = it.next();
+ significantCodeEditor.getDocument().insertString(significantCodeEditor.getDocument().getEndPosition().getOffset(), textBlock + "\n", null);
+ }
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException("Can't read significant code for " + getNodeName(component), e);
+ }
+ }
+ }
+
private void updateDuplications(Component component) {
duplicationEditor.setText("");
if (reader.hasCoverage(component.getRef())) {
@@ -553,6 +572,12 @@ public class ScannerReportViewerApp {
cpdTextBlocksEditor = new JEditorPane();
cpdTextBlocksTab.setViewportView(cpdTextBlocksEditor);
+ significantCodeTab = new JScrollPane();
+ tabbedPane.addTab("Significant Code Ranges", null, significantCodeTab, null);
+
+ significantCodeEditor = new JEditorPane();
+ significantCodeTab.setViewportView(significantCodeEditor);
+
treeScrollPane = new JScrollPane();
treeScrollPane.setPreferredSize(new Dimension(200, 400));
splitPane.setLeftComponent(treeScrollPane);