lttng.ust: Add the build-ID to the key of cache of addr2line calls
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.ui / src / org / eclipse / tracecompass / tmf / analysis / xml / ui / views / timegraph / XmlPresentationProvider.java
index 8c88a9456ebfc57f0a74bf6681315ba5dad460ac..cd7a8b27db6faddf25da2aeb24b1b3e296de0389 100644 (file)
@@ -13,8 +13,6 @@
 
 package org.eclipse.tracecompass.tmf.analysis.xml.ui.views.timegraph;
 
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -89,9 +87,11 @@ public class XmlPresentationProvider extends TimeGraphPresentationProvider {
             int value = tcEvent.getValue();
 
             if (entry.getType() == EntryDisplayType.DISPLAY) {
-                Integer index = checkNotNull(stateIndex.get(value));
-                String rgb = stateValues.get(index.intValue()).getStateString();
-                return rgb;
+                Integer index = stateIndex.get(value);
+                if (index != null) {
+                    String rgb = stateValues.get(index.intValue()).getStateString();
+                    return rgb;
+                }
             }
             return null;
         }
@@ -141,16 +141,7 @@ public class XmlPresentationProvider extends TimeGraphPresentationProvider {
                 return;
             }
 
-            RGB colorRGB = new RGB(255, 0, 0);
-            if (color.startsWith(TmfXmlStrings.COLOR_PREFIX)) {
-                Integer hex = Integer.parseInt(color.substring(1), 16);
-                int hex1 = hex.intValue() % 256;
-                int hex2 = (hex.intValue() / 256) % 256;
-                int hex3 = (hex.intValue() / (256 * 256)) % 256;
-                colorRGB = new RGB(hex3, hex2, hex1);
-            } else {
-                colorRGB = calcColor(value);
-            }
+            final RGB colorRGB = (color.startsWith(TmfXmlStrings.COLOR_PREFIX)) ? parseColor(color) : calcColor(value);
 
             StateItem item = new StateItem(colorRGB, name);
 
@@ -172,6 +163,16 @@ public class XmlPresentationProvider extends TimeGraphPresentationProvider {
         });
     }
 
+    private static RGB parseColor(String color) {
+        RGB colorRGB;
+        Integer hex = Integer.parseInt(color.substring(1), 16);
+        int hex1 = hex.intValue() % 256;
+        int hex2 = (hex.intValue() / 256) % 256;
+        int hex3 = (hex.intValue() / (256 * 256)) % 256;
+        colorRGB = new RGB(hex3, hex2, hex1);
+        return colorRGB;
+    }
+
     private static RGB calcColor(int value) {
         int x = (value * 97) % 1530;
         int r = 0, g = 0, b = 0;
This page took 0.02724 seconds and 5 git commands to generate.