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