tmf: Simple warning fixes in tmf.ui and tests
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / widgets / timegraph / widgets / TimeGraphScale.java
index 9abc7d2ff2801f3d83e235085b8fef1efb9547d2..f25db8c5ef4bd06e6ac0e3fd5554d1538bb97bc8 100644 (file)
@@ -18,7 +18,6 @@ package org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets;
 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
@@ -69,7 +68,7 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
     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
@@ -109,7 +108,7 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
     }\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
@@ -135,7 +134,7 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
                 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
@@ -266,7 +265,7 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
         }\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
@@ -620,7 +619,7 @@ class TimeDrawAbsYear extends TimeDraw {
 \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
@@ -635,7 +634,7 @@ class TimeDrawAbsMonth extends TimeDraw {
 \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
@@ -650,13 +649,13 @@ class TimeDrawAbsDay extends TimeDraw {
 \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
@@ -675,13 +674,13 @@ class TimeDrawAbsHrs extends TimeDraw {
 \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
@@ -700,13 +699,13 @@ class TimeDrawAbsMin extends TimeDraw {
 \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
@@ -726,13 +725,13 @@ class TimeDrawAbsSec extends TimeDraw {
 \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
@@ -751,7 +750,7 @@ class TimeDrawAbsMillisec extends TimeDraw {
 \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
@@ -759,7 +758,7 @@ class TimeDrawAbsMillisec extends TimeDraw {
 \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
@@ -778,14 +777,14 @@ class TimeDrawAbsMicroSec extends TimeDraw {
 \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
@@ -804,14 +803,14 @@ class TimeDrawAbsNanoSec extends TimeDraw {
 \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
This page took 0.028846 seconds and 5 git commands to generate.