From 105c43bdf82e3a7408480a399d6ac3d1b47da16f Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Thu, 7 Jan 2016 15:32:05 -0500 Subject: [PATCH] analysis: rename DensityTimeFormat to SubSecondTimeWithUnitFormat Make it public. Change-Id: I6adf91b7b15ccc96105f35940641d65704b1ab3d Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/63786 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann --- .../SubSecondTimeWithUnitFormat.java} | 18 ++++++++++++------ .../AbstractSegmentStoreDensityViewer.java | 7 ++++--- .../density/SimpleTooltipProvider.java | 5 +++-- 3 files changed, 19 insertions(+), 11 deletions(-) rename analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/{internal/analysis/timing/ui/views/segmentstore/density/DensityTimeFormat.java => analysis/timing/ui/views/segmentstore/SubSecondTimeWithUnitFormat.java} (84%) diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density/DensityTimeFormat.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/SubSecondTimeWithUnitFormat.java similarity index 84% rename from analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density/DensityTimeFormat.java rename to analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/SubSecondTimeWithUnitFormat.java index c1c641cda8..5631c26196 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density/DensityTimeFormat.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/SubSecondTimeWithUnitFormat.java @@ -1,5 +1,5 @@ /********************************************************************** - * 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 @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html **********************************************************************/ -package org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.density; +package org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore; import java.text.DecimalFormat; import java.text.FieldPosition; @@ -18,12 +18,18 @@ 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. + * Time format, it will take a time in nano seconds and convert it to a string + * with 3 decimals max. * - * @author Matthew Khouzam + * examples: + *
    + *
  • 100 -> "100 ns"
  • + *
  • 1001 -> "1.001 us" (mu)
  • + *
  • 314159264 -> "312.159 ms"
  • + *
  • 10000002000000 -> "1000.002 s"
  • + *
*/ -public final class DensityTimeFormat extends Format { +public final class SubSecondTimeWithUnitFormat extends Format { private static final long serialVersionUID = -5147827135781459548L; diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java index 542a5dccfb..46bdd1fff0 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java @@ -1,5 +1,5 @@ /****************************************************************************** - * 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 @@ -11,6 +11,7 @@ package org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density; 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; @@ -26,8 +27,8 @@ import org.eclipse.swt.widgets.Composite; 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; @@ -67,7 +68,7 @@ import com.google.common.collect.Lists; */ 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; diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density/SimpleTooltipProvider.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density/SimpleTooltipProvider.java index 91ee2400da..f42c0af9a6 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density/SimpleTooltipProvider.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density/SimpleTooltipProvider.java @@ -1,5 +1,5 @@ /********************************************************************** - * 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 @@ -15,6 +15,7 @@ import org.eclipse.jdt.annotation.Nullable; 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; @@ -29,7 +30,7 @@ import org.swtchart.ISeries; */ 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. -- 2.34.1