gdbtrace: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.control.ui / src / org / eclipse / linuxtools / internal / lttng2 / control / ui / views / property / TraceDomainPropertySource.java
CommitLineData
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:
080600d9 10 * Bernd Hufmann - Initial API and implementation
06b9339e 11 **********************************************************************/
8e8c0226 12package org.eclipse.linuxtools.internal.lttng2.control.ui.views.property;
06b9339e 13
8e8c0226
AM
14import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.BufferType;
15import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages;
16import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent;
080600d9 17import org.eclipse.linuxtools.tmf.ui.properties.ReadOnlyTextPropertyDescriptor;
06b9339e 18import org.eclipse.ui.views.properties.IPropertyDescriptor;
06b9339e
BH
19
20/**
06b9339e
BH
21 * <p>
22 * Property source implementation for the trace domain component.
23 * </p>
5a7326dc 24 *
dbd4432d 25 * @author Bernd Hufmann
06b9339e
BH
26 */
27public class TraceDomainPropertySource extends BasePropertySource {
28
29 // ------------------------------------------------------------------------
30 // Constants
31 // ------------------------------------------------------------------------
32
33 /**
34 * The trace domain 'name' property ID.
35 */
36 public static final String TRACE_DOMAIN_NAME_PROPERTY_ID = "trace.domain.name"; //$NON-NLS-1$
37 /**
5a7326dc 38 * The trace domain 'name' property name.
06b9339e
BH
39 */
40 public static final String TRACE_DOMAIN_NAME_PROPERTY_NAME = Messages.TraceControl_DomainNamePropertyName;
ca8c54b3
SD
41 /**
42 * The domain 'buffer type' property ID.
43 */
44 public static final String BUFFER_TYPE_PROPERTY_ID = "trace.domain.bufferType"; //$NON-NLS-1$
45 /**
46 * The domain 'buffer type' property name.
47 */
48 public static final String BUFER_TYPE_PROPERTY_NAME = Messages.TraceControl_BufferTypePropertyName;
5a7326dc 49
06b9339e
BH
50 // ------------------------------------------------------------------------
51 // Attributes
52 // ------------------------------------------------------------------------
11252342 53
06b9339e 54 /**
5a7326dc 55 * The trace domain component which this property source is for.
06b9339e 56 */
ca8c54b3 57 private final TraceDomainComponent fDomain;
5a7326dc 58
06b9339e
BH
59 // ------------------------------------------------------------------------
60 // Constructors
61 // ------------------------------------------------------------------------
11252342 62
06b9339e
BH
63 /**
64 * Constructor
65 * @param component - the trace domain component
66 */
67 public TraceDomainPropertySource(TraceDomainComponent component) {
ca8c54b3 68 fDomain = component;
06b9339e 69 }
5a7326dc 70
06b9339e
BH
71 // ------------------------------------------------------------------------
72 // Operations
73 // ------------------------------------------------------------------------
11252342 74
06b9339e
BH
75 @Override
76 public IPropertyDescriptor[] getPropertyDescriptors() {
83051fc3 77 if (fDomain.getBufferType() == BufferType.BUFFER_TYPE_UNKNOWN) {
ca8c54b3
SD
78 return new IPropertyDescriptor[] {
79 new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME) };
80 }
81
06b9339e 82 return new IPropertyDescriptor[] {
ca8c54b3
SD
83 new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME),
84 new ReadOnlyTextPropertyDescriptor(BUFFER_TYPE_PROPERTY_ID, BUFER_TYPE_PROPERTY_NAME) };
06b9339e
BH
85 }
86
06b9339e
BH
87 @Override
88 public Object getPropertyValue(Object id) {
ca8c54b3 89 if(BUFFER_TYPE_PROPERTY_ID.equals(id)){
83051fc3 90 return fDomain.getBufferType().getInName();
ca8c54b3
SD
91 }
92
06b9339e 93 if(TRACE_DOMAIN_NAME_PROPERTY_ID.equals(id)) {
ca8c54b3 94 return fDomain.getName();
06b9339e
BH
95 }
96 return null;
97 }
98
99}
This page took 0.054586 seconds and 5 git commands to generate.