1 /**********************************************************************
2 * Copyright (c) 2012 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 **********************************************************************/
12 package org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
.impl
;
14 import java
.util
.Iterator
;
15 import java
.util
.List
;
17 import org
.eclipse
.core
.commands
.ExecutionException
;
18 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
19 import org
.eclipse
.core
.runtime
.NullProgressMonitor
;
20 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IBaseEventInfo
;
21 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IUstProviderInfo
;
22 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.messages
.Messages
;
23 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.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 * @throws ExecutionException If the command fails
70 public void getProviderFromNode() throws ExecutionException
{
71 getProviderFromNode(new NullProgressMonitor());
75 * Gets the provider information from the target node.
76 * @param monitor - a progress monitor
77 * @throws ExecutionException If the command fails
79 public void getProviderFromNode(IProgressMonitor monitor
) throws ExecutionException
{
81 List
<IBaseEventInfo
> eventInfos
= getControlService().getKernelProvider(monitor
);
83 if (!eventInfos
.isEmpty()) {
84 KernelProviderComponent component
= new KernelProviderComponent(Messages
.TraceControl_KernelProviderDisplayName
, this);
86 component
.setEventInfo(eventInfos
);
89 List
<IUstProviderInfo
> allProviders
= getControlService().getUstProvider(monitor
);
91 for (Iterator
<IUstProviderInfo
> iterator
= allProviders
.iterator(); iterator
.hasNext();) {
92 IUstProviderInfo ustProviderInfo
= iterator
.next();
93 UstProviderComponent ustComponent
= new UstProviderComponent(ustProviderInfo
.getName(), this);
94 addChild(ustComponent
);
95 ustComponent
.setUstProvider(ustProviderInfo
);
100 * Returns whether the kernel provider is available or not
101 * @return <code>true</code> if kernel provide is available or <code>false</code>
103 public boolean hasKernelProvider() {
104 List
<ITraceControlComponent
> kernelList
= getChildren(KernelProviderComponent
.class);
105 return !kernelList
.isEmpty();
109 * Returns if node supports filtering of events
110 * @return <code>true</code> if node supports filtering else <code>false</code>
112 public boolean isEventFilteringSupported() {
113 return ((TargetNodeComponent
)getParent()).isEventFilteringSupported();