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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.core;
13 import net.sourceforge.phpdt.core.IJavaElement;
14 import net.sourceforge.phpdt.internal.core.CompilationUnit;
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;
22 * @see IPackageDeclaration
25 /* package */ class PackageDeclaration extends SourceRefElement implements IPackageDeclaration {
26 protected PackageDeclaration(CompilationUnit parent, String name) {
29 public boolean equals(Object o) {
30 if (!(o instanceof PackageDeclaration)) return false;
31 return super.equals(o);
34 * @see JavaElement#equalsDOMNode
36 protected boolean equalsDOMNode(IDOMNode node) throws JavaModelException {
37 return (node.getNodeType() == IDOMNode.PACKAGE) && getElementName().equals(node.getName());
42 public int getElementType() {
43 return PACKAGE_DECLARATION;
46 * @see JavaElement#getHandleMemento()
48 protected char getHandleMementoDelimiter() {
49 return JavaElement.JEM_PACKAGEDECLARATION;
52 * @private Debugging purposes
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());
59 buffer.append(" (not open)"); //$NON-NLS-1$