Commit | Line | Data |
---|---|---|
06b9339e BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 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.TraceDomainComponent; |
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 trace domain component. | |
22 | * </p> | |
5a7326dc | 23 | * |
dbd4432d | 24 | * @author Bernd Hufmann |
06b9339e BH |
25 | */ |
26 | public class TraceDomainPropertySource extends BasePropertySource { | |
27 | ||
28 | // ------------------------------------------------------------------------ | |
29 | // Constants | |
30 | // ------------------------------------------------------------------------ | |
31 | ||
32 | /** | |
33 | * The trace domain 'name' property ID. | |
34 | */ | |
35 | public static final String TRACE_DOMAIN_NAME_PROPERTY_ID = "trace.domain.name"; //$NON-NLS-1$ | |
36 | /** | |
5a7326dc | 37 | * The trace domain 'name' property name. |
06b9339e BH |
38 | */ |
39 | public static final String TRACE_DOMAIN_NAME_PROPERTY_NAME = Messages.TraceControl_DomainNamePropertyName; | |
5a7326dc | 40 | |
06b9339e BH |
41 | // ------------------------------------------------------------------------ |
42 | // Attributes | |
43 | // ------------------------------------------------------------------------ | |
44 | /** | |
5a7326dc | 45 | * The trace domain component which this property source is for. |
06b9339e BH |
46 | */ |
47 | private final TraceDomainComponent fBaseEvent; | |
5a7326dc | 48 | |
06b9339e BH |
49 | // ------------------------------------------------------------------------ |
50 | // Constructors | |
51 | // ------------------------------------------------------------------------ | |
52 | /** | |
53 | * Constructor | |
54 | * @param component - the trace domain component | |
55 | */ | |
56 | public TraceDomainPropertySource(TraceDomainComponent component) { | |
57 | fBaseEvent = component; | |
58 | } | |
5a7326dc | 59 | |
06b9339e BH |
60 | // ------------------------------------------------------------------------ |
61 | // Operations | |
62 | // ------------------------------------------------------------------------ | |
63 | /* | |
64 | * (non-Javadoc) | |
115b4a01 | 65 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyDescriptors() |
06b9339e BH |
66 | */ |
67 | @Override | |
68 | public IPropertyDescriptor[] getPropertyDescriptors() { | |
69 | return new IPropertyDescriptor[] { | |
5a7326dc | 70 | new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME)}; |
06b9339e BH |
71 | } |
72 | ||
73 | /* | |
74 | * (non-Javadoc) | |
115b4a01 | 75 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object) |
06b9339e BH |
76 | */ |
77 | @Override | |
78 | public Object getPropertyValue(Object id) { | |
79 | if(TRACE_DOMAIN_NAME_PROPERTY_ID.equals(id)) { | |
80 | return fBaseEvent.getName(); | |
81 | } | |
82 | return null; | |
83 | } | |
84 | ||
85 | } |