1 /**********************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
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
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
;
15 import java
.util
.Iterator
;
16 import java
.util
.List
;
18 import org
.eclipse
.core
.commands
.ExecutionException
;
19 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
20 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.IBaseEventInfo
;
21 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.IUstProviderInfo
;
22 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.messages
.Messages
;
23 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.ITraceControlComponent
;
27 * Implementation of the trace provider group.
30 * @author Bernd Hufmann
32 public class TraceProviderGroup
extends TraceControlComponent
{
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
37 * Path to icon file for this component.
39 public static final String TRACE_PROVIDERS_ICON_FILE
= "icons/obj16/providers.gif"; //$NON-NLS-1$
41 // ------------------------------------------------------------------------
43 // ------------------------------------------------------------------------
45 // ------------------------------------------------------------------------
47 // ------------------------------------------------------------------------
50 * @param name - the name of the component.
51 * @param parent - the parent of this component.
53 public TraceProviderGroup(String name
, ITraceControlComponent parent
) {
55 setImage(TRACE_PROVIDERS_ICON_FILE
);
58 // ------------------------------------------------------------------------
60 // ------------------------------------------------------------------------
62 // ------------------------------------------------------------------------
64 // ------------------------------------------------------------------------
67 * Gets the provider information from the target node.
68 * @param monitor - a progress monitor
69 * @throws ExecutionException If the command fails
71 public void getProviderFromNode(IProgressMonitor monitor
) throws ExecutionException
{
73 List
<IBaseEventInfo
> eventInfos
= getControlService().getKernelProvider(monitor
);
75 if (!eventInfos
.isEmpty()) {
76 KernelProviderComponent component
= new KernelProviderComponent(Messages
.TraceControl_KernelProviderDisplayName
, this);
78 component
.setEventInfo(eventInfos
);
81 List
<IUstProviderInfo
> allProviders
= getControlService().getUstProvider(monitor
);
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
);
92 * Returns whether the kernel provider is available or not
93 * @return <code>true</code> if kernel provide is available or <code>false</code>
95 public boolean hasKernelProvider() {
96 List
<ITraceControlComponent
> kernelList
= getChildren(KernelProviderComponent
.class);
97 return !kernelList
.isEmpty();
101 * Returns if node supports filtering of events
102 * @return <code>true</code> if node supports filtering else <code>false</code>
104 public boolean isEventFilteringSupported() {
105 return ((TargetNodeComponent
)getParent()).isEventFilteringSupported();