aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch-protocol
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2015-11-16 15:14:34 +0100
committerDuarte Meneses <duarte.meneses@sonarsource.com>2015-11-16 15:21:01 +0100
commite306193f685ba72fea402b8e80875b8cd9c5341a (patch)
tree34baf3e0190f75f03e67a0b36765588567b37cd8 /sonar-batch-protocol
parentff15786ca7aa029a1ae4a2ed67f5352a1b03853b (diff)
downloadsonarqube-e306193f685ba72fea402b8e80875b8cd9c5341a.tar.gz
sonarqube-e306193f685ba72fea402b8e80875b8cd9c5341a.zip
Improve report viewer
Diffstat (limited to 'sonar-batch-protocol')
-rw-r--r--sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/viewer/ViewerApplication.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/viewer/ViewerApplication.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/viewer/ViewerApplication.java
index e17e2363eb3..a2f9352f6d2 100644
--- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/viewer/ViewerApplication.java
+++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/viewer/ViewerApplication.java
@@ -20,6 +20,7 @@
package org.sonar.batch.protocol.viewer;
import java.awt.BorderLayout;
+import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.io.File;
@@ -30,6 +31,7 @@ import java.nio.charset.StandardCharsets;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Scanner;
+
import javax.swing.JEditorPane;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
@@ -46,6 +48,7 @@ import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;
+
import org.sonar.batch.protocol.output.BatchReport;
import org.sonar.batch.protocol.output.BatchReport.Component;
import org.sonar.batch.protocol.output.BatchReport.Metadata;
@@ -200,16 +203,18 @@ public class ViewerApplication {
private void updateSource(Component component) {
File sourceFile = reader.getFileStructure().fileFor(Domain.SOURCE, component.getRef());
+ sourceEditor.setText("");
+
if (sourceFile.exists()) {
try (Scanner s = new Scanner(sourceFile, StandardCharsets.UTF_8.name()).useDelimiter("\\Z")) {
- sourceEditor.setText(s.next());
+ if (s.hasNext()) {
+ sourceEditor.setText(s.next());
+ }
} catch (IOException ex) {
StringWriter errors = new StringWriter();
ex.printStackTrace(new PrintWriter(errors));
sourceEditor.setText(errors.toString());
}
- } else {
- sourceEditor.setText("");
}
}
@@ -301,7 +306,9 @@ public class ViewerApplication {
return;
}
+ frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
updateDetails((Component) node.getUserObject());
+ frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}