tmf: Add method to get marker list for all categories at once
authorPatrick Tasse <patrick.tasse@gmail.com>
Fri, 14 Oct 2016 18:57:48 +0000 (14:57 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Mon, 6 Mar 2017 20:29:26 +0000 (15:29 -0500)
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 <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/83643
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.ui/.settings/.api_filters
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/IMarkerEventSource.java

index a005a55b24187af0bbd0315418381adbee610b62..f301ddc4bc23cbd1e4f3b35bd22a4df70d3dd1cc 100644 (file)
             </message_arguments>
         </filter>
     </resource>
+    <resource path="src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/IMarkerEventSource.java" type="org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEventSource">
+        <filter comment="API preference INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Ignore is not properly supported (Bug 507246)" id="404000815">
+            <message_arguments>
+                <message_argument value="org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEventSource"/>
+                <message_argument value="getMarkerList(long, long, long, IProgressMonitor)"/>
+            </message_arguments>
+        </filter>
+    </resource>
 </component>
index 61928f897962202f6448cf57d0ff89c0c025ac6f..7fb453be0a2286ad43af2d2c4bfc77f13e4a7607 100644 (file)
@@ -1462,12 +1462,7 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
             long resolution, @NonNull IProgressMonitor monitor) {
         List<IMarkerEvent> 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;
     }
index a46a5ee8493f3ff2edb5fb2c1f18e4a9efe14b79..84a7135425a3757fbf256e663bdf5db5e1b3862e 100644 (file)
@@ -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).
+     * <p>
+     * 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;
+    }
 }
This page took 0.028673 seconds and 5 git commands to generate.