Implement setPinned for Control Flow View
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 27 Oct 2016 21:43:48 +0000 (17:43 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 11 Nov 2016 15:44:16 +0000 (10:44 -0500)
When pinned the control flow view does not scroll/seek on position change, trace
change, and its filters do not change.

Also:
- Ignores all outbound and inbound signalling.
- Disables all modifiers of the visible time range windows.
- Disables time based scrolling/seeking (horizontal scrolling).
- Hides the thread presentation menu.
- Changes the tab label to enhance visibility of the pinned state.
- Allows vertical scrolling and expand/collapse operation.

Change-Id: I6bf2329f0f932feba20f06c971a1adb4de940b6c
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/Messages.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/messages.properties
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/ControlFlowView.java
lttng/org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/kernel/ui/swtbot/tests/ControlFlowViewTest.java

index 018848ca101760c7ed1d3b2ac583d55d76149723..3a3072116e118adb6511e3c0726dc00b1f03032f 100644 (file)
@@ -41,6 +41,8 @@ public class Messages extends NLS {
     public static String ControlFlowView_uncheckInactiveToolTip;
     public static String ControlFlowView_attributeSyscallName;
     public static String ControlFlowView_attributeCpuName;
+
+    public static String ControlFlowView_ExperimentLabel;
     public static String ControlFlowView_flatViewLabel;
     public static String ControlFlowView_flatViewToolTip;
     public static String ControlFlowView_hierarchicalViewLabel;
@@ -48,6 +50,10 @@ public class Messages extends NLS {
     public static String ControlFlowView_optimizeLabel;
     public static String ControlFlowView_optimizeToolTip;
 
+    public static String ControlFlowView_PinnedLabel;
+
+    public static String ControlFlowView_TraceLabel;
+
     public static String ResourcesView_stateTypeName;
     public static String ResourcesView_multipleStates;
     public static String ResourcesView_nextResourceActionNameText;
index 17ebd881da8580f8a1ed0efd91bb0f6d456253d7..ba3f92dba7f440a1090383312aa3fe15c8553b95 100644 (file)
@@ -32,12 +32,15 @@ ControlFlowView_uncheckInactiveLabel=Uncheck Inactive
 ControlFlowView_uncheckInactiveToolTip=Unchecks all threads not executing within the time frame.
 ControlFlowView_attributeSyscallName=System Call
 ControlFlowView_attributeCpuName=CPU
+ControlFlowView_ExperimentLabel=Experiment
 ControlFlowView_flatViewLabel=Flat
 ControlFlowView_flatViewToolTip= Flat Thread Layout
 ControlFlowView_hierarchicalViewLabel=Hierarchical
 ControlFlowView_hierarchicalViewToolTip=Hierarchical Thread Layout
 ControlFlowView_optimizeLabel=Optimize
 ControlFlowView_optimizeToolTip=Optimize
+ControlFlowView_PinnedLabel=Pinned
+ControlFlowView_TraceLabel=Trace
 
 ResourcesView_stateTypeName=Resource
 ResourcesView_multipleStates=(multiple)
index 8cb642b308f928e26698f36f8fd1001fc7e7770b..f201d38f8970dcd29c3158c25c8bfe513f7b76f0 100644 (file)
@@ -63,6 +63,7 @@ import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
@@ -72,6 +73,7 @@ import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
 import org.eclipse.tracecompass.tmf.core.util.Pair;
 import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractStateSystemTimeGraphView;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ILinkEvent;
@@ -111,6 +113,7 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
     private static final String BIRTH_TIME_COLUMN = Messages.ControlFlowView_birthTimeColumn;
     private static final String INVISIBLE_COLUMN = Messages.ControlFlowView_invisibleColumn;
     private Action fOptimizationAction;
+    private String fOriginalTabLabel;
 
     private static final String NEXT_EVENT_ICON_PATH = "icons/elcl16/shift_r_edit.gif"; //$NON-NLS-1$
     private static final String PREV_EVENT_ICON_PATH = "icons/elcl16/shift_l_edit.gif"; //$NON-NLS-1$
@@ -165,11 +168,13 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
 
     private MenuManager fThreadPresentationMenu;
     private IAction fFlatAction;
-
     private IAction fHierarchicalAction;
     private IAction fPreviousEventAction;
     private IAction fNextEventAction;
 
+    /** Pin related toggle switch */
+    private boolean fShowFollowThreadAction = true;
+
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
@@ -195,6 +200,7 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
         // add "Uncheck inactive" Button to TimeGraphFilterDialog
         super.getTimeGraphCombo().addTimeGraphFilterUncheckInactiveButton(
                 new ControlFlowCheckActiveProvider(Messages.ControlFlowView_uncheckInactiveLabel, Messages.ControlFlowView_uncheckInactiveToolTip));
+        fOriginalTabLabel = getPartName();
     }
 
     /**
@@ -207,7 +213,9 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
             StructuredSelection sSel = (StructuredSelection) selection;
             if (sSel.getFirstElement() instanceof ControlFlowEntry) {
                 ControlFlowEntry entry = (ControlFlowEntry) sSel.getFirstElement();
-                menuManager.add(new FollowThreadAction(ControlFlowView.this, entry.getName(), entry.getThreadId(), entry.getTrace()));
+                if (fShowFollowThreadAction) {
+                    menuManager.add(new FollowThreadAction(ControlFlowView.this, entry.getName(), entry.getThreadId(), entry.getTrace()));
+                }
             }
         }
     }
@@ -1059,8 +1067,51 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
 
     @Override
     protected boolean canBePinned() {
-        //TODO: actionPin is not defined
-        return false;
+        return true;
     }
 
+    @Override
+    protected synchronized void setPinned(boolean pinned) {
+
+        /* Is pinned */
+        if (pinned) {
+            /* Ignore all outbound and inbound signal */
+            TmfSignalManager.addIgnoredOutboundSignal(this, TmfSignal.class);
+            TmfSignalManager.addIgnoredInboundSignal(this, TmfSignal.class);
+
+            String objectType = Messages.ControlFlowView_TraceLabel;
+            if (getTrace() instanceof TmfExperiment) {
+                objectType = Messages.ControlFlowView_ExperimentLabel;
+            }
+            setPartName(String.format("%s [%s][%s:%s]", fOriginalTabLabel, Messages.ControlFlowView_PinnedLabel, objectType, getTrace().getName())); //$NON-NLS-1$
+        } else {
+            TmfSignalManager.clearIgnoredInboundSignalList(this);
+            TmfSignalManager.clearIgnoredOutboundSignalList(this);
+
+            setPartName(fOriginalTabLabel);
+
+            loadTrace(TmfTraceManager.getInstance().getActiveTrace());
+        }
+
+        boolean enabled = !pinned;
+
+        fFlatAction.setEnabled(enabled);
+        fHierarchicalAction.setEnabled(enabled);
+        fOptimizationAction.setEnabled(enabled);
+        fPreviousEventAction.setEnabled(enabled);
+        fNextEventAction.setEnabled(enabled);
+        fThreadPresentationMenu.setVisible(enabled);
+        fThreadPresentationMenu.markDirty();
+
+        fShowFollowThreadAction = enabled;
+
+        /* Propagate pin state to viewer */
+        if (getTimeGraphCombo() != null) {
+            getTimeGraphCombo().setPinned(pinned);
+        } else {
+            getTimeGraphViewer().setPinned(pinned);
+        }
+
+        redraw();
+    }
 }
index f17395aba0932ab92f1b343a9abfece7590f6f6c..5c1761441a6edbb4b2c953db7a1a5058dd55fd34 100644 (file)
@@ -99,7 +99,8 @@ public class ControlFlowViewTest extends KernelTimeGraphViewTestBase {
 
     @Override
     protected List<String> getToolbarTooltips() {
-        return Arrays.asList("Align Views", "Optimize", SEPARATOR,
+        return Arrays.asList("Pin View", SEPARATOR,
+                "Align Views", "Optimize", SEPARATOR,
                 "Show View Filters", "Show Legend", SEPARATOR,
                 "Reset the Time Scale to Default", "Select Previous State Change", "Select Next State Change", SEPARATOR,
                 "Add Bookmark...", "Previous Marker", "Next Marker", SEPARATOR,
This page took 0.028275 seconds and 5 git commands to generate.