lttng: Rename lttng2 feature/plugins to lttng2.control
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.control.ui / src / org / eclipse / linuxtools / internal / lttng2 / control / ui / views / model / impl / TraceProviderGroup.java
1 /**********************************************************************
2 * Copyright (c) 2012, 2013 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 * Bernd Hufmann - Updated for support of LTTng Tools 2.1
12 **********************************************************************/
13 package org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl;
14
15 import java.util.Iterator;
16 import java.util.List;
17
18 import org.eclipse.core.commands.ExecutionException;
19 import org.eclipse.core.runtime.IProgressMonitor;
20 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IBaseEventInfo;
21 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IUstProviderInfo;
22 import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages;
23 import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
24
25 /**
26 * <p>
27 * Implementation of the trace provider group.
28 * </p>
29 *
30 * @author Bernd Hufmann
31 */
32 public 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$
40
41 // ------------------------------------------------------------------------
42 // Attributes
43 // ------------------------------------------------------------------------
44
45 // ------------------------------------------------------------------------
46 // Constructors
47 // ------------------------------------------------------------------------
48 /**
49 * Constructor
50 * @param name - the name of the component.
51 * @param parent - the parent of this component.
52 */
53 public TraceProviderGroup(String name, ITraceControlComponent parent) {
54 super(name, parent);
55 setImage(TRACE_PROVIDERS_ICON_FILE);
56 }
57
58 // ------------------------------------------------------------------------
59 // Accessors
60 // ------------------------------------------------------------------------
61
62 // ------------------------------------------------------------------------
63 // Operations
64 // ------------------------------------------------------------------------
65
66 /**
67 * Gets the provider information from the target node.
68 * @param monitor - a progress monitor
69 * @throws ExecutionException If the command fails
70 */
71 public void getProviderFromNode(IProgressMonitor monitor) throws ExecutionException {
72
73 List<IBaseEventInfo> eventInfos = getControlService().getKernelProvider(monitor);
74
75 if (!eventInfos.isEmpty()) {
76 KernelProviderComponent component = new KernelProviderComponent(Messages.TraceControl_KernelProviderDisplayName, this);
77 addChild(component);
78 component.setEventInfo(eventInfos);
79 }
80
81 List<IUstProviderInfo> allProviders = getControlService().getUstProvider(monitor);
82
83 for (Iterator<IUstProviderInfo> iterator = allProviders.iterator(); iterator.hasNext();) {
84 IUstProviderInfo ustProviderInfo = iterator.next();
85 UstProviderComponent ustComponent = new UstProviderComponent(ustProviderInfo.getName(), this);
86 addChild(ustComponent);
87 ustComponent.setUstProvider(ustProviderInfo);
88 }
89 }
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 }
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 }
107 }
108
This page took 0.04472 seconds and 5 git commands to generate.