コード例 #1
0
 public boolean visit(UseStatement declaration) throws Exception {
   Collection<UsePart> parts = declaration.getParts();
   for (UsePart part : parts) {
     String name = null;
     if (part.getAlias() != null) {
       name = part.getAlias().getName();
     } else {
       name = part.getNamespace().getName();
       int index = name.lastIndexOf(NamespaceReference.NAMESPACE_SEPARATOR);
       if (index >= 0) {
         name = name.substring(index + 1);
       }
     }
     fLastUseParts.put(name, part);
   }
   return visitGeneral(declaration);
 }
コード例 #2
0
 public boolean visit(UseStatement declaration) throws Exception {
   Collection<UsePart> parts = declaration.getParts();
   for (UsePart part : parts) {
     String name = null;
     if (part.getAlias() != null) {
       name = part.getAlias().getName();
     } else {
       name = part.getNamespace().getName();
       int index = name.lastIndexOf(NamespaceReference.NAMESPACE_SEPARATOR);
       if (index >= 0) {
         name = name.substring(index + 1);
       }
     }
     ImportInfo info = new ImportInfo();
     String containerName;
     if (fLastNamespace == null) {
       containerName = GLOBAL_NAMESPACE_CONTAINER_NAME;
     } else {
       containerName = fLastNamespace.getName();
     }
     info.containerName = containerName;
     if (declaration.getNamespace() == null) {
       info.name = part.getNamespace().getFullyQualifiedName();
     } else {
       info.name =
           PHPModelUtils.concatFullyQualifiedNames(
               declaration.getNamespace().getFullyQualifiedName(),
               part.getNamespace().getFullyQualifiedName());
     }
     info.sourceStart = part.getNamespace().sourceStart();
     info.sourceEnd = part.getNamespace().sourceEnd();
     fRequestor.acceptImport(info);
     fLastUseParts.put(name, part);
   }
   return true;
 }