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
.model
.impl
;
14 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.IBaseEventInfo
;
15 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.ITraceControlComponent
;
16 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TraceEventType
;
17 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TraceLogLevel
;
18 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.property
.BaseEventPropertySource
;
19 import org
.eclipse
.ui
.views
.properties
.IPropertySource
;
22 * <b><u>BaseEventComponent</u></b>
24 * Implementation of the base trace event component.
27 public class BaseEventComponent
extends TraceControlComponent
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
32 * Path to icon file for this component.
34 public static final String TRACE_EVENT_ICON_FILE_ENABLED
= "icons/obj16/event_enabled.gif"; //$NON-NLS-1$
36 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
40 * The Event information implementation.
42 private IBaseEventInfo fEventInfo
;
44 // ------------------------------------------------------------------------
46 // ------------------------------------------------------------------------
50 * @param name - the name of the component.
51 * @param parent - the parent of this component.
53 public BaseEventComponent(String name
, ITraceControlComponent parent
) {
55 setImage(TRACE_EVENT_ICON_FILE_ENABLED
);
56 fEventInfo
= new EventInfo(name
);
59 // ------------------------------------------------------------------------
61 // ------------------------------------------------------------------------
63 * Sets the event information.
64 * @param eventInfo - the event info to set.
66 public void setEventInfo(IBaseEventInfo eventInfo
) {
67 fEventInfo
= eventInfo
;
71 * @return the event type.
73 public TraceEventType
getEventType() {
74 return fEventInfo
.getEventType();
78 * Sets the event type to the given value.
79 * @param type - type to set.
81 public void setEventType(TraceEventType type
) {
82 fEventInfo
.setEventType(type
);
86 * Sets the event type to the value specified by the give name.
87 * @param typeName - the type name.
89 public void setEventType(String typeName
) {
90 fEventInfo
.setEventType(typeName
);
94 * @return the trace event log level
96 public TraceLogLevel
getLogLevel() {
97 return fEventInfo
.getLogLevel();
101 * Sets the trace event log level to the given level
102 * @param level - event log level to set
104 public void setLogLevel(TraceLogLevel level
) {
105 fEventInfo
.setLogLevel(level
);
109 * Sets the trace event log level to the level specified by the given name.
110 * @param levelName - event log level name
112 public void setLogLevel(String levelName
) {
113 fEventInfo
.setLogLevel(levelName
);
118 * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
120 @SuppressWarnings("rawtypes")
122 public Object
getAdapter(Class adapter
) {
123 if (adapter
== IPropertySource
.class) {
124 return new BaseEventPropertySource(this);
128 // ------------------------------------------------------------------------
130 // ------------------------------------------------------------------------