Improve package tangle index for LTTng 2.0 control design
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / model / impl / BaseEventComponent.java
CommitLineData
eb1bab5b
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 **********************************************************************/
115b4a01 12package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl;
eb1bab5b 13
9315aeee
BH
14import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo;
15import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
16import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
17import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.EventInfo;
115b4a01 18import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
115b4a01 19import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BaseEventPropertySource;
06b9339e 20import org.eclipse.ui.views.properties.IPropertySource;
eb1bab5b
BH
21
22/**
23 * <b><u>BaseEventComponent</u></b>
24 * <p>
25 * Implementation of the base trace event component.
26 * </p>
27 */
28public class BaseEventComponent extends TraceControlComponent {
29 // ------------------------------------------------------------------------
30 // Constants
31 // ------------------------------------------------------------------------
32 /**
33 * Path to icon file for this component.
34 */
35 public static final String TRACE_EVENT_ICON_FILE_ENABLED = "icons/obj16/event_enabled.gif"; //$NON-NLS-1$
36
37 // ------------------------------------------------------------------------
38 // Attributes
39 // ------------------------------------------------------------------------
40 /**
41 * The Event information implementation.
42 */
43 private IBaseEventInfo fEventInfo;
44
45 // ------------------------------------------------------------------------
46 // Constructors
47 // ------------------------------------------------------------------------
48
49 /**
50 * Constructor
51 * @param name - the name of the component.
52 * @param parent - the parent of this component.
53 */
54 public BaseEventComponent(String name, ITraceControlComponent parent) {
55 super(name, parent);
56 setImage(TRACE_EVENT_ICON_FILE_ENABLED);
57 fEventInfo = new EventInfo(name);
58 }
59
60 // ------------------------------------------------------------------------
61 // Accessors
62 // ------------------------------------------------------------------------
63 /**
64 * Sets the event information.
65 * @param eventInfo - the event info to set.
66 */
67 public void setEventInfo(IBaseEventInfo eventInfo) {
68 fEventInfo = eventInfo;
69 }
70
71 /**
72 * @return the event type.
73 */
74 public TraceEventType getEventType() {
75 return fEventInfo.getEventType();
76 }
77
78 /**
79 * Sets the event type to the given value.
80 * @param type - type to set.
81 */
82 public void setEventType(TraceEventType type) {
83 fEventInfo.setEventType(type);
84 }
85
86 /**
87 * Sets the event type to the value specified by the give name.
88 * @param typeName - the type name.
89 */
90 public void setEventType(String typeName) {
91 fEventInfo.setEventType(typeName);
92 }
93
94 /**
95 * @return the trace event log level
96 */
97 public TraceLogLevel getLogLevel() {
98 return fEventInfo.getLogLevel();
99 }
100
101 /**
102 * Sets the trace event log level to the given level
103 * @param level - event log level to set
104 */
105 public void setLogLevel(TraceLogLevel level) {
106 fEventInfo.setLogLevel(level);
107 }
108
109 /**
110 * Sets the trace event log level to the level specified by the given name.
111 * @param levelName - event log level name
112 */
113 public void setLogLevel(String levelName) {
114 fEventInfo.setLogLevel(levelName);
115 }
116
06b9339e
BH
117 /*
118 * (non-Javadoc)
115b4a01 119 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
06b9339e
BH
120 */
121 @SuppressWarnings("rawtypes")
122 @Override
123 public Object getAdapter(Class adapter) {
124 if (adapter == IPropertySource.class) {
125 return new BaseEventPropertySource(this);
126 }
127 return null;
128 }
6503ae0f
BH
129
130 /**
131 * @return target node component.
132 */
133 public TargetNodeComponent getTargetNode() {
134 return (TargetNodeComponent) getParent().getParent();
135 }
136
137 /**
138 * @return if provider kernel or UST
139 */
140 public boolean isKernel() {
141 return getParent() instanceof KernelProviderComponent;
142 }
143
eb1bab5b
BH
144 // ------------------------------------------------------------------------
145 // Operations
146 // ------------------------------------------------------------------------
147}
This page took 0.035847 seconds and 5 git commands to generate.