Disable marker category toggle and marker selection when pinned
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 27 Oct 2016 19:41:39 +0000 (15:41 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 11 Nov 2016 15:36:07 +0000 (10:36 -0500)
Change-Id: Ic24457d76512abfcddd943dd88ae1329a112d636
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphMarkerAxis.java

index 53f151b5ba60c1f7c8086734267cf9255e4cd743..a82e7c453d31e2bc3e8a597dfc09c529a992a3c3 100644 (file)
@@ -68,6 +68,10 @@ public class TimeGraphMarkerAxis extends TimeGraphBaseControl {
     private @NonNull List<String> fCategories = Collections.EMPTY_LIST;
     private boolean fCollapsed = false;
 
+    /** Feature toggle swith */
+    private boolean fMarkerSelectionEnabled = true;
+    private boolean fMarkerCategoryVisibilityToggleEnabled = true;
+
     /**
      * Contructor
      *
@@ -169,17 +173,23 @@ public class TimeGraphMarkerAxis extends TimeGraphBaseControl {
             return;
         }
         if (e.x < bounds.x + nameSpace) {
-            String category = getHiddenCategoryForEvent(e, bounds);
-            if (category != null) {
-                for (IMarkerAxisListener listener : fListeners) {
-                    listener.setMarkerCategoryVisible(category, false);
+            if (fMarkerCategoryVisibilityToggleEnabled) {
+                String category = getHiddenCategoryForEvent(e, bounds);
+                if (category != null) {
+                    for (IMarkerAxisListener listener : fListeners) {
+                        listener.setMarkerCategoryVisible(category, false);
+                    }
                 }
             }
             return;
         }
-        IMarkerEvent marker = getMarkerForEvent(e);
-        if (marker != null) {
-            fTimeProvider.setSelectionRangeNotify(marker.getTime(), marker.getTime() + marker.getDuration(), false);
+
+        if (fMarkerSelectionEnabled) {
+            /* Allow marker selection when not pinned */
+            IMarkerEvent marker = getMarkerForEvent(e);
+            if (marker != null) {
+                fTimeProvider.setSelectionRangeNotify(marker.getTime(), marker.getTime() + marker.getDuration(), false);
+            }
         }
     }
 
@@ -445,4 +455,12 @@ public class TimeGraphMarkerAxis extends TimeGraphBaseControl {
         categories.retainAll(fMarkers.keySet());
         return categories;
     }
+
+    @Override
+    public synchronized void setPinned(boolean pinned) {
+        boolean enabled = !pinned;
+
+        fMarkerCategoryVisibilityToggleEnabled = enabled;
+        fMarkerSelectionEnabled = enabled;
+    }
 }
This page took 0.025667 seconds and 5 git commands to generate.