tmf: Support dynamic marker event sources
authorPatrick Tasse <patrick.tasse@gmail.com>
Fri, 15 Jul 2016 19:33:27 +0000 (15:33 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Fri, 29 Jul 2016 18:12:25 +0000 (14:12 -0400)
The signal TmfMarkerEventSourceUpdatedSignal is added to notify
components that a marker event source has changed and that markers and
marker categories need to be refreshed.

The zoom threads in abstract time graph views are changed to update the
marker categories along with the marker lists, to ensure they match.

Change-Id: I2c6fb2443a474d01d9d37ae5b6b8fc13a1ee7457
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/77415
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Hudson CI
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
doc/org.eclipse.tracecompass.doc.dev/doc/Developer-Guide.mediawiki
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/signal/TmfMarkerEventSourceUpdatedSignal.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java

index 649f74428e98e56b5928cc7505ec28bcfcc856ad..df4597d7e63e30c5bdf79b297d6acff4348d9d90 100644 (file)
@@ -1048,6 +1048,20 @@ Sent by the experiment after trace synchronization.
 
 Received by any component that needs to be notified of trace synchronization.
 
+=== TmfMarkerEventSourceUpdatedSignal ===
+
+''Purpose''
+
+This signal is used to indicate that a marker event source has been updated.
+
+''Senders''
+
+Sent by a component that has triggered a change in a marker event source.
+
+''Receivers''
+
+Received by any component that needs to refresh the markers due to the change in marker event source.
+
 == Debugging ==
 
 TMF has built-in Eclipse tracing support for the debugging of signal interaction between components. To enable it, open the '''Run/Debug Configuration...''' dialog, select a configuration, click the '''Tracing''' tab, select the plug-in '''org.eclipse.tracecompass.tmf.core''', and check the '''signal''' item.
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/signal/TmfMarkerEventSourceUpdatedSignal.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/signal/TmfMarkerEventSourceUpdatedSignal.java
new file mode 100644 (file)
index 0000000..077606b
--- /dev/null
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Patrick Tasse - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.signal;
+
+/**
+ * A marker event source has been updated
+ *
+ * @since 2.1
+ */
+public class TmfMarkerEventSourceUpdatedSignal extends TmfSignal {
+
+    /**
+     * @param source the signal source
+     */
+    public TmfMarkerEventSourceUpdatedSignal(Object source) {
+        super(source);
+    }
+
+}
index ab26e7dac6bec3818cbe55f8a8f1d1bd1bdde48f..5b24998db1e9445e2f10a33dc38b04f4ce65d60c 100644 (file)
@@ -119,6 +119,7 @@ public abstract class AbstractStateSystemTimeGraphView extends AbstractTimeGraph
                 markers.addAll(getTraceMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor()));
                 applyResults(() -> {
                     getTimeGraphViewer().setLinks(links);
+                    getTimeGraphViewer().setMarkerCategories(getMarkerCategories());
                     getTimeGraphViewer().setMarkers(markers);
                 });
             } else {
index 6865e702d4f6a8c6e21a9393cf46e03b874ae2a9..f2ae161dde608e8fe004e99a4107c8bdbd5a0a3a 100644 (file)
@@ -82,6 +82,7 @@ import org.eclipse.swt.widgets.TreeColumn;
 import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
 import org.eclipse.tracecompass.internal.tmf.ui.Activator;
 import org.eclipse.tracecompass.tmf.core.resources.ITmfMarker;
+import org.eclipse.tracecompass.tmf.core.signal.TmfMarkerEventSourceUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTimestampFormatUpdateSignal;
@@ -849,6 +850,7 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
                 if (events != null) {
                     fTimeGraphWrapper.getTimeGraphViewer().setLinks(events);
                 }
+                fTimeGraphWrapper.getTimeGraphViewer().setMarkerCategories(getMarkerCategories());
                 fTimeGraphWrapper.getTimeGraphViewer().setMarkers(markers);
                 redraw();
             });
@@ -1569,6 +1571,20 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
         fTimeGraphWrapper.refresh();
     }
 
+    /**
+     * A marker event source has been updated
+     *
+     * @param signal
+     *            the signal
+     * @since 2.1
+     */
+    @TmfSignalHandler
+    public void markerEventSourceUpdated(final TmfMarkerEventSourceUpdatedSignal signal) {
+        getTimeGraphViewer().setMarkerCategories(getMarkerCategories());
+        getTimeGraphViewer().setMarkers(null);
+        refresh();
+    }
+
     // ------------------------------------------------------------------------
     // Internal
     // ------------------------------------------------------------------------
@@ -1778,9 +1794,9 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
      * Get the list of current marker categories.
      *
      * @return The list of marker categories
-     * @since 2.0
+     * @since 2.1
      */
-    private @NonNull List<String> getMarkerCategories() {
+    protected @NonNull List<String> getMarkerCategories() {
         Set<String> categories = new LinkedHashSet<>(getViewMarkerCategories());
         for (IMarkerEventSource markerEventSource : getMarkerEventSources(fTrace)) {
             categories.addAll(markerEventSource.getMarkerCategories());
This page took 0.029968 seconds and 5 git commands to generate.