analysis: Allow SegementStoreContentProvider to accept Collection<ISegment>
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Fri, 4 Dec 2015 20:29:39 +0000 (15:29 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Wed, 9 Dec 2015 18:22:05 +0000 (13:22 -0500)
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 <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/62031
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/SegmentStoreContentProvider.java

index f14f2579ffac6b4ce9e494c04fac786f5320bf44..90686b7f553dabbe20fdf248db07bc99a5423f46 100644 (file)
@@ -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<ISegment> segmentStore = (ISegmentStore<ISegment>) newInput;
+            Collection<ISegment> segmentStore = (Collection<@NonNull ISegment>) newInput;
             ISegment[] array = Iterables.toArray(segmentStore, ISegment.class);
             @NonNull ISegment[] checkedArray = checkNotNullContents(array);
             if (fComparator != null) {
This page took 0.02749 seconds and 5 git commands to generate.