From bd9f92a89f5b1f607a5feab67c081e189778b9a1 Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Thu, 24 Oct 2013 14:59:39 -0400 Subject: [PATCH] lttng: Disallow adding contexts on events for v2.2 or later (419455) Change-Id: Ib68015ed1fb4b3bccfa18f010763a7c82ddf5806 Signed-off-by: Bernd Hufmann Reviewed-on: https://git.eclipse.org/r/17744 Tested-by: Hudson CI Reviewed-by: Bernd Hufmann IP-Clean: Bernd Hufmann Tested-by: Bernd Hufmann --- .../doc/User-Guide.mediawiki | 4 +- .../META-INF/MANIFEST.MF | 1 + org.eclipse.linuxtools.lttng2.ui/plugin.xml | 32 +++++++++++--- .../model/impl/TargetNodeComponent.java | 9 ++++ .../impl/TraceControlPropertyTester.java | 44 +++++++++++++++++++ .../model/impl/TraceEventComponent.java | 7 +++ 6 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceControlPropertyTester.java diff --git a/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki b/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki index 68d4ba90b5..0bf41ba790 100644 --- a/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki +++ b/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki @@ -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]] diff --git a/org.eclipse.linuxtools.lttng2.ui/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.lttng2.ui/META-INF/MANIFEST.MF index 42bc460e39..920af85e46 100644 --- a/org.eclipse.linuxtools.lttng2.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.lttng2.ui/META-INF/MANIFEST.MF @@ -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", diff --git a/org.eclipse.linuxtools.lttng2.ui/plugin.xml b/org.eclipse.linuxtools.lttng2.ui/plugin.xml index 3b03b07d04..9e9a48ecc2 100644 --- a/org.eclipse.linuxtools.lttng2.ui/plugin.xml +++ b/org.eclipse.linuxtools.lttng2.ui/plugin.xml @@ -727,20 +727,28 @@ - - - - + + + + + + + + + + - + + + + diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java index 964456b8c2..e6347bccca 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java @@ -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 true if it supports adding contexts on events else false + * + */ + 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 index 0000000000..5937f1920f --- /dev/null +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceControlPropertyTester.java @@ -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; + } +} diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java index e7ffbc702d..31ce99c81c 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java @@ -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 */ -- 2.34.1