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
.ui
.views
.control
.messages
.Messages
;
15 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
.impl
.TraceSessionComponent
;
16 import org
.eclipse
.linuxtools
.tmf
.ui
.properties
.ReadOnlyTextPropertyDescriptor
;
17 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
21 * Property source implementation for the trace session component.
24 * @author Bernd Hufmann
26 public class TraceSessionPropertySource
extends BasePropertySource
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
32 * The trace session name property ID.
34 public static final String TRACE_SESSION_NAME_PROPERTY_ID
= "trace.session.name"; //$NON-NLS-1$
36 * The trace session path property ID.
38 public static final String TRACE_SESSION_PATH_PROPERTY_ID
= "trace.session.path"; //$NON-NLS-1$
40 * The trace session state ID.
42 public static final String TRACE_SESSION_STATE_PROPERTY_ID
= "trace.session.state"; //$NON-NLS-1$
44 * The trace session name property name.
46 public static final String TRACE_SESSION_NAME_PROPERTY_NAME
= Messages
.TraceControl_SessionNamePropertyName
;
48 * The trace session path property name.
50 public static final String TRACE_SESSION_PATH_PROPERTY_NAME
= Messages
.TraceControl_SessionPathPropertyName
;
52 * The trace session state property name.
54 public static final String TRACE_SESSION_STATE_PROPERTY_NAME
= Messages
.TraceControl_StatePropertyName
;
56 // ------------------------------------------------------------------------
58 // ------------------------------------------------------------------------
61 * The session component which this property source is for.
63 private final TraceSessionComponent fSession
;
65 // ------------------------------------------------------------------------
67 // ------------------------------------------------------------------------
71 * @param component - the session component
73 public TraceSessionPropertySource(TraceSessionComponent component
) {
77 // ------------------------------------------------------------------------
79 // ------------------------------------------------------------------------
82 public IPropertyDescriptor
[] getPropertyDescriptors() {
83 return new IPropertyDescriptor
[] {
84 new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_NAME_PROPERTY_ID
, TRACE_SESSION_NAME_PROPERTY_NAME
),
85 new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_PATH_PROPERTY_ID
, TRACE_SESSION_PATH_PROPERTY_NAME
),
86 new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_STATE_PROPERTY_ID
, TRACE_SESSION_STATE_PROPERTY_NAME
)};
90 public Object
getPropertyValue(Object id
) {
91 if(TRACE_SESSION_NAME_PROPERTY_ID
.equals(id
)) {
92 return fSession
.getName();
94 if(TRACE_SESSION_PATH_PROPERTY_ID
.equals(id
)) {
95 return fSession
.getSessionPath();
97 if (TRACE_SESSION_STATE_PROPERTY_ID
.equals(id
)) {
98 return fSession
.getSessionState().name();