From: Francois Chouinard Date: Thu, 12 Jul 2012 19:56:08 +0000 (-0400) Subject: Check TS boundary in HV Current Event control (Bug384982) X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=e0fce55b3e341e348ce364fbd614f3307ad7d4f8;p=deliverable%2Ftracecompass.git Check TS boundary in HV Current Event control (Bug384982) Signed-off-by: Francois Chouinard --- diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java index 79a502633f..663b9874ae 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java @@ -13,6 +13,8 @@ package org.eclipse.linuxtools.tmf.ui.views.histogram; +import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange; +import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment; import org.eclipse.swt.widgets.Composite; /** @@ -63,6 +65,20 @@ public class HistogramCurrentTimeControl extends HistogramTextControl { long value = HistogramUtils.stringToNanoseconds(stringValue); if (getValue() != value) { + // Make sure that the new time is within range + TmfExperiment exp = TmfExperiment.getCurrentExperiment(); + if (exp != null) { + TmfTimeRange range = exp.getTimeRange(); + long startTime = range.getStartTime().getValue(); + long endTime = range.getEndTime().getValue(); + if (value < startTime) { + value = startTime; + } else if (value > endTime) { + value = endTime; + } + } + + // Set and propagate setValue(value); fParentView.updateCurrentEventTime(value); }