diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-05-15 10:55:48 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-05-15 10:56:16 +0200 |
commit | 63e0d80577fead868718957d80e9fec2de29cf66 (patch) | |
tree | 54333f3077664ebe7d7d4dd0a2656958bfecc133 /sonar-scanner-protocol | |
parent | 60fd87be7408b008a805724100761fb9dccdd8b5 (diff) | |
download | sonarqube-63e0d80577fead868718957d80e9fec2de29cf66.tar.gz sonarqube-63e0d80577fead868718957d80e9fec2de29cf66.zip |
add tab for ActiveRules to scanner report viewer
Diffstat (limited to 'sonar-scanner-protocol')
-rw-r--r-- | sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java | 21 |
1 files changed, 21 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 846e57db4a7..f78175e033c 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 @@ -95,6 +95,8 @@ public class ScannerReportViewerApp { private JEditorPane measuresEditor; private JScrollPane scmTab; private JEditorPane scmEditor; + private JScrollPane activeRuleTab; + private JEditorPane activeRuleEditor; /** * Create the application. @@ -184,6 +186,7 @@ public class ScannerReportViewerApp { metadata = reader.readMetadata(); updateTitle(); loadComponents(); + updateActiveRules(); } private void loadComponents() { @@ -317,6 +320,18 @@ public class ScannerReportViewerApp { } } + private void updateActiveRules() { + activeRuleEditor.setText(""); + + StringBuilder builder = new StringBuilder(); + try (CloseableIterator<ScannerReport.ActiveRule> activeRuleCloseableIterator = reader.readActiveRules()) { + while (activeRuleCloseableIterator.hasNext()) { + builder.append(activeRuleCloseableIterator.next().toString()).append("\n"); + } + activeRuleEditor.setText(builder.toString()); + } + } + private void updateHighlighting(Component component) { highlightingEditor.setText(""); try (CloseableIterator<ScannerReport.SyntaxHighlightingRule> it = reader.readComponentSyntaxHighlighting(component.getRef())) { @@ -468,6 +483,12 @@ public class ScannerReportViewerApp { scmEditor = new JEditorPane(); scmTab.setViewportView(scmEditor); + activeRuleTab = new JScrollPane(); + tabbedPane.addTab("ActiveRules", null, activeRuleTab, null); + + activeRuleEditor = new JEditorPane(); + activeRuleTab.setViewportView(activeRuleEditor); + treeScrollPane = new JScrollPane(); treeScrollPane.setPreferredSize(new Dimension(200, 400)); splitPane.setLeftComponent(treeScrollPane); |