3c0b342b38c3b824033fcccd1f7182dbd91e4c8a
[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.core.control.model.IBaseEventInfo;
19 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
20 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
21 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.KernelProviderPropertySource;
22 import org.eclipse.ui.views.properties.IPropertySource;
23
24 /**
25 * <p>
26 * Implementation of the Kernel provider component.
27 * </p>
28 *
29 * @author Bernd Hufmann
30 */
31 public class KernelProviderComponent extends TraceControlComponent {
32
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 // ------------------------------------------------------------------------
44
45 // ------------------------------------------------------------------------
46 // Constructors
47 // ------------------------------------------------------------------------
48 /**
49 * Constructor
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);
55 setToolTip(Messages.TraceControl_ProviderDisplayName);
56 setImage(KERNEL_PROVIDER_ICON_FILE);
57 }
58
59 // ------------------------------------------------------------------------
60 // Accessors
61 // ------------------------------------------------------------------------
62 /**
63 * Sets the events information for this component.
64 * @param eventInfos - events information to set.
65 */
66 public void setEventInfo(List<IBaseEventInfo> eventInfos) {
67 for (Iterator<IBaseEventInfo> iterator = eventInfos.iterator(); iterator.hasNext();) {
68 IBaseEventInfo baseEventInfo = iterator.next();
69 BaseEventComponent component = new BaseEventComponent(baseEventInfo.getName(), this);
70 component.setEventInfo(baseEventInfo);
71 addChild(component);
72 }
73 }
74
75 /*
76 * (non-Javadoc)
77 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
78 */
79 @Override
80 public Object getAdapter(Class adapter) {
81 if (adapter == IPropertySource.class) {
82 return new KernelProviderPropertySource(this);
83 }
84 return null;
85 }
86
87 // ------------------------------------------------------------------------
88 // Operations
89 // ------------------------------------------------------------------------
90
91 }
This page took 0.031989 seconds and 5 git commands to generate.