ctf: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / property / TraceDomainPropertySource.java
... / ...
CommitLineData
1/**********************************************************************
2 * Copyright (c) 2012, 2014 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 **********************************************************************/
12package org.eclipse.tracecompass.internal.lttng2.control.ui.views.property;
13
14import org.eclipse.tracecompass.internal.lttng2.control.core.model.impl.BufferType;
15import org.eclipse.tracecompass.internal.lttng2.control.ui.views.messages.Messages;
16import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent;
17import org.eclipse.tracecompass.tmf.ui.properties.ReadOnlyTextPropertyDescriptor;
18import org.eclipse.ui.views.properties.IPropertyDescriptor;
19
20/**
21 * <p>
22 * Property source implementation for the trace domain component.
23 * </p>
24 *
25 * @author Bernd Hufmann
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 /**
38 * The trace domain 'name' property name.
39 */
40 public static final String TRACE_DOMAIN_NAME_PROPERTY_NAME = Messages.TraceControl_DomainNamePropertyName;
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;
49
50 // ------------------------------------------------------------------------
51 // Attributes
52 // ------------------------------------------------------------------------
53
54 /**
55 * The trace domain component which this property source is for.
56 */
57 private final TraceDomainComponent fDomain;
58
59 // ------------------------------------------------------------------------
60 // Constructors
61 // ------------------------------------------------------------------------
62
63 /**
64 * Constructor
65 * @param component - the trace domain component
66 */
67 public TraceDomainPropertySource(TraceDomainComponent component) {
68 fDomain = component;
69 }
70
71 // ------------------------------------------------------------------------
72 // Operations
73 // ------------------------------------------------------------------------
74
75 @Override
76 public IPropertyDescriptor[] getPropertyDescriptors() {
77 if (fDomain.getBufferType() == BufferType.BUFFER_TYPE_UNKNOWN) {
78 return new IPropertyDescriptor[] {
79 new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME) };
80 }
81
82 return new IPropertyDescriptor[] {
83 new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME),
84 new ReadOnlyTextPropertyDescriptor(BUFFER_TYPE_PROPERTY_ID, BUFER_TYPE_PROPERTY_NAME) };
85 }
86
87 @Override
88 public Object getPropertyValue(Object id) {
89 if(BUFFER_TYPE_PROPERTY_ID.equals(id)){
90 return fDomain.getBufferType().getInName();
91 }
92
93 if(TRACE_DOMAIN_NAME_PROPERTY_ID.equals(id)) {
94 return fDomain.getName();
95 }
96 return null;
97 }
98
99}
This page took 0.024997 seconds and 5 git commands to generate.