gdbtrace: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.control.ui / src / org / eclipse / linuxtools / internal / lttng2 / control / ui / views / model / impl / TraceProviderGroup.java
CommitLineData
eb1bab5b 1/**********************************************************************
ba3a9bd2 2 * Copyright (c) 2012, 2013 Ericsson
cfdb727a 3 *
eb1bab5b
BH
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
cfdb727a
AM
8 *
9 * Contributors:
eb1bab5b 10 * Bernd Hufmann - Initial API and implementation
ba3a9bd2 11 * Bernd Hufmann - Updated for support of LTTng Tools 2.1
eb1bab5b 12 **********************************************************************/
8e8c0226 13package org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl;
eb1bab5b
BH
14
15import java.util.Iterator;
16import java.util.List;
17
18import org.eclipse.core.commands.ExecutionException;
19import org.eclipse.core.runtime.IProgressMonitor;
8e8c0226
AM
20import org.eclipse.linuxtools.internal.lttng2.control.core.model.IBaseEventInfo;
21import org.eclipse.linuxtools.internal.lttng2.control.core.model.IUstProviderInfo;
22import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages;
23import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
eb1bab5b
BH
24
25/**
eb1bab5b
BH
26 * <p>
27 * Implementation of the trace provider group.
28 * </p>
cfdb727a 29 *
dbd4432d 30 * @author Bernd Hufmann
eb1bab5b
BH
31 */
32public class TraceProviderGroup extends TraceControlComponent {
33 // ------------------------------------------------------------------------
34 // Constants
35 // ------------------------------------------------------------------------
36 /**
37 * Path to icon file for this component.
38 */
39 public static final String TRACE_PROVIDERS_ICON_FILE = "icons/obj16/providers.gif"; //$NON-NLS-1$
cfdb727a 40
eb1bab5b
BH
41 // ------------------------------------------------------------------------
42 // Attributes
43 // ------------------------------------------------------------------------
cfdb727a 44
eb1bab5b
BH
45 // ------------------------------------------------------------------------
46 // Constructors
47 // ------------------------------------------------------------------------
48 /**
cfdb727a 49 * Constructor
eb1bab5b
BH
50 * @param name - the name of the component.
51 * @param parent - the parent of this component.
cfdb727a 52 */
eb1bab5b
BH
53 public TraceProviderGroup(String name, ITraceControlComponent parent) {
54 super(name, parent);
55 setImage(TRACE_PROVIDERS_ICON_FILE);
56 }
cfdb727a 57
eb1bab5b
BH
58 // ------------------------------------------------------------------------
59 // Accessors
60 // ------------------------------------------------------------------------
61
62 // ------------------------------------------------------------------------
63 // Operations
64 // ------------------------------------------------------------------------
cfdb727a 65
eb1bab5b
BH
66 /**
67 * Gets the provider information from the target node.
68 * @param monitor - a progress monitor
cfdb727a 69 * @throws ExecutionException If the command fails
eb1bab5b
BH
70 */
71 public void getProviderFromNode(IProgressMonitor monitor) throws ExecutionException {
cfdb727a 72
eb1bab5b 73 List<IBaseEventInfo> eventInfos = getControlService().getKernelProvider(monitor);
a07c7629
BH
74
75 if (!eventInfos.isEmpty()) {
76 KernelProviderComponent component = new KernelProviderComponent(Messages.TraceControl_KernelProviderDisplayName, this);
77 addChild(component);
78 component.setEventInfo(eventInfos);
79 }
cfdb727a 80
eb1bab5b 81 List<IUstProviderInfo> allProviders = getControlService().getUstProvider(monitor);
cfdb727a 82
eb1bab5b 83 for (Iterator<IUstProviderInfo> iterator = allProviders.iterator(); iterator.hasNext();) {
cfdb727a 84 IUstProviderInfo ustProviderInfo = iterator.next();
eb1bab5b
BH
85 UstProviderComponent ustComponent = new UstProviderComponent(ustProviderInfo.getName(), this);
86 addChild(ustComponent);
87 ustComponent.setUstProvider(ustProviderInfo);
88 }
89 }
a07c7629
BH
90
91 /**
92 * Returns whether the kernel provider is available or not
93 * @return <code>true</code> if kernel provide is available or <code>false</code>
94 */
95 public boolean hasKernelProvider() {
96 List<ITraceControlComponent> kernelList = getChildren(KernelProviderComponent.class);
97 return !kernelList.isEmpty();
98 }
d4514365
BH
99
100 /**
101 * Returns if node supports filtering of events
102 * @return <code>true</code> if node supports filtering else <code>false</code>
103 */
104 public boolean isEventFilteringSupported() {
105 return ((TargetNodeComponent)getParent()).isEventFilteringSupported();
106 }
eb1bab5b
BH
107}
108
This page took 0.052571 seconds and 5 git commands to generate.