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 | **********************************************************************/ | |
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 | /** | |
25 | * <b><u>KernelProviderComponent</u></b> | |
26 | * <p> | |
27 | * TODO | |
28 | * </p> | |
29 | */ | |
30 | public class KernelProviderComponent extends TraceControlComponent { | |
31 | ||
32 | // ------------------------------------------------------------------------ | |
33 | // Constants | |
34 | // ------------------------------------------------------------------------ | |
35 | /** | |
36 | * Path to icon file for this component. | |
37 | */ | |
38 | public static final String KERNEL_PROVIDER_ICON_FILE = "icons/obj16/targets.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 KernelProviderComponent(String name, ITraceControlComponent parent) { | |
53 | super(name, parent); | |
7b48c899 | 54 | setToolTip(Messages.TraceControl_ProviderDisplayName); |
eb1bab5b BH |
55 | setImage(KERNEL_PROVIDER_ICON_FILE); |
56 | } | |
57 | ||
58 | // ------------------------------------------------------------------------ | |
59 | // Accessors | |
60 | // ------------------------------------------------------------------------ | |
61 | /** | |
62 | * Sets the events information for this component. | |
63 | * @param eventInfos - events information to set. | |
64 | */ | |
65 | public void setEventInfo(List<IBaseEventInfo> eventInfos) { | |
66 | for (Iterator<IBaseEventInfo> iterator = eventInfos.iterator(); iterator.hasNext();) { | |
67 | IBaseEventInfo baseEventInfo = (IBaseEventInfo) iterator.next(); | |
68 | BaseEventComponent component = new BaseEventComponent(baseEventInfo.getName(), this); | |
69 | component.setEventInfo(baseEventInfo); | |
70 | addChild(component); | |
71 | } | |
72 | } | |
73 | ||
06b9339e BH |
74 | /* |
75 | * (non-Javadoc) | |
115b4a01 | 76 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class) |
06b9339e BH |
77 | */ |
78 | @SuppressWarnings("rawtypes") | |
79 | @Override | |
80 | public Object getAdapter(Class adapter) { | |
81 | if (adapter == IPropertySource.class) { | |
82 | return new KernelProviderPropertySource(this); | |
83 | } | |
84 | return null; | |
85 | } | |
86 | ||
eb1bab5b BH |
87 | // ------------------------------------------------------------------------ |
88 | // Operations | |
89 | // ------------------------------------------------------------------------ | |
90 | ||
eb1bab5b | 91 | } |