From: Matthew Khouzam Date: Fri, 4 Dec 2015 20:29:39 +0000 (-0500) Subject: analysis: Allow SegementStoreContentProvider to accept Collection X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=6f9a98e1ce9d05e112e34ec5f82505013adc8f64;p=deliverable%2Ftracecompass.git analysis: Allow SegementStoreContentProvider to accept Collection This will allow easier testing. This also would also make the code easier to re-use by removing part of the dependencies on segments. Change-Id: I3d77a647306cae0c496ce894f5d326ddf1fd4e3b Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/62031 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann --- diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/SegmentStoreContentProvider.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/SegmentStoreContentProvider.java index f14f2579ff..90686b7f55 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/SegmentStoreContentProvider.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/SegmentStoreContentProvider.java @@ -16,6 +16,7 @@ package org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore; import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNullContents; import java.util.Arrays; +import java.util.Collection; import java.util.Comparator; import org.eclipse.jdt.annotation.NonNull; @@ -70,9 +71,9 @@ public class SegmentStoreContentProvider implements ISortingLazyContentProvider @Override public void inputChanged(@Nullable Viewer viewer, @Nullable Object oldInput, @Nullable Object newInput) { fTableViewer = (TableViewer) viewer; - if (newInput instanceof ISegmentStore) { + if (newInput instanceof Collection || newInput instanceof ISegmentStore) { @SuppressWarnings("unchecked") - ISegmentStore segmentStore = (ISegmentStore) newInput; + Collection segmentStore = (Collection<@NonNull ISegment>) newInput; ISegment[] array = Iterables.toArray(segmentStore, ISegment.class); @NonNull ISegment[] checkedArray = checkNotNullContents(array); if (fComparator != null) {