From: Alexandre Montplaisir Date: Fri, 4 Apr 2014 21:51:38 +0000 (-0400) Subject: tmf: Update the statistics viewer to use the refresh handler X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=65fc212e956ac3d6bfc8cc9898dbed434e239b7c;p=deliverable%2Ftracecompass.git tmf: Update the statistics viewer to use the refresh handler Change-Id: Ic4a9a60c949e077ed37c25b7de2340730e8d0094 Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/24480 Tested-by: Matthew Khouzam Reviewed-by: Matthew Khouzam --- diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java index 18dea7f9d7..14b9c8d4b6 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java @@ -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 map = stats.getEventTypesInRange(start, end); updateStats(aTrace, isGlobal, map); }