Commit | Line | Data |
---|---|---|
eb1bab5b BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 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 BH |
10 | * Bernd Hufmann - Initial API and implementation |
11 | **********************************************************************/ | |
12 | ||
115b4a01 | 13 | package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl; |
eb1bab5b BH |
14 | |
15 | import java.util.Iterator; | |
16 | import java.util.List; | |
17 | ||
9315aeee BH |
18 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo; |
19 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages; | |
115b4a01 BH |
20 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent; |
21 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.KernelProviderPropertySource; | |
06b9339e | 22 | import org.eclipse.ui.views.properties.IPropertySource; |
eb1bab5b BH |
23 | |
24 | /** | |
eb1bab5b | 25 | * <p> |
dbd4432d | 26 | * Implementation of the Kernel provider component. |
eb1bab5b | 27 | * </p> |
cfdb727a | 28 | * |
dbd4432d | 29 | * @author Bernd Hufmann |
eb1bab5b BH |
30 | */ |
31 | public class KernelProviderComponent extends TraceControlComponent { | |
cfdb727a | 32 | |
eb1bab5b BH |
33 | // ------------------------------------------------------------------------ |
34 | // Constants | |
35 | // ------------------------------------------------------------------------ | |
36 | /** | |
37 | * Path to icon file for this component. | |
38 | */ | |
39 | public static final String KERNEL_PROVIDER_ICON_FILE = "icons/obj16/targets.gif"; //$NON-NLS-1$ | |
40 | ||
41 | // ------------------------------------------------------------------------ | |
42 | // Attributes | |
43 | // ------------------------------------------------------------------------ | |
cfdb727a | 44 | |
eb1bab5b BH |
45 | // ------------------------------------------------------------------------ |
46 | // Constructors | |
47 | // ------------------------------------------------------------------------ | |
48 | /** | |
cfdb727a | 49 | * Constructor |
eb1bab5b BH |
50 | * @param name - the name of the component. |
51 | * @param parent - the parent of this component. | |
52 | */ | |
53 | public KernelProviderComponent(String name, ITraceControlComponent parent) { | |
54 | super(name, parent); | |
7b48c899 | 55 | setToolTip(Messages.TraceControl_ProviderDisplayName); |
eb1bab5b BH |
56 | setImage(KERNEL_PROVIDER_ICON_FILE); |
57 | } | |
cfdb727a | 58 | |
eb1bab5b BH |
59 | // ------------------------------------------------------------------------ |
60 | // Accessors | |
61 | // ------------------------------------------------------------------------ | |
62 | /** | |
cfdb727a AM |
63 | * Sets the events information for this component. |
64 | * @param eventInfos - events information to set. | |
eb1bab5b BH |
65 | */ |
66 | public void setEventInfo(List<IBaseEventInfo> eventInfos) { | |
67 | for (Iterator<IBaseEventInfo> iterator = eventInfos.iterator(); iterator.hasNext();) { | |
cfdb727a | 68 | IBaseEventInfo baseEventInfo = iterator.next(); |
eb1bab5b BH |
69 | BaseEventComponent component = new BaseEventComponent(baseEventInfo.getName(), this); |
70 | component.setEventInfo(baseEventInfo); | |
71 | addChild(component); | |
72 | } | |
73 | } | |
74 | ||
06b9339e BH |
75 | /* |
76 | * (non-Javadoc) | |
115b4a01 | 77 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class) |
06b9339e | 78 | */ |
06b9339e BH |
79 | @Override |
80 | public Object getAdapter(Class adapter) { | |
81 | if (adapter == IPropertySource.class) { | |
82 | return new KernelProviderPropertySource(this); | |
83 | } | |
84 | return null; | |
cfdb727a | 85 | } |
06b9339e | 86 | |
eb1bab5b BH |
87 | // ------------------------------------------------------------------------ |
88 | // Operations | |
89 | // ------------------------------------------------------------------------ | |
cfdb727a | 90 | |
eb1bab5b | 91 | } |