1
1
/**********************************************************************
2
* Copyright (c) 2012 Ericsson
2
* Copyright (c) 2012, 2013 Ericsson
4
4
* All rights reserved. This program and the accompanying materials are
5
5
* made available under the terms of the Eclipse Public License v1.0 which
6
6
* accompanies this distribution, and is available at
7
7
* http://www.eclipse.org/legal/epl-v10.html
10
* Bernd Hufmann - Initial API and implementation
10
* Bernd Hufmann - Initial API and implementation
11
11
**********************************************************************/
12
12
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property;
14
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BufferType;
14
15
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
15
16
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
17
import org.eclipse.linuxtools.tmf.ui.properties.ReadOnlyTextPropertyDescriptor;
16
18
import org.eclipse.ui.views.properties.IPropertyDescriptor;
17
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
21
22
* Property source implementation for the trace domain component.
24
25
* @author Bernd Hufmann
26
27
public class TraceDomainPropertySource extends BasePropertySource {
35
36
public static final String TRACE_DOMAIN_NAME_PROPERTY_ID = "trace.domain.name"; //$NON-NLS-1$
37
* The trace domain 'name' property name.
38
* The trace domain 'name' property name.
39
40
public static final String TRACE_DOMAIN_NAME_PROPERTY_NAME = Messages.TraceControl_DomainNamePropertyName;
42
* The domain 'buffer type' property ID.
44
public static final String BUFFER_TYPE_PROPERTY_ID = "trace.domain.bufferType"; //$NON-NLS-1$
46
* The domain 'buffer type' property name.
48
public static final String BUFER_TYPE_PROPERTY_NAME = Messages.TraceControl_BufferTypePropertyName;
41
50
// ------------------------------------------------------------------------
43
52
// ------------------------------------------------------------------------
45
* The trace domain component which this property source is for.
55
* The trace domain component which this property source is for.
47
private final TraceDomainComponent fBaseEvent;
57
private final TraceDomainComponent fDomain;
49
59
// ------------------------------------------------------------------------
51
61
// ------------------------------------------------------------------------
54
65
* @param component - the trace domain component
56
67
public TraceDomainPropertySource(TraceDomainComponent component) {
57
fBaseEvent = component;
60
71
// ------------------------------------------------------------------------
62
73
// ------------------------------------------------------------------------
65
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
68
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) };
69
82
return new IPropertyDescriptor[] {
70
new TextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME)};
83
new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME),
84
new ReadOnlyTextPropertyDescriptor(BUFFER_TYPE_PROPERTY_ID, BUFER_TYPE_PROPERTY_NAME) };
75
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
78
88
public Object getPropertyValue(Object id) {
89
if(BUFFER_TYPE_PROPERTY_ID.equals(id)){
90
return fDomain.getBufferType().getInName();
79
93
if(TRACE_DOMAIN_NAME_PROPERTY_ID.equals(id)) {
80
return fBaseEvent.getName();
94
return fDomain.getName();