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
.property
;
14 import java
.util
.ArrayList
;
15 import java
.util
.List
;
17 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.Messages
;
18 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
.impl
.TraceEventComponent
;
19 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
.impl
.TraceProbeEventComponent
;
20 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
21 import org
.eclipse
.ui
.views
.properties
.TextPropertyDescriptor
;
24 * <b><u>TraceEventPropertySource</u></b>
26 * Property source implementation for the trace probe event component.
29 public class TraceProbeEventPropertySource
extends TraceEventPropertySource
{
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
35 * The trace event 'probe address' property ID.
37 public static final String TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID
= "trace.event.probe.address"; //$NON-NLS-1$
39 * The trace event 'probe offset' property ID.
41 public static final String TRACE_EVENT_PROBE_OFFSET_PROPERTY_ID
= "trace.event.probe.offset"; //$NON-NLS-1$
43 * The trace event 'probe symbol' property ID.
45 public static final String TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID
= "trace.event.probe.symbol"; //$NON-NLS-1$
47 * The trace event 'probe address' property name.
49 public static final String TRACE_EVENT_PROBE_ADDRESS_PROPERTY_NAME
= Messages
.TraceControl_ProbeAddressPropertyName
;
51 * The trace event 'probe offset' property ID.
53 public static final String TRACE_EVENT_PROBE_OFFSET_PROPERTY_NAME
= Messages
.TraceControl_ProbeOffsetPropertyName
;
55 * The trace event 'probe symbol' property ID.
57 public static final String TRACE_EVENT_PROBE_SYMBOL_PROPERTY_NAME
= Messages
.TraceControl_ProbeSymbolPropertyName
;
59 // ------------------------------------------------------------------------
61 // ------------------------------------------------------------------------
63 // ------------------------------------------------------------------------
65 // ------------------------------------------------------------------------
66 public TraceProbeEventPropertySource(TraceEventComponent component
) {
68 if (component
.getClass() != TraceProbeEventComponent
.class) {
69 throw new IllegalArgumentException("Invalid type passed. Only class of type TraceProbeEventComponent allowed:\n" + component
.getClass()); //$NON-NLS-1$
73 // ------------------------------------------------------------------------
75 // ------------------------------------------------------------------------
78 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
81 public IPropertyDescriptor
[] getPropertyDescriptors() {
82 IPropertyDescriptor
[] superProperties
= super.getPropertyDescriptors();
83 List
<IPropertyDescriptor
> list
= new ArrayList
<IPropertyDescriptor
>();
84 for (int i
= 0; i
< superProperties
.length
; i
++) {
85 list
.add(superProperties
[i
]);
88 if (fEvent
instanceof TraceProbeEventComponent
) {
89 TraceProbeEventComponent event
= (TraceProbeEventComponent
) fEvent
;
90 if (event
.getAddress() != null) {
91 list
.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID
, TRACE_EVENT_PROBE_ADDRESS_PROPERTY_NAME
));
94 if (event
.getOffset() != null) {
95 list
.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_OFFSET_PROPERTY_ID
, TRACE_EVENT_PROBE_OFFSET_PROPERTY_NAME
));
98 if (event
.getSymbol() != null) {
99 list
.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID
, TRACE_EVENT_PROBE_SYMBOL_PROPERTY_NAME
));
102 return (IPropertyDescriptor
[])list
.toArray(new IPropertyDescriptor
[list
.size()]);
107 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
110 public Object
getPropertyValue(Object id
) {
111 if(TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID
.equals(id
)) {
112 return ((TraceProbeEventComponent
)fEvent
).getAddress();
114 if (TRACE_EVENT_PROBE_OFFSET_PROPERTY_ID
.equals(id
)) {
115 return ((TraceProbeEventComponent
)fEvent
).getOffset();
117 if (TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID
.equals(id
)) {
118 return ((TraceProbeEventComponent
)fEvent
).getSymbol();
120 return super.getPropertyValue(id
);