Update internal packages export in LTTng 2.0 control + update java doc
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / property / TraceSessionPropertySource.java
1 /**********************************************************************
2 * Copyright (c) 2012 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 **********************************************************************/
12 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property;
13
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.ui.views.properties.IPropertyDescriptor;
17 import org.eclipse.ui.views.properties.TextPropertyDescriptor;
18
19 /**
20 * <p>
21 * Property source implementation for the trace session component.
22 * </p>
23 *
24 * @author Bernd Hufmann
25 */
26 public class TraceSessionPropertySource extends BasePropertySource {
27
28 // ------------------------------------------------------------------------
29 // Constants
30 // ------------------------------------------------------------------------
31 /**
32 * The trace session name property ID.
33 */
34 public static final String TRACE_SESSION_NAME_PROPERTY_ID = "trace.session.name"; //$NON-NLS-1$
35 /**
36 * The trace session path property ID.
37 */
38 public static final String TRACE_SESSION_PATH_PROPERTY_ID = "trace.session.path"; //$NON-NLS-1$
39 /**
40 * The trace session state ID.
41 */
42 public static final String TRACE_SESSION_STATE_PROPERTY_ID = "trace.session.state"; //$NON-NLS-1$
43 /**
44 * The trace session name property name.
45 */
46 public static final String TRACE_SESSION_NAME_PROPERTY_NAME = Messages.TraceControl_SessionNamePropertyName;
47 /**
48 * The trace session path property name.
49 */
50 public static final String TRACE_SESSION_PATH_PROPERTY_NAME = Messages.TraceControl_SessionPathPropertyName;
51 /**
52 * The trace session state property name.
53 */
54 public static final String TRACE_SESSION_STATE_PROPERTY_NAME = Messages.TraceControl_StatePropertyName;
55
56 // ------------------------------------------------------------------------
57 // Attributes
58 // ------------------------------------------------------------------------
59 /**
60 * The session component which this property source is for.
61 */
62 private final TraceSessionComponent fSession;
63
64 // ------------------------------------------------------------------------
65 // Constructors
66 // ------------------------------------------------------------------------
67 /**
68 * Constructor
69 * @param component - the session component
70 */
71 public TraceSessionPropertySource(TraceSessionComponent component) {
72 fSession = component;
73 }
74
75 // ------------------------------------------------------------------------
76 // Operations
77 // ------------------------------------------------------------------------
78 /*
79 * (non-Javadoc)
80 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
81 */
82 @Override
83 public IPropertyDescriptor[] getPropertyDescriptors() {
84 return new IPropertyDescriptor[] {
85 new TextPropertyDescriptor(TRACE_SESSION_NAME_PROPERTY_ID, TRACE_SESSION_NAME_PROPERTY_NAME),
86 new TextPropertyDescriptor(TRACE_SESSION_PATH_PROPERTY_ID, TRACE_SESSION_PATH_PROPERTY_NAME),
87 new TextPropertyDescriptor(TRACE_SESSION_STATE_PROPERTY_ID, TRACE_SESSION_STATE_PROPERTY_NAME)};
88 }
89
90 /*
91 * (non-Javadoc)
92 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
93 */
94 @Override
95 public Object getPropertyValue(Object id) {
96 if(TRACE_SESSION_NAME_PROPERTY_ID.equals(id)) {
97 return fSession.getName();
98 }
99 if(TRACE_SESSION_PATH_PROPERTY_ID.equals(id)) {
100 return fSession.getSessionPath();
101 }
102 if (TRACE_SESSION_STATE_PROPERTY_ID.equals(id)) {
103 return fSession.getSessionState().name();
104 }
105 return null;
106 }
107 }
This page took 0.035348 seconds and 6 git commands to generate.