示例#1
0
  public boolean visit(UseStatement s) throws Exception {
    Map<String, String> parameters = createInitialParameters(s);
    xmlWriter.startTag("UseStatement", parameters);

    xmlWriter.startTag("Parts", new HashMap<String, String>());
    for (UsePart p : s.getParts()) {
      p.traverse(this);
    }
    xmlWriter.endTag("Parts");
    xmlWriter.endTag("UseStatement");
    return false;
  }
 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;
 }
示例#3
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);
 }