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.UstProviderComponent; | |
06b9339e BH |
16 | import org.eclipse.ui.views.properties.IPropertyDescriptor; |
17 | import org.eclipse.ui.views.properties.TextPropertyDescriptor; | |
18 | ||
19 | /** | |
20 | * <b><u>UstProviderPropertySource</u></b> | |
21 | * <p> | |
22 | * Property source implementation for the UST provider component. | |
23 | * </p> | |
24 | */ | |
25 | public class UstProviderPropertySource extends BasePropertySource { | |
26 | ||
27 | // ------------------------------------------------------------------------ | |
28 | // Constants | |
29 | // ------------------------------------------------------------------------ | |
30 | /** | |
31 | * The UST provider 'name' property ID. | |
32 | */ | |
33 | public static final String UST_PROVIDER_NAME_PROPERTY_ID = "ust.provider.name"; //$NON-NLS-1$ | |
34 | /** | |
35 | * The UST provider 'PID' property ID. | |
36 | */ | |
37 | public static final String UST_PROVIDER_PID_PROPERTY_ID = "ust.provider.pid"; //$NON-NLS-1$ | |
38 | /** | |
39 | * The UST provider 'name' property name. | |
40 | */ | |
41 | public static final String UST_PROVIDER_NAME_PROPERTY_NAME = Messages.TraceControl_ProviderNamePropertyName; | |
42 | /** | |
43 | * The UST provider 'type' property name. | |
44 | */ | |
45 | public static final String UST_PROVIDER_PID_PROPERTY_NAME = Messages.TraceControl_ProcessIdPropertyName; | |
46 | ||
47 | // ------------------------------------------------------------------------ | |
48 | // Attributes | |
49 | // ------------------------------------------------------------------------ | |
50 | /** | |
51 | * The UST provider component which this property source is for. | |
52 | */ | |
53 | private UstProviderComponent fUstProvider; | |
54 | ||
55 | // ------------------------------------------------------------------------ | |
56 | // Constructors | |
57 | // ------------------------------------------------------------------------ | |
58 | /** | |
59 | * Constructor | |
60 | * @param component - the UST provider component | |
61 | */ | |
62 | public UstProviderPropertySource(UstProviderComponent component) { | |
63 | fUstProvider = component; | |
64 | } | |
65 | ||
66 | // ------------------------------------------------------------------------ | |
67 | // Operations | |
68 | // ------------------------------------------------------------------------ | |
69 | /* | |
70 | * (non-Javadoc) | |
115b4a01 | 71 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyDescriptors() |
06b9339e BH |
72 | */ |
73 | @Override | |
74 | public IPropertyDescriptor[] getPropertyDescriptors() { | |
75 | return new IPropertyDescriptor[] { | |
76 | new TextPropertyDescriptor(UST_PROVIDER_NAME_PROPERTY_ID, UST_PROVIDER_NAME_PROPERTY_NAME), | |
77 | new TextPropertyDescriptor(UST_PROVIDER_PID_PROPERTY_ID, UST_PROVIDER_PID_PROPERTY_NAME)}; | |
78 | } | |
79 | ||
80 | /* | |
81 | * (non-Javadoc) | |
115b4a01 | 82 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object) |
06b9339e BH |
83 | */ |
84 | @Override | |
85 | public Object getPropertyValue(Object id) { | |
86 | if(UST_PROVIDER_NAME_PROPERTY_ID.equals(id)) { | |
87 | return fUstProvider.getName(); | |
88 | } | |
89 | if (UST_PROVIDER_PID_PROPERTY_ID.equals(id)) { | |
90 | return String.valueOf(fUstProvider.getPid()); | |
91 | } | |
92 | return null; | |
93 | } | |
94 | ||
95 | } |