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 org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
15
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent;
16
import org.eclipse.ui.views.properties.IPropertyDescriptor;
17
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
21
* Property source implementation for the target node component.
24
* @author Bernd Hufmann
26
public class TargetNodePropertySource extends BasePropertySource {
28
// ------------------------------------------------------------------------
30
// ------------------------------------------------------------------------
32
* The node name property ID.
34
public static final String TARGET_NODE_NAME_PROPERTY_ID = "target.node.name"; //$NON-NLS-1$
36
* The node address property ID.
38
public static final String TARGET_NODE_ADDRESS_PROPERTY_ID = "target.node.address"; //$NON-NLS-1$
40
* The state property ID.
42
public static final String TARGET_NODE_STATE_PROPERTY_ID = "target.node.state"; //$NON-NLS-1$
44
* The node name property name.
46
public static final String TARGET_NODE_NAME_PROPERTY_NAME = Messages.TraceControl_HostNamePropertyName;
48
* The node address property name.
50
public static final String TARGET_NODE_ADDRESS_PROPERTY_NAME = Messages.TraceControl_HostAddressPropertyName;
52
* The state address property name.
54
public static final String TARGET_NODE_STATE_PROPERTY_NAME = Messages.TraceControl_StatePropertyName;
56
// ------------------------------------------------------------------------
58
// ------------------------------------------------------------------------
60
* The node component which this property source is for.
62
private final TargetNodeComponent fTargetNode;
64
// ------------------------------------------------------------------------
66
// ------------------------------------------------------------------------
69
* @param component - the node component
71
public TargetNodePropertySource(TargetNodeComponent component) {
72
fTargetNode = component;
75
// ------------------------------------------------------------------------
77
// ------------------------------------------------------------------------
80
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
83
public IPropertyDescriptor[] getPropertyDescriptors() {
84
return new IPropertyDescriptor[] {
85
new TextPropertyDescriptor(TARGET_NODE_NAME_PROPERTY_ID, TARGET_NODE_NAME_PROPERTY_NAME),
86
new TextPropertyDescriptor(TARGET_NODE_ADDRESS_PROPERTY_ID, TARGET_NODE_ADDRESS_PROPERTY_NAME),
87
new TextPropertyDescriptor(TARGET_NODE_STATE_PROPERTY_ID, TARGET_NODE_STATE_PROPERTY_NAME)};
92
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
95
public Object getPropertyValue(Object id) {
96
if(TARGET_NODE_NAME_PROPERTY_ID.equals(id)) {
97
return fTargetNode.getName();
99
if (TARGET_NODE_ADDRESS_PROPERTY_ID.equals(id)) {
100
return fTargetNode.getHostName();
102
if (TARGET_NODE_STATE_PROPERTY_ID.equals(id)) {
103
return fTargetNode.getTargetNodeState().name();