/
PropertySheetProperty.java
100 lines (90 loc) · 2.22 KB
/
PropertySheetProperty.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc - initial API and implementation
*******************************************************************************/
package org.eclipse.reddeer.eclipse.ui.views.properties;
import org.eclipse.reddeer.swt.api.TreeItem;
/**
* Implements property of Properties View
* @author Vlado Pakan
*
*/
public class PropertySheetProperty {
private TreeItem treeItem;
/**
* Instantiates a new properties view property.
*
* @param treeItem the tree item
*/
public PropertySheetProperty(TreeItem treeItem){
this.treeItem = treeItem;
}
/**
* Returns property value.
*
* @return the property value
*/
public String getPropertyValue(){
return treeItem.getCell(1);
}
/**
* Returns property name.
*
* @return the property name
*/
public String getPropertyName(){
return treeItem.getCell(0);
}
/**
* Returns RedDeer TreeItem representing this property.
*
* @return the tree item
*/
public TreeItem getTreeItem(){
return this.treeItem;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return getPropertyName() + "=" + getPropertyValue();
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((getPropertyName() == null) ? 0 : getPropertyName().hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PropertySheetProperty other = (PropertySheetProperty) obj;
if (treeItem == null) {
if (other.treeItem != null)
return false;
} else if (!getPropertyName().equals(other.getPropertyName()))
return false;
return true;
}
}