/*****************************************************************************
- * Copyright (c) 2007 Intel Corporation, 2009, 2012 Ericsson.
+ * Copyright (c) 2007, 2013 Intel Corporation, Ericsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* Vitaly A. Provodin, Intel - Initial API and implementation
* Alvaro Sanchez-Leon - Updated for TMF
* Patrick Tasse - Refactoring
- *
*****************************************************************************/
+
package org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets;
import java.util.Iterator;
}
Resolution res = Resolution.NANOSEC;
- if (_timeDataProvider.isCalendarFormat()) {
+ TimeFormat tf = _timeDataProvider.getTimeFormat();
+ if (tf == TimeFormat.CALENDAR) {
addItem(Messages.TmfTimeTipHandler_TRACE_DATE, eventStartTime > -1 ?
Utils.formatDate(eventStartTime)
: "?"); //$NON-NLS-1$
- if (eventDuration > 0) {
- addItem(Messages.TmfTimeTipHandler_TRACE_START_TIME, eventStartTime > -1 ?
- Utils.formatTime(eventStartTime, TimeFormat.ABSOLUTE, res)
- : "?"); //$NON-NLS-1$
-
- addItem(Messages.TmfTimeTipHandler_TRACE_STOP_TIME, eventEndTime > -1 ?
- Utils.formatTime(eventEndTime, TimeFormat.ABSOLUTE, res)
- : "?"); //$NON-NLS-1$
- } else {
- addItem(Messages.TmfTimeTipHandler_TRACE_EVENT_TIME, eventStartTime > -1 ?
- Utils.formatTime(eventStartTime, TimeFormat.ABSOLUTE, res)
- : "?"); //$NON-NLS-1$
- }
+ }
+ if (eventDuration > 0) {
+ addItem(Messages.TmfTimeTipHandler_TRACE_START_TIME, eventStartTime > -1 ?
+ Utils.formatTime(eventStartTime, tf, res)
+ : "?"); //$NON-NLS-1$
+
+ addItem(Messages.TmfTimeTipHandler_TRACE_STOP_TIME, eventEndTime > -1 ?
+ Utils.formatTime(eventEndTime, tf, res)
+ : "?"); //$NON-NLS-1$
} else {
- if (eventDuration > 0) {
- addItem(Messages.TmfTimeTipHandler_TRACE_START_TIME, eventStartTime > -1 ?
- Utils.formatTime(eventStartTime, TimeFormat.RELATIVE, res)
- : "?"); //$NON-NLS-1$
-
- addItem(Messages.TmfTimeTipHandler_TRACE_STOP_TIME, eventEndTime > -1 ?
- Utils.formatTime(eventEndTime, TimeFormat.RELATIVE, res)
- : "?"); //$NON-NLS-1$
- } else {
- addItem(Messages.TmfTimeTipHandler_TRACE_EVENT_TIME, eventStartTime > -1 ?
- Utils.formatTime(eventStartTime, TimeFormat.RELATIVE, res)
- : "?"); //$NON-NLS-1$
- }
+ addItem(Messages.TmfTimeTipHandler_TRACE_EVENT_TIME, eventStartTime > -1 ?
+ Utils.formatTime(eventStartTime, tf, res)
+ : "?"); //$NON-NLS-1$
}
if (eventDuration > 0) {
// Duration in relative format in any case
+ if (tf == TimeFormat.CALENDAR) {
+ tf = TimeFormat.RELATIVE;
+ }
addItem(Messages.TmfTimeTipHandler_DURATION, eventDuration > -1 ?
- Utils.formatTime(eventDuration, TimeFormat.RELATIVE, res)
+ Utils.formatTime(eventDuration, tf, res)
: "?"); //$NON-NLS-1$
}
}
@Override
public void mouseHover(MouseEvent event) {
+ if ((event.stateMask & SWT.BUTTON_MASK) != 0) {
+ return;
+ }
Point pt = new Point(event.x, event.y);
TimeGraphControl timeGraphControl = (TimeGraphControl) event.widget;
createTooltipShell(timeGraphControl.getShell());