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.core.IPackageDeclaration;
15 import net.sourceforge.phpdt.core.JavaModelException;
16 import net.sourceforge.phpdt.core.jdom.IDOMNode;
19 * @see IPackageDeclaration
22 /* package */class PackageDeclaration extends SourceRefElement implements
24 protected PackageDeclaration(CompilationUnit parent, String name) {
28 public boolean equals(Object o) {
29 if (!(o instanceof PackageDeclaration))
31 return super.equals(o);
35 * @see JavaElement#equalsDOMNode
37 protected boolean equalsDOMNode(IDOMNode node) throws JavaModelException {
38 return (node.getNodeType() == IDOMNode.PACKAGE)
39 && getElementName().equals(node.getName());
45 public int getElementType() {
46 return PACKAGE_DECLARATION;
50 * @see JavaElement#getHandleMemento()
52 protected char getHandleMementoDelimiter() {
53 return JavaElement.JEM_PACKAGEDECLARATION;
57 * @private Debugging purposes
59 protected void toStringInfo(int tab, StringBuffer buffer, Object info) {
60 buffer.append(this.tabString(tab));
61 buffer.append("package "); //$NON-NLS-1$
62 buffer.append(getElementName());
64 buffer.append(" (not open)"); //$NON-NLS-1$