Skip to content

Commit

Permalink
opentracing: Adapt to getViewMarkerList removal
Browse files Browse the repository at this point in the history
Adapt this method also in SpanLifeView, accordingly and so this builds
after the change [1] being done in org.eclipse.tracecompass.

Reformat this file using the default Eclipse formatter.

[1] Bug 579484: Remove the deprecated getViewMarkerList

Change-Id: I1071c5f1b44d2a251b14c59b1367a9e2689a0110
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/193516
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
  • Loading branch information
marco-miller committed May 25, 2022
1 parent a1b3504 commit 29d6755
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
package org.eclipse.tracecompass.incubator.internal.opentracing.ui.view.spanlife;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.StreamSupport;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.annotation.NonNull;
Expand Down Expand Up @@ -45,11 +47,11 @@ public class SpanLifeView extends BaseDataProviderTimeGraphView {
* Span life view Id
*/
public static final String ID = "org.eclipse.tracecompass.incubator.opentracing.ui.view.life.spanlife.view"; //$NON-NLS-1$

private static final RGBA MARKER_COLOR = new RGBA(200, 0, 0, 150);

private static final Image ERROR_IMAGE = Objects.requireNonNull(Activator.getDefault()).getImageFromPath("icons/delete_button.gif"); //$NON-NLS-1$


private static class SpanTreeLabelProvider extends TreeLabelProvider {

@Override
Expand Down Expand Up @@ -88,11 +90,22 @@ public SpanLifeView(String id, TimeGraphPresentationProvider pres, String dpID)
}

@Override
protected @NonNull List<IMarkerEvent> getViewMarkerList(long startTime, long endTime,
protected @NonNull List<IMarkerEvent> getViewMarkerList(Iterable<@NonNull TimeGraphEntry> entries, long startTime, long endTime,
long resolution, @NonNull IProgressMonitor monitor) {
ITimeGraphEntry[] expandedElements = getTimeGraphViewer().getExpandedElements();
List<ITimeGraphEntry> queriedElements = new ArrayList<>();
for (ITimeGraphEntry candidate : expandedElements) {
if (StreamSupport.stream(entries.spliterator(), false).anyMatch(candidate::equals)) {
queriedElements.add(candidate);
}
}
if (queriedElements.isEmpty()) {
// Fall-back to this method's previous implementation to not break
// anything. Still possible to improve caller's efficiency later.
queriedElements = Arrays.asList(expandedElements);
}
List<IMarkerEvent> markers = new ArrayList<>();
for (ITimeGraphEntry element : expandedElements) {
for (ITimeGraphEntry element : queriedElements) {
ITmfTreeDataModel entryModel = ((TimeGraphEntry) element).getEntryModel();
if (entryModel instanceof SpanLifeEntryModel) {
SpanLifeEntryModel model = (SpanLifeEntryModel) entryModel;
Expand Down

0 comments on commit 29d6755

Please sign in to comment.