Update internal packages export in LTTng 2.0 control + update java doc
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / model / impl / TraceProbeEventComponent.java
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 **********************************************************************/
12 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl;
13
14 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IEventInfo;
15 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ProbeEventInfo;
16 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
17 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.TraceProbeEventPropertySource;
18 import org.eclipse.ui.views.properties.IPropertySource;
19
20
21 /**
22 * <p>
23 * Implementation of the trace channel component.
24 * </p>
25 *
26 * @author Bernd Hufmann
27 */
28 public class TraceProbeEventComponent extends TraceEventComponent {
29 // ------------------------------------------------------------------------
30 // Constants
31 // ------------------------------------------------------------------------
32
33 // ------------------------------------------------------------------------
34 // Attributes
35 // ------------------------------------------------------------------------
36
37 // ------------------------------------------------------------------------
38 // Constructors
39 // ------------------------------------------------------------------------
40 /**
41 * Constructor
42 * @param name - the name of the component.
43 * @param parent - the parent of this component.
44 */
45 public TraceProbeEventComponent(String name, ITraceControlComponent parent) {
46 super(name, parent);
47 fEventInfo = new ProbeEventInfo(name);
48 }
49
50 // ------------------------------------------------------------------------
51 // Accessors
52 // ------------------------------------------------------------------------
53
54 /**
55 * Sets the event information.
56 * @param eventInfo - the event information to set.
57 */
58 @Override
59 public void setEventInfo(IEventInfo eventInfo) {
60 if (eventInfo instanceof ProbeEventInfo) {
61 fEventInfo = eventInfo;
62 return;
63 }
64 throw new IllegalArgumentException("Invalid type passed. Only class of type ProbeEventInfo allowed:\n" + eventInfo.getClass()); //$NON-NLS-1$
65 }
66
67 /*
68 * (non-Javadoc)
69 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
70 */
71 @SuppressWarnings("rawtypes")
72 @Override
73 public Object getAdapter(Class adapter) {
74 if (adapter == IPropertySource.class) {
75 return new TraceProbeEventPropertySource(this);
76 }
77 return null;
78 }
79 /**
80 * @return the address of the probe. (null if Symbol is used)
81 */
82 public String getAddress() {
83 return getEventInfo().getAddress();
84 }
85 /**
86 * Sets the address of the probe.
87 * @param address - a address
88 */
89 public void setAddress(String address) {
90 getEventInfo().setAddress(address);
91 }
92 /**
93 * @return the offset applied to the symbol.
94 */
95 public String getOffset() {
96 return getEventInfo().getOffset();
97 }
98 /**
99 * Sets the offset applied to the symbol. (valid if symbol is used)
100 * @param offset - a offset
101 */
102 public void setOffset(String offset) {
103 getEventInfo().setOffset(offset);
104 }
105 /**
106 * @return the symbol name. (null if address is used)
107 */
108 public String getSymbol() {
109 return getEventInfo().getSymbol();
110 }
111 /**
112 * Sets the symbol name.
113 * @param symbol - a symbol name (null if address is used)
114 */
115 public void setSymbol(String symbol) {
116 getEventInfo().setSymbol(symbol);
117 }
118
119 // ------------------------------------------------------------------------
120 // Helper methods
121 // ------------------------------------------------------------------------
122 private ProbeEventInfo getEventInfo() {
123 return (ProbeEventInfo) fEventInfo;
124 }
125
126 }
This page took 0.07313 seconds and 5 git commands to generate.