multiView: Get the legend of tree viewer by ID

Instead of using the name to get query the legend, the ID of the entry
is used and should thus match the XY chart's legend.

Change-Id: I64279aa46b1895536dda0aac628b1b5f0ebbaeb7
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/163857
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Reviewed-by: Ivan Grinenko <ivan.grinenko@auriga.com>
diff --git a/analyses/org.eclipse.tracecompass.incubator.tmf.ui.multiview.ui/src/org/eclipse/tracecompass/incubator/internal/tmf/ui/multiview/ui/view/xychart/TreeViewer.java b/analyses/org.eclipse.tracecompass.incubator.tmf.ui.multiview.ui/src/org/eclipse/tracecompass/incubator/internal/tmf/ui/multiview/ui/view/xychart/TreeViewer.java
index ba7d8a9..48afe4c 100644
--- a/analyses/org.eclipse.tracecompass.incubator.tmf.ui.multiview.ui/src/org/eclipse/tracecompass/incubator/internal/tmf/ui/multiview/ui/view/xychart/TreeViewer.java
+++ b/analyses/org.eclipse.tracecompass.incubator.tmf.ui.multiview.ui/src/org/eclipse/tracecompass/incubator/internal/tmf/ui/multiview/ui/view/xychart/TreeViewer.java
@@ -77,7 +77,10 @@
                     && isChecked(element)) {

                 Optional<ITmfTreeDataModel> model = tryGetModel(element);

                 if (model.isPresent()) {

-                    return getLegendImage(model.get().getName());

+                    ITmfTreeDataModel treeModel = model.get();

+                    if (treeModel.hasRowModel()) {

+                        return getLegendImage(treeModel.getId());

+                    }

                 }

             }

             return null;