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