Update usage of IAdaptable#getAdapter
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / model / impl / KernelProviderComponent.java
CommitLineData
eb1bab5b 1/**********************************************************************
ed902a2b 2 * Copyright (c) 2012, 2014 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
9bc60be7 13package org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl;
eb1bab5b
BH
14
15import java.util.Iterator;
16import java.util.List;
17
9bc60be7
AM
18import org.eclipse.tracecompass.internal.lttng2.control.core.model.IBaseEventInfo;
19import org.eclipse.tracecompass.internal.lttng2.control.ui.views.messages.Messages;
20import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceControlComponent;
21import org.eclipse.tracecompass.internal.lttng2.control.ui.views.property.KernelProviderPropertySource;
06b9339e 22import 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 */
31public class KernelProviderComponent extends TraceControlComponent {
cfdb727a 32
eb1bab5b
BH
33 // ------------------------------------------------------------------------
34 // Constants
35 // ------------------------------------------------------------------------
11252342 36
eb1bab5b
BH
37 /**
38 * Path to icon file for this component.
39 */
40 public static final String KERNEL_PROVIDER_ICON_FILE = "icons/obj16/targets.gif"; //$NON-NLS-1$
41
eb1bab5b
BH
42 // ------------------------------------------------------------------------
43 // Constructors
44 // ------------------------------------------------------------------------
11252342 45
eb1bab5b 46 /**
cfdb727a 47 * Constructor
eb1bab5b
BH
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);
7b48c899 53 setToolTip(Messages.TraceControl_ProviderDisplayName);
eb1bab5b
BH
54 setImage(KERNEL_PROVIDER_ICON_FILE);
55 }
cfdb727a 56
eb1bab5b
BH
57 // ------------------------------------------------------------------------
58 // Accessors
59 // ------------------------------------------------------------------------
11252342 60
eb1bab5b 61 /**
cfdb727a
AM
62 * Sets the events information for this component.
63 * @param eventInfos - events information to set.
eb1bab5b
BH
64 */
65 public void setEventInfo(List<IBaseEventInfo> eventInfos) {
66 for (Iterator<IBaseEventInfo> iterator = eventInfos.iterator(); iterator.hasNext();) {
cfdb727a 67 IBaseEventInfo baseEventInfo = iterator.next();
eb1bab5b
BH
68 BaseEventComponent component = new BaseEventComponent(baseEventInfo.getName(), this);
69 component.setEventInfo(baseEventInfo);
70 addChild(component);
71 }
72 }
73
06b9339e 74 @Override
e58fe1d5 75 public <T> T getAdapter(Class<T> adapter) {
06b9339e 76 if (adapter == IPropertySource.class) {
e58fe1d5 77 return adapter.cast(new KernelProviderPropertySource(this));
06b9339e
BH
78 }
79 return null;
cfdb727a 80 }
06b9339e 81
eb1bab5b 82}
This page took 0.073122 seconds and 5 git commands to generate.