summaryrefslogtreecommitdiffstats
path: root/sonar-scanner-protocol
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-06-30 11:03:36 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-06-30 13:35:45 +0200
commit5ad0f133511c49ea347fe9b7eef76b7e9633e321 (patch)
tree99ab6c851779e3a077b27b9894c34ab220c60079 /sonar-scanner-protocol
parent1dae2bb3433759a186d99ccfdb91acd5646c69d4 (diff)
downloadsonarqube-5ad0f133511c49ea347fe9b7eef76b7e9633e321.tar.gz
sonarqube-5ad0f133511c49ea347fe9b7eef76b7e9633e321.zip
Add issues to report viewer
Diffstat (limited to 'sonar-scanner-protocol')
-rw-r--r--sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java23
1 files changed, 23 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 70ea5f477c9..614bbedb58b 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
@@ -52,6 +52,7 @@ import org.sonar.core.util.CloseableIterator;
import org.sonar.scanner.protocol.output.FileStructure.Domain;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReport.Component;
+import org.sonar.scanner.protocol.output.ScannerReport.Issue;
import org.sonar.scanner.protocol.output.ScannerReport.Metadata;
import org.sonar.scanner.protocol.output.ScannerReportReader;
@@ -78,6 +79,8 @@ public class ScannerReportViewerApp {
private TextLineNumber textLineNumber;
private JScrollPane duplicationTab;
private JEditorPane duplicationEditor;
+ private JScrollPane issuesTab;
+ private JEditorPane issuesEditor;
/**
* Create the application.
@@ -191,6 +194,7 @@ public class ScannerReportViewerApp {
updateSource(component);
updateCoverage(component);
updateDuplications(component);
+ updateIssues(component);
}
private void updateDuplications(Component component) {
@@ -207,6 +211,19 @@ public class ScannerReportViewerApp {
}
}
+ private void updateIssues(Component component) {
+ issuesEditor.setText("");
+ try (CloseableIterator<Issue> it = reader.readComponentIssues(component.getRef())) {
+ while (it.hasNext()) {
+ Issue issue = it.next();
+ int offset = issuesEditor.getDocument().getEndPosition().getOffset();
+ issuesEditor.getDocument().insertString(offset, issue.toString(), null);
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException("Can't read issues for " + getNodeName(component), e);
+ }
+ }
+
private void updateCoverage(Component component) {
coverageEditor.setText("");
try (CloseableIterator<ScannerReport.LineCoverage> it = reader.readComponentCoverage(component.getRef())) {
@@ -324,6 +341,12 @@ public class ScannerReportViewerApp {
duplicationEditor = new JEditorPane();
duplicationTab.setViewportView(duplicationEditor);
+ issuesTab = new JScrollPane();
+ tabbedPane.addTab("Issues", null, issuesTab, null);
+
+ issuesEditor = new JEditorPane();
+ issuesTab.setViewportView(issuesEditor);
+
treeScrollPane = new JScrollPane();
treeScrollPane.setPreferredSize(new Dimension(200, 400));
splitPane.setLeftComponent(treeScrollPane);