From: Geneviève Bastien Date: Mon, 9 Jun 2014 14:08:56 +0000 (-0400) Subject: TMF: Bug 416055: Fix behavior of synchronization view X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=72aef47a47665c73c798cb86beec2e30133f1a96;p=deliverable%2Ftracecompass.git TMF: Bug 416055: Fix behavior of synchronization view Change-Id: I596e07eb8eb5cc688f0f1810d02f91cfc616a9b1 Signed-off-by: Geneviève Bastien Reviewed-on: https://git.eclipse.org/r/28200 Tested-by: Hudson CI Reviewed-by: Matthew Khouzam Tested-by: Matthew Khouzam --- diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/TmfSynchronizationView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/TmfSynchronizationView.java index ce06df91b6..d17bd113ff 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/TmfSynchronizationView.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/TmfSynchronizationView.java @@ -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 *