import java.text.SimpleDateFormat;\r
import java.util.Calendar;\r
import java.util.Date;\r
-import java.util.GregorianCalendar;\r
\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.Utils.Resolution;\r
import org.eclipse.swt.SWT;\r
private static final double LOG10_3 = Math.log10(3);\r
private static final double LOG10_5 = Math.log10(5);\r
\r
- private static final Calendar GREGORIAN_CALENDAR = GregorianCalendar.getInstance();\r
+ private static final Calendar GREGORIAN_CALENDAR = Calendar.getInstance();\r
\r
private ITimeDataProvider _timeProvider;\r
private int _dragState = 0;\r
}\r
\r
private void calcTimeDelta(int width, double pixelsPerNanoSec) {\r
- double minDelta = (double) ((pixelsPerNanoSec == 0) ? YEAR_IN_NS : width / pixelsPerNanoSec);\r
+ double minDelta = (pixelsPerNanoSec == 0) ? YEAR_IN_NS : width / pixelsPerNanoSec;\r
long unit = 1;\r
if (_timeProvider != null && _timeProvider.isCalendarFormat()) {\r
if (minDelta > 6 * MONTH_IN_NS) {\r
return;\r
}\r
}\r
- double log = Math.log10((double) minDelta / unit);\r
+ double log = Math.log10(minDelta / unit);\r
long pow10 = (long) log;\r
double remainder = log - pow10;\r
if (remainder < LOG10_1) {\r
}\r
\r
// draw selected time\r
- int x = _rect0.x + (int) ((double)(selectedTime - time0) * pixelsPerNanoSec);\r
+ int x = _rect0.x + (int) ((selectedTime - time0) * pixelsPerNanoSec);\r
if (x >= _rect0.x && x < _rect0.x + _rect0.width) {\r
gc.setForeground(_colors.getColor(TimeGraphColorScheme.SELECTED_TIME));\r
gc.drawLine(x, _rect0.y + _rect0.height - 6, x, _rect0.y\r
\r
@Override\r
public void draw(GC gc, long time, Rectangle rect) {\r
- String stime = syearformat.format(new Date((long) (time / 1000000)));\r
+ String stime = syearformat.format(new Date(time / 1000000));\r
Utils.drawText(gc, stime, rect, true);\r
}\r
\r
\r
@Override\r
public void draw(GC gc, long time, Rectangle rect) {\r
- String stime = smonthformat.format(new Date((long) (time / 1000000)));\r
+ String stime = smonthformat.format(new Date(time / 1000000));\r
Utils.drawText(gc, stime, rect, true);\r
}\r
\r
\r
@Override\r
public void draw(GC gc, long time, Rectangle rect) {\r
- String stime = sdayformat.format(new Date((long) (time / 1000000)));\r
+ String stime = sdayformat.format(new Date(time / 1000000));\r
Utils.drawText(gc, stime, rect, true);\r
}\r
\r
@Override\r
public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
- String header = sdayformatheader.format(new Date((long) (time / 1000000)));\r
+ String header = sdayformatheader.format(new Date(time / 1000000));\r
int headerwidth = gc.stringExtent(header).x + 4;\r
if (headerwidth <= rect.width) {\r
rect.x += (rect.width - headerwidth);\r
\r
@Override\r
public void draw(GC gc, long time, Rectangle rect) {\r
- String stime = shrsformat.format(new Date((long) (time / 1000000)));\r
+ String stime = shrsformat.format(new Date(time / 1000000));\r
Utils.drawText(gc, stime, rect, true);\r
}\r
\r
@Override\r
public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
- String header = shrsformatheader.format(new Date((long) (time / 1000000)));\r
+ String header = shrsformatheader.format(new Date(time / 1000000));\r
int headerwidth = gc.stringExtent(header).x + 4;\r
if (headerwidth <= rect.width) {\r
rect.x += (rect.width - headerwidth);\r
\r
@Override\r
public void draw(GC gc, long time, Rectangle rect) {\r
- String stime = sminformat.format(new Date((long) (time / 1000000)));\r
+ String stime = sminformat.format(new Date(time / 1000000));\r
Utils.drawText(gc, stime, rect, true);\r
}\r
\r
@Override\r
public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
- String header = sminformatheader.format(new Date((long) (time / 1000000)));\r
+ String header = sminformatheader.format(new Date(time / 1000000));\r
int headerwidth = gc.stringExtent(header).x + 4;\r
if (headerwidth <= rect.width) {\r
rect.x += (rect.width - headerwidth);\r
\r
@Override\r
public void draw(GC gc, long time, Rectangle rect) {\r
- String stime = stimeformat.format(new Date((long) (time / 1000000)));\r
+ String stime = stimeformat.format(new Date(time / 1000000));\r
Utils.drawText(gc, stime, rect, true);\r
}\r
\r
@Override\r
public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
- String header = stimeformatheader.format(new Date((long) (time / 1000000)));\r
+ String header = stimeformatheader.format(new Date(time / 1000000));\r
int headerwidth = gc.stringExtent(header).x + 4;\r
if (headerwidth <= rect.width) {\r
rect.x += (rect.width - headerwidth);\r
\r
@Override\r
public void draw(GC gc, long time, Rectangle rect) {\r
- String stime = stimeformat.format(new Date((long) (time / 1000000)));\r
+ String stime = stimeformat.format(new Date(time / 1000000));\r
String ns = Utils.formatNs(time, Resolution.MILLISEC);\r
\r
Utils.drawText(gc, stime + "." + ns, rect, true); //$NON-NLS-1$\r
\r
@Override\r
public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
- String header = stimeformatheader.format(new Date((long) (time / 1000000)));\r
+ String header = stimeformatheader.format(new Date(time / 1000000));\r
int headerwidth = gc.stringExtent(header).x + 4;\r
if (headerwidth <= rect.width) {\r
rect.x += (rect.width - headerwidth);\r
\r
@Override\r
public void draw(GC gc, long time, Rectangle rect) {\r
- String stime = stimeformat.format(new Date((long) (time / 1000000)));\r
+ String stime = stimeformat.format(new Date(time / 1000000));\r
String micr = Utils.formatNs(time, Resolution.MICROSEC);\r
Utils.drawText(gc, stime + "." + micr, rect, true); //$NON-NLS-1$\r
}\r
\r
@Override\r
public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
- String header = stimeformatheader.format(new Date((long) (time / 1000000)));\r
+ String header = stimeformatheader.format(new Date(time / 1000000));\r
int headerwidth = gc.stringExtent(header).x + 4;\r
if (headerwidth <= rect.width) {\r
rect.x += (rect.width - headerwidth);\r
\r
@Override\r
public void draw(GC gc, long time, Rectangle rect) {\r
- String stime = stimeformat.format(new Date((long) (time / 1000000)));\r
+ String stime = stimeformat.format(new Date(time / 1000000));\r
String ns = Utils.formatNs(time, Resolution.NANOSEC);\r
Utils.drawText(gc, stime + "." + ns, rect, true); //$NON-NLS-1$\r
}\r
\r
@Override\r
public void drawAbsHeader(GC gc, long time, Rectangle rect) {\r
- String header = stimeformatheader.format(new Date((long) (time / 1000000)));\r
+ String header = stimeformatheader.format(new Date(time / 1000000));\r
int headerwidth = gc.stringExtent(header).x + 4;\r
if (headerwidth <= rect.width) {\r
rect.x += (rect.width - headerwidth);\r