TMF: Bug 416055: Fix behavior of synchronization view
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Mon, 9 Jun 2014 14:08:56 +0000 (10:08 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Wed, 11 Jun 2014 20:15:32 +0000 (16:15 -0400)
Change-Id: I596e07eb8eb5cc688f0f1810d02f91cfc616a9b1
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/28200
Tested-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/TmfSynchronizationView.java

index ce06df91b6508e5320ec68a79612d6ff994f5ed1..d17bd113ffa1f2aa31b116b32f019d5d49a9c49b 100644 (file)
@@ -14,9 +14,15 @@ package org.eclipse.linuxtools.tmf.ui.views.synchronization;
 
 import java.util.Map;
 
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 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 +77,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 +116,30 @@ public class TmfSynchronizationView extends TmfView {
         fTree.setFocus();
     }
 
+    /**
+     * Handler called when a trace is selected
+     *
+     * @param signal
+     *            Contains information about the selected trace
+     */
+    @TmfSignalHandler
+    public void traceSelected(TmfTraceSelectedSignal signal) {
+        fAlgoSync = null;
+        if (signal.getTrace() instanceof TmfExperiment) {
+            try {
+                fAlgoSync = ((TmfExperiment) signal.getTrace()).synchronizeTraces();
+            } catch (TmfTraceException e) {
+                Activator.getDefault().logError("Error while getting the synchronization data of experiment", e); //$NON-NLS-1$
+            }
+        }
+        Display.getDefault().asyncExec(new Runnable() {
+            @Override
+            public void run() {
+                updateTable();
+            }
+        });
+    }
+
     /**
      * Handler called when traces are synchronized
      *
This page took 0.025578 seconds and 5 git commands to generate.