Package org.eclipse.wst.common.core.search.document

Examples of org.eclipse.wst.common.core.search.document.FileReferenceEntry


    // TODO This code should be refactored to delegate the responsibility to
    // detect links between files to the search providers/contributors.
    // The current code only handles the XSD and WSDL cases.
   
    if("import".equals(localName) && namespaceMatches(uri)){ //$NON-NLS-1$
      FileReferenceEntry documentEntry = new FileReferenceEntry();
      documentEntry.setCategory(IXMLSearchConstants.REF);
      documentEntry.setKey("import"); //$NON-NLS-1$
      String namespace = attributes.getValue("namespace"); //$NON-NLS-1$
      String location = attributes.getValue(getLocationAttributeName(uri)); //$NON-NLS-1$
      documentEntry.setPublicIdentifier(namespace);
      documentEntry.setRelativeFilePath(location);           
      document.putEntry(documentEntry);
    }
    if(("redefine".equals(localName)|| "include".equals(localName)) && //$NON-NLS-1$ //$NON-NLS-2$
        namespaceMatches(uri)){
      FileReferenceEntry documentEntry = new FileReferenceEntry();
      documentEntry.setCategory(IXMLSearchConstants.REF);
      documentEntry.setKey("include"); //$NON-NLS-1$
      String location = attributes.getValue(getLocationAttributeName(uri)); //$NON-NLS-1$
      documentEntry.setPublicIdentifier(uri);
      documentEntry.setRelativeFilePath(location);
      document.putEntry(documentEntry);
    }
   
   
        // issue (cs) you may want to try perf measurements to compate reusing the same
        // instance of a SAXSearchElement instead of newing one each time
    //XMLSearchPattern.SAXSearchElement searchElement = new XMLSearchPattern.SAXSearchElement();
    searchElement.setElementName(localName);
    searchElement.setElementNamespace(uri);
    searchElement.setAttributes(attributes);
    searchElement.setNamespaceMap(namespaceMap);
    searchElement.setTargetNamespace(targetNamespace);
    if (currentPath.size() > 0)
    {
      String parentName = (String)currentPath.peek();
      searchElement.setParentName(parentName);
    }     
 

    if(matcher != null){
      if(matcher.matches(pattern, searchElement)){
        hasMatch = true;
        if(pattern instanceof XMLComponentReferencePattern){
          ComponentReferenceEntry documentEntry = new ComponentReferenceEntry();
          documentEntry.setCategory(IXMLSearchConstants.COMPONENT_REF);
          QualifiedName name = new QualifiedName(uri, localName);
          documentEntry.setKey(name.toString());
          documentEntry.setName(name);
          document.putEntry(documentEntry);
        }
        else if(pattern instanceof XMLComponentDeclarationPattern){
          ComponentDeclarationEntry documentEntry = new ComponentDeclarationEntry();
          documentEntry.setCategory(IXMLSearchConstants.COMPONENT_DECL);
                    QualifiedName name = new QualifiedName(targetNamespace, attributes.getValue("name")); //$NON-NLS-1$
          QualifiedName metaName = new QualifiedName(uri, localName);                   
          documentEntry.setKey(name.toString());
                    documentEntry.setName(name);
          documentEntry.setMetaName(metaName);
          document.putEntry(documentEntry);
        }
      }
    }
    currentPath.push(localName); //$NON-NLS-1$   
View Full Code Here


        for (int j = 0; j < entries.length; j++)
        {
          Entry entry = entries[j];
          if (entry instanceof FileReferenceEntry)
          {
            FileReferenceEntry fileReferenceEntry = (FileReferenceEntry)entry;
            // TODO.. record an utilize the public id from the fileReferenceEntry
            //
            if (fileReferenceEntry.getRelativeFilePath() != null)
            { 
              String resolvedURI = uriResolver.resolve(source, null, fileReferenceEntry.getRelativeFilePath());
              resolveEntry[j] = resolvedURI;
              if (resolvedURI.equals(target))
              {
                return true;
              }            
View Full Code Here

TOP

Related Classes of org.eclipse.wst.common.core.search.document.FileReferenceEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.