瀏覽代碼

Add to scanner report viewer: tab with significant code ranges

tags/7.5
Duarte Meneses 6 年之前
父節點
當前提交
1f61e5ace0

+ 25
- 0
sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java 查看文件

private JEditorPane pluginEditor; private JEditorPane pluginEditor;
private JScrollPane cpdTextBlocksTab; private JScrollPane cpdTextBlocksTab;
private JEditorPane cpdTextBlocksEditor; private JEditorPane cpdTextBlocksEditor;
private JScrollPane significantCodeTab;
private JEditorPane significantCodeEditor;


/** /**
* Create the application. * Create the application.
updateMeasures(component); updateMeasures(component);
updateScm(component); updateScm(component);
updateCpdTextBlocks(component); updateCpdTextBlocks(component);
updateSignificantCode(component);
} }


private void updateCpdTextBlocks(Component component) { private void updateCpdTextBlocks(Component component) {
} }
} }


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) { private void updateDuplications(Component component) {
duplicationEditor.setText(""); duplicationEditor.setText("");
if (reader.hasCoverage(component.getRef())) { if (reader.hasCoverage(component.getRef())) {
cpdTextBlocksEditor = new JEditorPane(); cpdTextBlocksEditor = new JEditorPane();
cpdTextBlocksTab.setViewportView(cpdTextBlocksEditor); cpdTextBlocksTab.setViewportView(cpdTextBlocksEditor);


significantCodeTab = new JScrollPane();
tabbedPane.addTab("Significant Code Ranges", null, significantCodeTab, null);
significantCodeEditor = new JEditorPane();
significantCodeTab.setViewportView(significantCodeEditor);

treeScrollPane = new JScrollPane(); treeScrollPane = new JScrollPane();
treeScrollPane.setPreferredSize(new Dimension(200, 400)); treeScrollPane.setPreferredSize(new Dimension(200, 400));
splitPane.setLeftComponent(treeScrollPane); splitPane.setLeftComponent(treeScrollPane);

Loading…
取消
儲存