1 /**********************************************************************
2 * Copyright (c) 2012, 2013 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
.property
;
14 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.messages
.Messages
;
15 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.impl
.TargetNodeComponent
;
16 import org
.eclipse
.tracecompass
.tmf
.ui
.properties
.ReadOnlyTextPropertyDescriptor
;
17 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
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 version property ID.
46 public static final String TARGET_NODE_VERSION_PROPERTY_ID
= "target.node.version"; //$NON-NLS-1$
49 * The node name property name.
51 public static final String TARGET_NODE_NAME_PROPERTY_NAME
= Messages
.TraceControl_HostNamePropertyName
;
53 * The node address property name.
55 public static final String TARGET_NODE_ADDRESS_PROPERTY_NAME
= Messages
.TraceControl_HostAddressPropertyName
;
57 * The state address property name.
59 public static final String TARGET_NODE_STATE_PROPERTY_NAME
= Messages
.TraceControl_StatePropertyName
;
61 * The node version property name.
63 public static final String TARGET_NODE_VERSION_PROPERTY_NAME
= Messages
.TraceControl_VersionPropertyName
;
65 // ------------------------------------------------------------------------
67 // ------------------------------------------------------------------------
69 * The node component which this property source is for.
71 private final TargetNodeComponent fTargetNode
;
73 // ------------------------------------------------------------------------
75 // ------------------------------------------------------------------------
78 * @param component - the node component
80 public TargetNodePropertySource(TargetNodeComponent component
) {
81 fTargetNode
= component
;
84 // ------------------------------------------------------------------------
86 // ------------------------------------------------------------------------
89 public IPropertyDescriptor
[] getPropertyDescriptors() {
90 return new IPropertyDescriptor
[] {
91 new ReadOnlyTextPropertyDescriptor(TARGET_NODE_NAME_PROPERTY_ID
, TARGET_NODE_NAME_PROPERTY_NAME
),
92 new ReadOnlyTextPropertyDescriptor(TARGET_NODE_ADDRESS_PROPERTY_ID
, TARGET_NODE_ADDRESS_PROPERTY_NAME
),
93 new ReadOnlyTextPropertyDescriptor(TARGET_NODE_STATE_PROPERTY_ID
, TARGET_NODE_STATE_PROPERTY_NAME
),
94 new ReadOnlyTextPropertyDescriptor(TARGET_NODE_VERSION_PROPERTY_ID
, TARGET_NODE_VERSION_PROPERTY_NAME
)};
98 public Object
getPropertyValue(Object id
) {
99 if(TARGET_NODE_NAME_PROPERTY_ID
.equals(id
)) {
100 return fTargetNode
.getName();
102 if (TARGET_NODE_ADDRESS_PROPERTY_ID
.equals(id
)) {
103 return fTargetNode
.getHostName();
105 if (TARGET_NODE_STATE_PROPERTY_ID
.equals(id
)) {
106 return fTargetNode
.getTargetNodeState().name();
108 if (TARGET_NODE_VERSION_PROPERTY_ID
.equals(id
)) {
109 return fTargetNode
.getNodeVersion();