RC2 compatibility
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / core / PackageDeclaration.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.IJavaElement;
14 import net.sourceforge.phpdt.core.IPackageDeclaration;
15 import net.sourceforge.phpdt.core.JavaModelException;
16 import net.sourceforge.phpdt.core.jdom.IDOMNode;
17
18 /**
19  * @see IPackageDeclaration
20  */
21
22 /* package */ class PackageDeclaration extends SourceRefElement implements IPackageDeclaration {
23         protected PackageDeclaration(CompilationUnit parent, String name) {
24                 super(parent, name);
25         }
26         public boolean equals(Object o) {
27                 if (!(o instanceof PackageDeclaration)) return false;
28                 return super.equals(o);
29         }
30 /**
31  * @see JavaElement#equalsDOMNode
32  */
33 protected boolean equalsDOMNode(IDOMNode node) throws JavaModelException {
34         return (node.getNodeType() == IDOMNode.PACKAGE) && getElementName().equals(node.getName());
35 }
36 /**
37  * @see IJavaElement
38  */
39 public int getElementType() {
40         return PACKAGE_DECLARATION;
41 }
42 /**
43  * @see JavaElement#getHandleMemento()
44  */
45 protected char getHandleMementoDelimiter() {
46         return JavaElement.JEM_PACKAGEDECLARATION;
47 }
48 /**
49  * @private Debugging purposes
50  */
51 protected void toStringInfo(int tab, StringBuffer buffer, Object info) {
52         buffer.append(this.tabString(tab));
53         buffer.append("package "); //$NON-NLS-1$
54         buffer.append(getElementName());
55         if (info == null) {
56                 buffer.append(" (not open)"); //$NON-NLS-1$
57         }
58 }
59 }