tmf: Update the statistics viewer to use the refresh handler
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 4 Apr 2014 21:51:38 +0000 (17:51 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 14 Jul 2014 21:58:21 +0000 (17:58 -0400)
Change-Id: Ic4a9a60c949e077ed37c25b7de2340730e8d0094
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/24480
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java

index 18dea7f9d75681da2dd97aafc09446517ddf0124..14b9c8d4b6bf39c729a4059ff03dd94fc82961b7 100644 (file)
@@ -35,6 +35,7 @@ import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
+import org.eclipse.linuxtools.tmf.ui.TmfUiRefreshHandler;
 import org.eclipse.linuxtools.tmf.ui.viewers.TmfViewer;
 import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData;
 import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnDataProvider;
@@ -67,9 +68,6 @@ public class TmfStatisticsViewer extends TmfViewer {
     /** Timestamp scale used for all statistics (nanosecond) */
     private static final byte TIME_SCALE = ITmfTimestamp.NANOSECOND_SCALE;
 
-    /** The delay (in ms) between each update in live-reading mode */
-    private static final long LIVE_UPDATE_DELAY = 1000;
-
     /** The actual tree viewer to display */
     private TreeViewer fTreeViewer;
 
@@ -263,7 +261,7 @@ public class TmfStatisticsViewer extends TmfViewer {
             return;
         }
 
-        viewerControl.getDisplay().asyncExec(new Runnable() {
+        TmfUiRefreshHandler.getInstance().queueUpdate(this, new Runnable() {
             @Override
             public void run() {
                 if (!viewerControl.isDisposed()) {
@@ -665,7 +663,7 @@ public class TmfStatisticsViewer extends TmfViewer {
                          * being built (or, if the back-end is already
                          * completely built, it will skip over the while() immediately.
                          */
-                        while (!ss.waitUntilBuilt(LIVE_UPDATE_DELAY)) {
+                        while (!ss.waitUntilBuilt(TmfUiRefreshHandler.UPDATE_PERIOD)) {
                             Map<String, Long> map = stats.getEventTypesInRange(start, end);
                             updateStats(aTrace, isGlobal, map);
                         }
This page took 0.02603 seconds and 5 git commands to generate.