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