Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Hufmann2013-05-29 13:11:59 +0000
committerBernd Hufmann2013-05-31 16:54:04 +0000
commit95173b0defc98aed9f911de7d21bde92e61aebc0 (patch)
treeb24013f27200e37ac1f3793f649eb5047b2574ce
parentfbfac1d5937b1686ceef52ed4feeb4734b02721d (diff)
downloadorg.eclipse.linuxtools-95173b0defc98aed9f911de7d21bde92e61aebc0.tar.gz
org.eclipse.linuxtools-95173b0defc98aed9f911de7d21bde92e61aebc0.tar.xz
org.eclipse.linuxtools-95173b0defc98aed9f911de7d21bde92e61aebc0.zip
Fix for empty views that extend TmfView after restart (Bug 409345)
All views in Tmf/LTTng are affected by this problem: - Add Handling of TmfTraceOpenedSignal in all relevant views - The TmfUml2SDSyncLoader handles now the TmfTraceOpenedSignal - TmfTrace is now registered as VIP listener for signals Change-Id: Id0275bb44f72e4a05be8b91699958975c7b108f9 Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com> Reviewed-on: https://git.eclipse.org/r/13336 Tested-by: Hudson CI Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> IP-Clean: Patrick Tasse <patrick.tasse@gmail.com> Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java48
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java45
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/signal/TmfSignalManager.java3
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java3
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackView.java45
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/environment/TmfEnvironmentView.java14
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramView.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java32
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java176
9 files changed, 235 insertions, 133 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java
index 5d76a6b546..e9181da46b 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java
@@ -8,6 +8,7 @@
*
* Contributors:
* Patrick Tasse - Initial API and implementation
+ * Bernd Hufmann - Updated signal handling
*******************************************************************************/
package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.controlflow;
@@ -41,6 +42,7 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
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;
@@ -428,12 +430,23 @@ public class ControlFlowView 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
*
* @param signal
- * The signal that's received
+ * The incoming signal
*/
@TmfSignalHandler
public void traceSelected(final TmfTraceSelectedSignal signal) {
@@ -441,21 +454,7 @@ public class ControlFlowView extends TmfView {
return;
}
fTrace = signal.getTrace();
-
- synchronized (fEntryListMap) {
- fEntryList = fEntryListMap.get(fTrace);
- if (fEntryList == null) {
- synchronized (fBuildThreadMap) {
- BuildThread buildThread = new BuildThread(fTrace);
- fBuildThreadMap.put(fTrace, buildThread);
- buildThread.start();
- }
- } else {
- fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- refresh();
- }
- }
+ loadTrace();
}
/**
@@ -593,6 +592,23 @@ public class ControlFlowView extends TmfView {
// Internal
// ------------------------------------------------------------------------
+ private void loadTrace() {
+ synchronized (fEntryListMap) {
+ fEntryList = fEntryListMap.get(fTrace);
+ if (fEntryList == null) {
+ synchronized (fBuildThreadMap) {
+ BuildThread buildThread = new BuildThread(fTrace);
+ fBuildThreadMap.put(fTrace, buildThread);
+ buildThread.start();
+ }
+ } else {
+ fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ refresh();
+ }
+ }
+ }
+
private void buildEventList(final ITmfTrace trace, IProgressMonitor monitor) {
fStartTime = Long.MAX_VALUE;
fEndTime = Long.MIN_VALUE;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java
index 2d7bbd5862..52c225c9e3 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java
@@ -38,6 +38,7 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
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.timestamp.ITmfTimestamp;
@@ -357,6 +358,17 @@ public class ResourcesView extends TmfView {
// ------------------------------------------------------------------------
/**
+ * Handler for the trace opened signal.
+ * @param signal the trace selected signal
+ * @since 2.0
+ */
+ @TmfSignalHandler
+ public void traceOpened(TmfTraceOpenedSignal signal) {
+ fTrace = signal.getTrace();
+ loadTrace();
+ }
+
+ /**
* Handler for the trace selected signal
*
* @param signal
@@ -368,21 +380,7 @@ public class ResourcesView extends TmfView {
return;
}
fTrace = signal.getTrace();
-
- synchronized (fEntryListMap) {
- fEntryList = fEntryListMap.get(fTrace);
- if (fEntryList == null) {
- synchronized (fBuildThreadMap) {
- BuildThread buildThread = new BuildThread(fTrace);
- fBuildThreadMap.put(fTrace, buildThread);
- buildThread.start();
- }
- } else {
- fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- refresh();
- }
- }
+ loadTrace();
}
/**
@@ -470,6 +468,23 @@ public class ResourcesView extends TmfView {
// Internal
// ------------------------------------------------------------------------
+ private void loadTrace() {
+ synchronized (fEntryListMap) {
+ fEntryList = fEntryListMap.get(fTrace);
+ if (fEntryList == null) {
+ synchronized (fBuildThreadMap) {
+ BuildThread buildThread = new BuildThread(fTrace);
+ fBuildThreadMap.put(fTrace, buildThread);
+ buildThread.start();
+ }
+ } else {
+ fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ refresh();
+ }
+ }
+ }
+
private void buildEventList(final ITmfTrace trace, IProgressMonitor monitor) {
fStartTime = Long.MAX_VALUE;
fEndTime = Long.MIN_VALUE;
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/signal/TmfSignalManager.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/signal/TmfSignalManager.java
index cbbf343b53..1ad50f7455 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/signal/TmfSignalManager.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/signal/TmfSignalManager.java
@@ -8,6 +8,7 @@
*
* Contributors:
* Francois Chouinard - Initial API and implementation
+ * Bernd Hufmann - Update register methods
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.signal;
@@ -60,6 +61,7 @@ public class TmfSignalManager {
* The object that will be notified of new signals
*/
public static synchronized void register(Object listener) {
+ deregister(listener); // make sure that listener is only registered once
Method[] methods = getSignalHandlerMethods(listener);
if (methods.length > 0) {
fListeners.put(listener, methods);
@@ -75,6 +77,7 @@ public class TmfSignalManager {
* The object that will be notified of new signals
*/
public static synchronized void registerVIP(Object listener) {
+ deregister(listener); // make sure that listener is only registered once
Method[] methods = getSignalHandlerMethods(listener);
if (methods.length > 0) {
fVIPListeners.put(listener, methods);
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
index 5a9fd53599..a698f9540a 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
@@ -28,6 +28,7 @@ import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceRangeUpdatedSignal;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
@@ -219,6 +220,8 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
}
}
super.init(traceName, type);
+ // register as VIP after super.init() because TmfComponent registers to signal manager there
+ TmfSignalManager.registerVIP(this);
}
/**
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackView.java
index 951b3232bb..038fd723db 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackView.java
@@ -8,6 +8,7 @@
*
* Contributors:
* Patrick Tasse - Initial API and implementation
+ * Bernd Hufmann - Updated signal handling
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.callstack;
@@ -47,6 +48,7 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
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;
@@ -582,6 +584,17 @@ public class CallStackView 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
@@ -595,21 +608,7 @@ public class CallStackView extends TmfView {
return;
}
fTrace = signal.getTrace();
-
- synchronized (fEntryListMap) {
- fEntryList = fEntryListMap.get(fTrace);
- if (fEntryList == null) {
- synchronized (fBuildThreadMap) {
- BuildThread buildThread = new BuildThread(fTrace);
- fBuildThreadMap.put(fTrace, buildThread);
- buildThread.start();
- }
- } else {
- fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- refresh();
- }
- }
+ loadTrace();
}
/**
@@ -734,6 +733,22 @@ public class CallStackView extends TmfView {
// ------------------------------------------------------------------------
// Internal
// ------------------------------------------------------------------------
+ private void loadTrace() {
+ synchronized (fEntryListMap) {
+ fEntryList = fEntryListMap.get(fTrace);
+ if (fEntryList == null) {
+ synchronized (fBuildThreadMap) {
+ BuildThread buildThread = new BuildThread(fTrace);
+ fBuildThreadMap.put(fTrace, buildThread);
+ buildThread.start();
+ }
+ } else {
+ fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ refresh();
+ }
+ }
+ }
private void buildThreadList(final ITmfTrace trace, IProgressMonitor monitor) {
fStartTime = Long.MAX_VALUE;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/environment/TmfEnvironmentView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/environment/TmfEnvironmentView.java
index 82f31727bb..0a190bcd8d 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/environment/TmfEnvironmentView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/environment/TmfEnvironmentView.java
@@ -18,6 +18,7 @@ import java.util.Map;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
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.trace.ITmfTraceProperties;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
@@ -112,6 +113,19 @@ public class TmfEnvironmentView extends TmfView {
}
/**
+ * Handler for the trace opened signal.
+ * @param signal
+ * The incoming signal
+ * @since 2.0
+ */
+ @TmfSignalHandler
+ public void traceOpened(TmfTraceOpenedSignal signal) {
+ fTrace = signal.getTrace();
+ updateTable();
+ }
+
+
+ /**
* Handler for the trace selected signal.
*
* @param signal
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramView.java
index 5393cdc49b..45cd97e821 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramView.java
@@ -378,7 +378,7 @@ public class HistogramView extends TmfView {
/**
* Handles trace opened signal. Loads histogram if new trace time range is not
* equal <code>TmfTimeRange.NULL_RANGE</code>
- * @param signal the trace selected signal
+ * @param signal the trace opened signal
* @since 2.0
*/
@TmfSignalHandler
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java
index 7d14a6930d..126e0fc623 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java
@@ -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();
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
index d514914403..a4f24a557c 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
@@ -38,6 +38,7 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
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.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
@@ -263,6 +264,18 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
}
/**
+ * Handler for the trace opened signal.
+ * @param signal The trace opened signal
+ * @since 2.0
+ */
+ @TmfSignalHandler
+ public void traceOpened(TmfTraceOpenedSignal signal) {
+ fTrace = signal.getTrace();
+ loadTrace();
+ }
+
+
+ /**
* Signal handler for the trace selected signal.
*
* Spawns a request to index the trace (checkpoints creation) as well as it fills
@@ -273,81 +286,57 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
*/
@TmfSignalHandler
public void traceSelected(TmfTraceSelectedSignal signal) {
+ // Update the trace reference
+ ITmfTrace trace = signal.getTrace();
+ if (!trace.equals(fTrace)) {
+ fTrace = trace;
+ }
+ loadTrace();
+ }
+ /**
+ * Method for loading the current selected trace into the view.
+ * Sub-class need to override this method to add the view specific implementation.
+ * @since 2.0
+ */
+ protected void loadTrace() {
ITmfEventRequest indexRequest = null;
fLock.lock();
- try {
- // Update the trace reference
- ITmfTrace trace = signal.getTrace();
- if (!trace.equals(fTrace)) {
- fTrace = trace;
- } else {
- return;
- }
-
- final Job job = new IndexingJob("Indexing " + getName() + "..."); //$NON-NLS-1$ //$NON-NLS-2$
- job.setUser(false);
- job.schedule();
-
- indexRequest = fIndexRequest;
-
- cancelOngoingRequests();
-
- TmfTimeRange window = TmfTimeRange.ETERNITY;
-
- fIndexRequest = new TmfEventRequest(ITmfEvent.class, window, TmfDataRequest.ALL_DATA, DEFAULT_BLOCK_SIZE, ITmfDataRequest.ExecutionType.BACKGROUND) {
- private ITmfTimestamp fFirstTime = null;
- private ITmfTimestamp fLastTime = null;
- private int fNbSeqEvents = 0;
- private final List<ITmfSyncSequenceDiagramEvent> fSdEvents = new ArrayList<ITmfSyncSequenceDiagramEvent>(MAX_NUM_OF_MSG);
-
- @Override
- public void handleData(ITmfEvent event) {
- super.handleData(event);
+ try {
+ final Job job = new IndexingJob("Indexing " + getName() + "..."); //$NON-NLS-1$ //$NON-NLS-2$
+ job.setUser(false);
+ job.schedule();
- ITmfSyncSequenceDiagramEvent sdEvent = getSequenceDiagramEvent(event);
+ indexRequest = fIndexRequest;
- if (sdEvent != null) {
- ++fNbSeqEvents;
+ cancelOngoingRequests();
- if (fFirstTime == null) {
- fFirstTime = event.getTimestamp();
- }
+ TmfTimeRange window = TmfTimeRange.ETERNITY;
- fLastTime = event.getTimestamp();
+ fIndexRequest = new TmfEventRequest(ITmfEvent.class, window, TmfDataRequest.ALL_DATA, DEFAULT_BLOCK_SIZE, ITmfDataRequest.ExecutionType.BACKGROUND) {
- if ((fNbSeqEvents % MAX_NUM_OF_MSG) == 0) {
- fLock.lock();
- try {
- fCheckPoints.add(new TmfTimeRange(fFirstTime, fLastTime));
- if (fView != null) {
- fView.updateCoolBar();
- }
- } finally {
- fLock.unlock();
- }
- fFirstTime = null;
+ private ITmfTimestamp fFirstTime = null;
+ private ITmfTimestamp fLastTime = null;
+ private int fNbSeqEvents = 0;
+ private final List<ITmfSyncSequenceDiagramEvent> fSdEvents = new ArrayList<ITmfSyncSequenceDiagramEvent>(MAX_NUM_OF_MSG);
- }
+ @Override
+ public void handleData(ITmfEvent event) {
+ super.handleData(event);
- if (fNbSeqEvents > MAX_NUM_OF_MSG) {
- // page is full
- return;
- }
+ ITmfSyncSequenceDiagramEvent sdEvent = getSequenceDiagramEvent(event);
- fSdEvents.add(sdEvent);
+ if (sdEvent != null) {
+ ++fNbSeqEvents;
- if (fNbSeqEvents == MAX_NUM_OF_MSG) {
- fillCurrentPage(fSdEvents);
- }
+ if (fFirstTime == null) {
+ fFirstTime = event.getTimestamp();
}
- }
- @Override
- public void handleSuccess() {
- if ((fFirstTime != null) && (fLastTime != null)) {
+ fLastTime = event.getTimestamp();
+ if ((fNbSeqEvents % MAX_NUM_OF_MSG) == 0) {
fLock.lock();
try {
fCheckPoints.add(new TmfTimeRange(fFirstTime, fLastTime));
@@ -357,34 +346,64 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
} finally {
fLock.unlock();
}
+ fFirstTime = null;
+
}
- if (fNbSeqEvents <= MAX_NUM_OF_MSG) {
- fillCurrentPage(fSdEvents);
+ if (fNbSeqEvents > MAX_NUM_OF_MSG) {
+ // page is full
+ return;
}
- super.handleSuccess();
+ fSdEvents.add(sdEvent);
+
+ if (fNbSeqEvents == MAX_NUM_OF_MSG) {
+ fillCurrentPage(fSdEvents);
+ }
}
+ }
+
+ @Override
+ public void handleSuccess() {
+ if ((fFirstTime != null) && (fLastTime != null)) {
- @Override
- public void handleCompleted() {
- if (fEvents.isEmpty()) {
- fFrame = new Frame();
- fView.setFrameSync(fFrame);
+ fLock.lock();
+ try {
+ fCheckPoints.add(new TmfTimeRange(fFirstTime, fLastTime));
+ if (fView != null) {
+ fView.updateCoolBar();
+ }
+ } finally {
+ fLock.unlock();
}
- super.handleCompleted();
- job.cancel();
}
- };
- } finally {
- fLock.unlock();
- }
- if (indexRequest != null && !indexRequest.isCompleted()) {
- indexRequest.cancel();
- }
- resetLoader();
- fTrace.sendRequest(fIndexRequest);
+ if (fNbSeqEvents <= MAX_NUM_OF_MSG) {
+ fillCurrentPage(fSdEvents);
+ }
+
+ super.handleSuccess();
+ }
+
+ @Override
+ public void handleCompleted() {
+ if (fEvents.isEmpty()) {
+ fFrame = new Frame();
+ fView.setFrameSync(fFrame);
+ }
+ super.handleCompleted();
+ job.cancel();
+ }
+ };
+
+ } finally {
+ fLock.unlock();
+ }
+ if (indexRequest != null && !indexRequest.isCompleted()) {
+ indexRequest.cancel();
+ }
+ resetLoader();
+ fTrace.sendRequest(fIndexRequest);
}
@@ -480,7 +499,6 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
fView.setSDFilterProvider(this);
resetLoader();
-
IEditorPart editor = fView.getSite().getPage().getActiveEditor();
if (editor instanceof ITmfTraceEditor) {
ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();

Back to the top