Re-structure LTTng sub-project as per the Linux Tools guidelines
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / timeframe / SpinnerGroup.java
index ff99f154a78147b9f34d09fa9be7316d598eae45..50aef6671283209d1320a83c689225d79ad4acdd 100644 (file)
@@ -12,8 +12,8 @@
 
 package org.eclipse.linuxtools.lttng.ui.views.timeframe;
 
-import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -43,8 +43,8 @@ public class SpinnerGroup {
     private static final byte NS_SCALING_FACTOR = -9;
 
     // Labels
-    private static final String SECONDS_LABEL = "sec";
-    private static final String NANOSEC_LABEL = "ns";
+    private static final String SECONDS_LABEL = "sec"; //$NON-NLS-1$
+    private static final String NANOSEC_LABEL = "ns"; //$NON-NLS-1$
 
     // Widgets
     private Group group;
@@ -66,6 +66,7 @@ public class SpinnerGroup {
     private int currentSeconds;
     private int currentNanosec;
     
+       @SuppressWarnings("unused")
        private TimeFrameView fOwner;
 
     /**
@@ -96,7 +97,8 @@ public class SpinnerGroup {
         // Create and position the widgets
         seconds = new Spinner(group, SWT.BORDER);
         seconds.addModifyListener(new ModifyListener() {
-            public void modifyText(ModifyEvent e) {
+            @Override
+                       public void modifyText(ModifyEvent e) {
                 currentSeconds = seconds.getSelection();
                 refreshCurrentTime();
             }
@@ -109,7 +111,8 @@ public class SpinnerGroup {
 
         nanosec = new Spinner(group, SWT.BORDER);
         nanosec.addModifyListener(new ModifyListener() {
-            public void modifyText(ModifyEvent e) {
+            @Override
+                       public void modifyText(ModifyEvent e) {
                 currentNanosec = nanosec.getSelection();
                 // Correct for nanosec underflow
                 if (currentNanosec < 0) {
@@ -137,7 +140,7 @@ public class SpinnerGroup {
         long newCurrentTime = ((long) currentSeconds) * NS_PER_SECOND + currentNanosec;
         TmfTimestamp ts = new TmfTimestamp(newCurrentTime, NS_SCALING_FACTOR, 0);
         currentTime = ts;
-        fOwner.synchTimeFrameWidgets(this);
+//        fOwner.synchTimeFrameWidgets(this);
     }
 
     // ====================================================================
@@ -157,7 +160,7 @@ public class SpinnerGroup {
     }
 
     public TmfTimestamp getSpan() {
-        TmfTimestamp span = new TmfTimestamp(startTime.getAdjustment(endTime), NS_SCALING_FACTOR, 0);
+        TmfTimestamp span = new TmfTimestamp(startTime.getAdjustment(endTime, NS_SCALING_FACTOR), NS_SCALING_FACTOR, 0);
         return span;
     }
 
@@ -216,7 +219,7 @@ public class SpinnerGroup {
        if (range != null) {
                // Extract the time range
             TmfTimestamp start = range.getStartTime();
-            TmfTimestamp end = range.getEndTime();
+            TmfTimestamp end   = range.getEndTime();
 
             // Assume start time is OK
             setStartTime(start);
@@ -274,8 +277,11 @@ public class SpinnerGroup {
      * Perform the update on the UI thread
      */
     public void updateSpinners() {
-
+       // Ignore update if disposed
+       if (seconds.isDisposed()) return;
+       
         seconds.getDisplay().asyncExec(new Runnable() {
+                       @Override
                        public void run() {
                                if (!seconds.isDisposed() && !nanosec.isDisposed()) {
                            // If we are on the start second, ensure that [currentNS >= startNS]
@@ -304,8 +310,10 @@ public class SpinnerGroup {
 
                            // Refresh the spinners (value, range, increments, ...)
                                        // To ensure that the spinners are properly set, the range has to be > 0 
-                                       seconds.setValues(currentSeconds, startSeconds - 1, endSeconds + 1, 0, 1, 10);
-                                       nanosec.setValues(currentNanosec, startns - 1, endns + 1, 0, 1, 1000000);
+//                                     seconds.setValues(currentSeconds, startSeconds - 1, endSeconds + 1, 0, 1, 10);
+//                                     nanosec.setValues(currentNanosec, startns - 1, endns + 1, 0, 1, 1000000);
+                                       seconds.setValues(currentSeconds, startSeconds, endSeconds, 0, 1, 10);
+                                       nanosec.setValues(currentNanosec, startns, endns, 0, 100000, 10000000);
 
                            // If start == end (i.e. no range), disable the spinner
                            // (if start == end, the spinner widget range is set to [0..100] by default)
This page took 0.025024 seconds and 5 git commands to generate.