tmf: Use DecimalUnitFormat for time graph selection range less than 1s
authorPatrick Tasse <patrick.tasse@gmail.com>
Thu, 10 Nov 2016 20:38:52 +0000 (15:38 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Wed, 16 Nov 2016 21:24:28 +0000 (16:24 -0500)
Change-Id: Ia71c26f42f89f09621b57295768a38565f0f9247
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/84838
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/Utils.java

index 0b0bf7c36d04e47a5021dd9d2ca58114ed185ee0..0d00e4b5efa8ee0bccff13140e162371d2371b66 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (c) 2007, 2014 Intel Corporation, Ericsson
+ * Copyright (c) 2007, 2016 Intel Corporation, Ericsson
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -29,6 +29,7 @@ import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.tracecompass.common.core.format.DecimalUnitFormat;
 import org.eclipse.tracecompass.internal.tmf.ui.Messages;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimePreferences;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
@@ -555,6 +556,11 @@ public class Utils {
         // append the ms, us and ns as specified in the resolution
         str.append(formatNs(delta, resolution));
         str.append("s"); //$NON-NLS-1$
+        if (seconds == 0) {
+            str.append(" ("); //$NON-NLS-1$
+            str.append(new DecimalUnitFormat(1.0 / SEC_IN_NS).format(delta));
+            str.append("s)"); //$NON-NLS-1$
+        }
         return str.toString();
     }
 
This page took 0.025793 seconds and 5 git commands to generate.