Commit | Line | Data |
---|---|---|
eb1bab5b BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 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 | **********************************************************************/ | |
31a6a4e4 | 12 | package org.eclipse.linuxtools.internal.lttng.ui.views.control.model.impl; |
eb1bab5b BH |
13 | |
14 | import java.util.Iterator; | |
15 | import java.util.List; | |
16 | ||
17 | import org.eclipse.core.commands.ExecutionException; | |
18 | import org.eclipse.core.runtime.IProgressMonitor; | |
19 | import org.eclipse.core.runtime.NullProgressMonitor; | |
31a6a4e4 BH |
20 | import org.eclipse.linuxtools.internal.lttng.ui.views.control.Messages; |
21 | import org.eclipse.linuxtools.internal.lttng.ui.views.control.model.IBaseEventInfo; | |
22 | import org.eclipse.linuxtools.internal.lttng.ui.views.control.model.ITraceControlComponent; | |
23 | import org.eclipse.linuxtools.internal.lttng.ui.views.control.model.IUstProviderInfo; | |
eb1bab5b BH |
24 | |
25 | /** | |
26 | * <b><u>TraceProviderGroup</u></b> | |
27 | * <p> | |
28 | * Implementation of the trace provider group. | |
29 | * </p> | |
30 | */ | |
31 | public class TraceProviderGroup extends TraceControlComponent { | |
32 | // ------------------------------------------------------------------------ | |
33 | // Constants | |
34 | // ------------------------------------------------------------------------ | |
35 | /** | |
36 | * Path to icon file for this component. | |
37 | */ | |
38 | public static final String TRACE_PROVIDERS_ICON_FILE = "icons/obj16/providers.gif"; //$NON-NLS-1$ | |
39 | ||
40 | // ------------------------------------------------------------------------ | |
41 | // Attributes | |
42 | // ------------------------------------------------------------------------ | |
43 | ||
44 | // ------------------------------------------------------------------------ | |
45 | // Constructors | |
46 | // ------------------------------------------------------------------------ | |
47 | /** | |
48 | * Constructor | |
49 | * @param name - the name of the component. | |
50 | * @param parent - the parent of this component. | |
51 | */ | |
52 | public TraceProviderGroup(String name, ITraceControlComponent parent) { | |
53 | super(name, parent); | |
54 | setImage(TRACE_PROVIDERS_ICON_FILE); | |
55 | } | |
56 | ||
57 | // ------------------------------------------------------------------------ | |
58 | // Accessors | |
59 | // ------------------------------------------------------------------------ | |
60 | ||
61 | // ------------------------------------------------------------------------ | |
62 | // Operations | |
63 | // ------------------------------------------------------------------------ | |
64 | ||
65 | /** | |
66 | * Gets the provider information from the target node. | |
67 | * @throws ExecutionException | |
68 | */ | |
69 | public void getProviderFromNode() throws ExecutionException { | |
70 | getProviderFromNode(new NullProgressMonitor()); | |
71 | } | |
72 | ||
73 | /** | |
74 | * Gets the provider information from the target node. | |
75 | * @param monitor - a progress monitor | |
76 | * @throws ExecutionException | |
77 | */ | |
78 | public void getProviderFromNode(IProgressMonitor monitor) throws ExecutionException { | |
79 | ||
80 | List<IBaseEventInfo> eventInfos = getControlService().getKernelProvider(monitor); | |
81 | KernelProviderComponent component = new KernelProviderComponent(Messages.TraceControl_KernelProviderDisplayName, this); | |
82 | addChild(component); | |
83 | component.setEventInfo(eventInfos); | |
84 | ||
85 | List<IUstProviderInfo> allProviders = getControlService().getUstProvider(monitor); | |
86 | ||
87 | for (Iterator<IUstProviderInfo> iterator = allProviders.iterator(); iterator.hasNext();) { | |
88 | IUstProviderInfo ustProviderInfo = (IUstProviderInfo) iterator.next(); | |
89 | UstProviderComponent ustComponent = new UstProviderComponent(ustProviderInfo.getName(), this); | |
90 | addChild(ustComponent); | |
91 | ustComponent.setUstProvider(ustProviderInfo); | |
92 | } | |
93 | } | |
94 | } | |
95 |