| 1 | /********************************************************************** |
| 2 | * Copyright (c) 2012, 2013 Ericsson |
| 3 | * |
| 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 |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Bernd Hufmann - Initial API and implementation |
| 11 | **********************************************************************/ |
| 12 | package org.eclipse.linuxtools.internal.lttng2.control.ui.views.property; |
| 13 | |
| 14 | import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages; |
| 15 | import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.KernelProviderComponent; |
| 16 | import org.eclipse.tracecompass.tmf.ui.properties.ReadOnlyTextPropertyDescriptor; |
| 17 | import org.eclipse.ui.views.properties.IPropertyDescriptor; |
| 18 | |
| 19 | /** |
| 20 | * <p> |
| 21 | * Property source implementation for the kernl provider component. |
| 22 | * </p> |
| 23 | * |
| 24 | * @author Bernd Hufmann |
| 25 | */ |
| 26 | public class KernelProviderPropertySource extends BasePropertySource { |
| 27 | |
| 28 | // ------------------------------------------------------------------------ |
| 29 | // Constants |
| 30 | // ------------------------------------------------------------------------ |
| 31 | |
| 32 | /** |
| 33 | * The kernel provider 'name' property ID. |
| 34 | */ |
| 35 | public static final String KERNEL_PROVIDER_NAME_PROPERTY_ID = "ust.provider.name"; //$NON-NLS-1$ |
| 36 | /** |
| 37 | * The kernel provider 'name' property name. |
| 38 | */ |
| 39 | public static final String KERNEL_PROVIDER_NAME_PROPERTY_NAME = Messages.TraceControl_ProviderNamePropertyName; |
| 40 | |
| 41 | // ------------------------------------------------------------------------ |
| 42 | // Attributes |
| 43 | // ------------------------------------------------------------------------ |
| 44 | |
| 45 | /** |
| 46 | * The kernel provider component which this property source is for. |
| 47 | */ |
| 48 | private KernelProviderComponent fProvider; |
| 49 | |
| 50 | // ------------------------------------------------------------------------ |
| 51 | // Constructors |
| 52 | // ------------------------------------------------------------------------ |
| 53 | |
| 54 | /** |
| 55 | * Constructor |
| 56 | * @param component - the kernel provider component |
| 57 | */ |
| 58 | public KernelProviderPropertySource(KernelProviderComponent component) { |
| 59 | fProvider = component; |
| 60 | } |
| 61 | |
| 62 | // ------------------------------------------------------------------------ |
| 63 | // Operations |
| 64 | // ------------------------------------------------------------------------ |
| 65 | |
| 66 | @Override |
| 67 | public IPropertyDescriptor[] getPropertyDescriptors() { |
| 68 | return new IPropertyDescriptor[] { |
| 69 | new ReadOnlyTextPropertyDescriptor(KERNEL_PROVIDER_NAME_PROPERTY_ID, KERNEL_PROVIDER_NAME_PROPERTY_NAME)}; |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | public Object getPropertyValue(Object id) { |
| 74 | if(KERNEL_PROVIDER_NAME_PROPERTY_ID.equals(id)) { |
| 75 | return fProvider.getName(); |
| 76 | } |
| 77 | return null; |
| 78 | } |
| 79 | |
| 80 | } |