From: Patrick Tasse Date: Fri, 15 Jul 2016 19:33:27 +0000 (-0400) Subject: tmf: Support dynamic marker event sources X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=1af9b70f92bf4a1e1b0c4840bca1f6e4b9bd87db;p=deliverable%2Ftracecompass.git tmf: Support dynamic marker event sources 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 Reviewed-on: https://git.eclipse.org/r/77415 Reviewed-by: Matthew Khouzam Reviewed-by: Hudson CI Tested-by: Bernd Hufmann --- diff --git a/doc/org.eclipse.tracecompass.doc.dev/doc/Developer-Guide.mediawiki b/doc/org.eclipse.tracecompass.doc.dev/doc/Developer-Guide.mediawiki index 649f74428e..df4597d7e6 100644 --- a/doc/org.eclipse.tracecompass.doc.dev/doc/Developer-Guide.mediawiki +++ b/doc/org.eclipse.tracecompass.doc.dev/doc/Developer-Guide.mediawiki @@ -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 index 0000000000..077606b62d --- /dev/null +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/signal/TmfMarkerEventSourceUpdatedSignal.java @@ -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); + } + +} diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java index ab26e7dac6..5b24998db1 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java @@ -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 { diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java index 6865e702d4..f2ae161dde 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java @@ -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 getMarkerCategories() { + protected @NonNull List getMarkerCategories() { Set categories = new LinkedHashSet<>(getViewMarkerCategories()); for (IMarkerEventSource markerEventSource : getMarkerEventSources(fTrace)) { categories.addAll(markerEventSource.getMarkerCategories());