Introduce the notion of pin state to TmfViewer
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 27 Oct 2016 16:47:43 +0000 (12:47 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 11 Nov 2016 15:36:07 +0000 (10:36 -0500)
By default a pinned viewer register a global inbound and outbound
blacklisting of signals.

Change-Id: I33e42b5debd1ea8eac2a034eec73b4ceb2e81879
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/TmfViewer.java

index 4a28ffd0e6217fe91451138300cef20bf4db59fb..81e1445e3c99e53b590e4c49ca3c3a7e31bfa5ad 100644 (file)
@@ -14,6 +14,8 @@ package org.eclipse.tracecompass.tmf.ui.viewers;
 
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.tracecompass.tmf.core.component.TmfComponent;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
 
 /**
  * Abstract class that extends {@link TmfComponent} to be specific to viewers.
@@ -83,4 +85,25 @@ public abstract class TmfViewer extends TmfComponent implements ITmfViewer {
     public Composite getParent() {
         return fParent;
     }
+
+    /**
+     * Perform the necessary action based on the passed state to apply. Viewers
+     * can override this function for more control over what is performed on a
+     * change of the pin state
+     *
+     * When in a pinned state a viewer filter all inbound and outbound signals.
+     *
+     * @param pinned
+     *            The pin state
+     * @since 2.2
+     */
+    public synchronized void setPinned(boolean pinned) {
+        if (pinned) {
+            TmfSignalManager.addIgnoredInboundSignal(this, TmfSignal.class);
+            TmfSignalManager.addIgnoredOutboundSignal(this, TmfSignal.class);
+        } else {
+            TmfSignalManager.clearIgnoredInboundSignalList(this);
+            TmfSignalManager.clearIgnoredOutboundSignalList(this);
+        }
+    }
 }
This page took 0.02622 seconds and 5 git commands to generate.