ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / synchronization / TmfSynchronizationView.java
index ce06df91b6508e5320ec68a79612d6ff994f5ed1..c8188061ae9a1d69767470894a3bbb6ec9ddaabe 100644 (file)
@@ -15,8 +15,12 @@ package org.eclipse.linuxtools.tmf.ui.views.synchronization;
 import java.util.Map;
 
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSynchronizedSignal;
 import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
+import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
 import org.eclipse.linuxtools.tmf.ui.views.TmfView;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
@@ -71,6 +75,10 @@ public class TmfSynchronizationView extends TmfView {
         nameCol.pack();
         valueCol.pack();
 
+        ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
+        if (trace != null) {
+            traceSelected(new TmfTraceSelectedSignal(this, trace));
+        }
     }
 
     private void updateTable() {
@@ -106,6 +114,27 @@ public class TmfSynchronizationView extends TmfView {
         fTree.setFocus();
     }
 
+    /**
+     * Handler called when a trace is selected
+     *
+     * @param signal
+     *            Contains information about the selected trace
+     * @since 3.1
+     */
+    @TmfSignalHandler
+    public void traceSelected(TmfTraceSelectedSignal signal) {
+        fAlgoSync = null;
+        if (signal.getTrace() instanceof TmfExperiment) {
+            fAlgoSync = ((TmfExperiment) signal.getTrace()).synchronizeTraces();
+        }
+        Display.getDefault().asyncExec(new Runnable() {
+            @Override
+            public void run() {
+                updateTable();
+            }
+        });
+    }
+
     /**
      * Handler called when traces are synchronized
      *
This page took 0.02587 seconds and 5 git commands to generate.