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
.internal
.lttng2
.ui
.views
.control
.model
.impl
;
14 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IBaseEventInfo
;
15 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.TraceEventType
;
16 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.TraceLogLevel
;
17 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
.EventInfo
;
18 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
.ITraceControlComponent
;
19 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.property
.BaseEventPropertySource
;
20 import org
.eclipse
.ui
.views
.properties
.IPropertySource
;
24 * Implementation of the base trace event component.
27 * @author Bernd Hufmann
29 public class BaseEventComponent
extends TraceControlComponent
{
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
34 * Path to icon file for this component.
36 public static final String TRACE_EVENT_ICON_FILE_ENABLED
= "icons/obj16/event_enabled.gif"; //$NON-NLS-1$
38 // ------------------------------------------------------------------------
40 // ------------------------------------------------------------------------
42 * The Event information implementation.
44 private IBaseEventInfo fEventInfo
;
46 // ------------------------------------------------------------------------
48 // ------------------------------------------------------------------------
52 * @param name - the name of the component.
53 * @param parent - the parent of this component.
55 public BaseEventComponent(String name
, ITraceControlComponent parent
) {
57 setImage(TRACE_EVENT_ICON_FILE_ENABLED
);
58 fEventInfo
= new EventInfo(name
);
61 // ------------------------------------------------------------------------
63 // ------------------------------------------------------------------------
65 * Sets the event information.
66 * @param eventInfo - the event info to set.
68 public void setEventInfo(IBaseEventInfo eventInfo
) {
69 fEventInfo
= eventInfo
;
73 * @return the event type.
75 public TraceEventType
getEventType() {
76 return fEventInfo
.getEventType();
80 * Sets the event type to the given value.
81 * @param type - type to set.
83 public void setEventType(TraceEventType type
) {
84 fEventInfo
.setEventType(type
);
88 * Sets the event type to the value specified by the give name.
89 * @param typeName - the type name.
91 public void setEventType(String typeName
) {
92 fEventInfo
.setEventType(typeName
);
96 * @return the trace event log level
98 public TraceLogLevel
getLogLevel() {
99 return fEventInfo
.getLogLevel();
103 * Sets the trace event log level to the given level
104 * @param level - event log level to set
106 public void setLogLevel(TraceLogLevel level
) {
107 fEventInfo
.setLogLevel(level
);
111 * Sets the trace event log level to the level specified by the given name.
112 * @param levelName - event log level name
114 public void setLogLevel(String levelName
) {
115 fEventInfo
.setLogLevel(levelName
);
120 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
122 @SuppressWarnings("rawtypes")
124 public Object
getAdapter(Class adapter
) {
125 if (adapter
== IPropertySource
.class) {
126 return new BaseEventPropertySource(this);
132 * @return target node component.
134 public TargetNodeComponent
getTargetNode() {
135 return (TargetNodeComponent
) getParent().getParent();
139 * @return if provider kernel or UST
141 public boolean isKernel() {
142 return getParent() instanceof KernelProviderComponent
;
145 // ------------------------------------------------------------------------
147 // ------------------------------------------------------------------------