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 / BaseEventPropertySource.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.BaseEventComponent;
16import org.eclipse.ui.views.properties.IPropertyDescriptor;
17import org.eclipse.ui.views.properties.TextPropertyDescriptor;
18
19/**
20 * <b><u>BaseEventPropertySource</u></b>
21 * <p>
22 * Property source implementation for the base event component.
23 * </p>
24 */
25public class BaseEventPropertySource extends BasePropertySource {
26
27 // ------------------------------------------------------------------------
28 // Constants
29 // ------------------------------------------------------------------------
30
31 /**
32 * The base event 'name' property ID.
33 */
34 public static final String BASE_EVENT_NAME_PROPERTY_ID = "base.event.name"; //$NON-NLS-1$
35 /**
36 * The base event 'type' property ID.
37 */
38 public static final String BASE_EVENT_TYPE_PROPERTY_ID = "base.event.type"; //$NON-NLS-1$
39 /**
40 * The base event 'log level' property ID.
41 */
42 public static final String BASE_EVENT_LOGLEVEL_PROPERTY_ID = "base.event.loglevel"; //$NON-NLS-1$
43 /**
44 * The base event 'name' property name.
45 */
46 public static final String BASE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName;
47 /**
48 * The base event 'type' property name.
49 */
50 public static final String BASE_EVENT_TYPE_PROPERTY_NAME = Messages.TraceControl_EventTypePropertyName;
51 /**
52 * The base event 'log level' property name.
53 */
54 public static final String BASE_EVENT_LOGLEVEL_PROPERTY_NAME = Messages.TraceControl_LogLevelPropertyName;
55
56 // ------------------------------------------------------------------------
57 // Attributes
58 // ------------------------------------------------------------------------
59 /**
60 * The base event component which this property source is for.
61 */
62 private final BaseEventComponent fBaseEvent;
63
64 // ------------------------------------------------------------------------
65 // Constructors
66 // ------------------------------------------------------------------------
67 /**
68 * Constructor
69 * @param component - the base event component
70 */
71 public BaseEventPropertySource(BaseEventComponent component) {
72 fBaseEvent = component;
73 }
74
75 // ------------------------------------------------------------------------
76 // Operations
77 // ------------------------------------------------------------------------
78 /*
79 * (non-Javadoc)
80 * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
81 */
82 @Override
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)};
88 }
89
90 /*
91 * (non-Javadoc)
92 * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
93 */
94 @Override
95 public Object getPropertyValue(Object id) {
96 if(BASE_EVENT_NAME_PROPERTY_ID.equals(id)) {
97 return fBaseEvent.getName();
98 }
99 if (BASE_EVENT_TYPE_PROPERTY_ID.equals(id)) {
100 return fBaseEvent.getEventType().name();
101 }
102 if (BASE_EVENT_LOGLEVEL_PROPERTY_ID.equals(id)) {
103 return fBaseEvent.getLogLevel().name();
104 }
105 return null;
106 }
107
108}
This page took 0.029402 seconds and 5 git commands to generate.