Exemplo n.º 1
0
 /*
  * Package modifiers
  */
 @Override
 public String getPackage() {
   PackageDeclaration pkg = unit.getPackage();
   if (pkg != null) {
     return pkg.getName().getFullyQualifiedName();
   } else {
     return null;
   }
 }
 /*
  * @see ASTVisitor#visit(PackageDeclaration)
  */
 public boolean visit(PackageDeclaration node) {
   if (node.getAST().apiLevel() >= AST.JLS3) {
     if (node.getJavadoc() != null) {
       node.getJavadoc().accept(this);
     }
     for (Iterator it = node.annotations().iterator(); it.hasNext(); ) {
       Annotation p = (Annotation) it.next();
       p.accept(this);
       this.fBuffer.append(" "); // $NON-NLS-1$
     }
   }
   this.fBuffer.append("package "); // $NON-NLS-1$
   node.getName().accept(this);
   this.fBuffer.append(";"); // $NON-NLS-1$
   return false;
 }
Exemplo n.º 3
0
 public static String qualifiedName(TypeDeclaration decl) {
   String name = decl.getName().getIdentifier();
   ASTNode parent = decl.getParent();
   // resolve full name e.g.: A.B
   while (parent != null && parent.getClass() == TypeDeclaration.class) {
     name = ((TypeDeclaration) parent).getName().getIdentifier() + "." + name;
     parent = parent.getParent();
   }
   // resolve fully qualified name e.g.: some.package.A.B
   if (decl.getRoot().getClass() == CompilationUnit.class) {
     CompilationUnit root = (CompilationUnit) decl.getRoot();
     if (root.getPackage() != null) {
       PackageDeclaration pack = root.getPackage();
       name = pack.getName().getFullyQualifiedName() + "." + name;
     }
   }
   return name;
 }
Exemplo n.º 4
0
 /* (non-Javadoc)
  * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.PackageDeclaration)
  */
 public boolean visit(PackageDeclaration node) {
   Name name = node.getName();
   fPackage = Factory.packageDescriptor(name.getFullyQualifiedName());
   return false;
 }
Exemplo n.º 5
0
 @Override
 public boolean visit(PackageDeclaration node) {
   packageName = node.getName().toString();
   return false;
 }
Exemplo n.º 6
0
 @Override
 public boolean visit(final PackageDeclaration node) {
   currentPackage = node.getName().getFullyQualifiedName();
   return false;
 }