1 /**********************************************************************
2 * Copyright (c) 2012, 2013 Ericsson
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
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.property
;
14 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
.BufferType
;
15 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.messages
.Messages
;
16 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
.impl
.TraceDomainComponent
;
17 import org
.eclipse
.linuxtools
.tmf
.ui
.properties
.ReadOnlyTextPropertyDescriptor
;
18 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
22 * Property source implementation for the trace domain component.
25 * @author Bernd Hufmann
27 public class TraceDomainPropertySource
extends BasePropertySource
{
29 // ------------------------------------------------------------------------
31 // ------------------------------------------------------------------------
34 * The trace domain 'name' property ID.
36 public static final String TRACE_DOMAIN_NAME_PROPERTY_ID
= "trace.domain.name"; //$NON-NLS-1$
38 * The trace domain 'name' property name.
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
;
50 // ------------------------------------------------------------------------
52 // ------------------------------------------------------------------------
55 * The trace domain component which this property source is for.
57 private final TraceDomainComponent fDomain
;
59 // ------------------------------------------------------------------------
61 // ------------------------------------------------------------------------
65 * @param component - the trace domain component
67 public TraceDomainPropertySource(TraceDomainComponent component
) {
71 // ------------------------------------------------------------------------
73 // ------------------------------------------------------------------------
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
) };
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
) };
88 public Object
getPropertyValue(Object id
) {
89 if(BUFFER_TYPE_PROPERTY_ID
.equals(id
)){
90 return fDomain
.getBufferType().getInName();
93 if(TRACE_DOMAIN_NAME_PROPERTY_ID
.equals(id
)) {
94 return fDomain
.getName();