Internalize API for trace control and move control to lttng2
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / model / impl / KernelProviderComponent.java
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
13 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl;
14
15 import java.util.Iterator;
16 import java.util.List;
17
18 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IBaseEventInfo;
19 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
20 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.KernelProviderPropertySource;
21 import org.eclipse.ui.views.properties.IPropertySource;
22
23 /**
24 * <b><u>KernelProviderComponent</u></b>
25 * <p>
26 * TODO
27 * </p>
28 */
29 public class KernelProviderComponent extends TraceControlComponent {
30
31 // ------------------------------------------------------------------------
32 // Constants
33 // ------------------------------------------------------------------------
34 /**
35 * Path to icon file for this component.
36 */
37 public static final String KERNEL_PROVIDER_ICON_FILE = "icons/obj16/targets.gif"; //$NON-NLS-1$
38
39 // ------------------------------------------------------------------------
40 // Attributes
41 // ------------------------------------------------------------------------
42
43 // ------------------------------------------------------------------------
44 // Constructors
45 // ------------------------------------------------------------------------
46 /**
47 * Constructor
48 * @param name - the name of the component.
49 * @param parent - the parent of this component.
50 */
51 public KernelProviderComponent(String name, ITraceControlComponent parent) {
52 super(name, parent);
53 setImage(KERNEL_PROVIDER_ICON_FILE);
54 }
55
56 // ------------------------------------------------------------------------
57 // Accessors
58 // ------------------------------------------------------------------------
59 /**
60 * Sets the events information for this component.
61 * @param eventInfos - events information to set.
62 */
63 public void setEventInfo(List<IBaseEventInfo> eventInfos) {
64 for (Iterator<IBaseEventInfo> iterator = eventInfos.iterator(); iterator.hasNext();) {
65 IBaseEventInfo baseEventInfo = (IBaseEventInfo) iterator.next();
66 BaseEventComponent component = new BaseEventComponent(baseEventInfo.getName(), this);
67 component.setEventInfo(baseEventInfo);
68 addChild(component);
69 }
70 }
71
72 /*
73 * (non-Javadoc)
74 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
75 */
76 @SuppressWarnings("rawtypes")
77 @Override
78 public Object getAdapter(Class adapter) {
79 if (adapter == IPropertySource.class) {
80 return new KernelProviderPropertySource(this);
81 }
82 return null;
83 }
84
85 // ------------------------------------------------------------------------
86 // Operations
87 // ------------------------------------------------------------------------
88
89 }
This page took 0.03404 seconds and 6 git commands to generate.