[125668] fix up some ugly participant initialization bugs
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 8657076..c0a8b1c 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
@@ -49,14 +49,14 @@
*/
public abstract class XMLSearchParticipant extends SearchParticipant {
- String[] supportedContentTypes;
-
protected static final boolean debugPerf = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.xml.core.internal.search/perf")); //$NON-NLS-1$ //$NON-NLS-2$
public XMLSearchParticipant() {
super();
}
+
+ /*
public boolean initialize(SearchPattern pattern, String[] contentTypes){
super.initialize(pattern, contentTypes);
@@ -66,11 +66,11 @@
return true;
}
return false;
- }
+ }*/
- public SearchDocument getDocument(String documentPath) {
+ public SearchDocument createSearchDocument(String documentPath) {
return new XMLSearchDocument(documentPath, this);
@@ -223,9 +223,7 @@
* @param pattern the search pattern that is searched for
* @return content type's unique identifiers that could be searched for the given pattern.
*/
- public String[] getSupportedContentTypes(){
- return supportedContentTypes;
- }
+ public abstract String[] getSupportedContentTypes();
public void populateSearchDocument(SearchDocument document, SearchPattern pattern)
{
@@ -259,6 +257,8 @@
IFile file = files[i];
String path = file.getLocation().toString();
SearchDocument document = documentSet.getSearchDocument(path, id);
+ if (document != null)
+ {
Entry[] entries = document.getEntries(getSearchEntryCategory(pattern), null, 0);
if(entries != null && entries.length > 0)
{
@@ -289,6 +289,7 @@
this.locateMatches(pattern, document, requestor, monitor);
}
}
+ }
}
diff --git a/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/quickscan/XMLQuickScan.java b/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/quickscan/XMLQuickScan.java
index 34e7dc5..4cfb9dc 100644
--- a/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/quickscan/XMLQuickScan.java
+++ b/bundles/org.eclipse.wst.xml.core/src-search/org/eclipse/wst/xml/core/internal/search/quickscan/XMLQuickScan.java
@@ -26,24 +26,24 @@
*/
public class XMLQuickScan
{
-
+ /*
public static String getTargetNamespace(String fullFilePath)
{
XMLQuickScanContentHandler handler = new XMLQuickScanContentHandler();
parseFile(fullFilePath, handler);
return handler.getTargetNamespace();
- }
+ }*/
/*
* Returns information about matches encountered based on the criteria
* provided.
- */
+ *
public static boolean hasMatch(String fullFilePath, PatternMatcher matcher, SearchPattern pattern)
{
XMLQuickScanContentHandler handler = new XMLQuickScanContentHandler(matcher, pattern);
parseFile(fullFilePath, handler);
return handler.hasMatch();
- }
+ }*/
public static boolean populateSearchDocument(SearchDocument document, PatternMatcher matcher, SearchPattern pattern)
{
@@ -60,8 +60,8 @@
{
inputStream = new FileInputStream(new File(fullFilePath));
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
-
XMLReader reader = parser.getXMLReader();
+ //System.out.println("parseFile" + reader + " (" + fullFilePath + ")");
reader.setFeature("http://xml.org/sax/features/namespaces", true);
reader.setContentHandler(handler);
reader.parse(new InputSource(inputStream));
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java
index c148c95..8025be6 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java
@@ -20,10 +20,20 @@
private static String ID = "org.eclipse.wst.xsd.search.XSDSearchParticipant";
- public boolean initialize(SearchPattern pattern, String[] contentTypes){
-
- super.initialize(pattern, contentTypes);
- id = ID;
+ public XSDSearchParticipant()
+ {
+ super();
+ id = ID;
+ }
+
+ public String[] getSupportedContentTypes()
+ {
+ String[] result = { "org.eclipse.wst.xsd.core.xsdsource" };
+ return result;
+ }
+
+ public boolean isApplicable(SearchPattern pattern)
+ {
if(pattern instanceof XMLComponentSearchPattern ){
XMLComponentSearchPattern componentPattern = (XMLComponentSearchPattern)pattern;
String namespace = componentPattern.getMetaName().getNamespace();
@@ -33,11 +43,8 @@
}
return false;
}
-
-
- public ComponentSearchContributor getSearchContributor() {
+ public ComponentSearchContributor getSearchContributor() {
return new XSDSearchContributor();
}
-
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/common/ComponentSelectionDialog.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/common/ComponentSelectionDialog.java
index 77ce6ad..3ebe1f2 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/common/ComponentSelectionDialog.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/common/ComponentSelectionDialog.java
@@ -364,6 +364,7 @@
fireUpdateList(componentList);
}
catch (Exception e) {
+ e.printStackTrace();
}
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/xsd/XSDComponentFinder.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/xsd/XSDComponentFinder.java
index e52e53d..bedf16e 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/xsd/XSDComponentFinder.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/xsd/XSDComponentFinder.java
@@ -13,6 +13,8 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.wst.common.core.search.SearchEngine;
@@ -46,6 +48,7 @@
XMLComponentDeclarationPattern pattern = new XMLComponentDeclarationPattern(new QualifiedName("*", "*"), metaName, SearchPattern.R_PATTERN_MATCH);
SearchParticipant particpant = SearchPlugin.getDefault().getSearchParticipant("org.eclipse.wst.xsd.search.XSDSearchParticipant");
+ Assert.isNotNull(particpant);
// for now we assume that we only want to include the xsd related participant
// that way we don't get SearchMatches for things withing WSDL files