Update usage of IAdaptable#getAdapter
[deliverable/tracecompass.git] / btf / org.eclipse.tracecompass.btf.ui / src / org / eclipse / tracecompass / btf / ui / BtfEventAdapterFactory.java
CommitLineData
ff71e543
MK
1/*******************************************************************************
2 * Copyright (c) 2014 Ericsson
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Matthew Khouzam - Initial API and implementation
10 *******************************************************************************/
11
7ce90559 12package org.eclipse.tracecompass.btf.ui;
ff71e543
MK
13
14import org.eclipse.core.runtime.IAdapterFactory;
7ce90559 15import org.eclipse.tracecompass.btf.core.event.BtfEvent;
ff71e543
MK
16import org.eclipse.ui.views.properties.IPropertySource;
17
18/**
19 * Btf Event Adaptor Factory
20 *
21 * @author Matthew Khouzam
22 */
23public class BtfEventAdapterFactory implements IAdapterFactory {
24
25 private static final Class<?>[] PROPERTIES = new Class[] {
26 IPropertySource.class
27 };
28
29 @Override
30 public Class<?>[] getAdapterList() {
31 return PROPERTIES;
32 }
33
34 @Override
e58fe1d5
AM
35 public <T> T getAdapter(Object element, Class<T> adapterType) {
36 if (element instanceof BtfEvent && IPropertySource.class.equals(adapterType)) {
ff71e543 37 BtfEvent tmfEvent = (BtfEvent) element;
e58fe1d5 38 return adapterType.cast(new BtfEventPropertySource(tmfEvent));
ff71e543
MK
39 }
40 return null;
41 }
42
43}
This page took 0.054958 seconds and 5 git commands to generate.