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