Commit | Line | Data |
---|---|---|
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 | 12 | package org.eclipse.tracecompass.btf.ui; |
ff71e543 MK |
13 | |
14 | import org.eclipse.core.runtime.IAdapterFactory; | |
7ce90559 | 15 | import org.eclipse.tracecompass.btf.core.event.BtfEvent; |
ff71e543 MK |
16 | import org.eclipse.ui.views.properties.IPropertySource; |
17 | ||
18 | /** | |
19 | * Btf Event Adaptor Factory | |
20 | * | |
21 | * @author Matthew Khouzam | |
22 | */ | |
23 | public 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 | } |