Make it public.
Change-Id: I6adf91b7b15ccc96105f35940641d65704b1ab3d
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/63786
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2015, 2016 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ **********************************************************************/
+
+package org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore;
+
+import java.text.DecimalFormat;
+import java.text.FieldPosition;
+import java.text.Format;
+import java.text.ParsePosition;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
+
+/**
+ * Time format, it will take a time in nano seconds and convert it to a string
+ * with 3 decimals max.
+ *
+ * examples:
+ * <ul>
+ * <li>100 -> "100 ns"</li>
+ * <li>1001 -> "1.001 us" (mu)</li>
+ * <li>314159264 -> "312.159 ms"</li>
+ * <li>10000002000000 -> "1000.002 s"</li>
+ * </ul>
+ */
+public final class SubSecondTimeWithUnitFormat extends Format {
+
+
+ private static final long serialVersionUID = -5147827135781459548L;
+
+ private static final String SECONDS = "s"; //$NON-NLS-1$
+ private static final String NANOSECONDS = "ns"; //$NON-NLS-1$
+ private static final String MILLISECONDS = "ms"; //$NON-NLS-1$
+ private static final String MICROSECONDS = "\u00B5" + SECONDS; //$NON-NLS-1$
+
+ private static final int NANOS_PER_SEC = 1000000000;
+ private static final int NANOS_PER_MILLI = 1000000;
+ private static final int NANOS_PER_MICRO = 1000;
+
+ private final DecimalFormat fDecimalFormat = new DecimalFormat("#.###"); //$NON-NLS-1$
+
+ @Override
+ public Object parseObject(@Nullable String source, @Nullable ParsePosition pos) {
+ return source == null ? "" : source; //$NON-NLS-1$
+ }
+
+ @Override
+ public StringBuffer format(@Nullable Object obj, @Nullable StringBuffer toAppendTo, @Nullable FieldPosition pos) {
+ final @Nullable StringBuffer appender = toAppendTo;
+ if ((obj != null) && (obj instanceof Double || obj instanceof Long)) {
+ double formattedTime = obj instanceof Long ? ((Long) obj).doubleValue() : ((Double) obj).doubleValue();
+ String unit = NANOSECONDS;
+ if (formattedTime > NANOS_PER_SEC) {
+ unit = SECONDS;
+ formattedTime /= NANOS_PER_SEC;
+ } else if (formattedTime > NANOS_PER_MILLI) {
+ unit = MILLISECONDS;
+ formattedTime /= NANOS_PER_MILLI;
+ } else if (formattedTime > NANOS_PER_MICRO) {
+ unit = MICROSECONDS;
+ formattedTime /= NANOS_PER_MICRO;
+ }
+ String timeString = fDecimalFormat.format(formattedTime);
+ return appender == null ? new StringBuffer() : NonNullUtils.checkNotNull(appender.append(timeString).append(' ').append(unit));
+ }
+ return new StringBuffer();
+ }
+}
\ No newline at end of file
/******************************************************************************
- * Copyright (c) 2015 Ericsson
+ * Copyright (c) 2015, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
+import java.text.Format;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import org.eclipse.swt.widgets.Display;
import org.eclipse.tracecompass.analysis.timing.core.segmentstore.AbstractSegmentStoreAnalysisModule;
import org.eclipse.tracecompass.analysis.timing.core.segmentstore.IAnalysisProgressListener;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.SubSecondTimeWithUnitFormat;
import org.eclipse.tracecompass.common.core.NonNullUtils;
-import org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.density.DensityTimeFormat;
import org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.density.MouseDragZoomProvider;
import org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.density.MouseSelectionProvider;
import org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.density.SimpleTooltipProvider;
*/
public abstract class AbstractSegmentStoreDensityViewer extends TmfViewer {
- private static final DensityTimeFormat DENSITY_TIME_FORMATTER = new DensityTimeFormat();
+ private static final Format DENSITY_TIME_FORMATTER = new SubSecondTimeWithUnitFormat();
private static final RGB BAR_COLOR = new RGB(0x42, 0x85, 0xf4);
private final Chart fChart;
private final MouseDragZoomProvider fDragZoomProvider;
+++ /dev/null
-/**********************************************************************
- * Copyright (c) 2015 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
- * http://www.eclipse.org/legal/epl-v10.html
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.density;
-
-import java.text.DecimalFormat;
-import java.text.FieldPosition;
-import java.text.Format;
-import java.text.ParsePosition;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
-
-/**
- * Density format, it will take a time in NanoSeconds and convert it to a string
- * with 3 digits.
- *
- * @author Matthew Khouzam
- */
-public final class DensityTimeFormat extends Format {
-
-
- private static final long serialVersionUID = -5147827135781459548L;
-
- private static final String SECONDS = "s"; //$NON-NLS-1$
- private static final String NANOSECONDS = "ns"; //$NON-NLS-1$
- private static final String MILLISECONDS = "ms"; //$NON-NLS-1$
- private static final String MICROSECONDS = "\u00B5" + SECONDS; //$NON-NLS-1$
-
- private static final int NANOS_PER_SEC = 1000000000;
- private static final int NANOS_PER_MILLI = 1000000;
- private static final int NANOS_PER_MICRO = 1000;
-
- private final DecimalFormat fDecimalFormat = new DecimalFormat("#.###"); //$NON-NLS-1$
-
- @Override
- public Object parseObject(@Nullable String source, @Nullable ParsePosition pos) {
- return source == null ? "" : source; //$NON-NLS-1$
- }
-
- @Override
- public StringBuffer format(@Nullable Object obj, @Nullable StringBuffer toAppendTo, @Nullable FieldPosition pos) {
- final @Nullable StringBuffer appender = toAppendTo;
- if ((obj != null) && (obj instanceof Double || obj instanceof Long)) {
- double formattedTime = obj instanceof Long ? ((Long) obj).doubleValue() : ((Double) obj).doubleValue();
- String unit = NANOSECONDS;
- if (formattedTime > NANOS_PER_SEC) {
- unit = SECONDS;
- formattedTime /= NANOS_PER_SEC;
- } else if (formattedTime > NANOS_PER_MILLI) {
- unit = MILLISECONDS;
- formattedTime /= NANOS_PER_MILLI;
- } else if (formattedTime > NANOS_PER_MICRO) {
- unit = MICROSECONDS;
- formattedTime /= NANOS_PER_MICRO;
- }
- String timeString = fDecimalFormat.format(formattedTime);
- return appender == null ? new StringBuffer() : NonNullUtils.checkNotNull(appender.append(timeString).append(' ').append(unit));
- }
- return new StringBuffer();
- }
-}
\ No newline at end of file
/**********************************************************************
- * Copyright (c) 2015 Ericsson
+ * Copyright (c) 2015, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.SubSecondTimeWithUnitFormat;
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density.AbstractSegmentStoreDensityViewer;
import org.swtchart.IAxis;
import org.swtchart.IBarSeries;
*/
public class SimpleTooltipProvider extends BaseMouseProvider implements MouseTrackListener {
- private static final Format FORMAT = new DensityTimeFormat();
+ private static final Format FORMAT = new SubSecondTimeWithUnitFormat();
/**
* Constructor for a tool tip provider.