tmf: Add missing Javadoc to tmf.ui
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / widgets / timegraph / widgets / TimeGraphTooltipHandler.java
index 595675067568ee48b2d3f83df4ccf072a7cb3d37..d8d5afcbe57b975649e0ddc3fff9f905f77f9e76 100644 (file)
@@ -1,3 +1,4 @@
+
 /*****************************************************************************
  * Copyright (c) 2007 Intel Corporation, 2009, 2012 Ericsson.
  * All rights reserved. This program and the accompanying materials
@@ -206,43 +207,33 @@ public class TimeGraphTooltipHandler {
                     }
 
                     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$
                     }
                 }
This page took 0.023691 seconds and 5 git commands to generate.