Check TS boundary in HV Current Event control (Bug384982)
authorFrancois Chouinard <fchouinard@gmail.com>
Thu, 12 Jul 2012 19:56:08 +0000 (15:56 -0400)
committerFrancois Chouinard <fchouinard@gmail.com>
Thu, 12 Jul 2012 19:56:08 +0000 (15:56 -0400)
Signed-off-by: Francois Chouinard <fchouinard@gmail.com>
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java

index 79a502633fd116f544ee9339792b530537499414..663b9874ae27b51ca6b6e66fd4dc8b7e9dede1b5 100644 (file)
@@ -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);
         }
This page took 0.026083 seconds and 5 git commands to generate.