tmf: use ReadOnlyTextPropertyDescriptor in project model
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / property / UstProviderPropertySource.java
CommitLineData
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 12package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property;
06b9339e 13
9315aeee 14import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
115b4a01 15import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.UstProviderComponent;
06b9339e
BH
16import org.eclipse.ui.views.properties.IPropertyDescriptor;
17import org.eclipse.ui.views.properties.TextPropertyDescriptor;
18
19/**
06b9339e
BH
20 * <p>
21 * Property source implementation for the UST provider component.
22 * </p>
dbd4432d
BH
23 *
24 * @author Bernd Hufmann
06b9339e
BH
25 */
26public 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 /**
40 * The UST provider 'name' property name.
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 // ------------------------------------------------------------------------
51 /**
52 * The UST provider component which this property source is for.
53 */
54 private UstProviderComponent fUstProvider;
55
56 // ------------------------------------------------------------------------
57 // Constructors
58 // ------------------------------------------------------------------------
59 /**
60 * Constructor
61 * @param component - the UST provider component
62 */
63 public UstProviderPropertySource(UstProviderComponent component) {
64 fUstProvider = component;
65 }
66
67 // ------------------------------------------------------------------------
68 // Operations
69 // ------------------------------------------------------------------------
70 /*
71 * (non-Javadoc)
115b4a01 72 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
06b9339e
BH
73 */
74 @Override
75 public IPropertyDescriptor[] getPropertyDescriptors() {
76 return new IPropertyDescriptor[] {
77 new TextPropertyDescriptor(UST_PROVIDER_NAME_PROPERTY_ID, UST_PROVIDER_NAME_PROPERTY_NAME),
78 new TextPropertyDescriptor(UST_PROVIDER_PID_PROPERTY_ID, UST_PROVIDER_PID_PROPERTY_NAME)};
79 }
80
81 /*
82 * (non-Javadoc)
115b4a01 83 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
06b9339e
BH
84 */
85 @Override
86 public Object getPropertyValue(Object id) {
87 if(UST_PROVIDER_NAME_PROPERTY_ID.equals(id)) {
88 return fUstProvider.getName();
89 }
90 if (UST_PROVIDER_PID_PROPERTY_ID.equals(id)) {
91 return String.valueOf(fUstProvider.getPid());
92 }
93 return null;
94 }
95
96}
This page took 0.041422 seconds and 5 git commands to generate.