From: Patrick Tasse Date: Fri, 14 Oct 2016 18:57:48 +0000 (-0400) Subject: tmf: Add method to get marker list for all categories at once X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=cb73bc3951b93f2e300b451cc07aa9617136bb75;p=deliverable%2Ftracecompass.git tmf: Add method to get marker list for all categories at once This can be useful for marker event sources that provide multiple categories and for which it is easier to compute all the markers at the same time. Change-Id: I5efcfe4444f70ef879fb6a33aa4e28b844d08095 Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/83643 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann --- diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/.settings/.api_filters b/tmf/org.eclipse.tracecompass.tmf.ui/.settings/.api_filters index a005a55b24..f301ddc4bc 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/.settings/.api_filters +++ b/tmf/org.eclipse.tracecompass.tmf.ui/.settings/.api_filters @@ -34,4 +34,12 @@ + + + + + + + + diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java index 61928f8979..7fb453be0a 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java @@ -1462,12 +1462,7 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA long resolution, @NonNull IProgressMonitor monitor) { List markers = new ArrayList<>(); for (IMarkerEventSource markerEventSource : getMarkerEventSources(fTrace)) { - for (String category : markerEventSource.getMarkerCategories()) { - if (monitor.isCanceled()) { - break; - } - markers.addAll(markerEventSource.getMarkerList(category, startTime, endTime, resolution, monitor)); - } + markers.addAll(markerEventSource.getMarkerList(startTime, endTime, resolution, monitor)); } return markers; } diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/IMarkerEventSource.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/IMarkerEventSource.java index a46a5ee849..84a7135425 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/IMarkerEventSource.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/IMarkerEventSource.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Ericsson + * Copyright (c) 2015, 2017 Ericsson * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which @@ -12,6 +12,7 @@ package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model; +import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; @@ -52,4 +53,32 @@ public interface IMarkerEventSource { */ @NonNull List<@NonNull IMarkerEvent> getMarkerList(@NonNull String category, long startTime, long endTime, long resolution, @NonNull IProgressMonitor monitor); + /** + * Gets the list of marker events of all categories that intersect the given + * time range (inclusively). + *

+ * The list should include, for each category, the nearest previous and next + * markers that do not intersect the time range. + * + * @param startTime + * Start of the time range + * @param endTime + * End of the time range + * @param resolution + * The resolution + * @param monitor + * The progress monitor object + * @return The list of marker events + * @since 2.3 + */ + default @NonNull List<@NonNull IMarkerEvent> getMarkerList(long startTime, long endTime, long resolution, @NonNull IProgressMonitor monitor) { + List<@NonNull IMarkerEvent> markers = new ArrayList<>(); + for (String category : getMarkerCategories()) { + if (monitor.isCanceled()) { + break; + } + markers.addAll(getMarkerList(category, startTime, endTime, resolution, monitor)); + } + return markers; + } }