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;
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;
private int currentSeconds;
private int currentNanosec;
+ @SuppressWarnings("unused")
private TimeFrameView fOwner;
/**
// 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();
}
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) {
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);
}
// ====================================================================
}
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;
}
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);
* 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]
// 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)