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
.lttng
.ui
.views
.control
.property
;
14 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.Messages
;
15 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.TargetNodeComponent
;
16 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
17 import org
.eclipse
.ui
.views
.properties
.TextPropertyDescriptor
;
20 * <b><u>TargetNodePropertySource</u></b>
22 * Property source implementation for the target node component.
25 public class TargetNodePropertySource
extends BasePropertySource
{
27 // ------------------------------------------------------------------------
29 // ------------------------------------------------------------------------
31 * The node name property ID.
33 public static final String TARGET_NODE_NAME_PROPERTY_ID
= "target.node.name"; //$NON-NLS-1$
35 * The node address property ID.
37 public static final String TARGET_NODE_ADDRESS_PROPERTY_ID
= "target.node.address"; //$NON-NLS-1$
39 * The state property ID.
41 public static final String TARGET_NODE_STATE_PROPERTY_ID
= "target.node.state"; //$NON-NLS-1$
43 * The node name property name.
45 public static final String TARGET_NODE_NAME_PROPERTY_NAME
= Messages
.TraceControl_HostNamePropertyName
;
47 * The node address property name.
49 public static final String TARGET_NODE_ADDRESS_PROPERTY_NAME
= Messages
.TraceControl_HostAddressPropertyName
;
51 * The state address property name.
53 public static final String TARGET_NODE_STATE_PROPERTY_NAME
= Messages
.TraceControl_StatePropertyName
;
55 // ------------------------------------------------------------------------
57 // ------------------------------------------------------------------------
59 * The node component which this property source is for.
61 private final TargetNodeComponent fTargetNode
;
63 // ------------------------------------------------------------------------
65 // ------------------------------------------------------------------------
68 * @param component - the node component
70 public TargetNodePropertySource(TargetNodeComponent component
) {
71 fTargetNode
= component
;
74 // ------------------------------------------------------------------------
76 // ------------------------------------------------------------------------
79 * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
82 public IPropertyDescriptor
[] getPropertyDescriptors() {
83 return new IPropertyDescriptor
[] {
84 new TextPropertyDescriptor(TARGET_NODE_NAME_PROPERTY_ID
, TARGET_NODE_NAME_PROPERTY_NAME
),
85 new TextPropertyDescriptor(TARGET_NODE_ADDRESS_PROPERTY_ID
, TARGET_NODE_ADDRESS_PROPERTY_NAME
),
86 new TextPropertyDescriptor(TARGET_NODE_STATE_PROPERTY_ID
, TARGET_NODE_STATE_PROPERTY_NAME
)};
91 * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
94 public Object
getPropertyValue(Object id
) {
95 if(TARGET_NODE_NAME_PROPERTY_ID
.equals(id
)) {
96 return fTargetNode
.getName();
98 if (TARGET_NODE_ADDRESS_PROPERTY_ID
.equals(id
)) {
99 return fTargetNode
.getHostName();
101 if (TARGET_NODE_STATE_PROPERTY_ID
.equals(id
)) {
102 return fTargetNode
.getTargetNodeState().name();