1 /**********************************************************************
2 * Copyright (c) 2012, 2014 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
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.impl
;
14 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.IEventInfo
;
15 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.impl
.ProbeEventInfo
;
16 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.ITraceControlComponent
;
17 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.property
.TraceProbeEventPropertySource
;
18 import org
.eclipse
.ui
.views
.properties
.IPropertySource
;
23 * Implementation of the trace channel component.
26 * @author Bernd Hufmann
28 public class TraceProbeEventComponent
extends TraceEventComponent
{
29 // ------------------------------------------------------------------------
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
37 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
42 * @param name - the name of the component.
43 * @param parent - the parent of this component.
45 public TraceProbeEventComponent(String name
, ITraceControlComponent parent
) {
47 fEventInfo
= new ProbeEventInfo(name
);
50 // ------------------------------------------------------------------------
52 // ------------------------------------------------------------------------
55 * Sets the event information.
56 * @param eventInfo - the event information to set.
59 public void setEventInfo(IEventInfo eventInfo
) {
60 if (eventInfo
instanceof ProbeEventInfo
) {
61 fEventInfo
= eventInfo
;
64 throw new IllegalArgumentException("Invalid type passed. Only class of type ProbeEventInfo allowed:\n" + eventInfo
.getClass()); //$NON-NLS-1$
68 public <T
> T
getAdapter(Class
<T
> adapter
) {
69 if (adapter
== IPropertySource
.class) {
70 return adapter
.cast(new TraceProbeEventPropertySource(this));
75 * @return the address of the probe. (null if Symbol is used)
77 public String
getAddress() {
78 return getEventInfo().getAddress();
81 * Sets the address of the probe.
82 * @param address - a address
84 public void setAddress(String address
) {
85 getEventInfo().setAddress(address
);
88 * @return the offset applied to the symbol.
90 public String
getOffset() {
91 return getEventInfo().getOffset();
94 * Sets the offset applied to the symbol. (valid if symbol is used)
95 * @param offset - a offset
97 public void setOffset(String offset
) {
98 getEventInfo().setOffset(offset
);
101 * @return the symbol name. (null if address is used)
103 public String
getSymbol() {
104 return getEventInfo().getSymbol();
107 * Sets the symbol name.
108 * @param symbol - a symbol name (null if address is used)
110 public void setSymbol(String symbol
) {
111 getEventInfo().setSymbol(symbol
);
115 * @return the probe string whether it be an address or a symbol and an
118 public String
getProbeString() {
119 return getEventInfo().getProbeString();
122 // ------------------------------------------------------------------------
124 // ------------------------------------------------------------------------
125 private ProbeEventInfo
getEventInfo() {
126 return (ProbeEventInfo
) fEventInfo
;