ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / timegraph / AbstractTimeGraphView.java
index 038efaad964dfb541ed8bda83dd6c8ad7db47026..18db3cc48e519306796b225e63aa8e565dc7612c 100644 (file)
@@ -27,11 +27,13 @@ import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IStatusLineManager;
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.ILabelProviderListener;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
@@ -50,6 +52,7 @@ import org.eclipse.linuxtools.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
+import org.eclipse.linuxtools.tmf.ui.TmfUiRefreshHandler;
 import org.eclipse.linuxtools.tmf.ui.views.TmfView;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphContentProvider;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider2;
@@ -59,7 +62,6 @@ import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphTimeListener;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.TimeGraphCombo;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.TimeGraphPresentationProvider;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.TimeGraphRangeUpdateEvent;
-import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.TimeGraphSelectionEvent;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.TimeGraphTimeEvent;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.TimeGraphViewer;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ILinkEvent;
@@ -388,7 +390,7 @@ public abstract class AbstractTimeGraphView extends TmfView {
      * this class typically need to override the getColumnText method if they
      * have more than one column to display
      */
-    protected static class TreeLabelProvider implements ITableLabelProvider {
+    protected static class TreeLabelProvider implements ITableLabelProvider, ILabelProvider {
 
         @Override
         public void addListener(ILabelProviderListener listener) {
@@ -421,6 +423,23 @@ public abstract class AbstractTimeGraphView extends TmfView {
             return new String();
         }
 
+        /**
+         * @since 3.2
+         */
+        @Override
+        public Image getImage(Object element) {
+            return null;
+        }
+
+        /**
+         * @since 3.2
+         */
+        @Override
+        public String getText(Object element) {
+            TimeGraphEntry entry = (TimeGraphEntry) element;
+            return entry.getName();
+        }
+
     }
 
     private class BuildThread extends Thread {
@@ -493,11 +512,13 @@ public abstract class AbstractTimeGraphView extends TmfView {
                 }
             }
             redraw();
-            for (TimeGraphEntry child : entry.getChildren()) {
+            for (ITimeGraphEntry child : entry.getChildren()) {
                 if (fMonitor.isCanceled()) {
                     return;
                 }
-                zoom(child, monitor);
+                if (child instanceof TimeGraphEntry) {
+                    zoom((TimeGraphEntry) child, monitor);
+                }
             }
         }
 
@@ -847,13 +868,6 @@ public abstract class AbstractTimeGraphView extends TmfView {
             }
         });
 
-        fTimeGraphWrapper.addSelectionListener(new ITimeGraphSelectionListener() {
-            @Override
-            public void selectionChanged(TimeGraphSelectionEvent event) {
-                // ITimeGraphEntry selection = event.getSelection();
-            }
-        });
-
         fTimeGraphWrapper.getTimeGraphViewer().setTimeFormat(TimeFormat.CALENDAR);
 
         IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
@@ -1100,7 +1114,7 @@ public abstract class AbstractTimeGraphView extends TmfView {
      *            The progress monitor object
      * @return The list of events for the entry
      */
-    protected abstract List<ITimeEvent> getEventList(TimeGraphEntry entry,
+    protected abstract @Nullable List<ITimeEvent> getEventList(TimeGraphEntry entry,
             long startTime, long endTime, long resolution,
             IProgressMonitor monitor);
 
@@ -1129,7 +1143,7 @@ public abstract class AbstractTimeGraphView extends TmfView {
      * Refresh the display
      */
     protected void refresh() {
-        Display.getDefault().asyncExec(new Runnable() {
+        TmfUiRefreshHandler.getInstance().queueUpdate(this, new Runnable() {
             @Override
             public void run() {
                 if (fTimeGraphWrapper.isDisposed()) {
This page took 0.025744 seconds and 5 git commands to generate.