[232618] search and refactoring support for xsd not finding references in wsdl
diff --git a/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/XMLComponentSearchPattern.java b/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/XMLComponentSearchPattern.java
index 7abd04b..dff3048 100644
--- a/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/XMLComponentSearchPattern.java
+++ b/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/XMLComponentSearchPattern.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -11,7 +11,11 @@
 
 package org.eclipse.wst.xml.core.internal.search;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.eclipse.core.resources.IFile;
+import org.eclipse.wst.common.core.search.SearchParticipant;
 import org.eclipse.wst.common.core.search.pattern.ComponentSearchPattern;
 import org.eclipse.wst.common.core.search.pattern.QualifiedName;
 
@@ -23,10 +27,15 @@
 	
 	/**
 	 * Containing element patterns
+	 * @deprecated
 	 */
 	XMLSearchPattern[] children = new XMLSearchPattern[0];
 	
-
+	/**
+	 * A map of XMLSearchPattern[] by {@link SearchParticipant search participant}.
+	 */
+	protected Map childPatternsByParticipant = new HashMap();
+	
 	public XMLComponentSearchPattern(IFile file, QualifiedName elementQName, QualifiedName typeQName, int matchRule) {
 		super(file, elementQName, typeQName, matchRule);
 		
@@ -38,13 +47,50 @@
 		
 	}
 
+	/**
+	 * @deprecated Use {@link #getChildren(SearchParticipant)} instead.
+	 */
 	public XMLSearchPattern[] getChildren(){
 		return children;
 	}
 	
+    /**
+     * @deprecated Use {@link #addChildren(SearchParticipant, XMLSearchPattern[])} instead.
+     */
 	public void setChildren(XMLSearchPattern[] patterns){
 		children = patterns;
 		
 	}
+	
+	/**
+	 * Provides the child patterns contributed by the given search participant. 
+	 * @param searchParticipant the {@link SearchParticipant search participant} that contributed the patterns.
+     * @see XMLComponentSearchPattern#addChildren(SearchParticipant, XMLSearchPattern[]) addChildren
+	 * @return an array with the {@link XMLSearchPattern patterns} contributed by the {@link SearchParticipant search participant}.
+	 */
+	public XMLSearchPattern[] getChildren(SearchParticipant searchParticipant){
+	  XMLSearchPattern[] childPatterns = getChildren();
+	  if (searchParticipant != null){
+	    childPatterns = (XMLSearchPattern[])childPatternsByParticipant.get(searchParticipant);
+	    if (childPatterns == null){
+	      childPatterns = getChildren();
+	    }
+	  }
+	  return childPatterns;
+	}
 
+	/**
+	 * Saves the child patterns contributed by the given search participant.
+	 * @param searchParticipant the {@link SearchParticipant search participant} that is contributing the child search patterns.
+	 * @param childPatterns the child patterns contributed by the {@link SearchParticipant searchParticipant search participant}.
+	 * @see XMLComponentSearchPattern#getChildren(SearchParticipant) getChildren
+	 */
+	public void addChildren(SearchParticipant searchParticipant, XMLSearchPattern[] childPatterns){
+	  if (searchParticipant != null && childPatterns != null) {
+	    childPatternsByParticipant.put(searchParticipant, childPatterns);
+	  }
+	  else {
+	    children = childPatterns;
+	  }
+	}
 }
diff --git a/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/XMLSearchParticipant.java b/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/XMLSearchParticipant.java
index 0327e77..b709f58 100644
--- a/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/XMLSearchParticipant.java
+++ b/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/XMLSearchParticipant.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -126,7 +126,7 @@
 		if (PatternMatcher.class.equals(adapterType) &&
 				(adaptableObject instanceof XMLSearchPattern ||
 				adaptableObject instanceof XMLComponentSearchPattern) ) {
-			return new XMLSearchPatternMatcher();
+			return new XMLSearchPatternMatcher(this);
 		} 
 		return null; 
 	}
@@ -199,7 +199,7 @@
 			if(childPattern != null){
 					childPattern.setSearchName(componentPattern.getName().getLocalName());
 					childPattern.setSearchNamespace(componentPattern.getName().getNamespace());
-	     			componentPattern.setChildren(new XMLSearchPattern[]{childPattern});
+	     			componentPattern.addChildren(this, new XMLSearchPattern[]{childPattern});
 			}
 			
 		}
@@ -211,7 +211,7 @@
 				childPattern.setSearchName(componentPattern.getName().getLocalName());
 				childPattern.setSearchNamespace(componentPattern.getName().getNamespace());				
 			}
-			componentPattern.setChildren(childPatterns);
+			componentPattern.addChildren(this, childPatterns);
 			
 		}
 	}
diff --git a/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/matching/XMLSearchPatternMatcher.java b/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/matching/XMLSearchPatternMatcher.java
index 0b9c3d3..a5ee621 100644
--- a/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/matching/XMLSearchPatternMatcher.java
+++ b/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/matching/XMLSearchPatternMatcher.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -13,6 +13,7 @@
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.wst.common.core.search.SearchMatch;
+import org.eclipse.wst.common.core.search.SearchParticipant;
 import org.eclipse.wst.common.core.search.SearchRequestor;
 import org.eclipse.wst.common.core.search.pattern.QualifiedName;
 import org.eclipse.wst.common.core.search.pattern.SearchPattern;
@@ -25,7 +26,20 @@
 
 public class XMLSearchPatternMatcher extends PatternMatcher{
 	
-
+   /**
+    * The active search participant.
+    */
+    private SearchParticipant searchParticipant;
+  
+    /**
+     * Constructs a pattern matcher given a search participant.
+     * @param searchParticipant the active {@link SearchParticipant search participant}.
+     */
+    public XMLSearchPatternMatcher(SearchParticipant searchParticipant)
+    {
+      this.searchParticipant = searchParticipant;
+    }
+    
 	protected String computeNamespaceForPrefix(Element element, String prefix)
 	{
 	  String result = null;
@@ -110,7 +124,10 @@
 	
 	public void locateMatches(SearchPattern pattern, IFile file, Element element, SearchRequestor requestor) {
 		if(pattern instanceof XMLComponentSearchPattern){
-			XMLSearchPattern[] childPatterns = ((XMLComponentSearchPattern)pattern).getChildren();
+			XMLSearchPattern[] childPatterns = ((XMLComponentSearchPattern)pattern).getChildren(searchParticipant);
+			if (childPatterns == null){
+			  return;
+			}
 			for (int i = 0; i < childPatterns.length; i++) {
 				PatternMatcher matcher = (PatternMatcher)childPatterns[i].getAdapter(PatternMatcher.class);
 				if(matcher == null){
@@ -135,7 +152,10 @@
 	 */
 	public boolean matches(SearchPattern pattern, Object element){
 		if(pattern instanceof XMLComponentSearchPattern){
-			XMLSearchPattern[] childPatterns = ((XMLComponentSearchPattern)pattern).getChildren();
+			XMLSearchPattern[] childPatterns = ((XMLComponentSearchPattern)pattern).getChildren(searchParticipant);
+            if (childPatterns == null){
+              return false;
+            }
 			for (int i = 0; i < childPatterns.length; i++) {
 				PatternMatcher matcher = (PatternMatcher)childPatterns[i].getAdapter(PatternMatcher.class);
 				if(matcher == null){