Update file headers in LTTng Control feature
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / 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 **********************************************************************/
115b4a01 13package org.eclipse.linuxtools.internal.lttng2.ui.views.control.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;
20import org.eclipse.core.runtime.NullProgressMonitor;
9315aeee
BH
21import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo;
22import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo;
23import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
115b4a01 24import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
eb1bab5b
BH
25
26/**
eb1bab5b
BH
27 * <p>
28 * Implementation of the trace provider group.
29 * </p>
cfdb727a 30 *
dbd4432d 31 * @author Bernd Hufmann
eb1bab5b
BH
32 */
33public class TraceProviderGroup extends TraceControlComponent {
34 // ------------------------------------------------------------------------
35 // Constants
36 // ------------------------------------------------------------------------
37 /**
38 * Path to icon file for this component.
39 */
40 public static final String TRACE_PROVIDERS_ICON_FILE = "icons/obj16/providers.gif"; //$NON-NLS-1$
cfdb727a 41
eb1bab5b
BH
42 // ------------------------------------------------------------------------
43 // Attributes
44 // ------------------------------------------------------------------------
cfdb727a 45
eb1bab5b
BH
46 // ------------------------------------------------------------------------
47 // Constructors
48 // ------------------------------------------------------------------------
49 /**
cfdb727a 50 * Constructor
eb1bab5b
BH
51 * @param name - the name of the component.
52 * @param parent - the parent of this component.
cfdb727a 53 */
eb1bab5b
BH
54 public TraceProviderGroup(String name, ITraceControlComponent parent) {
55 super(name, parent);
56 setImage(TRACE_PROVIDERS_ICON_FILE);
57 }
cfdb727a 58
eb1bab5b
BH
59 // ------------------------------------------------------------------------
60 // Accessors
61 // ------------------------------------------------------------------------
62
63 // ------------------------------------------------------------------------
64 // Operations
65 // ------------------------------------------------------------------------
cfdb727a 66
eb1bab5b
BH
67 /**
68 * Gets the provider information from the target node.
cfdb727a 69 * @throws ExecutionException If the command fails
eb1bab5b
BH
70 */
71 public void getProviderFromNode() throws ExecutionException {
72 getProviderFromNode(new NullProgressMonitor());
73 }
74
75 /**
76 * Gets the provider information from the target node.
77 * @param monitor - a progress monitor
cfdb727a 78 * @throws ExecutionException If the command fails
eb1bab5b
BH
79 */
80 public void getProviderFromNode(IProgressMonitor monitor) throws ExecutionException {
cfdb727a 81
eb1bab5b 82 List<IBaseEventInfo> eventInfos = getControlService().getKernelProvider(monitor);
a07c7629
BH
83
84 if (!eventInfos.isEmpty()) {
85 KernelProviderComponent component = new KernelProviderComponent(Messages.TraceControl_KernelProviderDisplayName, this);
86 addChild(component);
87 component.setEventInfo(eventInfos);
88 }
cfdb727a 89
eb1bab5b 90 List<IUstProviderInfo> allProviders = getControlService().getUstProvider(monitor);
cfdb727a 91
eb1bab5b 92 for (Iterator<IUstProviderInfo> iterator = allProviders.iterator(); iterator.hasNext();) {
cfdb727a 93 IUstProviderInfo ustProviderInfo = iterator.next();
eb1bab5b
BH
94 UstProviderComponent ustComponent = new UstProviderComponent(ustProviderInfo.getName(), this);
95 addChild(ustComponent);
96 ustComponent.setUstProvider(ustProviderInfo);
97 }
98 }
a07c7629
BH
99
100 /**
101 * Returns whether the kernel provider is available or not
102 * @return <code>true</code> if kernel provide is available or <code>false</code>
103 */
104 public boolean hasKernelProvider() {
105 List<ITraceControlComponent> kernelList = getChildren(KernelProviderComponent.class);
106 return !kernelList.isEmpty();
107 }
d4514365
BH
108
109 /**
110 * Returns if node supports filtering of events
111 * @return <code>true</code> if node supports filtering else <code>false</code>
112 */
113 public boolean isEventFilteringSupported() {
114 return ((TargetNodeComponent)getParent()).isEventFilteringSupported();
115 }
eb1bab5b
BH
116}
117
This page took 0.045298 seconds and 5 git commands to generate.