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
.lttng
.ui
.views
.control
.property
;
14 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.Messages
;
15 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.TraceEventComponent
;
16 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
17 import org
.eclipse
.ui
.views
.properties
.TextPropertyDescriptor
;
20 * <b><u>TraceEventPropertySource</u></b>
22 * Property source implementation for the trace event component.
25 public class TraceEventPropertySource
extends BasePropertySource
{
27 // ------------------------------------------------------------------------
29 // ------------------------------------------------------------------------
31 * The trace event 'name' property ID.
33 public static final String TRACE_EVENT_NAME_PROPERTY_ID
= "trace.event.name"; //$NON-NLS-1$
35 * The trace event 'type' property ID.
37 public static final String TRACE_EVENT_TYPE_PROPERTY_ID
= "trace.event.type"; //$NON-NLS-1$
39 * The trace event 'log level' property ID.
41 public static final String TRACE_EVENT_LOGLEVEL_PROPERTY_ID
= "trace.event.loglevel"; //$NON-NLS-1$
43 * The trace event 'state' property ID.
45 public static final String TRACE_EVENT_STATE_PROPERTY_ID
= "trace.event.state"; //$NON-NLS-1$
47 * The trace event 'name' property name.
49 public static final String TRACE_EVENT_NAME_PROPERTY_NAME
= Messages
.TraceControl_EventNamePropertyName
;
51 * The trace event 'type' property name.
53 public static final String TRACE_EVENT_TYPE_PROPERTY_NAME
= Messages
.TraceControl_EventTypePropertyName
;
55 * The trace event 'log level' property name.
57 public static final String TRACE_EVENT_LOGLEVEL_PROPERTY_NAME
= Messages
.TraceControl_LogLevelPropertyName
;
59 * The trace event 'state' property name.
61 public static final String TRACE_EVENT_STATE_PROPERTY_NAME
= Messages
.TraceControl_StatePropertyName
;
63 // ------------------------------------------------------------------------
65 // ------------------------------------------------------------------------
67 * The event component which this property source is for.
69 private final TraceEventComponent fEvent
;
71 // ------------------------------------------------------------------------
73 // ------------------------------------------------------------------------
76 * @param component - the base event component
78 public TraceEventPropertySource(TraceEventComponent component
) {
82 // ------------------------------------------------------------------------
84 // ------------------------------------------------------------------------
87 * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
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
)};
100 * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
103 public Object
getPropertyValue(Object id
) {
104 if(TRACE_EVENT_NAME_PROPERTY_ID
.equals(id
)) {
105 return fEvent
.getName();
107 if (TRACE_EVENT_TYPE_PROPERTY_ID
.equals(id
)) {
108 return fEvent
.getEventType().name();
110 if (TRACE_EVENT_LOGLEVEL_PROPERTY_ID
.equals(id
)) {
111 return fEvent
.getLogLevel().name();
113 if (TRACE_EVENT_STATE_PROPERTY_ID
.equals(id
)) {
114 return fEvent
.getState().name();