aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-gwt
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-09-02 12:07:41 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-09-02 12:08:02 +0400
commitda60f0621e41a441bc67e522ac2ead3648bd06ad (patch)
tree0ee7282b988e633f6f5a1458ffa0773a82dc2b24 /plugins/sonar-core-gwt
parent5ff8c8c74e58a9df51be059908a064a43a67c50d (diff)
downloadsonarqube-da60f0621e41a441bc67e522ac2ead3648bd06ad.tar.gz
sonarqube-da60f0621e41a441bc67e522ac2ead3648bd06ad.zip
SONAR-2752 Improve UI to show duplications with other projects
Diffstat (limited to 'plugins/sonar-core-gwt')
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsPanel.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsPanel.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsPanel.java
index cad1b96cbc3..681205f4679 100644
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsPanel.java
+++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/duplicationsviewer/client/DuplicationsPanel.java
@@ -91,13 +91,15 @@ public class DuplicationsPanel extends Composite {
panel.add(table);
int rowCounter = 1;
+
+ String projectKey = resource.getKey().substring(0, resource.getKey().lastIndexOf(':'));
for (int i = 0; i < duplicationsXML.getLength(); i++) {
Element duplicationXML = (Element) duplicationsXML.item(i);
String lines = duplicationXML.getAttribute("lines");
String startLine = duplicationXML.getAttribute("start");
String targetStartLine = duplicationXML.getAttribute("target-start");
String targetResourceKey = duplicationXML.getAttribute("target-resource");
- renderDuplication(rowCounter, i, table, lines, startLine, targetStartLine, targetResourceKey, resource);
+ renderDuplication(rowCounter, i, table, lines, startLine, targetStartLine, targetResourceKey, resource, projectKey);
rowCounter+=2;
}
}
@@ -121,7 +123,7 @@ public class DuplicationsPanel extends Composite {
return table;
}
- private void renderDuplication(int row, int duplicationCounter, FlexTable table, String lines, String startLine, String targetStartLine, String targetResourceKey, final Resource resource) {
+ private void renderDuplication(int row, int duplicationCounter, FlexTable table, String lines, String startLine, String targetStartLine, String targetResourceKey, final Resource resource, String projectKey) {
String style = (duplicationCounter % 2 == 0) ? "odd" : "even";
SourcePanel src = new DefaultSourcePanel(resource, new Integer(startLine), new Integer(lines));
@@ -137,9 +139,18 @@ public class DuplicationsPanel extends Composite {
targetResourceKey = "Same file";
}
if (targetResourceKey.contains(":")) {
- targetResourceKey = targetResourceKey.substring(targetResourceKey.lastIndexOf(':') + 1);
+ int i = targetResourceKey.lastIndexOf(':');
+ String targetProjectKey = targetResourceKey.substring(0, i);
+ String targetFileKey = targetResourceKey.substring(i + 1);
+ if (targetProjectKey.equals(projectKey)) {
+ // same project
+ targetResourceKey = targetFileKey;
+ } else {
+ // another project
+ targetResourceKey = targetProjectKey + "<br/>" + targetFileKey;
+ }
}
- table.setText(row, 3, targetResourceKey);
+ table.setHTML(row, 3, targetResourceKey);
table.setText(row, 4, targetStartLine);
setRowStyle(row, table, style, false);