April 27/2010
authorAlvaro Sanchez-Leon <alvsan09@gmail.com>
Tue, 27 Apr 2010 14:51:54 +0000 (14:51 +0000)
committerAlvaro Sanchez-Leon <alvsan09@gmail.com>
Tue, 27 Apr 2010 14:51:54 +0000 (14:51 +0000)
bug 310040: [TMF] Time Analysis Widget: Use Mouse up event to trigger event notifications
https://bugs.eclipse.org/bugs/show_bug.cgi?id=310040

The initial implementation of this bug was checked-in merged with Bug 310200,
This commit action
  - Updates the cache synchronisation timers upon reception of time window updates from the application
  this in addition to its update with time window updates generated internally via the time analysis widget

org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/timeAnalysis/TmfTimeAnalysisViewer.java

index c829edf569ba8cb1c0b6c25b0d2a11c515bcf952..47ecddb00cc7b3b8f95f732103ce28d479cf2412 100644 (file)
@@ -55,8 +55,8 @@ public class TmfTimeAnalysisViewer implements ITimeAnalysisViewer, ITimeDataProv
        private long _time1;\r
        private long _time0_;\r
        private long _time1_;\r
-       private long _time0_InLastEvent = 0;\r
-       private long _time1_InLastEvent = 0;\r
+       private long _time0_extSynch = 0;\r
+       private long _time1_extSynch = 0;\r
        private boolean _timeRangeFixed;\r
        private int _nameWidthPref = 200;\r
        private int _minNameWidth = 6;\r
@@ -625,12 +625,23 @@ public class TmfTimeAnalysisViewer implements ITimeAnalysisViewer, ITimeDataProv
                _stateCtrl.selectItem(trace, false);\r
        }\r
 \r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see\r
+        * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITimeAnalysisViewer\r
+        * #setSelectVisTimeWindow(long, long, java.lang.Object)\r
+        */\r
        public void setSelectVisTimeWindow(long time0, long time1, Object source) {\r
                if (_acceptSetSelAPICalls == false || source == this) {\r
                        return;\r
                }\r
 \r
                setStartFinishTime(time0, time1);\r
+\r
+               // update notification time values since we are now in synch with the\r
+               // external application\r
+               updateExtSynchTimers();\r
        }\r
 \r
        public void setAcceptSelectionAPIcalls(boolean acceptCalls) {\r
@@ -666,7 +677,7 @@ public class TmfTimeAnalysisViewer implements ITimeAnalysisViewer, ITimeDataProv
        public void notifyStartFinishTimeSelectionListeners(long _time0, long _time1) {\r
                if (widgetTimeScaleSelectionListners.size() > 0) {\r
                        // Check if the time has actually changed from last notification\r
-                       if (_time0 != _time0_InLastEvent || _time1 != _time1_InLastEvent) {\r
+                       if (_time0 != _time0_extSynch || _time1 != _time1_extSynch) {\r
                                // Notify Time Scale Selection Listeners\r
                                TmfTimeScaleSelectionEvent event = new TmfTimeScaleSelectionEvent(\r
                                                this, _time0, _time1, getTimeSpace(), getSelectedTime());\r
@@ -678,13 +689,22 @@ public class TmfTimeAnalysisViewer implements ITimeAnalysisViewer, ITimeDataProv
                                        listener.tsfTmProcessTimeScaleEvent(event);\r
                                }\r
 \r
-                               // last time notification cache\r
-                               _time0_InLastEvent = _time0;\r
-                               _time1_InLastEvent = _time1;\r
+                               // update external synch timers\r
+                               updateExtSynchTimers();\r
                        }\r
                }\r
        }\r
 \r
+       /**\r
+        * update the cache timers used to identify the need to send a time window\r
+        * update to external registered listeners\r
+        */\r
+       private void updateExtSynchTimers() {\r
+               // last time notification cache\r
+               _time0_extSynch = _time0;\r
+               _time1_extSynch = _time1;\r
+       }\r
+\r
        public void setTimeCalendarFormat(boolean toAbsoluteCaltime) {\r
                calendarTimeFormat = toAbsoluteCaltime;\r
        }\r
This page took 0.026996 seconds and 5 git commands to generate.