Commit | Line | Data |
---|---|---|
080600d9 | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2013, 2014 Ericsson |
080600d9 MAL |
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 | * Marc-Andre Laperle - Initial API and implementation | |
10 | *******************************************************************************/ | |
2bdf0193 | 11 | package org.eclipse.tracecompass.tmf.ui.viewers.events; |
080600d9 MAL |
12 | |
13 | import org.eclipse.core.runtime.IAdapterFactory; | |
2bdf0193 | 14 | import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; |
080600d9 MAL |
15 | import org.eclipse.ui.views.properties.IPropertySource; |
16 | ||
17 | /** | |
18 | * Implements basic UI support for TMF events. | |
080600d9 MAL |
19 | */ |
20 | public class TmfEventAdapterFactory implements IAdapterFactory { | |
21 | ||
22 | private static Class<?>[] PROPERTIES = new Class[] { | |
23 | IPropertySource.class | |
24 | }; | |
25 | ||
26 | @Override | |
27 | public Class<?>[] getAdapterList() { | |
28 | return PROPERTIES; | |
29 | } | |
30 | ||
31 | @Override | |
e58fe1d5 | 32 | public <T> T getAdapter(Object element, Class<T> adapterType) { |
080600d9 | 33 | ITmfEvent tmfEvent = (ITmfEvent) element; |
e58fe1d5 AM |
34 | if (IPropertySource.class.equals(adapterType)) { |
35 | return adapterType.cast(new TmfEventPropertySource(tmfEvent)); | |
080600d9 MAL |
36 | } |
37 | return null; | |
38 | } | |
39 | } |