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
.BaseEventComponent
;
16 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
17 import org
.eclipse
.ui
.views
.properties
.TextPropertyDescriptor
;
20 * <b><u>BaseEventPropertySource</u></b>
22 * Property source implementation for the base event component.
25 public class BaseEventPropertySource
extends BasePropertySource
{
27 // ------------------------------------------------------------------------
29 // ------------------------------------------------------------------------
32 * The base event 'name' property ID.
34 public static final String BASE_EVENT_NAME_PROPERTY_ID
= "base.event.name"; //$NON-NLS-1$
36 * The base event 'type' property ID.
38 public static final String BASE_EVENT_TYPE_PROPERTY_ID
= "base.event.type"; //$NON-NLS-1$
40 * The base event 'log level' property ID.
42 public static final String BASE_EVENT_LOGLEVEL_PROPERTY_ID
= "base.event.loglevel"; //$NON-NLS-1$
44 * The base event 'name' property name.
46 public static final String BASE_EVENT_NAME_PROPERTY_NAME
= Messages
.TraceControl_EventNamePropertyName
;
48 * The base event 'type' property name.
50 public static final String BASE_EVENT_TYPE_PROPERTY_NAME
= Messages
.TraceControl_EventTypePropertyName
;
52 * The base event 'log level' property name.
54 public static final String BASE_EVENT_LOGLEVEL_PROPERTY_NAME
= Messages
.TraceControl_LogLevelPropertyName
;
56 // ------------------------------------------------------------------------
58 // ------------------------------------------------------------------------
60 * The base event component which this property source is for.
62 private final BaseEventComponent fBaseEvent
;
64 // ------------------------------------------------------------------------
66 // ------------------------------------------------------------------------
69 * @param component - the base event component
71 public BaseEventPropertySource(BaseEventComponent component
) {
72 fBaseEvent
= component
;
75 // ------------------------------------------------------------------------
77 // ------------------------------------------------------------------------
80 * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
83 public IPropertyDescriptor
[] getPropertyDescriptors() {
84 return new IPropertyDescriptor
[] {
85 new TextPropertyDescriptor(BASE_EVENT_NAME_PROPERTY_ID
, BASE_EVENT_NAME_PROPERTY_NAME
),
86 new TextPropertyDescriptor(BASE_EVENT_TYPE_PROPERTY_ID
, BASE_EVENT_TYPE_PROPERTY_NAME
),
87 new TextPropertyDescriptor(BASE_EVENT_LOGLEVEL_PROPERTY_ID
, BASE_EVENT_LOGLEVEL_PROPERTY_NAME
)};
92 * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
95 public Object
getPropertyValue(Object id
) {
96 if(BASE_EVENT_NAME_PROPERTY_ID
.equals(id
)) {
97 return fBaseEvent
.getName();
99 if (BASE_EVENT_TYPE_PROPERTY_ID
.equals(id
)) {
100 return fBaseEvent
.getEventType().name();
102 if (BASE_EVENT_LOGLEVEL_PROPERTY_ID
.equals(id
)) {
103 return fBaseEvent
.getLogLevel().name();