eb600da676babe274b87709109a0f9a47322f640
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / model / impl / TraceProviderGroup.java
1 /**********************************************************************
2 * Copyright (c) 2012, 2014 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.tracecompass.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.tracecompass.internal.lttng2.control.core.model.TraceDomainType;
21 import org.eclipse.tracecompass.internal.lttng2.control.core.model.IBaseEventInfo;
22 import org.eclipse.tracecompass.internal.lttng2.control.core.model.IUstProviderInfo;
23 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.messages.Messages;
24 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceControlComponent;
25
26 /**
27 * <p>
28 * Implementation of the trace provider group.
29 * </p>
30 *
31 * @author Bernd Hufmann
32 */
33 public 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$
41
42 // ------------------------------------------------------------------------
43 // Attributes
44 // ------------------------------------------------------------------------
45
46 // ------------------------------------------------------------------------
47 // Constructors
48 // ------------------------------------------------------------------------
49 /**
50 * Constructor
51 * @param name - the name of the component.
52 * @param parent - the parent of this component.
53 */
54 public TraceProviderGroup(String name, ITraceControlComponent parent) {
55 super(name, parent);
56 setImage(TRACE_PROVIDERS_ICON_FILE);
57 }
58
59 // ------------------------------------------------------------------------
60 // Accessors
61 // ------------------------------------------------------------------------
62
63 // ------------------------------------------------------------------------
64 // Operations
65 // ------------------------------------------------------------------------
66
67 /**
68 * Gets the provider information from the target node.
69 * @param monitor - a progress monitor
70 * @throws ExecutionException If the command fails
71 */
72 public void getProviderFromNode(IProgressMonitor monitor) throws ExecutionException {
73
74 List<IBaseEventInfo> eventInfos = getControlService().getKernelProvider(monitor);
75
76 if (!eventInfos.isEmpty()) {
77 KernelProviderComponent component = new KernelProviderComponent(Messages.TraceControl_KernelProviderDisplayName, this);
78 addChild(component);
79 component.setEventInfo(eventInfos);
80 }
81
82 List<IUstProviderInfo> allProviders = getControlService().getUstProvider(monitor);
83
84 for (Iterator<IUstProviderInfo> iterator = allProviders.iterator(); iterator.hasNext();) {
85 IUstProviderInfo ustProviderInfo = iterator.next();
86 UstProviderComponent ustComponent = new UstProviderComponent(ustProviderInfo.getName(), this);
87 addChild(ustComponent);
88 ustComponent.setUstProvider(ustProviderInfo);
89 }
90 }
91
92 /**
93 * Returns whether the kernel provider is available or not
94 * @return <code>true</code> if kernel provide is available or <code>false</code>
95 */
96 public boolean hasKernelProvider() {
97 List<ITraceControlComponent> kernelList = getChildren(KernelProviderComponent.class);
98 return !kernelList.isEmpty();
99 }
100
101 /**
102 * Returns if node supports filtering of events
103 * @param domain - the domain type ({@link TraceDomainType})
104 * @return <code>true</code> if node supports filtering else <code>false</code>
105 */
106 public boolean isEventFilteringSupported(TraceDomainType domain) {
107 return ((TargetNodeComponent)getParent()).isEventFilteringSupported(domain);
108 }
109
110 /**
111 * Checks if enabling of per syscall event is supported
112 *
113 * @return <code>true</code> if enabling of per syscall event is supported else <code>false</code>
114 */
115 public boolean isPerSyscallEventsSupported() {
116 return ((TargetNodeComponent) getParent()).isPerSyscallEventsSupported();
117 }
118 }
119
This page took 0.037009 seconds and 4 git commands to generate.