Commit | Line | Data |
---|---|---|
eb1bab5b | 1 | /********************************************************************** |
ed902a2b | 2 | * Copyright (c) 2012, 2014 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 | **********************************************************************/ |
9bc60be7 | 13 | package org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl; |
eb1bab5b BH |
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; | |
1bc37054 | 20 | import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceDomainType; |
9bc60be7 AM |
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; | |
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 | */ |
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$ | |
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. | |
69 | * @param monitor - a progress monitor | |
cfdb727a | 70 | * @throws ExecutionException If the command fails |
eb1bab5b BH |
71 | */ |
72 | public void getProviderFromNode(IProgressMonitor monitor) throws ExecutionException { | |
cfdb727a | 73 | |
eb1bab5b | 74 | List<IBaseEventInfo> eventInfos = getControlService().getKernelProvider(monitor); |
a07c7629 BH |
75 | |
76 | if (!eventInfos.isEmpty()) { | |
77 | KernelProviderComponent component = new KernelProviderComponent(Messages.TraceControl_KernelProviderDisplayName, this); | |
78 | addChild(component); | |
79 | component.setEventInfo(eventInfos); | |
80 | } | |
cfdb727a | 81 | |
eb1bab5b | 82 | List<IUstProviderInfo> allProviders = getControlService().getUstProvider(monitor); |
cfdb727a | 83 | |
eb1bab5b | 84 | for (Iterator<IUstProviderInfo> iterator = allProviders.iterator(); iterator.hasNext();) { |
cfdb727a | 85 | IUstProviderInfo ustProviderInfo = iterator.next(); |
eb1bab5b BH |
86 | UstProviderComponent ustComponent = new UstProviderComponent(ustProviderInfo.getName(), this); |
87 | addChild(ustComponent); | |
88 | ustComponent.setUstProvider(ustProviderInfo); | |
89 | } | |
90 | } | |
a07c7629 BH |
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 | } | |
d4514365 BH |
100 | |
101 | /** | |
102 | * Returns if node supports filtering of events | |
1bc37054 | 103 | * @param domain - the domain type ({@link TraceDomainType}) |
d4514365 BH |
104 | * @return <code>true</code> if node supports filtering else <code>false</code> |
105 | */ | |
1bc37054 BR |
106 | public boolean isEventFilteringSupported(TraceDomainType domain) { |
107 | return ((TargetNodeComponent)getParent()).isEventFilteringSupported(domain); | |
d4514365 | 108 | } |
207ff523 BR |
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 | } | |
eb1bab5b BH |
118 | } |
119 |