1 11 package org.eclipse.jdt.internal.core; 12 13 import org.eclipse.jdt.core.*; 14 import org.eclipse.jdt.core.IPackageDeclaration; 15 16 19 20 class PackageDeclaration extends SourceRefElement implements IPackageDeclaration { 21 22 String name; 23 24 protected PackageDeclaration(CompilationUnit parent, String name) { 25 super(parent); 26 this.name = name; 27 } 28 public boolean equals(Object o) { 29 if (!(o instanceof PackageDeclaration)) return false; 30 return super.equals(o); 31 } 32 public String getElementName() { 33 return this.name; 34 } 35 38 public int getElementType() { 39 return PACKAGE_DECLARATION; 40 } 41 44 protected char getHandleMementoDelimiter() { 45 return JavaElement.JEM_PACKAGEDECLARATION; 46 } 47 50 public IJavaElement getPrimaryElement(boolean checkOwner) { 51 CompilationUnit cu = (CompilationUnit)getAncestor(COMPILATION_UNIT); 52 if (checkOwner && cu.isPrimary()) return this; 53 return cu.getPackageDeclaration(this.name); 54 } 55 58 protected void toStringInfo(int tab, StringBuffer buffer, Object info, boolean showResolvedInfo) { 59 buffer.append(this.tabString(tab)); 60 buffer.append("package "); toStringName(buffer); 62 if (info == null) { 63 buffer.append(" (not open)"); } 65 } 66 } 67 | Popular Tags |