lttng: Disallow adding contexts on events for v2.2 or later (419455)
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Thu, 24 Oct 2013 18:59:39 +0000 (14:59 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Tue, 12 Nov 2013 14:18:37 +0000 (09:18 -0500)
Change-Id: Ib68015ed1fb4b3bccfa18f010763a7c82ddf5806
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/17744
Tested-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
IP-Clean: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki
org.eclipse.linuxtools.lttng2.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.ui/plugin.xml
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceControlPropertyTester.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java

index 68d4ba90b5f56608d1f05d6354aa4305241a74b1..0bf41ba7908862de6f4a554fcb5274118c83f9f9 100644 (file)
@@ -1193,9 +1193,9 @@ Adding contexts on channels and events from the channel level, will enable the s
 
 A new display will open for selecting one or more contexts to add. Select one or more contexts as described in chapter [[#Adding Contexts to Channels and Events of a Domain | Adding Contexts to Channels and Events of a Domain]]. Upon successful operation, the selected context will be added to all channels and their events of the selected domain. '''Note''' that the LTTng 2.0 tracer control on the remote host doesn't provide a way to retrieve added contexts. Hence it's not possible to display the context information in the GUI.
 
-==== Adding Contexts to a Event of a Specific Channel ====
+==== Adding Contexts to an Event of a Specific Channel ====
 
-Adding contexts to a event of a channel, select an event of a channel, click right mouse button on the corresponding event tree node and select the menu item '''Add Context...''' from the context-sensitive menu.
+Adding contexts to an event of a channel is only available in LTTng Tools versions v2.0.0-2.1.x. The menu option won't be visible for LTTng Tools version v2.2.0 or later. To add contexts on an event select an event of a channel, click right mouse button on the corresponding event tree node and select the menu item '''Add Context...''' from the context-sensitive menu.
 
 [[Image:images/LTTng2AddContextToEventsAction.png]]
 
index 42bc460e392b18c57f13a2d59947c6dba4164eb0..920af85e46f45647e034a67c4eb7d8209d2dbba5 100644 (file)
@@ -10,6 +10,7 @@ Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.eclipse.ui,
  org.eclipse.ui.ide,
+ org.eclipse.core.expressions,
  org.eclipse.core.resources,
  org.eclipse.core.runtime,
  org.eclipse.linuxtools.lttng2.core;bundle-version="2.1.0",
index 3b03b07d04ad91fd39b659c5d489e78a4ba7e613..9e9a48ecc2317e9e0c6987ce1f8d5123ca8d6647 100644 (file)
                <with
                      variable="activeMenuSelection">
                   <and>
-                     <iterate
-                           operator="or">
-                        <instanceof
-                              value="org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent">
-                        </instanceof>
-                     </iterate>
                      <count
                            value="1">
                      </count>
+                     <iterate
+                           ifEmpty="false"
+                           operator="and">
+                        <and>
+                           <or>
+                              <instanceof
+                                    value="org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent">
+                              </instanceof>
+                           </or>
+                           <test
+                                 forcePluginActivation="true"
+                                 property="org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.isAddContextOnEventSupported">
+                           </test>
+                        </and>
+                     </iterate>
                   </and>
                </with>
             </visibleWhen>
          </command>
-
          <command
                commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.calibrate"
                icon="icons/elcl16/calibrate.gif"
             class="org.eclipse.linuxtools.internal.lttng2.ui.views.control.preferences.ControlPreferenceInitializer">
       </initializer>
    </extension>
+   <extension
+         point="org.eclipse.core.expressions.propertyTesters">
+      <propertyTester
+            class="org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlPropertyTester"
+            id="org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.propertyTester"
+            namespace="org.eclipse.linuxtools.internal.lttng2.ui.views.control.model"
+            properties="isAddContextOnEventSupported"
+            type="org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent">
+      </propertyTester>
+   </extension>
    
    
 </plugin>
index 964456b8c2a6cc2519b020e7e45f94a8281eb551..e6347bcccadbbe3cffbb3586aad51b6704bf9e5e 100644 (file)
@@ -265,6 +265,15 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
         return getControlService().isVersionSupported("2.3.0"); //$NON-NLS-1$
     }
 
+    /**
+     * Returns if node supports adding contexts on event
+     * @return <code>true</code> if it supports adding contexts on events else <code>false</code>
+     *
+     */
+    public boolean isContextOnEventSupported() {
+        return !getControlService().isVersionSupported("2.2.0"); //$NON-NLS-1$
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceControlPropertyTester.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceControlPropertyTester.java
new file mode 100644 (file)
index 0000000..5937f19
--- /dev/null
@@ -0,0 +1,44 @@
+/**********************************************************************
+ * Copyright (c) 2013 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:
+ *   Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl;
+
+import org.eclipse.core.expressions.PropertyTester;
+
+/**
+ *
+ * Property Tester Implementation for Trace Control Components.
+ *
+ * @author Bernd Hufmann
+ */
+public class TraceControlPropertyTester extends PropertyTester {
+
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+    private static final String ADD_CONTEXT_SUPPORT_PROPERTY = "isAddContextOnEventSupported"; //$NON-NLS-1$
+
+
+    @Override
+    public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+
+        // Check if node supports adding contexts on event level.
+        if (ADD_CONTEXT_SUPPORT_PROPERTY.equals(property)) {
+            if ((receiver != null) && (receiver instanceof TraceEventComponent)) {
+                TraceEventComponent event = (TraceEventComponent) receiver;
+                TargetNodeComponent node = event.getTargetNode();
+                return node.isContextOnEventSupported();
+            }
+        }
+        return false;
+    }
+}
index e7ffbc702d86ea3588b86e1cfe1690d9d1c457d4..31ce99c81c3694540104a9d787e0ab64aa06bc96 100644 (file)
@@ -190,6 +190,13 @@ public class TraceEventComponent extends TraceControlComponent {
         return null;
     }
 
+    /**
+     * @return target node component.
+     */
+    public TargetNodeComponent getTargetNode() {
+        return ((TraceChannelComponent)getParent()).getTargetNode();
+    }
+
     /**
      * @return session name from parent
      */
This page took 0.033381 seconds and 5 git commands to generate.