Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien2017-11-22 17:08:27 -0500
committerJean-Christian Kouame2017-12-05 21:40:40 -0500
commitf5c31e70352d98cf5a97f16b26994bc5f5f509dd (patch)
tree13b20ce4cb80dab8051c9e2f38bcd77f60ded2d6
parentf4d06138f4fe70120912901942933dc0311ad440 (diff)
downloadorg.eclipse.tracecompass-stable-3.2.tar.gz
org.eclipse.tracecompass-stable-3.2.tar.xz
org.eclipse.tracecompass-stable-3.2.zip
xml: bug 527644 Fix tooltip for XY viewerv3.2.0stable-3.2
This assigns a unique name to each series, so the name can be shown and recognized in the tooltip. Change-Id: I8c37dd71a85cbb530bd5dcab92950e241bc12197 Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net> Reviewed-on: https://git.eclipse.org/r/112127 Reviewed-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com> Tested-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com> Reviewed-by: Hudson CI (cherry picked from commit 75ebfbbc3d00bdea968fbab6ce87209bc50b3efd) Reviewed-on: https://git.eclipse.org/r/112921
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/module/XmlXYDataProvider.java25
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/xychart/XmlTreeViewer.java2
2 files changed, 19 insertions, 8 deletions
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/module/XmlXYDataProvider.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/module/XmlXYDataProvider.java
index 9842df6d30..ac2352a842 100644
--- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/module/XmlXYDataProvider.java
+++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/module/XmlXYDataProvider.java
@@ -85,6 +85,7 @@ public class XmlXYDataProvider extends AbstractTmfTraceDataProvider
* reused per every quark, and finds the quarks to query for the XY models.
*/
private final BiMap<Long, Integer> fIdToQuark = HashBiMap.create();
+ private final BiMap<Integer, String> fQuarkToString = HashBiMap.create();
private final long fTraceId = ENTRY_IDS.getAndIncrement();
private @Nullable TmfModelResponse<List<TmfTreeDataModel>> fCached;
@@ -257,7 +258,7 @@ public class XmlXYDataProvider extends AbstractTmfTraceDataProvider
ImmutableMap.Builder<String, IYModel> ySeries = ImmutableMap.builder();
for (Entry<Integer, double[]> tempEntry : map.entrySet()) {
- String name = String.valueOf(fIdToQuark.inverse().get(tempEntry.getKey()));
+ String name = String.valueOf(fQuarkToString.get(tempEntry.getKey()));
ySeries.put(name, new YModel(name, tempEntry.getValue()));
}
@@ -361,13 +362,11 @@ public class XmlXYDataProvider extends AbstractTmfTraceDataProvider
}
}
if (!seriesName.isEmpty()) {
+ String tempSeriesName = seriesName;
+ String uniqueName = fQuarkToString.computeIfAbsent(quark, q -> getUniqueNameFor(tempSeriesName));
// Check if an ID has already been created for this quark.
- Long id = fIdToQuark.inverse().get(quark);
- if (id == null) {
- id = ENTRY_IDS.getAndIncrement();
- fIdToQuark.put(id, quark);
- }
- builder.add(new TmfTreeDataModel(id, fTraceId, seriesName));
+ Long id = fIdToQuark.inverse().computeIfAbsent(quark, q -> ENTRY_IDS.getAndIncrement());
+ builder.add(new TmfTreeDataModel(id, fTraceId, uniqueName));
}
}
@@ -380,6 +379,18 @@ public class XmlXYDataProvider extends AbstractTmfTraceDataProvider
return new TmfModelResponse<>(list, ITmfResponse.Status.RUNNING, CommonStatusMessage.RUNNING);
}
+ private String getUniqueNameFor(String seriesName) {
+ Integer quark = fQuarkToString.inverse().get(seriesName);
+ int index = 1;
+ String newName = seriesName;
+ while (quark != null) {
+ newName = seriesName + '(' + index + ')';
+ quark = fQuarkToString.inverse().get(newName);
+ index++;
+ }
+ return newName;
+ }
+
/**
* @since 2.4
*/
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/xychart/XmlTreeViewer.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/xychart/XmlTreeViewer.java
index 0e3aa0f36f..5ea053c797 100644
--- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/xychart/XmlTreeViewer.java
+++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/xychart/XmlTreeViewer.java
@@ -46,7 +46,7 @@ public class XmlTreeViewer extends AbstractSelectTreeViewer {
// do not show the legend for the trace entries.
return null;
}
- return getLegendImage(Long.toString(genericEntry.getModel().getId()));
+ return getLegendImage(String.valueOf(genericEntry.getModel().getName()));
}
return null;
}

Back to the top