Merge branch 'master' into lttng_2_0_control_dev
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / control / property / TraceEventPropertySource.java
CommitLineData
06b9339e
BH
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 **********************************************************************/
12package org.eclipse.linuxtools.lttng.ui.views.control.property;
13
14import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
15import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceEventComponent;
16import org.eclipse.ui.views.properties.IPropertyDescriptor;
17import org.eclipse.ui.views.properties.TextPropertyDescriptor;
18
19/**
20 * <b><u>TraceEventPropertySource</u></b>
21 * <p>
22 * Property source implementation for the trace event component.
23 * </p>
24 */
25public class TraceEventPropertySource extends BasePropertySource {
26
27 // ------------------------------------------------------------------------
28 // Constants
29 // ------------------------------------------------------------------------
30 /**
31 * The trace event 'name' property ID.
32 */
33 public static final String TRACE_EVENT_NAME_PROPERTY_ID = "trace.event.name"; //$NON-NLS-1$
34 /**
35 * The trace event 'type' property ID.
36 */
37 public static final String TRACE_EVENT_TYPE_PROPERTY_ID = "trace.event.type"; //$NON-NLS-1$
38 /**
39 * The trace event 'log level' property ID.
40 */
41 public static final String TRACE_EVENT_LOGLEVEL_PROPERTY_ID = "trace.event.loglevel"; //$NON-NLS-1$
42 /**
43 * The trace event 'state' property ID.
44 */
45 public static final String TRACE_EVENT_STATE_PROPERTY_ID = "trace.event.state"; //$NON-NLS-1$
46 /**
47 * The trace event 'name' property name.
48 */
49 public static final String TRACE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName;
50 /**
51 * The trace event 'type' property name.
52 */
53 public static final String TRACE_EVENT_TYPE_PROPERTY_NAME = Messages.TraceControl_EventTypePropertyName;
54 /**
55 * The trace event 'log level' property name.
56 */
57 public static final String TRACE_EVENT_LOGLEVEL_PROPERTY_NAME = Messages.TraceControl_LogLevelPropertyName;
58 /**
59 * The trace event 'state' property name.
60 */
61 public static final String TRACE_EVENT_STATE_PROPERTY_NAME = Messages.TraceControl_StatePropertyName;
62
63 // ------------------------------------------------------------------------
64 // Attributes
65 // ------------------------------------------------------------------------
66 /**
67 * The event component which this property source is for.
68 */
69 private final TraceEventComponent fEvent;
70
71 // ------------------------------------------------------------------------
72 // Constructors
73 // ------------------------------------------------------------------------
74 /**
75 * Constructor
76 * @param component - the base event component
77 */
78 public TraceEventPropertySource(TraceEventComponent component) {
79 fEvent = component;
80 }
81
82 // ------------------------------------------------------------------------
83 // Operations
84 // ------------------------------------------------------------------------
85 /*
86 * (non-Javadoc)
87 * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
88 */
89 @Override
90 public IPropertyDescriptor[] getPropertyDescriptors() {
91 return new IPropertyDescriptor[] {
92 new TextPropertyDescriptor(TRACE_EVENT_NAME_PROPERTY_ID, TRACE_EVENT_NAME_PROPERTY_NAME),
93 new TextPropertyDescriptor(TRACE_EVENT_TYPE_PROPERTY_ID, TRACE_EVENT_TYPE_PROPERTY_NAME),
94 new TextPropertyDescriptor(TRACE_EVENT_LOGLEVEL_PROPERTY_ID, TRACE_EVENT_LOGLEVEL_PROPERTY_NAME),
95 new TextPropertyDescriptor(TRACE_EVENT_STATE_PROPERTY_ID, TRACE_EVENT_STATE_PROPERTY_NAME)};
96 }
97
98 /*
99 * (non-Javadoc)
100 * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
101 */
102 @Override
103 public Object getPropertyValue(Object id) {
104 if(TRACE_EVENT_NAME_PROPERTY_ID.equals(id)) {
105 return fEvent.getName();
106 }
107 if (TRACE_EVENT_TYPE_PROPERTY_ID.equals(id)) {
108 return fEvent.getEventType().name();
109 }
110 if (TRACE_EVENT_LOGLEVEL_PROPERTY_ID.equals(id)) {
111 return fEvent.getLogLevel().name();
112 }
113 if (TRACE_EVENT_STATE_PROPERTY_ID.equals(id)) {
114 return fEvent.getState().name();
115 }
116 return null;
117 }
118
119}
This page took 0.029815 seconds and 5 git commands to generate.