1 /**********************************************************************
2 * Copyright (c) 2012 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
.lttng
.ui
.views
.control
.property
;
14 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.views
.control
.Messages
;
15 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.views
.control
.model
.impl
.TraceSessionComponent
;
16 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
17 import org
.eclipse
.ui
.views
.properties
.TextPropertyDescriptor
;
20 * <b><u>TraceSessionPropertySource</u></b>
22 * Property source implementation for the trace session component.
25 public class TraceSessionPropertySource
extends BasePropertySource
{
27 // ------------------------------------------------------------------------
29 // ------------------------------------------------------------------------
31 * The trace session name property ID.
33 public static final String TRACE_SESSION_NAME_PROPERTY_ID
= "trace.session.name"; //$NON-NLS-1$
35 * The trace session path property ID.
37 public static final String TRACE_SESSION_PATH_PROPERTY_ID
= "trace.session.path"; //$NON-NLS-1$
39 * The trace session state ID.
41 public static final String TRACE_SESSION_STATE_PROPERTY_ID
= "trace.session.state"; //$NON-NLS-1$
43 * The trace session name property name.
45 public static final String TRACE_SESSION_NAME_PROPERTY_NAME
= Messages
.TraceControl_SessionNamePropertyName
;
47 * The trace session path property name.
49 public static final String TRACE_SESSION_PATH_PROPERTY_NAME
= Messages
.TraceControl_SessionPathPropertyName
;
51 * The trace session state property name.
53 public static final String TRACE_SESSION_STATE_PROPERTY_NAME
= Messages
.TraceControl_StatePropertyName
;
55 // ------------------------------------------------------------------------
57 // ------------------------------------------------------------------------
59 * The session component which this property source is for.
61 private final TraceSessionComponent fSession
;
63 // ------------------------------------------------------------------------
65 // ------------------------------------------------------------------------
68 * @param component - the session component
70 public TraceSessionPropertySource(TraceSessionComponent component
) {
74 // ------------------------------------------------------------------------
76 // ------------------------------------------------------------------------
79 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
82 public IPropertyDescriptor
[] getPropertyDescriptors() {
83 return new IPropertyDescriptor
[] {
84 new TextPropertyDescriptor(TRACE_SESSION_NAME_PROPERTY_ID
, TRACE_SESSION_NAME_PROPERTY_NAME
),
85 new TextPropertyDescriptor(TRACE_SESSION_PATH_PROPERTY_ID
, TRACE_SESSION_PATH_PROPERTY_NAME
),
86 new TextPropertyDescriptor(TRACE_SESSION_STATE_PROPERTY_ID
, TRACE_SESSION_STATE_PROPERTY_NAME
)};
91 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
94 public Object
getPropertyValue(Object id
) {
95 if(TRACE_SESSION_NAME_PROPERTY_ID
.equals(id
)) {
96 return fSession
.getName();
98 if(TRACE_SESSION_PATH_PROPERTY_ID
.equals(id
)) {
99 return fSession
.getSessionPath();
101 if (TRACE_SESSION_STATE_PROPERTY_ID
.equals(id
)) {
102 return fSession
.getSessionState().name();