Fix for empty views that extend TmfView after restart (Bug 409345)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / statesystem / TmfStateSystemExplorer.java
index 7d14a6930d8653331dc1d111e695bbe748122e38..126e0fc623735cab08b185cc4cf489f75cd6db66 100644 (file)
@@ -9,6 +9,7 @@
  * Contributors:
  *   Florian Wininger - Initial API and implementation
  *   Alexandre Montplaisir - Refactoring, performance tweaks
+ *   Bernd Hufmann - Updated signal handling
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.ui.views.statesystem;
@@ -25,6 +26,7 @@ import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
@@ -380,6 +382,17 @@ public class TmfStateSystemExplorer extends TmfView {
     // ------------------------------------------------------------------------
     // Signal handlers
     // ------------------------------------------------------------------------
+    /**
+     * Handler for the trace opened signal.
+     * @param signal
+     *            The incoming signal
+     * @since 2.0
+     */
+    @TmfSignalHandler
+    public void traceOpened(TmfTraceOpenedSignal signal) {
+        fTrace = signal.getTrace();
+        loadTrace();
+    }
 
     /**
      * Handler for the trace selected signal. This will make the view display
@@ -393,13 +406,7 @@ public class TmfStateSystemExplorer extends TmfView {
         ITmfTrace trace = signal.getTrace();
         if (trace != fTrace) {
             fTrace = trace;
-            Thread thread = new Thread("State system visualizer construction") { //$NON-NLS-1$
-                @Override
-                public void run() {
-                    createTable();
-                }
-            };
-            thread.start();
+            loadTrace();
         }
     }
 
@@ -437,4 +444,15 @@ public class TmfStateSystemExplorer extends TmfView {
         };
         thread.start();
     }
+
+    private void loadTrace() {
+        Thread thread = new Thread("State system visualizer construction") { //$NON-NLS-1$
+            @Override
+            public void run() {
+                createTable();
+            }
+        };
+        thread.start();
+    }
+
 }
This page took 0.026149 seconds and 5 git commands to generate.