Commit | Line | Data |
---|---|---|
06b9339e | 1 | /********************************************************************** |
11252342 | 2 | * Copyright (c) 2012, 2013 Ericsson |
5a7326dc | 3 | * |
06b9339e BH |
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 | |
5a7326dc BH |
8 | * |
9 | * Contributors: | |
06b9339e BH |
10 | * Bernd Hufmann - Initial API and implementation |
11 | **********************************************************************/ | |
115b4a01 | 12 | package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property; |
06b9339e | 13 | |
9315aeee | 14 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages; |
115b4a01 | 15 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.UstProviderComponent; |
5a7326dc | 16 | import org.eclipse.linuxtools.tmf.core.util.ReadOnlyTextPropertyDescriptor; |
06b9339e | 17 | import org.eclipse.ui.views.properties.IPropertyDescriptor; |
06b9339e BH |
18 | |
19 | /** | |
06b9339e BH |
20 | * <p> |
21 | * Property source implementation for the UST provider component. | |
22 | * </p> | |
5a7326dc | 23 | * |
dbd4432d | 24 | * @author Bernd Hufmann |
06b9339e BH |
25 | */ |
26 | public class UstProviderPropertySource extends BasePropertySource { | |
27 | ||
28 | // ------------------------------------------------------------------------ | |
29 | // Constants | |
30 | // ------------------------------------------------------------------------ | |
31 | /** | |
32 | * The UST provider 'name' property ID. | |
33 | */ | |
34 | public static final String UST_PROVIDER_NAME_PROPERTY_ID = "ust.provider.name"; //$NON-NLS-1$ | |
35 | /** | |
36 | * The UST provider 'PID' property ID. | |
37 | */ | |
38 | public static final String UST_PROVIDER_PID_PROPERTY_ID = "ust.provider.pid"; //$NON-NLS-1$ | |
39 | /** | |
5a7326dc | 40 | * The UST provider 'name' property name. |
06b9339e BH |
41 | */ |
42 | public static final String UST_PROVIDER_NAME_PROPERTY_NAME = Messages.TraceControl_ProviderNamePropertyName; | |
43 | /** | |
44 | * The UST provider 'type' property name. | |
45 | */ | |
46 | public static final String UST_PROVIDER_PID_PROPERTY_NAME = Messages.TraceControl_ProcessIdPropertyName; | |
47 | ||
48 | // ------------------------------------------------------------------------ | |
49 | // Attributes | |
50 | // ------------------------------------------------------------------------ | |
11252342 | 51 | |
06b9339e | 52 | /** |
5a7326dc | 53 | * The UST provider component which this property source is for. |
06b9339e BH |
54 | */ |
55 | private UstProviderComponent fUstProvider; | |
5a7326dc | 56 | |
06b9339e BH |
57 | // ------------------------------------------------------------------------ |
58 | // Constructors | |
59 | // ------------------------------------------------------------------------ | |
11252342 | 60 | |
06b9339e BH |
61 | /** |
62 | * Constructor | |
63 | * @param component - the UST provider component | |
64 | */ | |
65 | public UstProviderPropertySource(UstProviderComponent component) { | |
66 | fUstProvider = component; | |
67 | } | |
5a7326dc | 68 | |
06b9339e BH |
69 | // ------------------------------------------------------------------------ |
70 | // Operations | |
71 | // ------------------------------------------------------------------------ | |
11252342 | 72 | |
06b9339e BH |
73 | @Override |
74 | public IPropertyDescriptor[] getPropertyDescriptors() { | |
75 | return new IPropertyDescriptor[] { | |
5a7326dc BH |
76 | new ReadOnlyTextPropertyDescriptor(UST_PROVIDER_NAME_PROPERTY_ID, UST_PROVIDER_NAME_PROPERTY_NAME), |
77 | new ReadOnlyTextPropertyDescriptor(UST_PROVIDER_PID_PROPERTY_ID, UST_PROVIDER_PID_PROPERTY_NAME)}; | |
06b9339e BH |
78 | } |
79 | ||
06b9339e BH |
80 | @Override |
81 | public Object getPropertyValue(Object id) { | |
82 | if(UST_PROVIDER_NAME_PROPERTY_ID.equals(id)) { | |
83 | return fUstProvider.getName(); | |
84 | } | |
85 | if (UST_PROVIDER_PID_PROPERTY_ID.equals(id)) { | |
86 | return String.valueOf(fUstProvider.getPid()); | |
87 | } | |
88 | return null; | |
89 | } | |
90 | ||
91 | } |