Fix for bug 385437: Control Flow view's "Previous event" button skips
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / widgets / timegraph / widgets / TimeGraphControl.java
index b0a6b48d12cd66956834d69436262515dd33a480..8bce4c89b23c0b5a10f148ddcb15140120d080ad 100644 (file)
@@ -540,7 +540,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
      * Select an event\r
      *\r
      * @param n\r
-     *            1 to enable, -1 to disable\r
+     *            1 for next event, -1 for previous event\r
      */\r
     public void selectEvent(int n) {\r
         if (null == _timeProvider) {\r
@@ -572,6 +572,11 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
                 if (nextTime > endTime) {\r
                     nextTime = endTime;\r
                 }\r
+            } else if (n == -1) {\r
+                // for previous event go to its end time unless we were already there\r
+                if (nextEvent.getTime() + nextEvent.getDuration() < selectedTime) {\r
+                    nextTime = nextEvent.getTime() + nextEvent.getDuration();\r
+                }\r
             }\r
             _timeProvider.setSelectedTimeNotify(nextTime, true);\r
             fireSelectionChanged();\r
This page took 0.077029 seconds and 5 git commands to generate.