1) Added missing strings for italic, underline and strike through.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / core / SourceField.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.core;
12
13 import net.sourceforge.phpdt.core.IField;
14 import net.sourceforge.phpdt.core.IJavaElement;
15 import net.sourceforge.phpdt.core.JavaModelException;
16 import net.sourceforge.phpdt.core.Signature;
17 import net.sourceforge.phpdt.core.jdom.IDOMNode;
18
19 /**
20  * @see IField
21  */
22
23 /* package */class SourceField extends Member implements IField {
24
25         /**
26          * Constructs a handle to the field with the given name in the specified
27          * type.
28          */
29         protected SourceField(JavaElement parent, String name) {
30                 super(parent, name);
31         }
32
33         public boolean equals(Object o) {
34                 if (!(o instanceof SourceField))
35                         return false;
36                 return super.equals(o);
37         }
38
39         /**
40          * @see JavaElement#equalsDOMNode
41          */
42         protected boolean equalsDOMNode(IDOMNode node) throws JavaModelException {
43                 return (node.getNodeType() == IDOMNode.FIELD)
44                                 && super.equalsDOMNode(node);
45         }
46
47         /**
48          * @see IField
49          */
50         public Object getConstant() throws JavaModelException {
51                 SourceFieldElementInfo info = (SourceFieldElementInfo) getElementInfo();
52                 return info.initializationSource;
53         }
54
55         /**
56          * @see IJavaElement
57          */
58         public int getElementType() {
59                 return FIELD;
60         }
61
62         /**
63          * @see JavaElement#getHandleMemento()
64          */
65         protected char getHandleMementoDelimiter() {
66                 return JavaElement.JEM_FIELD;
67         }
68
69         /**
70          * @see IField
71          */
72         public String getTypeSignature() throws JavaModelException {
73                 // SourceFieldElementInfo info = (SourceFieldElementInfo)
74                 // getElementInfo();
75                 // return info.getTypeSignature();
76                 return "";
77         }
78
79         /**
80          * @private Debugging purposes
81          */
82         protected void toStringInfo(int tab, StringBuffer buffer, Object info) {
83                 buffer.append(this.tabString(tab));
84                 if (info == null) {
85                         buffer.append(getElementName());
86                         buffer.append(" (not open)"); //$NON-NLS-1$
87                 } else if (info == NO_INFO) {
88                         buffer.append(getElementName());
89                 } else {
90                         try {
91                                 buffer.append(Signature.toString(this.getTypeSignature()));
92                                 buffer.append(" "); //$NON-NLS-1$
93                                 buffer.append(this.getElementName());
94                         } catch (JavaModelException e) {
95                                 buffer
96                                                 .append("<JavaModelException in toString of " + getElementName()); //$NON-NLS-1$
97                         }
98                 }
99         }
100 }